Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#3992 closed task (fixed)

Views: implement long-press behavior

Reported by: erikos Owned by: erikos
Priority: Urgent Milestone:
Component: Sugar Version: 0.97.x
Severity: Major Keywords: r+, olpc-test-passed
Cc: manuq Distribution/OS: OLPC
Bug Status: Assigned

Description

long-press should be equivalent to a right click, bring up the full Palette.

Attachments (11)

0001-Add-the-long-press-signal-to-the-EventIcon.patch (2.0 KB) - added by erikos 9 years ago.
Patch for the toolit that adds the long-press eventcontroller to the EventIcon
0002-EventIcon-able-to-dismiss-Palette.patch (1.1 KB) - added by erikos 8 years ago.
add events to dismiss Palette
0003-EventController-make-detach-function-available.patch (1.1 KB) - added by erikos 8 years ago.
make detach available
0004-CursurInvoker-add-long-press-gesture-to-raise-Palett.patch (4.0 KB) - added by erikos 8 years ago.
CursorInvoker: add long-press
0001-SugarLongPress-gesture-controller-remove-animation.patch (7.2 KB) - added by erikos 8 years ago.
SugarLongPress gesture controller: remove animation
0001-FavoritesView-switch-ActivityPalette-from-GTK.Menu-t.patch (3.9 KB) - added by erikos 8 years ago.
FavoritesView: switch ActivityPalette from GTK.Menu to custom menu
0001-CurrentActivityPalette-switch-ActivityPalette-from-G.patch (3.1 KB) - added by erikos 8 years ago.
CurrentActivityPalette: switch ActivityPalette from GTK.Menu to custom menu
lptest.py (1.9 KB) - added by erikos 8 years ago.
test for long-press gesture
0001-JournalPalette-make-sure-to-popdown-when-we-switch-t.patch (946 bytes) - added by erikos 8 years ago.
JournalPalette: make sure to popdown when we switch to the Journal
0001-BuddyMenu-switch-from-GTK.Menu-to-custom-menu-part-o.patch (8.1 KB) - added by erikos 8 years ago.
BuddyMenu: switch from GTK.Menu to custom menu
0001-NetworkView-add-the-custom-SugarPalette-instead-of-t.patch (7.9 KB) - added by erikos 8 years ago.
NetworkView: add the custom SugarPalette instead of the GTK.Menu based one

Download all attachments as: .zip

Change History (21)

comment:1 Changed 9 years ago by erikos

We could pack the logic into the EventIcon directly like we do for the invoker.

diff --git a/src/sugar3/graphics/icon.py b/src/sugar3/graphics/icon.py
index 9008f3f..2391860 100644
--- a/src/sugar3/graphics/icon.py
+++ b/src/sugar3/graphics/icon.py
@@ -32,6 +32,8 @@ from gi.repository import GdkPixbuf
 from gi.repository import Rsvg
 import cairo
 
+from gi.repository import SugarGestures
+
 from sugar3.graphics import style
 from sugar3.graphics.xocolor import XoColor
 from sugar3.util import LRU
@@ -497,6 +499,12 @@ class EventIcon(Gtk.EventBox):
         from sugar3.graphics.palette import CursorInvoker
         self._palette_invoker = CursorInvoker()
         self._palette_invoker.attach(self)
+
+        gesture_controller = SugarGestures.LongPressController()
+        gesture_controller.connect('pressed', self.__long_pressed_cb)
+        gesture_controller.attach(self,
+                                  SugarGestures.EventControllerFlags.NONE)
+
         self.connect('destroy', self.__destroy_cb)
 
     def do_draw(self, cr):
@@ -678,6 +686,9 @@ class EventIcon(Gtk.EventBox):
 
         self.set_palette(Palette(text))
 
+    def __long_pressed_cb(self, controller, x, y):
+        self.props.palette.popup(immediate=True, state=1)
+

comment:2 Changed 9 years ago by erikos

  • Priority changed from Unspecified by Maintainer to Urgent

We need this as well for the Activity list in the Frame, tap does switch directly to the Activity, long-press should reveal the Palette.

Changed 9 years ago by erikos

Patch for the toolit that adds the long-press eventcontroller to the EventIcon

comment:3 Changed 9 years ago by erikos

While testing I found out that on long press the Palette pops up and directly down again. This is because we do use a Gtk.Menu in the Views Palette and that does popdown on a long press and actually as well a long click (you can test this with a long click with the buttons as well).

The above patch tries to use our custom Palette for the AP icon. An issue with that approach is that currently you can not dismiss such a Palette by clicking somewhere around it. As well it does not automatically go away when a menu item is selected (see as well the 'remove' option for a usb key device in the Frame).

Changed 8 years ago by erikos

add events to dismiss Palette

Changed 8 years ago by erikos

make detach available

Changed 8 years ago by erikos

CursorInvoker: add long-press

comment:4 Changed 8 years ago by erikos

  • Cc manuq added
  • Keywords r? added

Changed 8 years ago by erikos

SugarLongPress gesture controller: remove animation

Changed 8 years ago by erikos

FavoritesView: switch ActivityPalette from GTK.Menu to custom menu

Changed 8 years ago by erikos

CurrentActivityPalette: switch ActivityPalette from GTK.Menu to custom menu

Changed 8 years ago by erikos

test for long-press gesture

Changed 8 years ago by erikos

JournalPalette: make sure to popdown when we switch to the Journal

Changed 8 years ago by erikos

BuddyMenu: switch from GTK.Menu to custom menu

Changed 8 years ago by erikos

NetworkView: add the custom SugarPalette instead of the GTK.Menu based one

comment:6 Changed 8 years ago by manuq

  • Keywords r+ olpc-test-pending added; r? removed
  • Resolution set to fixed
  • Status changed from new to closed

All those went in, impressive work Simon.

In the favorites view, spiral layout, we have drag and drop code that breaks the long press behaviour, is being tracked here: http://bugs.sugarlabs.org/ticket/4014

comment:7 Changed 8 years ago by manuq

  • Resolution fixed deleted
  • Status changed from closed to reopened

Ups, reopenning because we still need long-press for the Activity list in the Frame.

comment:8 Changed 8 years ago by erikos

  • Resolution set to fixed
  • Status changed from reopened to closed

I preferred to open new tickets for the critical missing long-press behaviours: #4127 #4128

comment:9 Changed 8 years ago by greenfeld

  • Keywords olpc-test-passed added; olpc-test-pending removed

Every main Sugar view seems to support both short and long taps in Sugar 0.98.2/13.1.0 os20.

comment:10 Changed 8 years ago by dnarvaez

  • Milestone 0.98 deleted

Milestone 0.98 deleted

Note: See TracTickets for help on using tickets.