Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/ComboBox.py
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@member.fsf.org>2009-01-18 23:01:58 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2009-01-21 11:51:11 (GMT)
commit86ce7d4c14b458dce4edca81af8ae9fff0a770f7 (patch)
treee63735b797c9635a93d91532530d3d2cf391821f /ComboBox.py
parenta52e60d0db350281f881b196bb8c467c5d0272d0 (diff)
...
Diffstat (limited to 'ComboBox.py')
-rw-r--r--ComboBox.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/ComboBox.py b/ComboBox.py
new file mode 100644
index 0000000..d5a6c64
--- /dev/null
+++ b/ComboBox.py
@@ -0,0 +1,39 @@
+import pygtk
+import gtk
+
+from sugar.graphics.combobox import ComboBox
+
+class BigComboBox(ComboBox):
+ def __init__(self):
+ ComboBox.__init__(self)
+
+ def append_item(self, action_id, text = None, icon_name = None, size = None,
+ pixbuf = None):
+
+ if not self._icon_renderer and (icon_name or pixbuf):
+ self._icon_renderer = gtk.CellRendererPixbuf()
+
+ settings = self.get_settings()
+ w, h = gtk.icon_size_lookup_for_settings(settings, gtk.ICON_SIZE_MENU)
+ self._icon_renderer.props.stock_size = w
+
+ self.pack_start(self._icon_renderer, False)
+ self.add_attribute(self._icon_renderer, 'pixbuf', 2)
+
+ if not self._text_renderer and text:
+ self._text_renderer = gtk.CellRendererText()
+ self.pack_end(self._text_renderer, True)
+ self.add_attribute(self._text_renderer, 'text', 1)
+
+ if not pixbuf:
+ if icon_name:
+ if not size:
+ size = gtk.ICON_SIZE_LARGE_TOOLBAR
+ width, height = gtk.icon_size_lookup(size)
+ else:
+ width, height = size
+ pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(icon_name, width, height)
+ else:
+ pixbuf = None
+
+ self._model.append([action_id, text, pixbuf, False])