From 2aa69e7199b756db60c67f6438c4ffccf2ffde35 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Tue, 24 Oct 2006 19:44:18 +0200 Subject: [PATCH] Add the overlay icon on the frame --- shell/view/Shell.py | 4 ++-- shell/view/frame/Frame.py | 9 ++++++++- shell/view/frame/overlaybox.py | 18 ++++++++++++++++++ shell/view/stylesheet.py | 4 ++++ 4 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 shell/view/frame/overlaybox.py diff --git a/shell/view/Shell.py b/shell/view/Shell.py index 29305cd5..deaa8891 100644 --- a/shell/view/Shell.py +++ b/shell/view/Shell.py @@ -88,7 +88,7 @@ class Shell(gobject.GObject): elif key == 'F6': self.start_activity('org.sugar.Terminal') elif key == 'F9': - self._show_hide_activity_chat() + self.toggle_chat_visibility() def __global_key_released_cb(self, grabber, key): if key == 'F5': @@ -182,7 +182,7 @@ class Shell(gobject.GObject): return host return None - def _show_hide_activity_chat(self): + def toggle_chat_visibility(self): act = self.get_current_activity() if not act: return diff --git a/shell/view/frame/Frame.py b/shell/view/frame/Frame.py index 64c75855..80fb4d17 100644 --- a/shell/view/frame/Frame.py +++ b/shell/view/frame/Frame.py @@ -21,6 +21,7 @@ import wnck from view.frame.ActivitiesBox import ActivitiesBox from view.frame.ZoomBox import ZoomBox +from view.frame.overlaybox import OverlayBox from view.frame.FriendsBox import FriendsBox from view.frame.PanelWindow import PanelWindow from view.frame.notificationtray import NotificationTray @@ -169,10 +170,16 @@ class Frame: tray_widget.props.widget = tray tray_box.append(tray_widget, gtk.EXPAND) - [x, y] = grid.point(14, 0) + [x, y] = grid.point(13, 0) root.append(tray_box, hippo.PACK_FIXED) root.move(tray_box, x, y) + box = OverlayBox(self._shell) + + [x, y] = grid.point(14, 0) + root.append(box, hippo.PACK_FIXED) + root.move(box, x, y) + # Bottom panel [menu_shell, root] = self._create_panel(grid, 0, 11, 16, 1) menu_shell.set_position(MenuShell.TOP) diff --git a/shell/view/frame/overlaybox.py b/shell/view/frame/overlaybox.py new file mode 100644 index 00000000..eaa1e5de --- /dev/null +++ b/shell/view/frame/overlaybox.py @@ -0,0 +1,18 @@ +import hippo + +from sugar.graphics import style +from sugar.graphics.canvasicon import CanvasIcon + +class OverlayBox(hippo.CanvasBox): + def __init__(self, shell): + hippo.CanvasBox.__init__(self, orientation=hippo.ORIENTATION_HORIZONTAL) + + self._shell = shell + + icon = CanvasIcon(icon_name='stock-chat') + style.apply_stylesheet(icon, 'frame.OverlayIcon') + icon.connect('activated', self._overlay_clicked_cb) + self.append(icon) + + def _overlay_clicked_cb(self, item): + self._shell.toggle_chat_visibility() diff --git a/shell/view/stylesheet.py b/shell/view/stylesheet.py index 22ce2100..15355698 100644 --- a/shell/view/stylesheet.py +++ b/shell/view/stylesheet.py @@ -25,6 +25,10 @@ frame_ActivityIcon = { 'size' : style.standard_icon_size } +frame_OverlayIcon = { + 'size' : style.standard_icon_size +} + frame_ZoomIcon = { 'size' : style.standard_icon_size }