diff options
author | Marco Pesenti Gritti <marco@localhost.localdomain> | 2008-07-22 12:41:48 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@localhost.localdomain> | 2008-07-22 12:41:48 (GMT) |
commit | 6c580f9e36d6cceed948aec7d684a90b62ff2c93 (patch) | |
tree | 90aedc9f3dfdd23863475d8a0a014d28f6b0fe40 /src/view/home | |
parent | 101178f21a8d0019b10d1272a2b19e051d6567bf (diff) |
Refactor activity launcher. Fix #7546
Diffstat (limited to 'src/view/home')
-rw-r--r-- | src/view/home/HomeWindow.py | 16 | ||||
-rw-r--r-- | src/view/home/Makefile.am | 1 | ||||
-rw-r--r-- | src/view/home/launchbox.py | 104 |
3 files changed, 0 insertions, 121 deletions
diff --git a/src/view/home/HomeWindow.py b/src/view/home/HomeWindow.py index 9c5180c..4ff0620 100644 --- a/src/view/home/HomeWindow.py +++ b/src/view/home/HomeWindow.py @@ -23,7 +23,6 @@ from view.home.MeshBox import MeshBox from view.home.HomeBox import HomeBox from view.home.FriendsBox import FriendsBox from view.home.transitionbox import TransitionBox -from view.home.launchbox import LaunchBox from model.shellmodel import ShellModel from model import shellmodel @@ -31,7 +30,6 @@ _HOME_PAGE = 0 _FRIENDS_PAGE = 1 _MESH_PAGE = 2 _TRANSITION_PAGE = 3 -_LAUNCH_PAGE = 4 class HomeWindow(gtk.Window): def __init__(self): @@ -63,7 +61,6 @@ class HomeWindow(gtk.Window): self._friends_box = FriendsBox() self._mesh_box = MeshBox() self._transition_box = TransitionBox() - self._launch_box = LaunchBox() self._activate_view() self.add(self._home_box) @@ -137,9 +134,6 @@ class HomeWindow(gtk.Window): self._transition_box.set_size(size) def _transition_completed_cb(self, transition_box): - self._sync_view() - - def _sync_view(self): current_child = self.get_child() self.remove(current_child) @@ -156,13 +150,3 @@ class HomeWindow(gtk.Window): def get_home_box(self): return self._home_box - - def show_launcher(self): - self.remove(self.get_child()) - self.add(self._launch_box) - self._launch_box.show() - - self._launch_box.zoom_in() - - def hide_launcher(self): - self._sync_view() diff --git a/src/view/home/Makefile.am b/src/view/home/Makefile.am index 80781d7..b323589 100644 --- a/src/view/home/Makefile.am +++ b/src/view/home/Makefile.am @@ -7,7 +7,6 @@ sugar_PYTHON = \ grid.py \ FriendView.py \ FriendsBox.py \ - launchbox.py \ HomeBox.py \ HomeWindow.py \ MeshBox.py \ diff --git a/src/view/home/launchbox.py b/src/view/home/launchbox.py deleted file mode 100644 index da4cb84..0000000 --- a/src/view/home/launchbox.py +++ /dev/null @@ -1,104 +0,0 @@ -# Copyright (C) 2008, Red Hat, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -import hippo -import gobject -import logging - -from sugar.graphics import style -from sugar.graphics import animator -from sugar.graphics.xocolor import XoColor - -from model import shellmodel -from view.pulsingicon import CanvasPulsingIcon - -class LaunchBox(hippo.Canvas): - def __init__(self): - gobject.GObject.__init__(self) - - self._activity_icon = CanvasPulsingIcon() - - # FIXME support non-xo colors in CanvasPulsingIcon - self._activity_icon.props.base_color = \ - XoColor('%s,%s' % (style.COLOR_BUTTON_GREY.get_svg(), - style.COLOR_TRANSPARENT.get_svg())) - - vbox = hippo.CanvasBox(orientation=hippo.ORIENTATION_VERTICAL) - vbox.props.background_color = style.COLOR_WHITE.get_int() - vbox.append(self._activity_icon, hippo.PACK_EXPAND) - self.set_root(vbox) - - self._animator = animator.Animator(1.0) - - self._home = shellmodel.get_instance().get_home() - self._home.connect('active-activity-changed', - self.__active_activity_changed_cb) - self._home.connect('launch-failed', self.__launch_ended_cb) - self._home.connect('launch-completed', self.__launch_ended_cb) - - self._update_icon() - - def zoom_in(self): - logging.debug('zooming in to activity') - - self._activity_icon.props.size = style.STANDARD_ICON_SIZE - - self._animator.remove_all() - self._animator.add(_Animation(self._activity_icon, - style.STANDARD_ICON_SIZE, - style.XLARGE_ICON_SIZE)) - self._animator.start() - - logging.debug('starting pulse') - - self._activity_icon.props.pulsing = True - - def suspend(self): - self._activity_icon.props.paused = True - - def resume(self): - self._activity_icon.props.paused = False - - def _update_icon(self): - activity = self._home.get_active_activity() - if activity is not None: - self._activity_icon.props.file_name = activity.get_icon_path() - self._activity_icon.props.pulse_color = activity.get_icon_color() - else: - self._activity_icon.props.file_name = None - - if activity is not None and activity.props.launching: - self.resume() - else: - self.suspend() - - def __active_activity_changed_cb(self, model, activity): - self._update_icon() - - def __launch_ended_cb(self, model, activity): - self._update_icon() - -class _Animation(animator.Animation): - def __init__(self, icon, start_size, end_size): - animator.Animation.__init__(self, 0.0, 1.0) - - self._icon = icon - self.start_size = start_size - self.end_size = end_size - - def next_frame(self, current): - d = (self.end_size - self.start_size) * current - self._icon.props.size = self.start_size + d |