[Sugar-devel] [PATCH sugar] Frame: new behavior for revealing/hiding the Frame with the mouse
Manuel Quiñones
manuq at laptop.org
Mon Aug 20 10:47:30 EDT 2012
2012/8/17 Simon Schampijer <simon at schampijer.de>
>
> 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 I suggested, maybe leave the frame open whle switching zoom views?
> - (as before) you can use 'alt-tab' to cycle through the
> running activities
>
> - drag & drop is currently not working, SL #3811
>
> v2: fixed cycling through running activities
Tested, works as expected.
Another thing to think is the frame in relation with the Control
Panel. I think the frame should be hidden when the control panel is
opened.
> Signed-off-by: Simon Schampijer <simon at laptop.org>
> ---
> src/jarabe/frame/activitiestray.py | 2 ++
> src/jarabe/frame/frame.py | 53
> ++++++++++----------------------------
> src/jarabe/frame/zoomtoolbar.py | 6 +++++
> src/jarabe/view/tabbinghandler.py | 2 +-
> 4 files changed, 22 insertions(+), 41 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'])
> diff --git a/src/jarabe/view/tabbinghandler.py
> b/src/jarabe/view/tabbinghandler.py
> index 0889792..0a298cd 100644
> --- a/src/jarabe/view/tabbinghandler.py
> +++ b/src/jarabe/view/tabbinghandler.py
> @@ -58,7 +58,7 @@ class TabbingHandler(object):
>
> self._tabbing = False
> else:
> - self._frame.show(self._frame.MODE_NON_INTERACTIVE)
> + self._frame.show()
>
> def __timeout_cb(self, event_time):
> self._activate_current(event_time)
> --
> 1.7.11.4
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
--
.. manuq ..
More information about the Sugar-devel
mailing list