76 Commits (master)

Author SHA1 Message Date
Pro-Panda aa8a5e70c4 Port from Python 2 to six
Signed-off-by: James Cameron <quozl@laptop.org>
5 years ago
James Cameron 12de9f0412 Remove noisy output from sugar-activity 7 years ago
James Cameron 495eed8737 Prepend instead of append to path
When an activity is launched, an import should first search the activity
bundle source rather than /usr/bin

Fixes the need to change activity sources every time a system package
conflicts with an import.

May impact any activity that relies on a system package being in search
path before the bundle source.  Forty activities were tested, and none
relied on this.
7 years ago
James Cameron 4b6d8751b3 sugar-activity: typo 8 years ago
Sebastian Silva a462f14c55 Properly make a random activity_id outside Sugar. 8 years ago
Sebastian Silva c5fa4dfd59 Fix regression for GTK2 activities caused by 2f2b2d2
The issue was caused by importing from activityfactory which caused GObject to be imported. This conflicts with GTK2. (Reported by James Cameron)
The idea is that we should create the sugar profile's activity root if it doesn't exist yet, when running outside Sugar.
8 years ago
Sebastian Silva 2f2b2d20d8 Allow to run activities without Sugar shell.
- Handle lack of GSettings gracefully.
- Still requires sugar-datastore.
- Supports avoiding X11 docks/panels.
- Provides icons for Activity windows.

Try it outside Sugar. Go to an Activity directory and run 'sugar-activity'.
Tested it with Terminal, Finance, Write, Browse, Memorize under XFCE4.
Tested in Gnome under OLPC-OS.
Also works from Sugar Terminal Activity.
Does not affect regular Sugar operation.

This is patch v.2 -
    Addresses most concerns:
    - Removed commented code, sorry.
    - Changed code to use profile.get_nickname and get_color where possible.

    Couldn't the launcher just pass this info?
    Maybe the launcher could set the activity root as well?
        - It is intended to be usable from the command line also.
    Should put sugar version in the environment
        - It is intended to work even without Sugar Shell installed.
    Why don't we always set the icon?
        - On XO it might use some memory. I was concerned to degrade
        performance.
    Also, imports should be at the top of the file?
        - Also a concern about performance on XO.
        This way it is only loaded in this use case.
        Maybe it is insignificant -moved as requested.
    It would be nice if the changes to the POT for sugar-toolkit-gtk3
    could be incorporated in this pull request, please.
        - There were no changes to POT files as part of this patch. Maybe
        it is worth translating low level command line tools, not sure.
    Suggest packaged activities might also provide .desktop files.
        - Intriguing but not sure within scope of this patch. You mean generate
        a .desktop file automatically as an option? Sounds nice!
    Suggest sugar-activity might also accept path to unpacked bundle.
        - Implemented!
8 years ago
James Cameron 00c541af4f sugar-activity-web: remove bash specific code 9 years ago
Gonzalo Odiard f157b1148e Avoid breaking activity startup by dbus timeout on sigle instance - Fixes #4773
This problem only happen in activities configured with the option -s
in the activity.info "exec" field, and the objective is use a single process,
even when starting more than one instance. If the process do not reply,
start a new process, instead of show a error.

Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
10 years ago
Gonzalo Odiard 43a4611d75 Pep8 and pyflakes fixes to sugar-activity 10 years ago
Gonzalo Odiard f52b4e1a96 Make webactivity compatible with webkit1
If a env variable SUGAR_USE_WEBKIT1 exists,
uses a different module to start the activity using a local webserver,
borrowed from wikipedia activity.
When use webkit1 the web inspector is not enabled, because do not work.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
11 years ago
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.
11 years ago
Daniel Narvaez 6523ba1481 Bind the new toolkit domain 11 years ago
Daniel Narvaez b83ddaefaf Revert "Fix translations domains to point to new toolkit"
This reverts commit abe0de3ef8.
11 years ago
Daniel Narvaez abe0de3ef8 Fix translations domains to point to new toolkit 11 years ago
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).
11 years ago
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.
11 years ago
Daniel Narvaez a1b73ff527 Rename HTML to web 11 years ago
Daniel Narvaez d4019684a3 Add exec script to build pure html activities
An hello world activity using the script
http://git.sugarlabs.org/hello-world/mainline/trees/html
11 years ago
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>
11 years ago
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
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 b03a483854 Use the gtk3 toolkit in the sugar-activity
Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-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
Marco Pesenti Gritti 488402df7d Split sugar-toolkit out of sugar shell. 16 years ago
Marco Pesenti Gritti 44efc2a131 Complete paths cleanup and remove SUGAR_PREFIX and
SUGAR_PATH environment variables.
16 years ago
Marco Pesenti Gritti aca3ae6c88 Remove get_service_path and use the usual wrapper script approach. 16 years ago
Marco Pesenti Gritti dbe42ac6d9 Make the shell scripts just a tiny wrapper which setup
the python path and run main().
16 years ago
Marco Pesenti Gritti 1c361ea5dd Add a config module into the shell holding path informations.
Get rid of env.get_locale_path()
16 years ago
Marco Pesenti Gritti 33ae2dc548 Remove get_bin_path usage. 16 years ago
Marco Pesenti Gritti e85a07e2d2 Work around for numpy/gtk issue with turkish locale. Fix #5559. 17 years ago
Tomeu Vizoso b7e0ccbf81 #5512 import the activity module later. 17 years ago
Marco Pesenti Gritti 6046c8ed46 Reap only activity processes. Fix #5044 17 years ago
Marco Pesenti Gritti 0aa31147db Strip out /usr/bin/env from the interpreter cmd,
it's apparently confusing gdb.
17 years ago
Marco Pesenti Gritti 4c66eec49b Completely get rid of sound in the shell to make
sure it's not causing problems.
17 years ago
Marco Pesenti Gritti cc9e561153 Reap childs rather than ignoring them. 17 years ago
Marco Pesenti Gritti d445bc086d Free the sound device when the startup when the sound has been played.
Factored out to a separate sound module from cjb patch.
17 years ago
Simon Schampijer 70079de872 refinements in output of sugar-control 17 years ago
Simon Schampijer 14ffdc1d03 sugar-control: fixed some imports, cleaned some strings 17 years ago
Simon Schampijer 38b87ad7cd sugar-control: add env import 17 years ago
Marco Pesenti Gritti b72f00e30b Integrate control panel in the build so that I can actually
distcheck.
17 years ago
Marco Pesenti Gritti 880f1c637d Parse arguments rather than forking out a shell 17 years ago
Marco Pesenti Gritti 0daccca71f Fake backup script 17 years ago
Tomeu Vizoso 5084ecf4f4 Add the posibility to launch activitis in gdb to sugar-lauch. 17 years ago
Marco Pesenti Gritti cb0cedbc40 Do not use prgname for the bundle id because xulrunner
is messing with it. Some activity launch fixes.
17 years ago
Marco Pesenti Gritti 68ff71a0cb Split part of the sugar library to sugar-base 17 years ago
Marco Pesenti Gritti a0bd80bb4e Snapshot 6c7c6a503b. 17 years ago
Marco Pesenti Gritti b44a2916ba Rework sugar.logger and make activities just
redirect their output to a log.
17 years ago
Marco Pesenti Gritti 7c59d10a06 Actually remove the factory 17 years ago
Marco Pesenti Gritti c2982f2774 Implement a sugar-launch command. Works like the old sugar-activity
but should deal fine with native activities too.
17 years ago