From 6704e1bfd30580ba3f8b9b36f336f41242e96785 Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Wed, 28 Feb 2007 16:41:50 +0100 Subject: [PATCH] Button fixes and fix launching activities from the clipboard. --- shell/view/clipboardicon.py | 12 +----------- sugar/graphics/iconbutton.py | 25 ++++++++++++------------- 2 files changed, 13 insertions(+), 24 deletions(-) diff --git a/shell/view/clipboardicon.py b/shell/view/clipboardicon.py index caa949ad..c8c76922 100644 --- a/shell/view/clipboardicon.py +++ b/shell/view/clipboardicon.py @@ -47,13 +47,6 @@ class ClipboardIcon(CanvasIcon): self.props.xo_color = XoColor("#000000,#424242") else: self.props.xo_color = XoColor("#000000,#FFFFFF") - - def _activity_create_success_cb(self, handler, activity): - activity.start(util.unique_id()) - activity.execute("open_document", [self._object_id]) - - def _activity_create_error_cb(self, handler, err): - pass def _open_file(self): if self._percent < 100 or not self._activity: @@ -61,10 +54,7 @@ class ClipboardIcon(CanvasIcon): logging.debug("_icon_activated_cb: " + self._object_id) - # Launch the activity to handle this item - handler = activityfactory.create(self._activity) - handler.connect('success', self._activity_create_success_cb) - handler.connect('error', self._activity_create_error_cb) + activityfactory.create_with_uri(self._activity, self._object_id) def _icon_activated_cb(self, icon): self._open_file() diff --git a/sugar/graphics/iconbutton.py b/sugar/graphics/iconbutton.py index a58300b0..fea02fbd 100644 --- a/sugar/graphics/iconbutton.py +++ b/sugar/graphics/iconbutton.py @@ -43,16 +43,17 @@ class IconButton(CanvasIcon): CanvasIcon.__init__(self, cache=True, **kwargs) - if not self.props.fill_color: + if self._active: self.props.fill_color = color.BUTTON_BACKGROUND_NORMAL - if not self.props.stroke_color: self.props.stroke_color = color.BUTTON_NORMAL - self.props.background_color = color.BUTTON_BACKGROUND_NORMAL.get_int() + self.props.background_color = \ + color.BUTTON_BACKGROUND_NORMAL.get_int() + else: + self.props.fill_color = color.BUTTON_BACKGROUND_INACTIVE + self.props.stroke_color = color.BUTTON_INACTIVE + self.props.background_color = \ + color.BUTTON_BACKGROUND_INACTIVE.get_int() - self._normal_fill_color = self.props.fill_color - self._normal_stroke_color = self.props.stroke_color - self._normal_background_color = self.props.background_color - self._set_size(STANDARD_SIZE) self.connect('button-press-event', @@ -76,13 +77,11 @@ class IconButton(CanvasIcon): elif pspec.name == 'active': self._active = value if self._active: - self.props.fill_color = self._normal_fill_color - self.props.stroke_color = self._normal_stroke_color - self.props.background_color = self._normal_background_color + self.props.fill_color = color.BUTTON_BACKGROUND_NORMAL + self.props.stroke_color = color.BUTTON_NORMAL else: self.props.fill_color = color.BUTTON_BACKGROUND_INACTIVE self.props.stroke_color = color.BUTTON_INACTIVE - self.props.background_color = color.BUTTON_BACKGROUND_INACTIVE.get_int() else: CanvasIcon.do_set_property(self, pspec, value) @@ -104,5 +103,5 @@ class IconButton(CanvasIcon): if self._active: self.props.background_color = color.BLACK.get_int() else: - if self._active: - self.props.background_color = self._normal_background_color + self.props.background_color = \ + color.BUTTON_BACKGROUND_NORMAL.get_int()