diff options
-rw-r--r-- | qeditor.rpy | 6 | ||||
-rw-r--r-- | ueditor.rpy | 56 |
2 files changed, 56 insertions, 6 deletions
diff --git a/qeditor.rpy b/qeditor.rpy index 5a0809d..478e809 100644 --- a/qeditor.rpy +++ b/qeditor.rpy @@ -130,7 +130,7 @@ screen quest_editor(): hbox: spacing 1 $ input=Input( - value=EditorInputValue(lt, "loot", i, "str", key3=0), + value=QEditorInputValue(lt, "loot", i, "str", key3=0), copypaste=True, allow="0123456789", length=9) @@ -142,7 +142,7 @@ screen quest_editor(): label ": " $ input=Input( - value=EditorInputValue(ch, "loot", i, "int", key3=1), + value=QEditorInputValue(ch, "loot", i, "int", key3=1), copypaste=True, allow="0123456789", length=5) @@ -363,7 +363,7 @@ init python: return - class EditorInputValue(InputValue): + class QEditorInputValue(InputValue): def __init__(self, variable, key1, key2, inpu="int", key3=None, key4=None): try: self.variable = variable diff --git a/ueditor.rpy b/ueditor.rpy index 4c904af..def5b9f 100644 --- a/ueditor.rpy +++ b/ueditor.rpy @@ -69,9 +69,21 @@ screen units_editor(): label _("%d - %s %s %s" % (uedit["unit_id"], star_write(uedit["rare"]), uedit["name"], ifte(uedit["sex"], "(F)", "(M)"))) hbox: spacing 10 - textbutton _("-") action Function(ueditor, "unit_id", -1) - label ("%d" % uedit["unit_id"]) - textbutton _("+") action Function(ueditor, "unit_id", 1) + #textbutton _("-") action Function(ueditor, "unit_id", -1) + #label ("%d" % uedit["unit_id"]) + #textbutton _("+") action Function(ueditor, "unit_id", 1) + #def __init__(self, variable, key1, key2, inpu="int", key3=None, key4=None): + label _("ID: ") + $ input=Input( + value=UEditorInputValue(uedit, "unit_id", None, "int", dp=True), + copypaste=True, + allow="0123456789", + length=8) + button: + #key_events True + action input.enable + add input + null height 25 label _("Base ID %d" % uedit["unit_base_id"]) label _("Flavor text:") @@ -274,6 +286,44 @@ init python: return + + class UEditorInputValue(InputValue): + def __init__(self, variable, key1, key2, inpu="int", key3=None, key4=None, dp=False): + try: + self.variable = variable + except: + self.variable = "" + self.inpu = inpu + self.short_display = dp + + self.default=True + self.editable=True + + self.key1=key1 + self.key2=key2 + self.key3=key3 + self.key4=key4 + + def get_text(self): + try: + if not self.short_display: + return str(self.variable) + else: + return str(self.variable[self.key1]) + except: + traceback.print_exc() + return "" + #return globals()[self.variable] + + def set_text(self, s): + #globals()[self.variable] = s + ueditor_input(self.key1, self.key2, self.inpu, s, key3=self.key3, key4=self.key4) + + def enter(self): + renpy.restart_interaction() + #renpy.run(self.Disable()) + #raise renpy.IgnoreEvent() + label units_editors: $ uedit=allunitsbase[0] $ current=0 |