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")
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)
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)
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)
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)
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")
def __init__(self, widget=None): DWidget.__init__(self, widget or gtk.MenuItem()) bind.key_bind(self, "label", self.props, "label")
def __init__(self, widget): DContainer.__init__(self, widget) bind.key_bind(self, "homogeneous", self.props, "homogeneous")
def __init__(self): DContainer.__init__(self, gtk.Window()) bind.key_bind(self, "title", self.props, "title")
def __init__(self): DWidget.__init__(self, gtk.Label()) bind.key_bind(self, "label", self.props, "label") bind.key_bind(self, "text", self, "label")
def __init__(self): DWidget.__init__(self, gtk.Button("")) bind.key_bind(self, "label", self.props, "label")
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")
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()