From 946a8f1b4206d0200a4b9baa0e79894871bfddce Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 8 Jan 2007 17:05:55 -0500 Subject: [PATCH 1/2] Misc shell activity launch fixes also switch to home screen when launching an activity so we can get feedback on launch status --- shell/view/Shell.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/shell/view/Shell.py b/shell/view/Shell.py index 40c5c83f..ee7dd09b 100644 --- a/shell/view/Shell.py +++ b/shell/view/Shell.py @@ -183,6 +183,8 @@ class Shell(gobject.GObject): self._hosts[activity_host.get_xid()] = activity_host def _activity_removed_cb(self, home_model, home_activity): + if not home_activity.get_launched(): + return xid = home_activity.get_xid() if self._hosts.has_key(xid): self._hosts[xid].destroy() @@ -277,7 +279,7 @@ class Shell(gobject.GObject): def _start_error_cb(self, handler, err, home_model, activity_id, activity_type): logging.error("Couldn't launch activity %s (%s):\n%s" % (activity_id, activity_type, err)) - home_mode.notify_activity_launch_failed(activity_id) + home_model.notify_activity_launch_failed(activity_id) def start_activity(self, activity_type): logging.debug('Shell.start_activity') @@ -294,6 +296,9 @@ class Shell(gobject.GObject): handler.connect('success', self._start_success_cb, act_id, activity_type) handler.connect('error', self._start_error_cb, home_model, act_id, activity_type) + # Zoom to Home for launch feedback + self.set_zoom_level(sugar.ZOOM_HOME) + def set_zoom_level(self, level): if level == sugar.ZOOM_ACTIVITY: self._screen.toggle_showing_desktop(False) From 6b67c410e017545103f3d7a8f86d6f00a47ce2e2 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 8 Jan 2007 17:12:20 -0500 Subject: [PATCH 2/2] Delete old surfaces when no longer used --- sugar/graphics/canvasicon.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/sugar/graphics/canvasicon.py b/sugar/graphics/canvasicon.py index f47f06bc..071a7456 100644 --- a/sugar/graphics/canvasicon.py +++ b/sugar/graphics/canvasicon.py @@ -82,27 +82,31 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem): _cache = _IconCache() def __init__(self, **kwargs): + self._buffer = None self._size = 24 self._color = None self._icon_name = None hippo.CanvasBox.__init__(self, **kwargs) - self._buffer = None - self.connect('button-press-event', self._button_press_event_cb) + def _invalidate_buffer(self, new_buffer): + if self._buffer: + del self._buffer + self._buffer = new_buffer + def do_set_property(self, pspec, value): if pspec.name == 'icon-name': self._icon_name = value - self._buffer = None + self._invalidate_buffer(None) self.emit_paint_needed(0, 0, -1, -1) elif pspec.name == 'color': - self._buffer = None + self._invalidate_buffer(None) self._color = value self.emit_paint_needed(0, 0, -1, -1) elif pspec.name == 'size': - self._buffer = None + self._invalidate_buffer(None) self._size = value self.emit_request_changed() @@ -129,7 +133,6 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem): del ctx self._buffer = surface - self._buffer_scale = scale return self._buffer