def __init__(self, format_=None, _entry=Date): super(Dates, self).__init__() self.from_ = add_operators(_entry()) self.pack_start(self.from_, expand=True, fill=True) self.pack_start(gtk.Label(_('..')), expand=False, fill=False) self.to = add_operators(_entry()) self.pack_start(self.to, expand=True, fill=True) if format_: self.from_.props.format = format_ self.to.props.format = format_
def __init__(self, view, attrs): Widget.__init__(self, view, attrs) self.widget = Gtk.HBox() self.entry = self.mnemonic_widget = DateTimeEntry() for child in self.entry.get_children(): add_operators(child) if isinstance(child, Gtk.ComboBox): child = child.get_child() child.set_property('activates_default', True) child.connect('key_press_event', self.sig_key_press) child.connect('activate', self.sig_activate) child.connect('changed', lambda _: self.send_modified()) child.connect('focus-out-event', lambda x, y: self._focus_out()) self.widget.pack_start(self.entry, expand=False, fill=False, padding=0)
def __init__(self, view, attrs): Widget.__init__(self, view, attrs) self.widget = gtk.HBox() self.entry = self.mnemonic_widget = DateTimeEntry() for child in self.entry.get_children(): add_operators(child) if isinstance(child, gtk.ComboBoxEntry): child.set_focus_chain([child.get_child()]) child = child.get_child() child.set_property('activates_default', True) child.connect('key_press_event', self.sig_key_press) child.connect('activate', self.sig_activate) child.connect('changed', lambda _: self.send_modified()) child.connect('focus-out-event', lambda x, y: self._focus_out()) self.widget.pack_start(self.entry, expand=False, fill=False)
def create_widget(self): widget = add_operators(Date()) record = self.parent_widget.record field = self.parent_widget.field if record and field: format_ = field.date_format(record) widget.props.format = format_ widget.connect('key_press_event', self.parent_widget.send_modified) widget.connect('focus-out-event', lambda w, e: self.parent_widget._focus_out()) return widget
def __init__(self, view, attrs, _entry=DateEntry): super(Date, self).__init__(view, attrs) self.widget = gtk.HBox() self.entry = self.mnemonic_widget = add_operators(_entry()) self.real_entry.set_property('activates_default', True) self.real_entry.connect('key_press_event', self.sig_key_press) self.real_entry.connect('activate', self.sig_activate) self.real_entry.connect('changed', lambda _: self.send_modified()) self.real_entry.connect('focus-out-event', lambda x, y: self._focus_out()) self.widget.pack_start(self.entry, expand=False, fill=False)
def __call__(self): return add_operators(self.entry())