Commit Graph

917 Commits

Author SHA1 Message Date
Gonzalo Odiard
b8074549f6 Fix cloning activity in sugar - SL #4608
Probably this code was not included in the initial port from gtk2 to
gtk3, because is only used by Sugar, but now we need it.

I changed the way the parameter dist_name is used,
then a complementary patch in sugar is needed

Fixes #4608

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
2013-11-29 16:14:07 -03:00
Walter Bender
cd5292881e Add single_instance field to activity bundle
This field can be used by activities that need to be restricted to a
single open instance. Usage is:

single_instance = yes

jarabe/model/shell.py has been modified look for this field in a
separate patch to Sugar.

Together these two patches constitute the implementation of Sugar
feature Launch Limits [1]

[1] http://wiki.sugarlabs.org/go/Features/Launch_Limits
2013-11-21 13:39:43 -05:00
Manuel Quiñones
1baebb2051 Merge branch 'gir' of https://github.com/dnarvaez/sugar-toolkit-gtk3 into dnarvaez-gir 2013-11-20 10:57:06 -03:00
Diego Naula
ddd566c847 Fixes #3665: add is_fullscreen() method to Window class
Signed-off-by: Diego Naula <dnaula1997@gmail.com>
2013-11-19 22:38:14 -06:00
Ezequiel Pereira
f13a14a2b3 Add journal filter for .xo bundles
Fix #1712
2013-11-19 01:00:00 +01:00
Daniel Narvaez
28423249f6 Make gir files depend on their library
Otherwise with parallel builds we might try to build gir files
before the library causing an error. This happened once in the
buildbot.

Fix #4606
2013-11-17 18:50:07 +01:00
Gonzalo Odiard
32f97b48c3 Workaround to enable start of activities still using service_name
While we deprecated service_name a long time ago, still there are activities
using it, and is a source of frequent problems.

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
2013-10-30 23:02:11 -03:00
Daniel Narvaez
cf392735a0 Ensure logs path exists when initializing logs
Otherwise, for example, if we start datastore alone
like we do in the tests, we try to create logs without
the directory and traceback.
2013-10-07 23:31:49 +02:00
Daniel Narvaez
6d6469ee12 Remove now unused method 2013-09-15 16:34:03 +02:00
Daniel Narvaez
fd831931ad Remove duplicated code
And deprecate duplicated function.
2013-09-11 18:12:54 +02:00
Daniel Narvaez
a1b6b129aa Make the debug script profile aware 2013-09-11 17:33:27 +02:00
Daniel Narvaez
fe192be798 Add a SUGAR_HOME environment variable
We should really use XDG directories but that will be a bit
more complicated and require migration scripts. This is a
short time solution to "expose" the dot sugar directory in
sugar-build.
2013-09-11 16:36:31 +02:00
Daniel Narvaez
e908aeb8ca Remove unused imports 2013-09-11 16:34:48 +02:00
Daniel Narvaez
d12a1d5131 Fix translations domains to point to new toolkit 2013-09-11 16:02:47 +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
Walter Bender
ec5f064c10 Ensure entity value is type str
There are times when the entity value passed in for substitution
is of type unicode. This causes Rsvg to fail when processing the
SVG. This patch checks for unicode and converts it to utf-8.

Fixes #4621
2013-09-08 22:51:00 +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
Manuel Quiñones
fa7a765f4e Drop session.py
SessionManager has been moved to shell, and the other class has
nothing inside.
2013-09-02 21:38:49 +02:00
Manuel Quiñones
d45560e3c7 Web activity: quit the GTK main loop when activity is destroyed
Fixes #4603 .

In GTK activities, this is done by _ActivitySession when the activity
unregisters itself, in _complete_close method.

Making the web activity aware of session logout will be handled in
another patch for the shell, see http://bugs.sugarlabs.org/ticket/4611
2013-08-30 08:36:28 -03:00
Manuel Quiñones
c8fa6bd694 Web activity: set activity name as the title of the window - SL #4605
At least View Source uses it.
2013-08-30 08:22:10 -03:00
Martin Abente Lahaye
ba8c435e50 Include string.h to sugar-fatattr
According to dsd's wisdom, without being
included, strerror is undeclared.

