Esempio n. 1
0
 def __init__(self, widget):
     bind.AttributeDict.__init__(self)
     self.widget = widget
     if not hasattr(type(self), "_do_not_show"):
         widget.show()
     self.props = PropertyDict(self.widget)
     self.child_props = bind.PyDict()
     bind.key_bind(self, "sensitive", self.props, "sensitive")
     bind.key_bind(self, "visible", self.props, "visible")
Esempio n. 2
0
 def __init__(self):
     DWidget.__init__(self, gtk.Entry())
     bind.key_bind(self, "text", self.props, "text")
     bind.key_bind(self, "placeholder", self.props, "placeholder")
     self._delayed = bind.DelayController()
     bind.bind(self._delayed.model, bind.MemoryValue(""))
     bind.bind(self._delayed.view, bind.value_for_dict_key(self, "text"))
     bind.bind(self._delayed.model, bind.value_for_dict_key(self, "delayed_text"))
     self._delayed.save()
     self.widget.connect("focus-out-event", self._save_and_false)
     self.widget.connect("activate", self._save_and_false)
     self.widget.connect("key-press-event", self._key_press)
Esempio n. 3
0
File: test2.py Progetto: hzmmzl/afn
 def __init__(self, task):
     g.DVBox.__init__(self)
     self.task = task
     if "children" not in task:
         task["children"] = bind.PyList()
     item_view = TaskItemView(task)
     self.children.append(item_view)
     bind.key_bind(self, "visible", item_view, "should_be_displayed")
     alignment = g.make(
         g.DAlignment(), props={"left-padding": 20, "xscale": 1}, children=[TaskListView(task["children"])]
     )
     self.children.append(alignment)
Esempio n. 4
0
File: test2.py Progetto: hzmmzl/afn
 def __init__(self, task):
     g.DHBox.__init__(self)
     self.task = task
     label = g.make(g.DLabel(), props={"xalign": 0, "ellipsize": pango.ELLIPSIZE_END})
     completed_box = g.make(g.DCheckButton(), child_props={"expand": False})
     edit_button = g.make(g.DButton(), props={"label": "Edit"}, child_props={"expand": False})
     edit_button.widget.connect("clicked", self.show_editor)
     add_button = g.make(g.DButton(), props={"label": "Add"}, child_props={"expand": False})
     add_button.widget.connect("clicked", lambda *args: create_task(task["children"]))
     bind.key_bind(label, "label", task, "text")
     # Show the full text in the tooltip
     bind.key_bind(label.props, "tooltip-text", task, "text")
     bind.key_bind(completed_box, "active", task, "completed")
     self.children += [label, completed_box, edit_button, add_button]
     visible = bind.BinaryViewer(lambda s, c: (s or (not c)), False, False)
     bind.v_key_bind(visible.a, show_all, "active")
     # TODO: Binding to task_completed seems not to work, tasks don't disappear
     # when marked completed. Figure out why.
     bind.v_key_bind(visible.b, completed_box, "active")
     bind.key_bind_v(self, "should_be_displayed", visible.output)
Esempio n. 5
0
 def __init__(self):
     DContainer.__init__(self, gtk.Alignment())
     for p in ["bottom-padding", "left-padding", "right-padding",
                "top-padding", "xalign", "xscale", "yalign", "yscale"]:
         bind.key_bind(self, p.replace("-", "_"), self.props, p)
Esempio n. 6
0
 def __init__(self, widget=None):
     DMenuItem.__init__(self, widget or gtk.CheckMenuItem())
     bind.key_bind(self, "active", self.props, "active")
     bind.key_bind(self, "checked", self, "active")
Esempio n. 7
0
 def __init__(self, widget=None):
     DWidget.__init__(self, widget or gtk.MenuItem())
     bind.key_bind(self, "label", self.props, "label")
Esempio n. 8
0
 def __init__(self, widget):
     DContainer.__init__(self, widget)
     bind.key_bind(self, "homogeneous", self.props, "homogeneous")
Esempio n. 9
0
 def __init__(self):
     DContainer.__init__(self, gtk.Window())
     bind.key_bind(self, "title", self.props, "title")
Esempio n. 10
0
 def __init__(self):
     DWidget.__init__(self, gtk.Label())
     bind.key_bind(self, "label", self.props, "label")
     bind.key_bind(self, "text", self, "label")
Esempio n. 11
0
 def __init__(self):
     DWidget.__init__(self, gtk.Button(""))
     bind.key_bind(self, "label", self.props, "label")
Esempio n. 12
0
 def __init__(self):
     DWidget.__init__(self, gtk.CheckButton(""))
     bind.key_bind(self, "label", self.props, "label")
     bind.key_bind(self, "active", self.props, "active")
     bind.key_bind(self, "checked", self, "active")
Esempio n. 13
0
File: test2.py Progetto: hzmmzl/afn
 def show_editor(self, *args):
     text_box = g.DEntry()
     bind.key_bind(text_box, "delayed_text", self.task, "text")
     w = g.make(g.DWindow(), props={"title": "Task Editor"}, children=[text_box])
     w.widget.resize(250, 1)
     text_box.widget.grab_focus()