When an activity is to stop, and the save-as setting is enabled, and the
journal entry has not been named, show an alert asking for a name, with
keyboard focus in the name entry with the name selected.
Return key commits the save with the name as shown.
Escape key cancels the alert and the stop.
While the alert is shown, the activity stop button(s) will be
insensitive.
As a side-effect, when an entry is resumed, switching to the journal
will show a clone entry with the same name. When the activity is
stopped, the clone entry will be removed or renamed. Forced power down
and reboot will show the clone entry.
https://wiki.sugarlabs.org/go/Features/Save-As
Signed-off-by: James Cameron <quozl@laptop.org>
Track the stop buttons for the activity, so that they can be set
insensitive or not in a later patch.
Our API allows for more than one stop button, though the use of more
than one is very rare.
- add a comment to explain the causes of keep failure,
- rename the keep failure response callback to fit convention,
- fix typo and whitespace nearby.
When an external monitor is connected or disconnected, about 25% of the
time an activity does not resize correctly; a size-changed signal occurs
but the workarea geometry has not changed.
Underlying problem is an update race in get_monitor_workarea, so the fix
is to call get_monitor_geometry for obtaining the width and height.
Can be reproduced easily without an external monitor by switching
display panel resolution repeatedly;
xrandr --output eDP1 --mode 1024x768
xrandr --output eDP1 --mode 1366x768
Part of a fix for https://bugs.sugarlabs.org/ticket/4968
- 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!
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.
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
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
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>
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 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')
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>
The wm module in sugar-toolkit-gtk3 has been reimplemented
in C and made available through introspection. The same was
hard to achieve directly using the Gdk API.
We can drop wm.py and the wrapper around gdk_property_change.
Signed-off-by: Daniel Narvaez <dwnarvaez@gmail.com>
Acked-by: Simon Schampijer <simon@laptop.org>
Must be done early, some activities set translations globally. Remove
the support for the langpackdir.
Signed-off-by: Simon Schampijer <simon@laptop.org>
We use json as included in Python. This will make Sugar dependent on
Python 2.6 and Python 2.7 to have the highest JSON performance.
Signed-off-by: Simon Schampijer <simon@laptop.org>
Previously we were using a GdkPixmap [1] created with the get_snapshot [2]
method of the Gtk.Widget. GTK 3 encourages to use cairo surfaces
now instead.
The ported mothod does create a cairo surface similar to that of the canvas'
window and draws on that. Then we create a cairo image surface with
the desired preview size and scale the canvas surface on that.
Several people have been involved in this work: Gonzalo Odiard,
Manuel Quiñones and Benjamin Berg.
[1] http://developer.gnome.org/gdk/stable/gdk-Bitmaps-and-Pixmaps.html#GdkPixmap
[2] http://developer.gnome.org/gtk/stable/GtkWidget.html#gtk-widget-get-snapshot
With the new 'Write to Journal anytime' feature it is possible
to write a description within an activity. Hopefully this leads
to more usage of the Journal for reflection by the learner. The
hinting nature ('you have not named your session yet') of the
Naming Alert has not been replaced, though.
Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Gonzalo Odiard <gonzalo@laptop.org>
Reviewed-by: Manuel Quiñones <manuq@laptop.org>
- removed deprecated imports from the activity module, use the
widgets module instead
- removed the ActivityToolbox class
- removed the Stop button from the ActivityToolbar
- removed set_toolbar/get_toolbar API from the window module
Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Gonzalo Odiard <gonzalo@laptop.org>
Acked-by: Daniel Drake <dsd@laptop.org>
Use the get_shared_activity method instead
Signed-off-by: Simon Schampijer <simon@laptop.org>
Reviewed-by: Gonzalo Odiard <gonzalo@laptop.org>
Acked-by: Daniel Drake <dsd@laptop.org>
We need set the theme in gsettings according the scale in
the SUGAR_SCLING environment variable.
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
Fix some trivial issues missed earlier: various missing imports,
some minor API changes to adapt to, do_size_request simple porting,
etc.
Signed-off-by: Daniel Drake <dsd@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
In GTK2, theme name and icon theme name properties could be set in the
GTK2 RC file, at runtime, or by the X settings daemon.
For GTK3, the RC file configuration route for these settings has been
removed. As we do not currently have a settings daemon implementation,
apply these important settings at runtime, early in the Activity
class.
Signed-off-by: Daniel Drake <dsd@laptop.org>
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>
The following data fields that were provided by PyGTK are not accessible
directly in GTK3+pygi and need to be replaced by accessor calls:
Adjustment.lower
Adjustment.page_size
Adjustment.upper
Adjustment.value
Bin.child
Widget.parent
Widget.style
Widget.window
Based on patches by Daniel Drake <dsd@laptop.org>.
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
This is only on a best-effort basis; the code will be in a broken state after
this patch and need to be fixed manually.
The purpose of committing the intermediate, non-working output is to make it
reproducible. It's impractical to manually review the changes.
The exact version used was 4f637212f13b197a95c824967a58496b9e3b877c from the
main pygobject repository [1] plus a custom patch [2] that hasn't been sent
upstream yet.
[1] git://git.gnome.org/pygobject
[2] https://sascha.silbe.org/patches/pygobject-convert-sugar-20111122.patch
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
8f1a821d68 only changed imports starting with
"import", but not those using "from ... import ...".
[replaced description]
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
The old gtk-2 based module will be present in
the 0.94 branch in the sugar-toolkit.
Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Sascha Silbe <silbe@activitycentral.com>