There are two different palette widgets in Sugar.
_PaletteMenuWidget is a Gtk.Menu and _PaletteWindowWidget is a Gtk.Window.
Only the palettes where the widget is a Gtk.Window can do present()
After add the directory to the IGNORE_DIRS array,
we need make the standard procedure to get the list off files
for the bundle, get_files_in_git honor the configured ignored
files and dirs. That was not a problem until now,
because that files was already not added to git,
but in the case of the screenshots, are included in git,
but we don't want include them in our bundles.
This new invoker is able to handle all the palettes on a treeview,
removing the need of one invoker per cell renderer (CellRendererInvoker).
This simplifies the code and makes it more efficient.
Also removes the logic from the CellRendererIcon, which
should only care about drawing itself. [1]
Is important to note than in Gtk3 a CellRenderer is not a GtkWidget
then can't know when the mouse is over it or have the usual events
used by other invokers, making the implementation CellRendererInvoker
very complicate.
This commit also removes the invoker of CellRendererIcon.
The ScrollingDetector logic is simplified too,
because now there are only one invoker instead of one by renderer
and the example code updated.
[1] https://developer.gnome.org/gtk3/stable/GtkCellRenderer.html
Detecting if the treeview is scrolling we can improve the performance of
the CellRendererIcon by avoiding unneeded calculations.
The example scrollingdetector.py shows how this can be used. The
changes are backward compatible.
Signed-off-by: Manuel Quiñones <manuel.por.aca@gmail.com>
Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
On commodity hardware without olpc-powerd, there is unnecessary
filesystem access.
On XO laptop hardware there are unnecessary errors in log for every
object delete:
ERROR root: Inhibit Suspend: Could not delete file
/var/run/powerd-inhibit-suspend/1773
Exception AttributeError: "'NoneType' object has no attribute
'endswith'" in <bound method PowerManager.__del__ of
<sugar3.power.PowerManager instance at 0xa15962c>> ignored
The Clock activity in speaking mode is a good reproducer.
Following changes are made:
- move the directory check to __init__, and set self._path to None if
olpc-powerd is not present,
- on inhibit_suspend, use self._path, which avoids a check of the
directory,
- on restore_suspend or __del__, avoid a call to os.unlink if
olpc-powerd is not present.
Use a more efficient method to check if the pointer is inside the cell,
because we have the cell_area in the do_render method.
Signed-off-by: Manuel Quiñones <manuel.por.aca@gmail.com>
Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
This commit adds the `launch_bundle` function in `sugar3.activity.
activity` which accesses the same function in the shell is over dbus.
This is means the shell process launches the bundle. Activities
should not launch child processes as per the Rainbow security model
[1].
[1] http://wiki.laptop.org/go/Rainbow
If a translator add a '\n' char in the summary translation
ConfigParser can't parse the linfo file.
Remove them when the file is created and show a message to warning
to the developer.
When we ported sugar to Gtk3 we removed the support of the fields
exec and service_name due they were deprecated for a long time [1].
But this is still a problem in deployments, and we already added
compatibility for the service_name field.
Here [3] there is a long thred were we discussed this issue.
[1] ae85dd62d4
[2] 32f97b48c3
[3] http://lists.sugarlabs.org/archive/sugar-devel/2013-October/045404.html
As described in SL#4307 Gtk.Clipboard.set_with_data is not
introspectable, therefore it can't be accessed though python
Gtk bindings.
Therefore, as a workaround for this issue, we provide acesss
to this method though a custom SugarExt binding.
This solution uses Carlos Garnacho annotations as described in
https://bugzilla.gnome.org/show_bug.cgi?id=656312#c18
Fixes SL#4307.
Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
Now when the espeak plugin is not installed there will be an
error (logging.error) in the log. Instead of the ugly message
of Gst
Also, if Gst isnt installed it debug a error too.
Fixes#3345
The BundleBuilder currently crashes on a malformed translation file. This is
good for humans (makes them fix their issues) but crashes bots who need it
compiled and don't care about that single translation file.
This patch adds a --no-fail option which stops the builder from crashing
To display a list of translated language names in the UI,
we add a list of the available languages, because the espeak
language names are not translated.
git version 1.9.3, in a activity directory created inside sugar-build/activities
return a empty string when the command "git ls-files" is executed,
and no repository is configured.
We need verify that condition, and process a file list from the filesystem.
Use set_active and save events to keep track of the time,
in seconds, that the activity is on the main screen. The
time is calculated and stored each time an activity is
open/resumed and closed. Therefore, each activity entry
will have an array of seconds for each time it was used.
This makes a 1 to 1 relationship between the spent and
lauch times. In orders words, we can reflect not only the
"when", but also the " for how long".
Even though this time does not necessarily represents the
real time the user "used" the activity, it is a low-cost
approach for reflecting time.
This is a long requested featured from deployments that have
been using statistics tools on journal metadata, and this
patch is already being used by OLPC-AU.
Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
PaletteWindow is the parent class of two different subclases,
Palette and _ToolBarPalette. Palette uses state changes intensively
in order to display secondary content, but _ToolBarPalette does not.
Because of this, Palette overwrites PaletteWindow's popup and popdown
methods adding one extra param called "state". This param is not required
either in PaletteWindow and specially not in _ToolBarPalette.
Therefore, any piece of code inside PaletteWindow which is meant for
Palette subclassing, should be moved out of PaletteWindow and placed
in the Palette class, where it corresponds.
This patch fixes the cases where _ToolBarPalette breaks because of this
mismatch.
Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
Push the palette widget opening process to the latest
in order to avoid the race condition where the animation
takes of the place of the real palette.
Fixes#2184
Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
When we implemented read max_participants from activity.info [1]
we changed the default value of max_participants, from 0 to 1.
Before, was responsability of the activities set max_participants == 1,
when the activity not implemented collaboration.
This change make the default backwards compatible.
[1] d0cca91fe8
When calculated the palette height based in the size of children,
forgoten add the border size. That moved the palette in the device icons
4 pixels to the bottom, then the gap was miscalcuated and the border
button border was not draw.
Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
In Gtk 3.10, Gtk.Window is drawing a gray border around the palette.
This patch draw a black rectangle defore we draw Gtk.render_frame_gap
to draw the border but with a gap to connect to the attached widget.
Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
Removes unnecessary code ie., changing label color.
Refactor label settings, to put all in the same place.
Fix changes to label_alignment that does not honor
original vertical padding settings.
Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
On Gtk 3.10, Gtk.Menu at the bottom of the screen are resized
to avoid fall out of the screen, then report a wrong height.
We need calculate the size of the children and move the Menu up.
This problem is visible on the Clipboard icon palettes,
and in journal objects palettes at the bottom of the screen.
This patch also rename a variable 'rect' to 'req', because is
a Requisition (width, height) and not a Rectangle (x, y, width, height).
Finally, to avoid a error with the secondary text on the palette,
when copy text from the terminal, reove the '¬r' character.
Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
As part of an effort to "honor" max_participants, this patch supports setting
max_participants in activity.info, thus making it available in the bundle.
By default, if it is not set in the bundle, the previous behavior persists.
In support of this change, a cache of Activity bundles is
maintained. The goal is to eliminate unnecessary calls to the file
system.
Add get_badge_size method to Icon class, so it can be accessed
by other Icon sub-classes.
ie., jarabe.frame.notification.NotificationPulsingIcon.
Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
Add a new method, called notify_user, to the base
Activity class.
This method can be used by activity developers to
send notifications to the new notification front
end. ie.,
self.notify_user('New High Score!',
'Your score is over 8999')
This is the only method pending implemented in c,
then we can remove seven files previously used.
Add a test for a corner case untested previously
Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
In some network environments, suspend/reume can make loose
messages and break collaboration. This patch inhibit suspend
when collaboration start. The implementation can be used by activities
or Sugar to inhibit suspend/resume when needed.
More information in http://dev.laptop.org/ticket/10363
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Since CellRendererInvoker can set the path at None if a mouse event
is out of the area of the renderer, can break the use of touch,
if happen after the mouse movement. This patch set the path,
in the point_in_cell_renderer test, for the positive case,
solving the issue.
Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
pixel_size should be always used now.
Change SMALL_ICON_SIZE to cover the other sizes at settings.ini.
Adds a transformation to keep backwards compatibility for some
time. This will be removed in the future.
./setup.py check now invokes tests in tests/ directory. tests directory should
have integration(UI tests) and unit(unit tests) sub directories, but it isn't
necessary to have any dir. of the above.
This issue was reported many times, when new users see a tooltip
try to click, and are confused when there are no action.
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
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>
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>
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
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>
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.
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).
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
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.
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
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>
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
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>
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).
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
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.
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.
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.
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>
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.
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>
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.
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
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
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.
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.
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.
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>
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.
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.
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.
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.
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>
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>
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>
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>
A new icon widget useful to display progress. It is compatible with
sugar3.graphics.icon.Icon . The progress is represented filling the
icon.
Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
Otherwise the internal state is messed up, GTK+ grabs may be held on
unrealized widgets.
Signed-off-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Simon Schampijer <simon@laptop.org>
This was lost when PaletteMenuItem was added in
2d0ac2a952 of sugar source code.
That class does not handle the text_maxlen argument (default to 60). I
used this argument to set the Gtk.Label's size:
label.set_max_width_chars and use MIDDLE for its EllipSizeMode as
sugar3.graphics.palette.Palette does for its title and subtitle.
With these settings, the title of the palette and its items share the
same behaviour and are rendered with the same width.
Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
Acked-by: Manuel Quiñones <manuq@laptop.org>
There are cases where there is no user interaction but we do
receive a clicked signal: in the clipboard we do have
GtkRadioToolButton which are derived from the GtkToggleToolButton [1].
The 'clicked' signal is emitted when the 'active' property
changes [2]. We use the 'active' property to indicate the
current active clipping. In the Invoker we do check now
if the event originated a user interaction or if it was
generated due to a for example a property change.
[1] http://developer.gnome.org/gtk3/3.4/GtkToggleToolButton.html
[2] http://developer.gnome.org/gtk3/3.4/GtkToggleToolButton.html#GtkToggleToolButton--active
Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Carlos Garnacho <carlos@lanedo.com>
Acked-by: Manuel Quiñones <manuq@laptop.org>