[Sugar-devel] [PATCH sugar] Making the buddy icons in the Views reveal the Palette on left click or touch
Manuel Quiñones
manuq at laptop.org
Thu Aug 16 08:07:23 EDT 2012
Very good Simon,
2012/8/15 Simon Schampijer <simon at schampijer.de>:
> The owner icon (in the Home, Group and Neighborhood View) has
> no primary action. On left click we agreed to always reveal the
> Palette. This will give a better experience for users with a
> mouse/trackpad and for those with a touchscreen.
>
> This patch also changes the behavior of the buddy icons that
> represent other learners which appear in the Neighborhood
> and Group View. Here as well we do not have currently a primary
> action. Left click does currently not do anything. We change this
> to revealing the Palette on left click now as well.
Nice description. I think this changes improve the mouse interaction
in addition to prepare Sugar for touch. They are welcome.
I'm testing them on the XO too.
> Signed-off-by: Simon Schampijer <simon at laptop.org>
Acked-by: Manuel Quiñones <manuq at laptop.org>
> ---
> src/jarabe/desktop/groupbox.py | 11 +++--------
> src/jarabe/desktop/meshbox.py | 11 ++---------
> src/jarabe/view/buddyicon.py | 6 ++++++
> 3 files changed, 11 insertions(+), 17 deletions(-)
>
> diff --git a/src/jarabe/desktop/groupbox.py b/src/jarabe/desktop/groupbox.py
> index 4fcd6c2..8beec90 100644
> --- a/src/jarabe/desktop/groupbox.py
> +++ b/src/jarabe/desktop/groupbox.py
> @@ -21,6 +21,7 @@ import gconf
> from sugar.graphics import style
> from sugar.graphics.xocolor import XoColor
>
> +from jarabe.view.buddyicon import BuddyIcon
> from jarabe.view.buddymenu import BuddyMenu
> from jarabe.view.eventicon import EventIcon
> from jarabe.model.buddy import get_owner_instance
> @@ -38,15 +39,9 @@ class GroupBox(ViewContainer):
>
> layout = SpreadLayout()
>
> - client = gconf.client_get_default()
> - color = XoColor(client.get_string('/desktop/sugar/user/color'))
> - owner_icon = EventIcon(icon_name='computer-xo', cache=True,
> - xo_color=color)
> # Round off icon size to an even number to ensure that the icon
> - # is placed evenly in the grid
> - owner_icon.props.pixel_size = style.LARGE_ICON_SIZE & ~1
> - owner_icon.set_palette(BuddyMenu(get_owner_instance()))
> -
> + owner_icon = BuddyIcon(get_owner_instance(),
> + style.LARGE_ICON_SIZE & ~1)
Yes that code can go away and BuddyIcon be used directly.
> ViewContainer.__init__(self, layout, owner_icon)
>
> self._friends = {}
> diff --git a/src/jarabe/desktop/meshbox.py b/src/jarabe/desktop/meshbox.py
> index 1de3779..8ac5047 100644
> --- a/src/jarabe/desktop/meshbox.py
> +++ b/src/jarabe/desktop/meshbox.py
> @@ -410,18 +410,11 @@ class MeshContainer(ViewContainer):
> __gtype_name__ = 'SugarMeshContainer'
>
> def __init__(self):
> -
> layout = SpreadLayout()
>
> - client = gconf.client_get_default()
> - color = XoColor(client.get_string('/desktop/sugar/user/color'))
> - owner_icon = EventIcon(icon_name='computer-xo', cache=True,
> - xo_color=color)
> # Round off icon size to an even number to ensure that the icon
> - # is placed evenly in the grid
> - owner_icon.props.pixel_size = style.STANDARD_ICON_SIZE & ~1
> - owner_icon.set_palette(BuddyMenu(get_owner_instance()))
> -
> + owner_icon = BuddyIcon(get_owner_instance(),
> + style.STANDARD_ICON_SIZE & ~1)
Same here.
> ViewContainer.__init__(self, layout, owner_icon)
>
>
> diff --git a/src/jarabe/view/buddyicon.py b/src/jarabe/view/buddyicon.py
> index 663bd92..e84e881 100644
> --- a/src/jarabe/view/buddyicon.py
> +++ b/src/jarabe/view/buddyicon.py
> @@ -15,6 +15,7 @@
> # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
>
> from sugar.graphics import style
> +from sugar.graphics.palette import Palette
>
> from jarabe.view.buddymenu import BuddyMenu
> from jarabe.view.eventicon import EventIcon
> @@ -33,6 +34,8 @@ class BuddyIcon(EventIcon):
> self._buddy.connect('notify::present', self.__buddy_notify_present_cb)
> self._buddy.connect('notify::color', self.__buddy_notify_color_cb)
>
> + self.connect('button-release-event', self.__button_release_event_cb)
> +
> self.palette_invoker.cache_palette = False
>
> self._update_color()
> @@ -40,6 +43,9 @@ class BuddyIcon(EventIcon):
> def create_palette(self):
> return BuddyMenu(self._buddy)
>
> + def __button_release_event_cb(self, icon, event):
> + self.props.palette.popup(immediate=True, state=Palette.SECONDARY)
> +
> def __buddy_notify_present_cb(self, buddy, pspec):
> # Update the icon's color when the buddy comes and goes
> self._update_color()
> --
> 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