def create_widget(self): widget = NumberEntry() widget.connect('key-press-event', self.parent_widget.send_modified) widget.connect('focus-out-event', lambda w, e: self.parent_widget._focus_out()) widget.props.activates_default = True widget.connect('activate', self.parent_widget.sig_activate) return widget
def __init__(self, view, attrs): super(Integer, self).__init__(view, attrs) self.widget = Gtk.HBox() self.entry = self.mnemonic_widget = NumberEntry( monetary=attrs.get('monetary', False)) self.entry.props.activates_default = True self.entry.connect('activate', self.sig_activate) self.entry.connect('focus-out-event', lambda *a: self._focus_out()) self.entry.connect('key-press-event', self.send_modified) self.symbol = attrs.get('symbol') if self.symbol: self.symbol_start = Gtk.Entry(editable=False) self.widget.pack_start(self.symbol_start, expand=False, fill=False, padding=1) self.widget.pack_start(self.entry, expand=False, fill=False, padding=0) self.factor = float(attrs.get('factor', 1)) self.grouping = bool(int(attrs.get('grouping', 1))) if self.symbol: self.symbol_end = Gtk.Entry(editable=False) self.widget.pack_start(self.symbol_end, expand=False, fill=False, padding=1)
def __init__(self, view, attrs): super(Integer, self).__init__(view, attrs) self.widget = Gtk.HBox() self.entry = self.mnemonic_widget = NumberEntry() self.entry.props.activates_default = True self.entry.connect('activate', self.sig_activate) self.entry.connect('focus-out-event', lambda *a: self._focus_out()) self.entry.connect('key-press-event', self.send_modified) self.widget.pack_start(self.entry, expand=False, fill=False, padding=0) self.factor = float(attrs.get('factor', 1))