Fixes #4600 sugar crashing when copying
journal entries to documents folder.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
2013-08-16 00:14:42 +02:00
Walter Bender
7d931c845e Fix annotation for xdg_mime_list_parents
There is a fatal crash in Sugar when retrieving mimetypes for some Journal
entries when contructing the icon palette (for both the Journal list view
and detail view). We isolated the problem to xdgmime.c, the call to
xdg_get_mime_parents. Dnarvaez observed that the annotation for the
return argument was missing and that the annotation for the return for
mime_list_parents was wrong. This patch fixes these annotations.

Fixes #4530
2013-08-15 23:59:33 +02:00
Daniel Drake
147d80aa78 ActivityFactory: don't run which to check for rainbow
One less thing to do in the common activity startup path.
Also, which might not be available.
2013-07-13 11:05:41 -06:00
Manuel Quiñones
0b47dd37b1 Merge branch 'objectchooser_preview-try2' of https://github.com/godiard/sugar-toolkit-gtk3 into godiard-objectchooser_preview-try2 2013-07-08 17:17:22 -03:00
Gonzalo Odiard
3e6507af6e Add a option to the objectchooser to show the object preview
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
2013-07-08 15:52:18 -03:00
Gonzalo Odiard
8e975bd5c9 Add a method to create a Pixbuf with the preview in the metadata
This code was moved from sugar expandedentry.py to be available to use
in other places. Some activities like Portfolio or JournalShare
have this code copied.

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
2013-07-08 15:51:27 -03:00
Daniel Drake
670fc44b1a Icon: handle image loading errors
If the icon can't be found, fall back on showing a generic icon.

Useful when activity/content bundles specify a bad icon, which is
unfortunately true for most content bundles in current existance
(because the icon field was previously unused).
2013-07-05 01:13:52 +02:00
Daniel Drake
f46ac7ba6a ContentBundle cleanups
Share get_installation_time() between all bundle types so that it works
with content bundles.

Add get_tags() stub, this is called by Sugar.

Remove unused fields: l10n, category, subcategory, etc.

We remove support for running OLPC's content bundle indexer.
This is assumed to go away now that Sugar will support content bundles
as first-class objects.

Some minor behavioural fixes and cleanups.

This now implements http://wiki.sugarlabs.org/go/Content_bundles
and when care is taken to include all the fields required by old
Sugar versions, there is no change in compatibility of existing or
new content bundles.

Required for http://wiki.sugarlabs.org/go/Features/Content_support
2013-07-05 01:13:52 +02:00
Daniel Narvaez
363eef5293 Fix pep8 2013-07-05 00:57:03 +02:00
surajgillespie
8c736d3870 Pass activity name to the webactivity 2013-07-05 00:53:23 +02:00
Manuel Quiñones
2643a0b25c Merge branch 'at' of https://github.com/dnarvaez/sugar-toolkit-gtk3 into dnarvaez-at 2013-07-04 19:20:46 -03:00
Daniel Drake
efaf9f9b2f Avoid use of uuid module
Upon import of uuid, that module uses ctypes.util to find libuuid/libc,
which involves forking a shell process which then forks and runs ldconfig.

ldconfig performs a whole bunch of disk accesses. This is a slowdown.

uuid.getnode() is also documented to be slow. Lets avoid using it in
the activity launch path; we don't need such a high degree of
randomness.

