Currently, the ToolInvoker code passes the button child in such a
way that the WidgetInvoker queues only the child's draw. In previous
Gtk+ versions, this magically resulted in redrawing the parent as well.
However, Gtk+ 3.20 is probably trying to save power and not randomly
redraw widgets. To fix this, we must queue the redraw of the widget
that we want to redraw explicitly.
- 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!
Sugar depended on Rainbow for clearing the activity instance/ and tmp/
directories. But Rainbow is no longer used downstream.
- remove support for Rainbow,
- avoid race when creating directories; don't check they exist before we
create.
Git submodules are only listed by their root directory in the
output of "git ls-files". Therefore, we must handle this case
so that the files from the module are included in the install
and dist_xo commands.
To reproduce the issue, you could do something like the following:
cd pippy
git clone https://github.com/samdroid-apps/collabwrapper
git add collabwrapper
python setup.py install # or just osbuild run
CHANNEL_TYPE_TUBES was deprecated since telepathy-gabble 0.17.25 and
is no longer present on modern distributions. This breaks collaboration
for _all_ activities, regardless if they use tubes or not.
Therefore, check if the channel creation failed due to support and allow
channel creation process to continue.
This patch fixes collaboration for the activities that do not use tubes
channel in modern distributions, but also allow to use tubes when running
on older distributions.
Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
In Gtk+ 3.20, you need to use the css name to select elements,
rather than the gtype name. Therefore, these must be added.
The css name must be set before the class instances are created, as
it effects the class rather than the instance. This is why it must
be places after the class definition.
A rework of the TreeViewInvoker used by the journal and activity list.
Fixes a persistent journal entry palette that reappears in journal or
home view. https://bugs.sugarlabs.org/ticket/4918
Also fixes an over-sensitive journal icon; with the journal mostly
empty, rapidly move the mouse from the bottom of the screen into the
lowest icon and then out again. Before this patch, the palette was
shown. After this patch, the mouse must rest in the icon.
Changes made:
- override _ensure_palette_exists in parent class Invoker,
- remove reference to MouseSpeedDetector, it is no longer required,
- remove enter and leave events; they are for the TreeView as a whole,
and are not required,
- properly detect that None is returned by get_path_at_pos, when the
coordinates are outside the TreeView cells.
Not fixed:
- moving the mouse out of the journal icon invoker does not popdown the
palette, but it does when moving the mouse out of the activity icon in
the activity list; so this is a problem beyond the invoker,
Tested on Fedora 18 and Ubuntu 15.10.
Test cases:
- check a click will activate item,
- check a right-click will show palette,
- check a mouse hover will show palette,
- check a brief mouse passing will not show palette,
- check if mouse leaving palette will popdown.
Instead of getting the position of the mouse later in the code,
this commit uses the coords given to sugar by Gtk that say where
the event happened. This means that if the system is busy, or
the user is fast with the mouse, the palette will pop up where
they originally clicked.
When disk is full, Sugar will not start, because the backup log
directory cannot be created.
X session logs in tmpfs show this exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/lib/python2.7/site-packages/jarabe/main.py", line 20, in <module>
logger.cleanup()
File "/usr/lib/python2.7/site-packages/sugar3/logger.py", line 113, in cleanup
os.mkdir(backup_dir)
OSError: [Errno 28] No space left on device: '/home/user/.sugar/default/logs/1448258018'
Fix is to ignore the exception.
We've been here before! Was previously fixed in 2010:
https://github.com/sugarlabs/sugar/commit/4cde481https://bugs.sugarlabs.org/ticket/1720http://dev.laptop.org/ticket/9623
But new regression introduced in 2012 during reorganisation of
code by Daniel Narvaez; the exception was no longer handled:
https://github.com/sugarlabs/sugar/commit/0e45f9dhttps://github.com/sugarlabs/sugar/commit/19db9c5
Reported-by: Nathan Riddle <nathanr333@charter.net>
Tested-by: James Cameron <quozl@laptop.org>
Create a private class for the button, timeout and response. Use the
private class as parent for both NotifyAlert and TimeoutAlert.
Extends the spurious response fix (cfeabdc) to NotifyAlert.
Also use g_timeout_add in preference to g_timeout_add_seconds, because
the latter is less precise in implementation.
Tested by changing the Register alert temporarily.
For an object of class TimeoutAlert, an OK response occurs on timeout,
even if user has clicked a button.
Remove the timeout when the user clicks a button.
A new method _response is added which overrides the parent method.
Gtk 3.8 introduces the tick callback [1]. This allows widgets to be
signaled before each frame, simmilar to requestAnimationFrame in the
browser.
This patch adds an optional widget argument to the Animator class so
tick based animation can be used. This is much more efficent than
using timeouts, as we get a more appropriate frame rate for the user.
[1] https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-add-tick-callback
As the ticket describe, create a object in the Journal
is no longer optional. The change do not break activities,
because the optional parameter is not removed, just ignored.
Right now is not possible do "from sugar3.datastore import datastore"
outside of GLib loop, because the import try to connect to a DBus signal,
and throw a exception.
That was not a problem in Sugar, because we always have a Glib loop
on all our activities, but is a problem when we want import the classes
to generate docs with pydoc. Many other classes import datastore,
then this is a blocker.
This patch removes the initialization when imported,
will be done when needed.
To solve ticket #4673, we calculate the palette size using the size
of all the widgets [2]. That solves the problem on Palettes based on
_PaletteMenuWidget but on _PaletteWindowWidget produce a wrong value
when the secondary_label is not null, and as a consequence
the palette position is wrong.
The solution is do the calculation only for _PaletteMenuWidget based
palettes.
[1] https://bugs.sugarlabs.org/ticket/4673
[2] b9d6b628a9
With the introduction of 'activate' signal on [1], and the use of that
signal in Sugar Home, we introduced a bug, now, pressing the secondary button
starts the activity instead of open the palette.
This patch solves the issue checking the putton pressed before send the signal.
[1] a19cf9ed27
When is used to clone a activity from sugar,
the options parameter is set to None.
The other uses of no_fail have False as default value
but this case was missing.
The effect of this error is that a .xo is not created in the Journal,
when the user select 'Duplicate' in the View Source window.
Commit a19cf9e changed the logic for handling CanvasIcon clicks. Therefore,
the visual state indicators must be updated to fit the new logic.
Test Case: Hold the mouse down on a home view icon. Move the mouse
in and out of the icon. See that the states correspond with what
happens if you release the mouse.
The mouse detector have a variable to store the id for the timeout.
The stop() method check if the id is null but do not set the id to null
after remove the GObject timeout, then try to remove the timeout multiple times.
The efect can be seen if a user move the mouse slowly over the icons
in the Sugar home, in shell.log we see many lines like:
sugar3/graphics/palettewindow.py:443: Warning: Source ID 2464 was not found
when attempting to remove it
The industry convention for mouse driven menu options is for them
to be activated when two conditions are met:
* a button down event occurs with the pointer inside the option, and;
* a button up event occurs with the pointer inside the option.
This issue was already solved on the PaletteMenuItem,
but the EventIcon have the same problem. This change add a 'activate' event,
that control that the two conditions are meet.
The code in Sugar need use this event instead of button-release-event.
When we use set_icon_widget(), GtkToolButton set a private property
contents_invalid = TRUE [1], and gtk_tool_button_construct_content [2]
is called. Then if the label widget not exist, a GtkLabel is added.
This is a problem for us, by example in the Clipboard buttons in the frame.
By adding a empty Gtk.Box instead of a label, we avoid the label creation.
But as this is a internal implementation of Gtk, can change in the future,
in fact the issue is not visible with Gtk < 3.16
This patch is based in a pr sent by Sam Parkinson
[1] https://github.com/GNOME/gtk/blob/master/gtk/gtktoolbutton.c#L1415
[2] https://github.com/GNOME/gtk/blob/master/gtk/gtktoolbutton.c#L357
When a programmer need open one activity from other [1]
usually need display in the user interface information about the activity
to open, like the name or the icon.
This method allow get this information, previously only available on jarabe.
[1] http://wiki.sugarlabs.org/go/Features/Start_activity_from_another_activity
The palette using a Gtk.Menu, had a separator displayed using a custom widget,
but that was not well displayed (the line didn't had the palette width
due to margin on the palette) and was broken on Gtk >= 3.16
Instead of use that widget to draw the separator line between at the bottom
of _HeaderItem, as we do with the toolbar buttons when the palette is displayed.
Historically, distro packagers have been using bunblebuilder, via
"setup.py install", to populate packages directories and files.
The install procedure uses ActivityBundle.install_mime_type to install
custom mime types, by creating symlinks and updating the system mime
types database via the update-mime-database tool.
When ActivityBundle.install_mime_type is executed during packages
creation, the symlinks end-up broken in the final package and the use
of update-mime-database populates the final packages with a new copy
of the database files which could clash with the system copy.
This patch adds a new option, called --skip-install-mime to "setup.py
install" to skip the execution of ActivityBundle.install_mime_type and
avoid the issues mentioned above.
Activity packagers should use this new option. The creation of symlinks
and the execution of update-mime-database should be done in post install
packaging steps.
Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
If is not initialized, the check for the espeak plugin will fail.
This patch also check for the espeak plugin at the beginnig
avoiding check every time the function enabled() is called.
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>