diff options
author | Marco Pesenti Gritti <marco@localhost.localdomain> | 2007-01-11 10:20:08 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@localhost.localdomain> | 2007-01-11 10:20:08 (GMT) |
commit | 297381cad771c3ac9c728ae784e8ea9c325184c4 (patch) | |
tree | 18bccae2bc2f0eee59936dadaab9edc5a622e018 /shell/view | |
parent | dda16d83c0fe754eb697c5ceb0bb952bfd15a70f (diff) |
Basic implementation of the shutdown graphics
Diffstat (limited to 'shell/view')
-rw-r--r-- | shell/view/Shell.py | 10 | ||||
-rw-r--r-- | shell/view/home/HomeBox.py | 13 |
2 files changed, 22 insertions, 1 deletions
diff --git a/shell/view/Shell.py b/shell/view/Shell.py index f687a2b..0fbcfe4 100644 --- a/shell/view/Shell.py +++ b/shell/view/Shell.py @@ -29,9 +29,11 @@ from view.ActivityHost import ActivityHost from sugar.activity import ActivityFactory from sugar.activity import Activity from view.frame.Frame import Frame +from model.ShellModel import ShellModel from hardwaremanager import HardwareManager from _sugar import KeyGrabber from _sugar import AudioManager +from sugar import env import sugar class Shell(gobject.GObject): @@ -107,6 +109,7 @@ class Shell(gobject.GObject): # For non-OLPC machines self._key_grabber.grab('<alt>f') self._key_grabber.grab('<alt>o') + self._key_grabber.grab('<alt><shift>s') def _key_pressed_cb(self, grabber, key): if key == 'F1': @@ -149,7 +152,7 @@ class Shell(gobject.GObject): self.toggle_chat_visibility() elif key == '0x93': # Frame key self._frame.notify_key_press() - elif key == '0x7C': # Power key + elif key == '0x7C' or key == '<alt><shift>s': # Power key self._shutdown() elif key == '0xEC': # Keyboard brightness self._hw_manager.toggle_keyboard_brightness() @@ -166,6 +169,11 @@ class Shell(gobject.GObject): console.toggle_visibility() def _shutdown(self): + self._model.props.state = ShellModel.STATE_SHUTDOWN + if not env.is_emulator(): + self._shutdown_system() + + def _shutdown_system(self): bus = dbus.SystemBus() proxy = bus.get_object('org.freedesktop.Hal', '/org/freedesktop/Hal/devices/computer') diff --git a/shell/view/home/HomeBox.py b/shell/view/home/HomeBox.py index 48069ea..daef97d 100644 --- a/shell/view/home/HomeBox.py +++ b/shell/view/home/HomeBox.py @@ -18,8 +18,10 @@ import hippo from view.home.activitiesdonut import ActivitiesDonut from view.home.MyIcon import MyIcon +from model.ShellModel import ShellModel from sugar.graphics.grid import Grid from sugar.graphics import style +from sugar.graphics.iconcolor import IconColor class HomeBox(hippo.CanvasBox, hippo.CanvasItem): __gtype_name__ = 'SugarHomeBox' @@ -36,6 +38,17 @@ class HomeBox(hippo.CanvasBox, hippo.CanvasItem): style.apply_stylesheet(self._my_icon, 'home.MyIcon') self.append(self._my_icon, hippo.PACK_FIXED) + shell.get_model().connect('notify::state', + self._shell_state_changed_cb) + + def _shell_state_changed_cb(self, model, pspec): + # FIXME handle all possible mode switches + if model.props.state == ShellModel.STATE_SHUTDOWN: + if self._donut: + self.remove(self._donut) + self._donut = None + self._my_icon.props.color = IconColor('insensitive') + def do_allocate(self, width, height): hippo.CanvasBox.do_allocate(self, width, height) |