This makes activities launch 1-2 seconds faster on XO-1.
2013-07-04 11:43:54 -06:00
Daniel Narvaez
6d2b97daec Fix pep8 errors
pep8 1.6.4 detects more issues
2013-07-04 19:00:57 +02:00
Daniel Drake
778b10f8d4 Allow override of user library path
This allows for override of ~/Library the same way that can be done
for ~/Activities. Useful for automated testing.
2013-07-02 17:46:33 +02:00
Daniel Drake
be91f84a4b Avoid auto-import of bundle helpers (#4527)
The new bundle helpers were being auto-loaded with sugar3.bundle due
to their placement in __init__.py. This was causing Gi to be imported,
breaking GTK2 activity launches.

Move the helpers to a dedicated module.
2013-06-29 09:17:26 -06:00
Daniel Narvaez
8fff409046 Add missing headers
Fixes distcheck
2013-06-27 16:11:23 +02:00
Daniel Narvaez
9778f1d35f Don't set AT_SPI_CLIENT
This is not necessary anymore with latest at-spi2-atk
(See commit 683739dea15d7c02c217a404d8c5d9d7af076a57)
2013-06-26 23:00:58 +02:00
Daniel Drake
12476caa12 Improve bundle API for bundleregistry changes
The bundle API is a bit confusing and inconsistent. Fix up the
ActivityBundle and ContentBundle classes to be more consistent and to
work with the ongoing improvements being made in bundleregistry.
2013-06-24 22:47:13 +02:00
Daniel Drake
f4c1bd152a Add bundle instantiation helpers
Add some helper functions for use by upcoming changes in the Sugar shell.
2013-06-24 22:47:13 +02:00
Gonzalo Odiard
ad3c163023 Fix ObjectChooser backwards compatibility
The last change brak compatibility with the use in activities
without set the filter_type parameter, because None is not
a allowed value in the dbus call.

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
2013-06-24 02:14:57 -03:00
Daniel Narvaez
f54229efd2 Move setting AT_SPI_CLIENT to discover
It needs to be called as early as possible before unit tests
has a chance to import gtk.

Hopefully will fix random test failures we are seeing in buildbot.
2013-06-22 12:29:00 +02:00
Daniel Narvaez
6d319619f0 Factor out the discover logic to the test module
This avoids duplication in sugar and sugar-toolkit-gtk3
makefiles.
2013-06-22 12:28:56 +02:00
Gonzalo Odiard
da3786d2fb Add filter_type optative parameter to objectchooser
Constants are defined to select the different filter_type
values. A comment was added to document the use.

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
2013-06-20 17:42:19 -03:00
Daniel Narvaez
19bc2268d4 Log the UI tree on error
The dump method doesn't actually print anything, just
returns the tree as a string.
2013-06-19 19:20:44 +02:00
Daniel Narvaez
5bef5a82d2 Set the AT_SPI_CLIENT variable in the tests
This ensures the test itself is not recognized as a client
by the registry. I'm not sure how that happens since we are
not loading gtk, but it does. Not being a real gtk client with
a mainloop we wasn't answering dbus calls and causing the registry
to hang and fail.
2013-06-15 23:56:45 +02:00
Daniel Narvaez
4dc7b9e4a4 Don't set atspi timeout
Looking at the code I'm unconvinced this behaves as expected,
in certain cases at least. So reverting it for now to avoid
confusion.
2013-06-15 19:16:59 +02:00
Daniel Narvaez
521778636e Add a UIUnitTest class
To make it easier to write UI unit tests.
2013-06-15 19:15:32 +02:00
Daniel Narvaez
c86c582e19 Resync with the sugar-build implementation of tree.py
Development continued there for a while. Now I will remove it
and used the toolkit implementation instead.

Changes:

* Retry faster
* Handle GLib errors
* Don't always dump the tree
* Support master atspi api
2013-06-14 23:27:13 +02:00
William Orr
c736ffefcd pep8'd sugar3 2013-06-11 15:27:19 +02:00
William Orr
1252d95671 pep8'd sugar3.test 2013-06-11 15:25:07 +02:00
William Orr
69a7aa8f68 pep8'd sugar3.presence 2013-06-11 15:21:39 +02:00
William Orr
edbc8f53b3 pep8'd sugar3.graphics 2013-06-11 15:18:15 +02:00
William Orr
51f07bba81 pep8'd sugar3.dispatch 2013-06-11 15:13:19 +02:00
William Orr
220c9b68ef pep8'd sugar3.datastore 2013-06-11 15:11:58 +02:00
William Orr
9e4454a2ed pep8'd sugar3.bundle 2013-06-11 15:10:55 +02:00
William Orr
8a6c935dd0 pep8'd sugar3.activity 2013-06-11 15:06:49 +02:00
Walter Bender
3e5c37f3f8 Adding SugarExt for setting hidden attribute on FAT files
This extension is used by Sugar to set the HIDDEN attribute for
.Sugar-Metadata. By creating an extension, we avoid the need to add an
additional dependency (fatattr) to Sugar. The code is modeled after
fatattr, using an IOCTL call get and set FAT file attributes.

There is a corresponding patch for model.py in sugar/src/jarabe/journal
2013-06-10 15:46:54 +02:00
Daniel Narvaez
9396b09ee4 Send bundleId and objectId to javascript
Also use the json module to generate the environemnt
dictionary string. This takes care of a None objectId
cleanly.
2013-06-10 15:46:54 +02:00
Gonzalo Odiard
58bab9cf6a Do not use the translated summary to get the value from gettext in the bundle builder
This patch is a rebased push from pull request #31

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
2013-06-10 15:46:54 +02:00
Daniel Narvaez
1f5e39f3a8 Cleanup environment initialization
We are not setting up a single sugar.window.environment object.
2013-06-10 15:46:54 +02:00
Daniel Narvaez
a1b73ff527 Rename HTML to web 2013-06-10 15:46:54 +02:00
Daniel Narvaez
8e381f9e2f Make the inspector toggle work reliably 2013-06-10 15:46:54 +02:00
Daniel Narvaez
28fe9b757f Use a relative path in the activities url
It's just a bit cleaner.
2013-06-10 15:46:54 +02:00
Daniel Narvaez
a30af509c2 Rework HTMLActivity to not inherit from Activity
This will make the activity use less memory and start faster.
2013-06-10 15:46:54 +02:00
Daniel Narvaez
3aadcbcbf0 Move the websocket service to the shell
It's a first step to make html activities much lighter. It also
just makes a lot more sense to have them interact directly with
the system rather than proxying through the python activity.
2013-06-10 15:46:54 +02:00
Daniel Narvaez
b276f61da1 Use javascript to setup websocket port and key 2013-06-10 15:46:54 +02:00
Daniel Narvaez
3f908ef999 Deprecate and ignore the SUGAR_EMULATOR variable 2013-06-10 15:46:54 +02:00
Daniel Narvaez
2fcac13791 Toggle the inspector on and off with ctrl-shift-i 2013-06-10 15:46:53 +02:00
Daniel Narvaez
0abae0e7d0 Use a custom scheme for app content
To get the origin right.
2013-06-10 15:46:53 +02:00
William Orr
e649070aa2 Replaced deprecated GObject methods with GLib methods 2013-06-10 15:46:53 +02:00
William Orr
3a8760c9e4 Fixed crash in journal when mousing over activity icons 2013-06-10 15:46:53 +02:00
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
Daniel Narvaez
55a072470f Silence pyflake 2013-05-05 01:46:13 +02:00
Daniel Narvaez
9f71aa864f Remove various unused bits 2013-05-05 01:44:03 +02:00
Daniel Narvaez
6c4a9b34a1 Add a get_xo_color API 2013-05-03 08:42:35 -03:00
Daniel Narvaez
671ad1ae3e Require authentication before making API calls
Otherwise anything might access the bus.

Note: This will not work if the user moves to another html page.  They
will not have a port/key passed in the query string of the URL, so
they won't be able to connect.
2013-05-03 08:40:44 -03:00
Daniel Narvaez
ff5612caee Add API to close an html activity
We are exposing it using a websocket server. The port of the server
is passed in the search string of the file:// url.
2013-05-03 08:40:24 -03:00
Daniel Narvaez
6cbc3d1a48 Improve XOColor fallback logic
We was failing if the value in gconf was None. Also parsing
the string once just to see if it's valid was pretty dumb.
2013-05-02 18:52:59 +02:00
Daniel Narvaez
680c501ad6 Add a binding for gconf_client_set_list (using strings) 2013-04-29 20:03:09 +02:00
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
2013-04-23 16:05:20 +02:00
Manuel Quiñones
7156e67aa2 Color Palette: get back horizontal padding - SL #4325
The PaletteWindow lost the horizontal padding when it started to be
used as replacement of palette menus.  So now each implementation has
to add the padding.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
2013-04-17 17:09:45 -03:00
Walter Bender
b4c0b2258f Use gettext algorithm to determine locale for activity.linfo
When activity bundles are loaded, the activity name and summary are
pulled from an activity.linfo file that is associated with
locale. However, sometimes locale, which uses $LANG has been
superceded by $LANGUAGE as set in
extensions/cpsection/languages/model.py. This patch uses the same
algorithm as gettext.py to find activity.linfo

This problem is seen on the .AU systems which use en_AU for locale and
en_GB for LANGUAGE.
2013-04-15 08:42:42 -04:00
Daniel Narvaez
7cb4a1d72d Handle invalid /desktop/sugar/user/color
This is currently breaking the activity list unit test where
the profile has not been initialized. But, more in general,
it seems like we should not be crashing if our settings has
unexpected values.
2013-04-09 18:13:18 +02:00
Daniel Narvaez
6202d4d5cc Bind xdgmime in SugarExt
And use it in the sugar3.mime modules. This allows
to get rid of the pygtk generated sugarbase module,
along with the wrapping code.

Also add more cases to test_time to make sure
everything is still working.
2013-04-09 11:36:51 +02:00
Daniel Narvaez
e6397cf2db Some initial infrastructure for UI tests
The uitree module exposes the at-spi tree. We can use it to do
functional tests of the UI, by checking if the expected
widgets exists, clicking them etc.

A simple example of how this can be used is in the test, which
runs a window and check that it has the expected button.
2013-04-09 11:36:51 +02:00
Daniel Narvaez
65560b0b94 Add a SUGAR_ACTIVITIES_PATH environment variable
Useful for tests but perhaps for other stuff too.
2013-04-09 11:36:51 +02:00
Daniel Narvaez
c5f30a9fbe Support out of source directory builds
It works similarly to automake. The current working directory
is used as build directory.
2013-04-09 11:36:49 +02:00
Daniel Narvaez
07d593fe52 Rework the install to use git files
Instead of installing everything except a few ignored files. This
is consistent with the other packagers.
2013-04-09 11:36:04 +02:00
Daniel Narvaez
9db81af598 Remove a few unused keywords 2013-04-05 17:05:42 +02:00
Daniel Narvaez
db448c4eea Remove a lot of unused imports
Signed-off-by: Daniel Narvaez <dwnarvaez@gmail.com>
2013-04-03 22:01:55 +02:00
Manuel Quiñones
a3cda7c49f Revert "icon.py: move all imports to the top"
We have circular imports if we do this.

This reverts commit 355ca09a8c.
2013-03-20 12:34:13 -03:00
Manuel Quiñones
355ca09a8c icon.py: move all imports to the top
Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
2013-03-20 12:24:21 -03: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 <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
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 <simon@laptop.org>
Reviewed-by: Daniel Drake <dsd@laptop.org>
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 <simon@laptop.org>
Acked-by: Manuel Quiñones <manuq@laptop.org>
2013-02-15 15:41:03 +01:00
Manuel Quiñones
a7e0e5ae57 Make the size of the preview image a public constant
Instead of hardcoding it.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
2013-02-04 11:51:03 -03:00
Daniel Narvaez
7ba72c4c61 Remove duplicated library flags
They are already provided by the pc files.
2013-01-28 18:41:54 +01:00
Manuel Quiñones
d32523655c Fix subtoolbars height - SL #4019
Remove the vertical padding from the box that contain the toolbar, and
change the order of drawings in the container widget so that the
outline looks right.  This has been tested with screenshots, see the
gif animation attached to the ticket.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
2013-01-23 10:48:06 -03:00