Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar

This commit is contained in:
Marco Pesenti Gritti 2007-02-14 15:34:55 +01:00
commit 40a08da32e
3 changed files with 8 additions and 22 deletions

View File

@ -66,7 +66,7 @@ class Entry(hippo.CanvasBox, hippo.CanvasItem):
self._canvas_widget.props.widget = self._entry self._canvas_widget.props.widget = self._entry
self._round_box.append(self._canvas_widget, hippo.PACK_EXPAND) self._round_box.append(self._canvas_widget, hippo.PACK_EXPAND)
def create_entry(): def create_entry(self):
""" """
Subclasses can override this method in order to provide a different Subclasses can override this method in order to provide a different
entry widget. entry widget.

View File

@ -35,15 +35,10 @@ class Label(hippo.CanvasBox, hippo.CanvasItem):
gobject.PARAM_READWRITE) gobject.PARAM_READWRITE)
} }
__gsignals__ = { def __init__(self, text=None):
'button-activated': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([int]))
}
def __init__(self, text):
hippo.CanvasBox.__init__(self, orientation=hippo.ORIENTATION_HORIZONTAL) hippo.CanvasBox.__init__(self, orientation=hippo.ORIENTATION_HORIZONTAL)
self.props.yalign = hippo.ALIGNMENT_CENTER self.props.yalign = hippo.ALIGNMENT_CENTER
self._buttons = {}
self._text = text self._text = text
self._round_box = RoundBox() self._round_box = RoundBox()
@ -60,17 +55,8 @@ class Label(hippo.CanvasBox, hippo.CanvasItem):
self._round_box.append(self._canvas_text, hippo.PACK_EXPAND) self._round_box.append(self._canvas_text, hippo.PACK_EXPAND)
def add_button(self, icon_name, action_id): def do_set_property(self, pspec, value):
button = Button(icon_name=icon_name) self._canvas_text.set_property(pspec.name, value)
button.props.scale = style.small_icon_scale def do_get_property(self, pspec):
return self._canvas_text.get_property(pspec.name)
button.props.yalign = hippo.ALIGNMENT_CENTER
button.props.xalign = hippo.ALIGNMENT_START
button.connect('activated', self._button_activated_cb)
self._round_box.append(button)
self._buttons[button] = action_id
def _button_activated_cb(self, button):
self.emit('button-activated', self._buttons[button])

View File

@ -45,8 +45,8 @@ toolbar.append(button)
label = Label('mec moc') label = Label('mec moc')
toolbar.append(label) toolbar.append(label)
label = Label('mac mic') label = Label()
label.add_button('theme:stock-close', BUTTON_DELETE) label.props.text = 'mac mic'
toolbar.append(label) toolbar.append(label)
gtk.main() gtk.main()