Exemplo n.º 1
0
        def do_add_field(dialog=None):
            global gDirty
            gDirty = True

            form = self.popup.get_values()
            self.popup.teardown()
            self.popup = None

            name = form['name']
            if self.theme[self.path].has_key(name):
                self.popup_message("%s is already a field name!" % name)
                return
            try:
                value = safe_eval.safe_eval(form['value'])
            except kytten.safe_eval.Unsafe_Source_Error:
                value = form['value']
            self.theme[self.path][name] = value
            fields_layout.add_row([
                kytten.Label(name),
                kytten.Input(id=name, text=str(value), on_input=on_input),
                kytten.Button("Delete", id=name, on_click=on_delete)
            ])

            if not self.delete_button.is_disabled():
                self.delete_button.disable()
            self.dialog.set_needs_layout()
Exemplo n.º 2
0
 def on_input(id, value):
     global gDirty
     gDirty = True
     try:
         self.theme[self.path][id] = safe_eval.safe_eval(value)
     except kytten.safe_eval.Unsafe_Source_Error:
         self.theme[self.path][id] = value
Exemplo n.º 3
0
        def do_add_field(widget):
            global gDirty
            gDirty = True
            fields_layout = kytten.GetObjectfromName('grid_field_layout')
            name = kytten.GetObjectfromName('input_name').get_value()
            value = kytten.GetObjectfromName('input_value').get_value()

            self.popup.teardown()
            self.popup = None

            if name in self.theme[self.path]:
                self.popup_message("%s is already a field name!" % name)
                return
            try:
                value = safe_eval.safe_eval(value)
            except kytten.safe_eval.Unsafe_Source_Error:
                value = value #
            self.theme[self.path][name] = value
            fields_layout.add_row(
                [kytten.Label(name),
                 kytten.Input(text=str(value), name='input'+name, on_input=on_input),
                 kytten.Button("Delete", name='btn'+name, on_click=on_delete)])

            if self.delete_button is not None and not self.delete_button.is_disabled():
                self.delete_button.disable()
            self.dialog.set_needs_layout()
Exemplo n.º 4
0
        def do_add_field(dialog=None):
            global gDirty
            gDirty = True

            form = self.popup.get_values()
            self.popup.teardown()
            self.popup = None

            name = form["name"]
            if name in self.theme[self.path]:
                self.popup_message("%s is already a field name!" % name)
                return
            try:
                value = safe_eval.safe_eval(form["value"])
            except kytten.safe_eval.Unsafe_Source_Error:
                value = form["value"]
            self.theme[self.path][name] = value
            fields_layout.add_row(
                [
                    kytten.Label(name),
                    kytten.Input(id=name, text=str(value), on_input=on_input),
                    kytten.Button("Delete", id=name, on_click=on_delete),
                ]
            )

            if not self.delete_button.is_disabled():
                self.delete_button.disable()
            self.dialog.set_needs_layout()
Exemplo n.º 5
0
 def on_input(id, value):
     global gDirty
     gDirty = True
     try:
         self.theme[self.path][id] = safe_eval.safe_eval(value)
     except kytten.safe_eval.Unsafe_Source_Error:
         self.theme[self.path][id] = value
Exemplo n.º 6
0
 def on_input(widget, value):
     global gDirty
     gDirty = True
     value = str(value)
     ID = widget.name[5:]
     try:
         self.theme[self.path][ID] = safe_eval.safe_eval(value)
     except kytten.safe_eval.Unsafe_Source_Error:
         self.theme[self.path][ID] = value