[Sugar-devel] [PATCH sugar] Neighborhood View: reveal Palette on left click/touch instead of a primary action

Simon Schampijer simon at schampijer.de
Wed Aug 15 13:38:21 EDT 2012


Having a primary action for the icons in the Neighborhood View
like the AP icon, the Ad-hoc, the Mesh network icon and the icon
for a shared activity has never been a fully working UI design because
the result you get by clicking on the icon was not fully clear to
the user (e.g. I clicked on the AP icon to connect to it, when I
click again will it deconnect?).

With the mouse you have a way of discovering secondary information
by hovering over the icon, this is not as elegant with touch. You would
need to use touch&hold for that but the 'failure' rate of
undesired actions is much higher.

In long discussions with Gary we agreed on always revealing the
Palette on left-click/touch and giving the learner the
information to make his choice. We think this is the best behavior
for both worlds.

For the SugarAdhoc Palette we make sure it has the connect option in
the Palette. Until now, the Palette did only have the connect
option shown when the device state had changed once.

This patch applies on top of "Making the buddy icons in the Views
reveal the Palette on left click or touch"

Signed-off-by: Simon Schampijer <simon at laptop.org>
---
 src/jarabe/desktop/meshbox.py      | 14 ++++++++------
 src/jarabe/desktop/networkviews.py | 10 +++++++---
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/jarabe/desktop/meshbox.py b/src/jarabe/desktop/meshbox.py
index 8ac5047..412a093 100644
--- a/src/jarabe/desktop/meshbox.py
+++ b/src/jarabe/desktop/meshbox.py
@@ -64,7 +64,8 @@ class _ActivityIcon(EventIcon):
         EventIcon.__init__(self, file_name=file_name,
                            xo_color=xo_color, pixel_size=size)
         self._model = model
-        self.connect('button-release-event', self._button_release_cb)
+        self.connect('button-release-event',
+                     self.__button_release_event_cb)
 
     def create_palette(self):
         primary_text = glib.markup_escape_text(self._model.bundle.get_name())
@@ -82,21 +83,22 @@ class _ActivityIcon(EventIcon):
 
         if joined:
             item = MenuItem(_('Resume'), 'activity-start')
-            item.connect('activate', self._clicked_cb)
+            item.connect('activate', self.__palette_item_clicked_cb)
             item.show()
             p.menu.append(item)
         elif not private:
             item = MenuItem(_('Join'), 'activity-start')
-            item.connect('activate', self._clicked_cb)
+            item.connect('activate', self.__palette_item_clicked_cb)
             item.show()
             p.menu.append(item)
 
         return p
 
-    def _button_release_cb(self, widget, event):
-        return self._clicked_cb(item=None)
+    def __button_release_event_cb(self, widget, event):
+        self.props.palette.popup(immediate=True,
+                                 state=palette.Palette.SECONDARY)
 
-    def _clicked_cb(self, item):
+    def __palette_item_clicked_cb(self, item):
         bundle = self._model.get_bundle()
         misc.launch(bundle, activity_id=self._model.activity_id,
                     color=self._model.get_color())
diff --git a/src/jarabe/desktop/networkviews.py b/src/jarabe/desktop/networkviews.py
index d2531bf..83269e0 100644
--- a/src/jarabe/desktop/networkviews.py
+++ b/src/jarabe/desktop/networkviews.py
@@ -330,7 +330,8 @@ class WirelessNetworkView(EventPulsingIcon):
         self._connect()
 
     def __button_release_event_cb(self, icon, event):
-        self._connect()
+        self._palette.popup(immediate=True,
+                            state=palette.Palette.SECONDARY)
 
     def _connect(self):
         # Activate existing connection, if there is one
@@ -489,6 +490,7 @@ class SugarAdhocView(EventPulsingIcon):
         self._connect_item = MenuItem(_('Connect'), 'dialog-ok')
         self._connect_item.connect('activate', self.__connect_activate_cb)
         palette_.menu.append(self._connect_item)
+        self._connect_item.show()
 
         self._disconnect_item = MenuItem(_('Disconnect'), 'media-eject')
         self._disconnect_item.connect('activate',
@@ -498,7 +500,8 @@ class SugarAdhocView(EventPulsingIcon):
         return palette_
 
     def __button_release_event_cb(self, icon, event):
-        get_adhoc_manager_instance().activate_channel(self._channel)
+        self._palette.popup(immediate=True,
+                            state=palette.Palette.SECONDARY)
 
     def __connect_activate_cb(self, icon):
         get_adhoc_manager_instance().activate_channel(self._channel)
@@ -688,7 +691,8 @@ class OlpcMeshView(EventPulsingIcon):
         self._connect()
 
     def __button_release_event_cb(self, icon, event):
-        self._connect()
+        self._palette.popup(immediate=True,
+                            state=palette.Palette.SECONDARY)
 
     def _connect(self):
         self._mesh_mgr.user_activate_channel(self._channel)
-- 
1.7.11.4



More information about the Sugar-devel mailing list