Change the Activity execute method to add a result boolean (handle/not handled).

When the camera key is pressed the Shell send and command to the active activity,
if that's not handled than it startup org.laptop.CameraActivity.
This commit is contained in:
Marco Pesenti Gritti
2006-12-21 12:37:02 +01:00
parent 1d98e5f6bf
commit 5623c8a3b1
3 changed files with 13 additions and 7 deletions
+3
View File
@@ -90,6 +90,9 @@ class ActivityHost:
else:
return profile.get_color()
def execute(self, command, args):
self._activity.execute(command, args)
def share(self):
self._activity.share()
self._chat_widget.share()
+7 -4
View File
@@ -88,9 +88,12 @@ class Shell(gobject.GObject):
self._frame = Frame(self)
self._frame.show_and_hide(3)
def _open_terminal_cb(self):
self.start_activity('org.sugar.Terminal')
return False
def _handle_camera_key(self):
if self._current_host:
if self._current_host.execute('camera', []):
return
self.start_activity('org.laptop.CameraActivity')
def __global_key_pressed_cb(self, grabber, key):
if key == 'F1':
@@ -114,7 +117,7 @@ class Shell(gobject.GObject):
elif key == '<shft><alt>F10':
self.toggle_chat_visibility()
elif key == '0xDC': # Camera key
pass
self._handle_camera_key()
elif key == '0xE0': # Overlay key
self.toggle_chat_visibility()
elif key == '0x93': # Frame key