From 1b292a7514b1e74c9504418b39ad37408d278dc5 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Tue, 24 Jul 2007 09:29:14 +0000 Subject: Combo for shared/private in the activity menu. --- (limited to 'sugar/graphics') diff --git a/sugar/graphics/toolcombobox.py b/sugar/graphics/toolcombobox.py index b39465e..01b308e 100644 --- a/sugar/graphics/toolcombobox.py +++ b/sugar/graphics/toolcombobox.py @@ -16,20 +16,45 @@ # Boston, MA 02111-1307, USA. import gtk +import gobject from sugar.graphics.combobox import ComboBox from sugar.graphics import units +from sugar.graphics import style class ToolComboBox(gtk.ToolItem): - def __init__(self, combo=None): - gtk.ToolItem.__init__(self) + __gproperties__ = { + 'label-text' : (str, None, None, None, + gobject.PARAM_WRITABLE), + } + + def __init__(self, combo=None, **kwargs): + self.label = None + self._label_text = '' + + gobject.GObject.__init__(self, **kwargs) self.set_border_width(units.microgrid_to_pixels(1)) + hbox = gtk.HBox(False, style.DEFAULT_SPACING) + + self.label = gtk.Label(self._label_text) + hbox.pack_start(self.label, False) + self.label.show() + if combo: self.combo = combo else: self.combo = ComboBox() - self.add(self.combo) + + hbox.pack_start(self.combo) self.combo.show() + self.add(hbox) + hbox.show() + + def do_set_property(self, pspec, value): + if pspec.name == 'label-text': + self._label_text = value + if self.label: + self.label.set_text(self._label_text) -- cgit v0.9.1