Button fixes and fix launching activities from the clipboard.

This commit is contained in:
Tomeu Vizoso 2007-02-28 16:41:50 +01:00
parent 32ac23ce27
commit 6704e1bfd3
2 changed files with 13 additions and 24 deletions

View File

@ -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()

View File

@ -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()