Commit Graph

26 Commits

Author SHA1 Message Date
Daniel Narvaez
6fdf5f208a Use python2 shebang
Some distributions have switched to python3 as default and our code
breaks because it's python2 specific. Follow the PEP 394
recommendation.
2013-09-30 11:55:14 -03:00
Daniel Narvaez
6523ba1481 Bind the new toolkit domain 2013-09-11 16:04:13 +02:00
Daniel Narvaez
b83ddaefaf Revert "Fix translations domains to point to new toolkit"
This reverts commit abe0de3ef8.
2013-09-11 15:59:34 +02:00
Daniel Narvaez
abe0de3ef8 Fix translations domains to point to new toolkit 2013-09-11 15:27:46 +02:00
Daniel Narvaez
9717e5954b Fix translations in non standard prefix
This drops a lot of code at the same time. The code in
__init__ was:

* Using a SUGAR_PREFIX environment variable that is not
defined anywhere
* Hardcoding prefix to /usr
* Setting up the sugar-base domain which doesn't exist anymore

The i18n module code was overcomplex because it was thought
for language packs which we don't support anymore, it was
not handling correctly locales with a country prefix, it
was hard coding the python prefix and it was not sorting
the directories as it intended too anyway.

The logic is very simple now. Use the locale directory in
the same prefix sugar-toolkit-gtk3 was installed, unless
SUGAR_LOCALEDIR is defined (for self contained bundles).
2013-09-10 22:55:11 +02:00
Daniel Drake
e01837f8be Drop use of deprecated dbus.glib
When writing Python apps that will use asynchronous DBus calls and
signals, python-dbus must be initialised with the appropriate main
loop.

sugar currently does this by importing the datastore module from
sugar-toolkit-gtk3, and the datastore module uses the deprecated
and confusing dbus.glib module (which automatically and non-obviously
sets the default GLib main context as the DBus mainloop).

Eliminate the dbus.glib usage from sugar-toolkit-gtk3 as part
of the effort to make sugar initialised the DBus mainloop in a
more explicit and non-deprecated fashion.
2013-09-05 17:47:52 +02: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 <simon@laptop.org>
Reviewed-by: Daniel Drake <dsd@laptop.org>
2013-03-08 10:29:17 +01:00
Gonzalo Odiard
5fdad9481b Set default python encoding to utf-8
As spoted by Daniel Narvaez in [1], pygi does not set the default encoding
anymore as the old GTK+ did. This change does break activities ported
to GTK+3.

The change in GTK+ has been discussed upstream here [2].

A better solution will be implemented when we port to Python 3,
when we will be able to use real unicode strings.

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>

[1] http://lists.sugarlabs.org/archive/sugar-devel/2012-August/038993.html
[2] https://bugzilla.gnome.org/show_bug.cgi?id=681915
2012-09-26 13:29:07 +02:00
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>
2012-06-05 23:45:26 +02:00
Simon Schampijer
b03a483854 Use the gtk3 toolkit in the sugar-activity
Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Daniel Drake <dsd@laptop.org>
2011-12-20 19:19:26 +01:00
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>
2011-12-13 17:35:30 -03:00
Marco Pesenti Gritti
488402df7d Split sugar-toolkit out of sugar shell. 2008-02-06 10:20:33 +01:00
Marco Pesenti Gritti
dbe42ac6d9 Make the shell scripts just a tiny wrapper which setup
the python path and run main().
2008-02-04 20:36:09 +01:00
Tomeu Vizoso
b7e0ccbf81 #5512 import the activity module later. 2007-12-19 20:03:25 +01:00
Marco Pesenti Gritti
cb0cedbc40 Do not use prgname for the bundle id because xulrunner
is messing with it. Some activity launch fixes.
2007-10-16 14:29:38 +02:00
Marco Pesenti Gritti
68ff71a0cb Split part of the sugar library to sugar-base 2007-10-15 15:39:07 +02:00
Marco Pesenti Gritti
b44a2916ba Rework sugar.logger and make activities just
redirect their output to a log.
2007-10-09 18:58:39 +02:00
Marco Pesenti Gritti
6073a396b3 Rename activity service_name to bundle_id 2007-10-09 13:15:06 +02:00
Marco Pesenti Gritti
6ebe910e93 In preparation of enabling rainbow by default, remove
the factory service from the public API. The Exec field
will now launch an activity instance.
Add a -s argument to sugar-activity to enable the single
process mode for activities that really need it.
2007-10-08 14:56:12 +02:00
Marco Pesenti Gritti
44b7eaefcc Make sure we import the right pygobject 2007-09-29 11:53:09 +02:00
Marco Pesenti Gritti
30bee7e43a Adapt to API changes 2007-06-29 22:14:27 +02:00
Tomeu Vizoso
b320ea36cf Some activity registry fixes. Thanks cjb. 2007-06-13 11:50:05 +02:00
Tomeu Vizoso
22689ed1da Several fixes for the object type registry and the activity registry. 2007-06-12 21:57:49 +02:00
Marco Pesenti Gritti
d271e1f481 Fix new instance message 2007-05-31 14:22:26 +02:00
Marco Pesenti Gritti
42fef182f4 Refactor the bundle registry. Move it inside
the shell and expose the parts that should be
public to the shell dbus service.
2007-05-27 20:24:10 +02:00
Marco Pesenti Gritti
49ff2f86de Move not shell specific scripts in bin 2007-04-06 15:22:22 +02:00