Ensure environment variables needed by Python activities are available
in each of the three supported scenarios;
- started from Sugar,
- started from Terminal inside Sugar,
- started by other desktop environments.
Variables always available are;
SUGAR_ACTIVITY_ROOT
SUGAR_BUNDLE_ID
SUGAR_BUNDLE_NAME
SUGAR_BUNDLE_PATH
SUGAR_BUNDLE_VERSION
Variables also available when started from Sugar are;
SUGAR_ACTIVITIES_HIDDEN
SUGAR_APISOCKET_KEY
SUGAR_APISOCKET_PORT
SUGAR_GROUP_LABELS
SUGAR_HOME
SUGAR_MIME_DEFAULTS
SUGAR_PROFILE
SUGAR_SCALING
SUGAR_VERSION
Variables also available when started from Terminal are;
SUGAR_TERMINAL_VERSION
Other changes;
- use os.makedirs in place of distutils.dir_util.mkpath,
- avoid redundant setting of SUGAR_BUNDLE_PATH,
- do not set SUGAR_BUNDLE_ID unnecessarily,
- add explanatory comment,
Tested on Ubuntu 18.04.
Signed-off-by: James Cameron <quozl@laptop.org>
Used when testing from the shell prompt using sugar-activity{,3}.
When Ctrl+C is pressed, close the activity.
May be used by other processes to request a clean activity stop, but
with save-as enabled may require user input.
* encourage "url" for either home page or user documentation,
* give examples for categorisation tags, define format,
* make "website" an alias for "url",
* make "category" and "categories" aliases for "tags".
* add the aliases to deprecated list; valid for use, but not encouraged.
Deprecates https://wiki.sugarlabs.org/go/Development_Team/Almanac/Activity_Bundles#.info_file_format
Signed-off-by: Vipul Gupta (@vipulgupta2048) <vipulgupta2048@gmail.com>
Signed-off-by: James Cameron <quozl@laptop.org>
Reviewed-by: Rahul Bothra <f2016015@pilani.bits-pilani.ac.in>
Reviewed-by: Yash Agrawal <yagrawal900@gmail.com>
When an icon file name matches a GNOME theme icon;
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/sugar3/graphics/icon.py", line 214, in _get_attach_points
cp.readfp(config_file)
File "/usr/lib/python2.7/ConfigParser.py", line 324, in readfp
self._read(fp, filename)
File "/usr/lib/python2.7/ConfigParser.py", line 512, in _read
raise MissingSectionHeaderError(fpname, lineno, line)
MissingSectionHeaderError: File contains no section headers.
Caused by reading a .png file as if it were config file, in turn
because the icon was expected by the toolkit to be .svg file type.
Regression introduced by f796638.
Fixes https://github.com/sugarlabs/activity-abacus/issues/16
- report a warning if either activity_version, icon, or license are
missing,
- fix typo in missing bundle_id exception message.
Fixes#378
Co-authored-by: Rahul Bothra <f2016015@pilani.bits-pilani.ac.in>
Explanation:
There was inconsistency between docs and the code.
- Docs said it returns -1 on timeout
- Code returned Gtk.Response.OK on timeout
Effect of this commit:
- Code returns -1 on timeout
Learners have to use tab to finish editing, followed by clicking the
activity icon to dismiss the dialog. A slow work flow and inconsistent
with journal list view. The enter key is ignored.
Add an activate signal handler to save the title. Force the focus to
move by calling hide and show.
Signed-off-by: James Cameron <quozl@laptop.org>
Some activities suffer from performance penalties once the number of
icons backed by SVGs exceeds 50.
Double the cache sizes.
Tested on OLPC XO-1, the weakest known system on which Sugar is used.
When an activity deletes the window associated with the canvas, save may
fail because Gdk.cairo_create is given an argument of None. Activity
continues to run without a window.
Reproduced with Chat activity and pressing Stop.
Avoid exception by returning None from get_preview when there is no
window.
- fix method name,
- return translated voices,
- low impact; method not yet used in any of the most frequently used
activities,
- old method name retained for compatibility just in case, but
deprecate.
Bundle versions are often described as being decimal floats e.g. 1.2,
but they also accept more than one dot, and a suffix after a dash,
e.g. 1.2.3-peru
Debian project and Ubuntu often use ~ for modified sources to comply
with distribution policy (~dfsg), or developer builds.
The dist_source target for setup.py does not work with
a version suffix like ~dfsg, requiring a manual step to rename the
file.
Adjust the regular expression to accept the ~ form.
When the datastore process begins on Fedora 26, the import of mime.py
causes a version warning to the system journal.
```
Jun 09 10:28:01 localhost-live org.laptop.sugar.DataStore[2197]: /usr/lib/python2.7/site-packages/sugar3/mime.py:29: PyGIWarning: GdkPixbuf was imported without specifying a version first. Use gi.require_version('GdkPixbuf', '2.0') before import to ensure that the right version gets loaded.
Jun 09 10:28:01 localhost-live org.laptop.sugar.DataStore[2197]: from gi.repository import GdkPixbuf
```
Accidental finding on #4989.
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.