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 <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
Also set up introspection annotations wherever it's needed
Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
This is a base class for gesture recognizers using possibly more
than a single touch.
Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
started/finished was renamed to began/ended, and "updated" signal
has been added too to complete the semantics
Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
style and colors of the progress feedback are subject to change
Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
controllers were already intrinsically related to a widget, so
set a property so controllers have a back reference to the widget
they attach to
Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
SugarEventController is an abstract object that attaches to a widget
and interprets an arbitrary set of events. Implementations of that
object get to define the sequence of events that trigger these.
The basic touch gestures (long press, rotate, swipe, zoom) have
been implemented on top of that object.
Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
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 <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
Make the first item of the menu a custom class, to make the children
widget allocate using all the available space. And so it can be
styled in the theme.
Remove the set_sensitive(False) from the header item, because the icon
was greyed out. This was to make it an informational, unclickeable
item. I am making it look like an informational item in the theme
instead. This has the problem that its still navigateable with
keyboard and clickeable, so it has to be fixed later.
Add a separator below the header. Is a custom class so it can be
styled in the theme.
Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
The styling of this toolbar elements should be ported to the theme at
one point.
Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
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] d1f68419e7/src/sugar/graphics/palettewindow.py (line716)
[2] http://www.pygtk.org/docs/pygtk/class-gtkobject.html#method-gtkobject--flags
Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
- 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 <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
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 <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
The convert script pygi-convert.sh commented out the call to
info.get_attach_points() in commit 820efa56
Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
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 <simon@laptop.org>
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] 6ce463585c
Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
The wm module in sugar-toolkit-gtk3 has been reimplemented
in C and made available through introspection. The same was
hard to achieve directly using the Gdk API.
We can drop wm.py and the wrapper around gdk_property_change.
Signed-off-by: Daniel Narvaez <dwnarvaez@gmail.com>
Acked-by: Simon Schampijer <simon@laptop.org>
In pygtk custom cellrenderers were done inheriting
gtk.GenericCellRenderer, and overriding the on_* methods. Now we
inherit Gtk.CellRenderer and the methods to override changed to do_* .
The destroy signal was moved to Gtk.Widget [1] so the Gtk.CellRenderer
doesn't have it anymore. Now we do the cleanup in the python
destructor method. A testcase tests/graphics/customdestroy.py shows
how is done.
tests/graphics/cellrenderericon.py tests the usage.
Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
[1] http://developer.gnome.org/gtk3/stable/ch24s02.html#id1459754
Extending the generic list will make those mime-types available in the
filter list (ObjectChooser, Journal). We have been extending the generic
list similarly before [1][2].
For the longer term fix see [3] to add support for custom mime types in
the ObjectChooser.
[1] http://bugs.sugarlabs.org/ticket/1319
[2] http://bugs.sugarlabs.org/ticket/1340
[3] http://bugs.sugarlabs.org/ticket/834
Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
Acked-by: Simon Schampijer <simon@laptop.org>
Draw a black background in the buttons when the palette is up, as
commit 01a06943 did with the ToolButton. As the comment for that
commit states, we can change the prelight background color in the
theme, but not when the mouse moves over the Palette.
Also add testcase to test the three toolbuttons.
Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
To make useful tests for the Sugar widgets, the theme must be the
same.
Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
When git is installed, it will return non-zero if it gets asked to list
the files in a non-git-repository. The subprocess.Popen instantiation is
successful in this case and the returncode attribute will contain the
error code from git. The current code handles this fine and does fall
back to our own source file listing facility.
If git isn't installed, however, trying to instantiate subprocess.Popen
will fail with OSError. We need to catch this and fall back to our own
source file listing facility like we do for the non-repository case.
Signed-off-by: Simon Schampijer <simon at laptop.org>
Reviewed-by: Gonzalo Odiard <gonzalo@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
To the grab_keys function we pass a list of strings the key
grabber should listen for. In order to make this
introspectable we need to annotate the function correctly. I
followed the instructions for passing arrays [1] and have
chosen the type of the array data looking at [2].
Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Daniel Narvaez <dwnarvaez@gmail.com>
Tested-by: Manuel Quiñones <manuq@laptop.org>
[1] https://live.gnome.org/PyGObject/IntrospectionPorting#Passing_arrays
[2] https://live.gnome.org/GObjectIntrospection/Annotations#Default_Basic_Types
Use clicked instead of button-pressed-event, because button-pressed-event
and the button-release-event are not emitted on a touchscreen device by
a touch in GTK+ 3.
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
This patch solves the following problems:
* API changed in the drag and drop code in Gtk.
Drag and drop is not working yet (SL #3796)
but the code needed to enable drag and drop is ported.
* Changes in the way to get color information from the theme
this is because Gtk.Style was deprecated by Gtk.StyleContext.
* The internal button was not visible.
Signed-of-by: Gonzalo Odiard <gonzalo@laptop.org>
-----
v2: Fixed comment based on manuq feedback, and add a note
about the non working drag and drop.