diff options
author | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2007-02-12 22:45:46 (GMT) |
---|---|---|
committer | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2007-02-12 22:45:46 (GMT) |
commit | 63c5bd5dbdbede63b65f9a919d49591fe7325632 (patch) | |
tree | f07aa975d181b05d4010d9b9db44c3a73c2368fc /sugar/graphics/entry.py | |
parent | ac23b66059f0a6b47404c99cab8e64ecfd5d4866 (diff) |
Allow for subclasses of Entry to override the base gtk.Entry.
Diffstat (limited to 'sugar/graphics/entry.py')
-rw-r--r-- | sugar/graphics/entry.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/sugar/graphics/entry.py b/sugar/graphics/entry.py index d2527ba..b912aa9 100644 --- a/sugar/graphics/entry.py +++ b/sugar/graphics/entry.py @@ -49,7 +49,7 @@ class Entry(hippo.CanvasBox, hippo.CanvasItem): self._round_box.props.border_color = Color.FRAME_BORDER.get_int() self.append(self._round_box, hippo.PACK_EXPAND) - self._entry = gtk.Entry() + self._entry = self.create_entry() self._entry.props.has_frame = False self._update_colors(focused=False) self._entry.modify_text(gtk.STATE_SELECTED, @@ -66,6 +66,13 @@ class Entry(hippo.CanvasBox, hippo.CanvasItem): self._canvas_widget.props.widget = self._entry self._round_box.append(self._canvas_widget, hippo.PACK_EXPAND) + def create_entry(): + """ + Subclasses can override this method in order to provide a different + entry widget. + """ + return gtk.Entry() + def add_button(self, icon_name, action_id): button = Button(icon_name=icon_name) @@ -79,12 +86,10 @@ class Entry(hippo.CanvasBox, hippo.CanvasItem): self._buttons[button] = action_id def do_set_property(self, pspec, value): - if pspec.name == 'text': - self._entry.set_text(value) + self._entry.set_property(pspec.name, value) - def do_get_property(self, pspec, value): - if pspec.name == 'text': - return self._entry.get_text() + def do_get_property(self, pspec): + return self._entry.get_property(pspec.name) def _entry_focus_in_event_cb(self, widget, event): self._update_colors(focused=True) |