18 Commits (4cc6967c8ddf66d8cfe3ea849dae068241d1b95b)

Author SHA1 Message Date
Daniel Narvaez 4cc6967c8d Reimplement the wm module in C
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>
12 years ago
Simon Schampijer 6330204e91 Move the translation initialisation to an earlier stage, SL #3654
Must be done early, some activities set translations globally. Remove
the support for the langpackdir.

Signed-off-by: Simon Schampijer <simon@laptop.org>
12 years ago
Simon Schampijer ab643a1076 Display spinner cursor when saving after closing the activity, OLPC #11691
Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Daniel Drake <dsd@laptop.org>
Tested-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Simon Schampijer 3c39375d9b Use json as included in Python SL #3142
We use json as included in Python. This will make Sugar dependent on
Python 2.6 and Python 2.7 to have the highest JSON performance.

Signed-off-by: Simon Schampijer <simon@laptop.org>
12 years ago
Simon Schampijer afcb2fcea9 Port get_preview method to cairo
Previously we were using a GdkPixmap [1] created with the get_snapshot [2]
method of the Gtk.Widget. GTK 3 encourages to use cairo surfaces
now instead.

The ported mothod does create a cairo surface similar to that of the canvas'
window and draws on that. Then we create a cairo image surface with
the desired preview size and scale the canvas surface on that.

Several people have been involved in this work: Gonzalo Odiard,
Manuel Quiñones and Benjamin Berg.

[1] http://developer.gnome.org/gdk/stable/gdk-Bitmaps-and-Pixmaps.html#GdkPixmap
[2] http://developer.gnome.org/gtk/stable/GtkWidget.html#gtk-widget-get-snapshot
12 years ago
Simon Schampijer bb02ef0ead Remove the Naming Alert
With the new 'Write to Journal anytime' feature it is possible
to write a description within an activity. Hopefully this leads
to more usage of the Journal for reflection by the learner. The
hinting nature ('you have not named your session yet') of the
Naming Alert has not been replaced, though.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Gonzalo Odiard <gonzalo@laptop.org>
Reviewed-by: Manuel Quiñones <manuq@laptop.org>
12 years ago
Simon Schampijer b5de7ef332 Remove support for the old deprecated toolbar
- removed deprecated imports from the activity module, use the
  widgets module instead
- removed the ActivityToolbox class
- removed the Stop button from the ActivityToolbar
- removed set_toolbar/get_toolbar API from the window module

Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Gonzalo Odiard <gonzalo@laptop.org>
Acked-by: Daniel Drake <dsd@laptop.org>
12 years ago
Simon Schampijer 70cee44717 Activity: remove deprecated _shared_activity member
Use the get_shared_activity method instead

Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Gonzalo Odiard <gonzalo@laptop.org>
Acked-by: Daniel Drake <dsd@laptop.org>
12 years ago
Gonzalo Odiard 24af358275 Set the sugar theme name in gsettings according the scale
We need set the theme in gsettings according the scale in
the SUGAR_SCLING environment variable.

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
13 years ago
Daniel Drake 15946211cf Trivial GTK3 porting fixes
Fix some trivial issues missed earlier: various missing imports,
some minor API changes to adapt to, do_size_request simple porting,
etc.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
13 years ago
Daniel Drake 3962517a58 activity.py: Apply sugar GTK3 theme and icon theme
In GTK2, theme name and icon theme name properties could be set in the
GTK2 RC file, at runtime, or by the X settings daemon.

For GTK3, the RC file configuration route for these settings has been
removed. As we do not currently have a settings daemon implementation,
apply these important settings at runtime, early in the Activity
class.

Signed-off-by: Daniel Drake <dsd@laptop.org>
13 years ago
Daniel Drake 4e137f6e4f sugar-activity: import and make independent of sugar-toolkit GTK versions
As we move to adding support for a second UI toolkit (GTK+ 3.x),
the sugar-activity binary used by all activities must become
backend-toolkit-independent. It would be wasteful to have two backend
toolkits loaded in memory, and in the GTK2/GTK3 case, it is impossible
(importing both results in an instant crash).

To achieve this, we split the existing sugar-toolkit activity/main.py:main()
functionality into two parts, moving it into the sugar-activity binary and
the Activity class as follows:
 1. All toolkit-specific stuff is moved into the Activity class (i.e.
   everything that interacts with GTK)
 2. Everything that can be reasonably/easily moved into the Activity class
   is also moved.
 3. What remains is the stuff that is inherently involved with the
   construction of the Activity object, not related to UI toolkits. This
   is moved into the sugar-activity binary.

main.py is then removed from sugar-toolkit, and sugar-activity is moved
from sugar to sugar-toolkit-gtk3 in order to keep toolkit-related code
with the toolkit itself.

With this work done, the one remaining question is how to invoke the main
loop. An optional run_main_loop() method is added to the activity class,
for GTK2 this will run the GTK2 main loop, for GTK3 the GTK3 main loop will
be run, etc.

Signed-off-by: Daniel Drake <dsd@laptop.org>
13 years ago
Sascha Silbe c82a775267 Use accessor functions for data fields
The following data fields that were provided by PyGTK are not accessible
directly in GTK3+pygi and need to be replaced by accessor calls:

Adjustment.lower
Adjustment.page_size
Adjustment.upper
Adjustment.value
Bin.child
Widget.parent
Widget.style
Widget.window

Based on patches by Daniel Drake <dsd@laptop.org>.

Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Simon Schampijer 8efb7c3f93 Adapt to changed Gtk.Window.set_geometry_hints() API
Unlike PyGTK [1], GTK3+pygi [2] wants GDK Geometry and WindowHints objects,
rather than individual values.

[1] http://developer.gnome.org/pygtk/stable/class-gtkwindow.html#method-gtkwindow--set-geometry-hints
[2] http://developer.gnome.org/gtk3/3.0/GtkWindow.html#gtk-window-set-geometry-hints

Signed-off-by: Simon Schampijer <simon@schampijer.de>
[replaced description, included fix-up commit]
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Sascha Silbe 820efa56b9 Run pygi-convert.sh for automatic conversion from GTK2 to GTK3 + pygi.
This is only on a best-effort basis; the code will be in a broken state after
this patch and need to be fixed manually.

The purpose of committing the intermediate, non-working output is to make it
reproducible. It's impractical to manually review the changes.

The exact version used was 4f637212f13b197a95c824967a58496b9e3b877c from the
main pygobject repository [1] plus a custom patch [2] that hasn't been sent
upstream yet.

[1] git://git.gnome.org/pygobject
[2] https://sascha.silbe.org/patches/pygobject-convert-sugar-20111122.patch

Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Simon Schampijer 89ef6304a1 Fix broken imports
8f1a821d68 only changed imports starting with
"import", but not those using "from ... import ...".

[replaced description]
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Simon Schampijer 8f1a821d68 Rename imports from sugar to sugar3
Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago
Simon Schampijer 000ed75cbe Rename the module to sugar3
The old gtk-2 based module will be present in
the 0.94 branch in the sugar-toolkit.

Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Sascha Silbe <silbe@activitycentral.com>
13 years ago