Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar/graphics
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@tomeuvizoso.net>2007-01-05 20:13:46 (GMT)
committer Tomeu Vizoso <tomeu@tomeuvizoso.net>2007-01-05 20:13:46 (GMT)
commitf50d9f5f9a972f7149c4a57f225e00d7e48834c6 (patch)
tree5f42a715a2f91b636b9873a119b4a5761c133510 /sugar/graphics
parent74e407f9ff72249ca9d597ccb58d64de1922cd52 (diff)
Added icon, title and preview for clipboard objects. Also allow for opening docs and rtfs from the web.
Diffstat (limited to 'sugar/graphics')
-rw-r--r--sugar/graphics/canvasicon.py6
-rw-r--r--sugar/graphics/menu.py10
2 files changed, 13 insertions, 3 deletions
diff --git a/sugar/graphics/canvasicon.py b/sugar/graphics/canvasicon.py
index 06aff7b..f47f06b 100644
--- a/sugar/graphics/canvasicon.py
+++ b/sugar/graphics/canvasicon.py
@@ -16,6 +16,7 @@
# Boston, MA 02111-1307, USA.
import re
+import logging
import gobject
import gtk
@@ -156,3 +157,8 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
def _button_press_event_cb(self, item, event):
item.emit_activated()
+
+ def set_icon_name(self, icon_name):
+ self._icon_name = icon_name
+ self._buffer = None
+ self.emit_paint_needed(0, 0, -1, -1)
diff --git a/sugar/graphics/menu.py b/sugar/graphics/menu.py
index 5b68d61..153c5bc 100644
--- a/sugar/graphics/menu.py
+++ b/sugar/graphics/menu.py
@@ -76,7 +76,7 @@ class Menu(gtk.Window):
orientation=hippo.ORIENTATION_HORIZONTAL)
self._root.append(self._action_box)
- def add_item(self, label, action_id):
+ def add_item(self, label, action_id=None):
if not self._item_box:
self._create_item_box()
@@ -84,8 +84,9 @@ class Menu(gtk.Window):
style.apply_stylesheet(text, 'menu.Item')
# FIXME need a way to make hippo items activable in python
- text.connect('button-press-event', self._item_clicked_cb, action_id)
- #text.connect('activated', self._action_clicked_cb, action_id)
+ if action_id:
+ text.connect('button-press-event', self._item_clicked_cb, action_id)
+ #text.connect('activated', self._action_clicked_cb, action_id)
self._item_box.append(text)
@@ -105,3 +106,6 @@ class Menu(gtk.Window):
def _action_clicked_cb(self, icon, action):
self.emit('action', action)
+
+ def set_title(self, title):
+ self._title_item.set_text(title)