From b025638732e66684ea7d2c49b67277f391051e99 Mon Sep 17 00:00:00 2001 From: Simon Schampijer Date: Thu, 28 Jun 2012 11:31:14 +0000 Subject: ControlPanel AboutMe section: use the EventIcon from the toolkit We had a similar implmentation of the EventIcon in this section, now we can reuse the one from the toolkit. --- diff --git a/extensions/cpsection/aboutme/view.py b/extensions/cpsection/aboutme/view.py index 84daec7..d68167e 100644 --- a/extensions/cpsection/aboutme/view.py +++ b/extensions/cpsection/aboutme/view.py @@ -19,7 +19,7 @@ import gtk import gobject from gettext import gettext as _ -from sugar.graphics.icon import Icon +from sugar.graphics.icon import EventIcon from sugar.graphics import style from sugar.graphics.xocolor import XoColor, colors @@ -111,22 +111,6 @@ _NEXT_STROKE_COLOR = 3 _PREVIOUS_STROKE_COLOR = 4 -class EventIcon(gtk.EventBox): - __gtype_name__ = 'SugarEventIcon' - - def __init__(self, **kwargs): - gtk.EventBox.__init__(self) - - self.icon = Icon(pixel_size=style.XLARGE_ICON_SIZE, **kwargs) - - self.set_visible_window(False) - self.set_app_paintable(True) - self.set_events(gtk.gdk.BUTTON_PRESS_MASK) - - self.add(self.icon) - self.icon.show() - - class ColorPicker(EventIcon): __gsignals__ = { 'color-changed': (gobject.SIGNAL_RUN_FIRST, @@ -135,14 +119,11 @@ class ColorPicker(EventIcon): } def __init__(self, picker): - EventIcon.__init__(self) - - self.icon.props.icon_name = 'computer-xo' + EventIcon.__init__(self, icon_name='computer-xo', + pixel_size=style.XLARGE_ICON_SIZE) self._picker = picker self._color = None - self.icon.props.pixel_size = style.XLARGE_ICON_SIZE - self.connect('button_press_event', self.__pressed_cb, picker) def update(self, color): @@ -156,7 +137,7 @@ class ColorPicker(EventIcon): self._color = XoColor(_get_next_stroke_color(color)) else: self._color = color - self.icon.props.xo_color = self._color + self.props.xo_color = self._color def __pressed_cb(self, button, event, picker): if picker != _CURRENT_COLOR: -- cgit v0.9.1