diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-12-23 20:10:48 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-12-23 20:10:48 -0300 |
commit | 8a1b7c6158b4a467a5430c20117ea06d0593911e (patch) | |
tree | ded3b13ab6dbacd1ea5675eac3b932e6af10a27b /ueditor.rpy | |
parent | 9613437fee7667b32b20c976ca76c43f85d1416a (diff) | |
download | sdk-8a1b7c6158b4a467a5430c20117ea06d0593911e.tar.gz sdk-8a1b7c6158b4a467a5430c20117ea06d0593911e.tar.bz2 sdk-8a1b7c6158b4a467a5430c20117ea06d0593911e.tar.xz sdk-8a1b7c6158b4a467a5430c20117ea06d0593911e.zip |
Basic editing functionality (proof of concept)
Diffstat (limited to 'ueditor.rpy')
-rw-r--r-- | ueditor.rpy | 56 |
1 files changed, 53 insertions, 3 deletions
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 |