Add the overlay icon on the frame

This commit is contained in:
Marco Pesenti Gritti 2006-10-24 19:44:18 +02:00
parent 77e0d33c3d
commit 2aa69e7199
4 changed files with 32 additions and 3 deletions

View File

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

View File

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

View File

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

View File

@ -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
}