Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2006-08-28 12:36:48 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2006-08-28 12:36:48 (GMT)
commitb6cf5ef31e30e23cb608fbc803af3026a5bb6e0b (patch)
tree7412e202236a01a00e3d10d5bcc2c5f09fd95043 /sugar
parenta0127aa4df05dfac0c99019f1fdfa89f587b4932 (diff)
Get the zoom level buttons to work
Diffstat (limited to 'sugar')
-rw-r--r--sugar/__init__.py4
-rw-r--r--sugar/canvas/IconItem.py31
2 files changed, 26 insertions, 9 deletions
diff --git a/sugar/__init__.py b/sugar/__init__.py
index e69de29..238ae96 100644
--- a/sugar/__init__.py
+++ b/sugar/__init__.py
@@ -0,0 +1,4 @@
+ZOOM_MESH = 0
+ZOOM_FRIENDS = 1
+ZOOM_HOME = 2
+ZOOM_ACTIVITY = 3
diff --git a/sugar/canvas/IconItem.py b/sugar/canvas/IconItem.py
index f94be4c..284e01b 100644
--- a/sugar/canvas/IconItem.py
+++ b/sugar/canvas/IconItem.py
@@ -50,7 +50,12 @@ class IconCache(gobject.GObject):
self._icons[key] = icon
return icon
-class IconItem(goocanvas.Image):
+class IconItem(goocanvas.Image, goocanvas.Item):
+ __gsignals__ = {
+ 'clicked': (gobject.SIGNAL_RUN_FIRST,
+ gobject.TYPE_NONE, ([])),
+ }
+
__gproperties__ = {
'icon-name': (str, None, None, None,
gobject.PARAM_CONSTRUCT_ONLY |
@@ -64,14 +69,6 @@ class IconItem(goocanvas.Image):
gobject.PARAM_READWRITE)
}
- def do_set_property(self, pspec, value):
- if pspec.name == 'icon-name':
- self._icon_name = value
- elif pspec.name == 'color':
- self._color = value
- elif pspec.name == 'size':
- self._size = value
-
def __init__(self, **kwargs):
goocanvas.Image.__init__(self, **kwargs)
@@ -83,3 +80,19 @@ class IconItem(goocanvas.Image):
theme = gtk.icon_theme_get_default()
pixbuf = theme.load_icon(self._icon_name, self._size, 0)
self.props.pixbuf = pixbuf
+
+ def do_set_property(self, pspec, value):
+ if pspec.name == 'icon-name':
+ self._icon_name = value
+ elif pspec.name == 'color':
+ self._color = value
+ elif pspec.name == 'size':
+ self._size = value
+
+ def do_create_view(self, canvas, parent_view):
+ view = goocanvas.Image.do_create_view(self, canvas, parent_view)
+ view.connect('button-press-event', self.__button_press_cb)
+ return view
+
+ def __button_press_cb(self, view, target, event):
+ self.emit('clicked')