Commit Graph
64 Commits
Author SHA1 Message Date
Simon Schampijer ba1abd4a33 Palettes: remove comment about deprecated API
We make use of this API in the shell and in the toolkit itself
and never removed those deprecated calls. Let's leave it like
this for now and remove the comment.
2013-06-10 15:46:53 +02:00
Simon Schampijer b3048112d6 Palette: handle the case where setting the transient window does fail, SL #4221
The expected parent window did likely change, for example
this can happen when we switch the Home Views while a Palette
of a canvas icon is popping up (SL #4221). In that case
send the 'popdown' signal so that for example the hovering
state feedback can be cleared.

Signed-off-by: Simon Schampijer <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2013-03-14 16:14:55 +01:00
Simon Schampijer dcbdcd77fe i18n get_locale_path: handle the case when the default locale is not set, SL #4450
If the default locale is not set (see SL #4450 for a use case), get_locale_path
does now return None so that the sugar-activity script can handle that case
cleanly.

Signed-off-by: Simon Schampijer <[email protected]>
Reviewed-by: Daniel Drake <[email protected]>
2013-03-08 10:29:17 +01:00
Simon Schampijer 63b8e87b1a ToggleToolbutton: do hide the tooltip when clicked or touched
This is the same behaviour as for the RadioToolButton and the
ToolButton. See 5a1b380dd6 where
we did the same for the RadioToolbutton.

Updated the toolbuttons.py test to be able to test that code
path.

Signed-off-by: Simon Schampijer <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2013-02-15 15:41:03 +01:00
Simon Schampijer 4199c0596b Notebook: fix type in doc string 2013-01-22 10:48:44 +01:00
Simon Schampijer 56da4d8e0c Animation: Remove non-descriptive doc string 2013-01-22 10:47:16 +01:00
Simon Schampijer d77c6f563d Remove halfish done incomplete docstring 2013-01-22 10:45:35 +01:00
Simon Schampijer 8357ccc4ea Release 0.98.3 2012-12-21 15:49:44 +01:00
Simon Schampijer 3859ff0022 WidgetInvoker: do not handle the clicked signal when there is no user interaction, part of SL #4307
There are cases where there is no user interaction but we do
receive a clicked signal: in the clipboard we do have
GtkRadioToolButton which are derived from the GtkToggleToolButton [1].

The 'clicked' signal is emitted when the 'active' property
changes [2]. We use the 'active' property to indicate the
current active clipping. In the Invoker we do check now
if the event originated a user interaction or if it was
generated due to a for example a property change.

[1] http://developer.gnome.org/gtk3/3.4/GtkToggleToolButton.html
[2] http://developer.gnome.org/gtk3/3.4/GtkToggleToolButton.html#GtkToggleToolButton--active

Signed-off-by: Simon Schampijer <[email protected]>
Reviewed-by: Carlos Garnacho <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2012-12-20 14:40:28 +01:00
Simon Schampijer 5b438e797a Release 0.98.2 2012-12-17 22:47:09 +01:00
Simon Schampijer 4de6057e1b Release 0.98.1 2012-12-10 19:14:47 +01:00
Simon Schampijer f5fee8a144 Popdown the palette if an item in the content box gets activated, SL #4191 and SL #4253
The Palette is popped down when an item is activated. We can
listen on the 'button-release-event' on that widget. We make
sure the widget is of type PaletteMenuItem. This is similar
to what the GtkMenu is doing, see gtk_menu_shell_button_release [1].

[1] http://git.gnome.org/browse/gtk+/tree/gtk/gtkmenushell.c#n915

Signed-off-by: Simon Schampijer <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2012-12-10 18:35:45 +01:00
Simon Schampijer e49f621110 TrayIcon: get the black background and outline for palette popup - SL #4089
Do the same as in ToolButton, update do_draw method to do the drawing
in the code.

Signed-off-by: Simon Schampijer <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2012-12-10 14:34:17 -03:00
Simon Schampijer 783db60027 Release 0.98.0 2012-11-29 16:51:51 +01:00
Simon Schampijer 06fab044e2 RadioToolButton: make sure _hide_tooltip_on_click is initialized in time
If we pass the active property to the constructor do_clicked seem
to get called. Before chaining up to the Gtk.RadioToolButton
constructor we need to initialize the variable.

This is a followup of 5a1b380dd6

Signed-off-by: Simon Schampijer <[email protected]>
Tested-by: Gonzalo Odiard <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2012-11-28 18:57:37 +01:00
Simon Schampijer d87967303c Release 0.97.13 2012-11-27 19:51:55 +01:00
Simon Schampijer 5a1b380dd6 RadioToolButton: hide tooltip on click, SL #4268
This is the same behaviour as with the ToolButton.

Signed-off-by: Simon Schampijer <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2012-11-27 14:43:54 +01:00
Simon Schampijer 43bd520f3d Release 0.97.12 2012-11-23 20:52:53 +01:00
Simon Schampijer 97869472ff Fixup of 4234ca684e 2012-11-23 20:50:19 +01:00
Simon Schampijer 6a01d9228d Follow up fixes for the lockable Palette support
- do not call set_expanded when the parent does not
  have that attribute, this is the case in the custom
  abacus Palette in the Abacus activity

- add the same code in the button release event callback
  that we have as well in the click event callback

Signed-off-by: Simon Schampijer <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2012-11-23 17:38:05 +01:00
Simon Schampijer 936ebaa382 Release 0.97.11 2012-11-21 20:28:29 +01:00
Simon Schampijer 6064fb30cc Add support for locking Palettes, SL #4008
This adds a property that indicates that a Palette should
behave in a locking manner. The behaviour is the same
as with the secondary Toolbars: when you hover over the invoking
widget the Palette will popdown and react to mouse movements,
leaving the invoker area or the Palette itself will popdown
the Palette again. When you click the invoking widget
the Palette will be locked. You have to unlock it again
to pop it down.

This patch makes the DescriptionButton and the Colorbutton
work.

If the DescriptionButton or the Colorbutton are placed in
the primary toolbar they will share the locked state with
the secondary toolbars. Only one can be locked at a time.

When a secondary toolbar is unlocked we do force that the
open Palettes are closed. Having a locking Palette in
a subtoolbar will also work (Activity Toolbar case or
ColorButton case in a few examples). There is no state
sharing implemented here at the moment, but so far we
do only have cases with one lockable Palette in a
subtoolbar.

This will also fix the case where we want to use the
OSK to edit the description of the activity SL #3887.

Signed-off-by: Simon Schampijer <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2012-11-21 20:21:46 +01:00
Simon Schampijer 458e357585 Release 0.97.10 2012-11-10 11:54:10 +01:00
Simon Schampijer c64d5590b0 CellRendererInvoker: no need to reset the controller manually anymore
This got fixed properly in b2df135844
2012-11-08 10:34:48 +01:00
Simon Schampijer dcfc92dbd0 Release 0.97.9 2012-11-07 20:25:26 +01:00
Simon Schampijer 811676ef4e CellRendererInvoker: always reset the long-press controller
Follow up of: ad9b0e9866
2012-11-07 00:45:58 +01:00
Simon Schampijer ad9b0e9866 CellRendererInvoker: add support for long-press events
This one is tricky because where the CellRendererInvoker is
used (Home View activity list and Journal list view) we do
use Palettes based on a GtkMenu. In the Journal list view
this Palette has submenus so it can not be easily replaced
with our custom Palette. That is why I am trying to make this
case work with a GtkMenu.

When the Palette does pop up it grabs the focus. This means that
the invoker does not see a TOUCH_END event. Same is the longpress
controller that is why we have to reset the controller when
the long-press is detected, otherwise it is not usable a second
time.

The default behavior of a GtkMenu is that it does pop down
on a long press/release event. So when doing a long press
on the icon the Palette was popping down directly. We can
stop this by listening on the button-release event in the
Menu and return True when the event happens in the invoker
coordinates.

Finally there are several issues with motion events: in the
invoker we listen to motion events on the treeview in order to
be able to popup/popdown the Palette on hovering over the
icon. This event is triggered as well when the icon is
tapped. We do check the origin of the event and do not trigger
the enter/leave when originated from a touchscreen. We do setup
the path for the CellRenderer however.

The second case where the motion events are triggered is
when you tap somewhere in the Palette when it is up. For
example you want to get to one of the submenues. Since the
Palette tracks motion events to work for the hover case [2]
we do get a leave event when the Palette is tapped and the
Palette does pop down. Same here, we check if the event
originated from a touchscreen and do discard it in that
case.

Signed-off-by: Simon Schampijer <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2012-11-06 23:36:57 +01:00
Simon Schampijer 2834344b98 DescriptionButton, ShareButton: set the toggle_palette option to True
Setting this option will popup the Palette on left click or tap
and popdown the Palette if it is up. This functionality has been
added with c4165967d5e05607db8b3e0969b516da87855431.

The ShareButton, which derrives from the RadioMenuButton, had the
desired behavior already overriding the on_clicked method, we
do this now in the invoker.

The DescriptionButton did only handle the popup part so far, with
this change the Palette will also popdown when the button is clicked
and the Palette is up.

Since both are Toolbuttons we have to set the hide_tooltip_on_click
property to False otherwise the popdown part would not function, see
1a8f89226b for more info.

Signed-off-by: Simon Schampijer <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2012-11-06 15:21:35 +01:00
Simon Schampijer 8f4474f3f5 SugarLongPressController: default the trigger_delay property to 600ms
Discussed and compared options with Gary.
2012-11-05 16:17:55 +01:00
Simon Schampijer a515976dff WidgetInvoker: add support for long-press events, part of #4127
The WidgetInvoker will decide if a long press has been made
or not. We watch out for TOUCH_END events and when a long-press
event has been seen before we stop further propagation of the
event, hence there won't be any button-release or clicked
events available to the user of the widget.

There are several widgets using the WidgetInvoker, and those
handle differently touch events. The GtkButton does have a widget
implementation to handle touch events, it does stop further
propagation and emits the pressed/released signal for further
consumption [1]. We will not get a button-press/button-release
event for a touch event in this case.

The default behaviour for widgets e.g. a TreeView is to transform
the touch events into pointer events [2], for those widgets we do get
a button-press/button-release event for a touch events.

[1] http://git.gnome.org/browse/gtk+/tree/gtk/gtkbutton.c#n1809
[2] http://git.gnome.org/browse/gtk+/tree/gtk/gtkwidget.c#n5876

Signed-off-by: Simon Schampijer <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2012-11-05 14:45:53 +01:00
Simon Schampijer de7c5b90bd TrayIcon: set the touch mask on the event box, part of SL #4127
We do need to add the mask if we want to receive
the 'touch-event' signal. The Gtk.EventBox does
set the touch event mask by default.

[1] http://developer.gnome.org/gtk3/3.4/GtkWidget.html#GtkWidget-touch-event
[2] http://git.gnome.org/browse/gtk+/tree/gtk/gtkeventbox.c#n411

Signed-off-by: Simon Schampijer <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2012-11-05 14:40:31 +01:00
Simon Schampijer 8af0d49591 GtkMenu: use point_in_cell_renderer for CellRendereInvoker to check if a point is in, part of SL #3921
We use get_rect to check if the mouse is still over the invoker
in order to know when to popdown the Palette. The CellRendererInvoker
did return the allocation of the TreeView so far.

We already have a point_in_cell_renderer method in the
CellRendererInvoker so we can use this to check if the mouse pointer
is over the cell or not. The method point_in_cell_renderer is made
public to make it clearer that it can be used from the outside.

Signed-off-by: Simon Schampijer <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2012-10-31 08:49:22 +01:00
Simon Schampijer 63a34191b1 Release 0.97.8 2012-10-25 16:25:20 +02:00
Simon Schampijer a36ada99fd CursurInvoker: add long-press gesture to raise Palette
This adds long-press gesture detection to the CursorInvoker
used in the EventIcon. This will make this gesture available
for the View icons for example.

We need to keep a boolean around to detect when a lon-press
event has happened and ignore the button-release event in
that case.

We add as well checks in the CursorInvoker and WidgetInvoker
for the enter events if they are of type Gdk.CrossingMode.NORMAL,
otherwise the Gdk.CrossingMode.TOUCH_BEGIN enter events that are detected
when a touch starts are handled and interfere.

Signed-off-by: Simon Schampijer <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2012-10-25 15:55:02 +02:00
Simon Schampijer 590785f7d1 EventIcon: make sure we are able to dismiss the Palette
Without this patch when tapping on an EventIcon
we do get a GDK_CROSSING_UNGRAB leave event when
the Palette is raised. Because of this the Invoker
does not know how to popdown the Palette when
you tap outside or when clicking on actions in the
Palette itself.

Signed-off-by: Simon Schampijer <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2012-10-25 15:54:46 +02:00
Simon Schampijer 1d9965c972 SugarLongPress gesture controller: remove animation
We found out that the animation does not solve the issue
of visually indicating the long-press gesture to our
satisfaction. This is because you do not know upfront
which icon does have a primary action and more options
that can be revealed with the long-press gesture and
the animation itself. We would need to theme the gesture
better first as well. That the animation is a separate
window does raise several side effects as well which we
would need to solve first.

Signed-off-by: Simon Schampijer <[email protected]>
Reviewed-by: Carlos Garnacho <[email protected]>
2012-10-25 12:25:01 +02:00
Simon Schampijer 20ef297526 Window: show unfullscreen button on button and touch events
We did track mouse motion events so far to show the unfullscreen
button. This adds the tracking of button events (left, middle, right
click) and touch tap.

Signed-off-by: Simon Schampijer <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2012-10-23 16:14:13 +02:00
Simon Schampijer 1224ab1451 Palettes: move PRIMARY and SECONDARY constant to the base class
Signed-off-by: Simon Schampijer <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2012-10-23 11:29:02 +02:00
Simon Schampijer 063e40d77d ActivityButton: set the toggle_palette option to True
Setting this option will popup the Palette on left click or tap
and popdown the Palette if it is up. This functionality has been
added with c4165967d5e05607db8b3e0969b516da87855431.

Signed-off-by: Simon Schampijer <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2012-10-23 11:29:02 +02:00
Simon Schampijer 1a8f89226b Add toggle_palette property for Palette invoker, SL #4065
The property does specify whether the invoker will popup/popdown
the Palette on button left click/touch tap. It defaults to False.

In the toolbutton we add a property if the tooltip should be popped
down on a click, this is set to true to have the same behavior as
before.

Signed-off-by: Simon Schampijer <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2012-10-23 11:28:15 +02:00
Simon Schampijer a2d2c79d5d Release 0.97.7 2012-10-16 20:47:10 +02:00
Simon Schampijer f91cfbfc8a Cursor tracker: only display the cursor in mouse/trackpad mode
Listen on RawEvents: listen for raw events on the root
window and decide whether the cursor is shown or not. A
touch begin event will hide the cursor a motion or button
press event will show it.

There is no API in XFixes to know whether a cursor is shown
or not so we keep track of the current state. Furthermore
we trap X errors if any bad access should happen.

Signed-off-by: Simon Schampijer <[email protected]>
Reviewed-by: Carlos Garnacho <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2012-10-15 20:53:17 +02:00
Simon Schampijer 23399f51dd Release 0.97.6 2012-10-10 23:03:47 +02:00
Simon Schampijer f569e7ef98 Cleanup: remove unused variable 2012-10-08 13:03:43 +02:00
Simon Schampijer 31d6e6dd1e Release 0.97.5 2012-10-05 20:43:52 +02:00
Simon Schampijer d16afa8f16 Build fixup of c635ee5dd7 2012-10-02 21:35:05 +02:00
Simon Schampijer 1da1f4a1ca Release 0.97.4 2012-09-26 15:27:33 +02:00
Simon Schampijer 6387b20c31 Release 0.97.3 2012-09-20 15:54:08 +02:00
Simon Schampijer b44a235d9f OSK support: canvas auto panning based on input focus
Listen to the 'request-clear-area' and 'unset-clear-area'
of the widget and adjust allocation accordingly.

Signed-off-by: Carlos Garnacho <[email protected]>
Acked-by: Simon Schampijer <[email protected]>
2012-09-20 15:26:19 +02:00
Simon Schampijer 2bedec55ed RadioToolButton, ToolButton, ToggleToolButton: add back the getter for the icon_name property
Follow up of fe11a3aa23
2012-09-20 09:38:39 +02:00
Simon Schampijer c411190178 RadioToolButton: remove incomplete and not as descriptive documentation 2012-09-20 09:19:04 +02:00
Simon Schampijer d4934d73a7 IconEntry, set_icon_from_name: handle case when icon can not be found cleanly
Sugar crashes if the sugar theme has not been set (in sugar-session)
in the set_icon_from_name method since some if the requested icons
can not be found. Handle that case cleanly.

Signed-off-by: Simon Schampijer <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2012-09-17 15:54:26 +02:00
Simon Schampijer 39226e69c5 event-controller: Don't install headers 2012-09-16 12:23:15 +02:00
Simon Schampijer ad950f4d06 event-controller: Put event-controller in alphabetical order in the Makefile 2012-09-16 12:23:15 +02:00
Simon Schampijer 4cf9ce0357 Release 0.97.2 2012-09-13 18:30:49 +02:00
Simon Schampijer 2d0ac2a952 Add new PaletteMenuItem widget for usage in mixed content Palettes
As Palettes can either include a Gtk.Menu or a Gtk.Window we
have to use a "false" menu when we want to have both
functionality in a Palette. This is a new class PaletteMenuItem
for those use cases.

Code highly based on the work from Gonzalo Odiard. The API is
based on the one from GtkImageMenuItem [1].

[1] http://developer.gnome.org/gtk3/3.4/GtkImageMenuItem.html

Signed-off-by: Simon Schampijer <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2012-09-13 17:40:14 +02:00
Simon Schampijer 5cb4a48c5b Subtoolbar Palettes do not display at correct position, SL #3891
GTK_WIDGET_NO_WINDOW has been deprecated but we can use
gtk_widget_get_has_window() instead [1]. This brings back the
old code.

Follow up of: 5ab2b80546

[1] http://developer.gnome.org/gtk/stable/GtkWidget.html#GTK-WIDGET-NO-WINDOW:CAPS

Signed-off-by: Simon Schampijer <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2012-09-12 21:22:57 +02:00
Simon Schampijer 5ab2b80546 Frame Device icons: Palette is not drawn at the correct position
We are adding the x value twice (from the allocation and from the origin)
in get_rect of the WidgetInvoker which we derive from in the FrameInvoker.
In the toolkit-gtk2 code [1] we did add the allocation.x value when
the widget does not provide its own gtk.gdk.Window (gtk.NO_WINDOW) [2]. This
is the same check we do above if the widget has a window and we set x and y
to 0 there which sounds sane enough to me.

[1] http://git.sugarlabs.org/sugar-toolkit/mainline/blobs/d1f68419e79376381fc2c3b111466714f044dfc0/src/sugar/graphics/palettewindow.py#line716
[2] http://www.pygtk.org/docs/pygtk/class-gtkobject.html#method-gtkobject--flags

Signed-off-by: Simon Schampijer <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2012-09-12 15:40:54 +02:00
Simon Schampijer 9b391fa3cf CellRendererInvoker: various fixups
- the GtkCellRenderer (which our CellRenderer derives from) is not a
  GtkWidget and therefor the 'get_display' method does not exist, we
  fallback to the default display in that case [1]
- the get_rect method should return a Gdk.Rectangle now, see other
  invokers
- check if event.mode is Gdk.CrossingMode.NORMAL to trigger a mouse
  leave see 289787e8c6 for a similar
  case
- todo: the Palette does not go away when the mouse leaves the
  widget

[1] http://developer.gnome.org/gtk3/3.4/GtkCellRenderer.html

Signed-off-by: Simon Schampijer <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2012-09-12 15:40:26 +02:00
Simon Schampijer c6c2220f0d CellRendererIcon: clipping rectangle not applied, SL #3872
We do not apply the clipping rectangle in do_render, we
need to call clip on the cairo_t as well. This solves the
issue in the Journal and in the Activity List View where
the icons do only appear on hovering over them.

See gtk_cell_renderer_render [1] for background information.

[1] http://git.gnome.org/browse/gtk+/tree/gtk/gtkcellrenderer.c#n731

Signed-off-by: Simon Schampijer <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2012-09-11 16:09:08 +02:00
Simon Schampijer 289787e8c6 CursorInvoker: check if event.mode is Gdk.CrossingMode.NORMAL to trigger a mouse leave
Like in the WidgetInvoker we check now first if the leave
event has the mode Gdk.CrossingMode.NORMAL, only then we trigger
a mouse leave to popdown the Palette. This stops the Palette
to appear/disappear in a loop.

Signed-off-by: Simon Schampijer <[email protected]>
2012-09-06 18:14:56 +02:00
Simon Schampijer 447cfc2df1 CellRendererInvoker: in Gtk.TreeViewColumn get_cell_renderers is now get_cells
Signed-off-by: Simon Schampijer <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2012-09-06 18:14:56 +02:00
Simon Schampijer 1ed4eb8ad5 Icon: Gdk.CairoContext does not exist
First of all 'Gdk.CairoContext' does not exist, this has been
made up by the conversion script in 820efa56b9

We do not need the previous gtk.gdk.CairoContext here anymore, we
do only want to set the background of the context here. See the
toolkit-gtk2 commit where this has been simplified [1].

[1] http://git.sugarlabs.org/sugar-toolkit/mainline/commit/6ce463585c3f3a639392e51cb26d789c2fde6516

Signed-off-by: Simon Schampijer <[email protected]>
Acked-by: Manuel Quiñones <[email protected]>
2012-09-06 18:14:56 +02:00
Simon Schampijer f766da335c Release 0.95.1 2011-10-25 13:19:07 +02:00