diff options
author | Simon Schampijer <simon@schampijer.de> | 2012-08-16 16:12:26 (GMT) |
---|---|---|
committer | Simon Schampijer <simon@schampijer.de> | 2012-08-21 04:03:01 (GMT) |
commit | 238338d4b5d6a065eb81bd118a8c0b7ca83717bf (patch) | |
tree | c0aef826c9fbb0a55198a61e904dce340eae9d9c /src/jarabe/frame | |
parent | 682c6c2fdebb8dcc2ee16ece2330c4d840806273 (diff) |
Frame: new behavior for revealing/hiding the Frame with the mouse
After discussing with Gary I prepared this patch to change the
interaction with the Frame in the following manner:
- you can reveal the Frame by going with the cursor in one of the
hot corners
- you can hide the Frame by going with the cursor in one of the
hot corners (and the Frame is visible)
- the Frame is not hidden on mouse out (leaving the Frame)
- (as before) you can hide/reveal the Frame with the designated keys
- the Frame is hidden when you switch between activities
(todo: hide as well when resume in the Palette is clicked)
- the Frame is hidden when a zoom level is selected
- (as before) you can use 'alt-tab' to cycle through the
running activities
- drag & drop is currently not working, SL #3811
Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel QuiƱones <manuq@laptop.org>
Diffstat (limited to 'src/jarabe/frame')
-rw-r--r-- | src/jarabe/frame/activitiestray.py | 2 | ||||
-rw-r--r-- | src/jarabe/frame/frame.py | 53 | ||||
-rw-r--r-- | src/jarabe/frame/zoomtoolbar.py | 6 |
3 files changed, 21 insertions, 40 deletions
diff --git a/src/jarabe/frame/activitiestray.py b/src/jarabe/frame/activitiestray.py index 9590bce..d386b3b 100644 --- a/src/jarabe/frame/activitiestray.py +++ b/src/jarabe/frame/activitiestray.py @@ -287,6 +287,8 @@ class ActivitiesTray(HTray): window = home_activity.get_window() if window: window.activate(gtk.get_current_event_time()) + frame = jarabe.frame.get_view() + frame.hide() def __remove_invite_cb(self, icon, invite): self._invites.remove_invite(invite) diff --git a/src/jarabe/frame/frame.py b/src/jarabe/frame/frame.py index 7407e18..ee112a1 100644 --- a/src/jarabe/frame/frame.py +++ b/src/jarabe/frame/frame.py @@ -57,29 +57,12 @@ class _Animation(animator.Animation): class _MouseListener(object): def __init__(self, frame): self._frame = frame - self._hide_sid = 0 def mouse_enter(self): - self._show_frame() - - def mouse_leave(self): - if self._frame.mode == Frame.MODE_MOUSE: - self._hide_frame() - - def _show_frame(self): - if self._hide_sid != 0: - gobject.source_remove(self._hide_sid) - self._frame.show(Frame.MODE_MOUSE) - - def _hide_frame_timeout_cb(self): - self._frame.hide() - return False - - def _hide_frame(self): - if self._hide_sid != 0: - gobject.source_remove(self._hide_sid) - self._hide_sid = gobject.timeout_add( - _FRAME_HIDING_DELAY, self._hide_frame_timeout_cb) + if self._frame.visible: + self._frame.hide() + else: + self._frame.show() class _KeyListener(object): @@ -88,23 +71,16 @@ class _KeyListener(object): def key_press(self): if self._frame.visible: - if self._frame.mode == Frame.MODE_KEYBOARD: - self._frame.hide() + self._frame.hide() else: - self._frame.show(Frame.MODE_KEYBOARD) + self._frame.show() class Frame(object): - MODE_MOUSE = 0 - MODE_KEYBOARD = 1 - MODE_NON_INTERACTIVE = 2 - def __init__(self): logging.debug('STARTUP: Loading the frame') - self.mode = None self._palette_group = palettegroup.get_group('frame') - self._palette_group.connect('popdown', self._palette_group_popdown_cb) self._left_panel = None self._right_panel = None @@ -143,6 +119,9 @@ class Frame(object): visible = property(is_visible, None) def hide(self): + if not self.visible: + return + if self._animator: self._animator.stop() @@ -150,16 +129,12 @@ class Frame(object): self._animator.add(_Animation(self, 0.0)) self._animator.start() - self.mode = None - - def show(self, mode): + def show(self): if self.visible: return if self._animator: self._animator.stop() - self.mode = mode - self._animator = animator.Animator(0.5) self._animator.add(_Animation(self, 1.0)) self._animator.start() @@ -180,6 +155,7 @@ class Frame(object): zoom_toolbar = ZoomToolbar() panel.append(zoom_toolbar, expand=False) zoom_toolbar.show() + zoom_toolbar.connect('level-clicked', self._level_clicked_cb) activities_tray = ActivitiesTray() panel.append(activities_tray) @@ -208,7 +184,6 @@ class Frame(object): def _create_left_panel(self): panel = ClipboardPanelWindow(self, gtk.POS_LEFT) - self._connect_to_panel(panel) panel.connect('drag-motion', self._drag_motion_cb) panel.connect('drag-leave', self._drag_leave_cb) @@ -216,7 +191,6 @@ class Frame(object): def _create_panel(self, orientation): panel = FrameWindow(orientation) - self._connect_to_panel(panel) return panel @@ -230,9 +204,8 @@ class Frame(object): if not panel.props.visible: panel.show() - def _connect_to_panel(self, panel): - panel.connect('enter-notify-event', self._enter_notify_cb) - panel.connect('leave-notify-event', self._leave_notify_cb) + def _level_clicked_cb(self, zoom_toolbar): + self.hide() def _update_position(self): screen_h = gtk.gdk.screen_height() diff --git a/src/jarabe/frame/zoomtoolbar.py b/src/jarabe/frame/zoomtoolbar.py index c28fe1c..b71f4f3 100644 --- a/src/jarabe/frame/zoomtoolbar.py +++ b/src/jarabe/frame/zoomtoolbar.py @@ -20,6 +20,7 @@ import logging import glib import gtk +import gobject from sugar.graphics import style from sugar.graphics.palette import Palette @@ -30,6 +31,10 @@ from jarabe.model import shell class ZoomToolbar(gtk.Toolbar): + __gsignals__ = { + 'level-clicked': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + ([])) + } def __init__(self): gtk.Toolbar.__init__(self) @@ -76,6 +81,7 @@ class ZoomToolbar(gtk.Toolbar): return shell.get_model().set_zoom_level(level) + self.emit('level-clicked') def __zoom_level_changed_cb(self, **kwargs): self._set_zoom_level(kwargs['new_level']) |