170 Commits (master)

Author SHA1 Message Date
Ibiam Chihurumnaya 8c976bd56a xml.etree.CElementTree deprecated
Any activity fails to build with Python 3.9;

Traceback (most recent call last):
  File "setup.py", line 19, in <module>
    from sugar3.activity import bundlebuilder
  File "sugar3/activity/bundlebuilder.py", line 44, in <module>
    import xml.etree.cElementTree as ET
ModuleNotFoundError: No module named 'xml.etree.cElementTree'

See https://docs.python.org/3.9/whatsnew/3.9.html#removed
"The xml.etree.cElementTree module has been removed."

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1817644

Signed-off-by: Ibiam Chihurumnaya <ibiamchihurumnaya@gmail.com>
Signed-off-by: James Cameron <quozl@laptop.org>
4 years ago
Ryan Van 72d36cc964 Add RedoButton accelerator
- use ctrl+y to be consistent with Write Activity,

- a design discussion gave no responses,
  http://lists.sugarlabs.org/archive/sugar-devel/2020-March/057832.html

Signed-off-by: James Cameron <quozl@laptop.org>
4 years ago
Ibiam Chihurumnaya ecf335c19c Add --from-code parameter to xgettext for a python3 activity
Signed-off-by: Ibiam Chihurumnaya <ibiamchihurumnaya@gmail.com>
4 years ago
Srevin Saju 139370d888 Correct SyntaxWarning - Python3.8 4 years ago
James Cameron 88adb38a42 Fix RuntimeError: could not create signal for _closing
On Ubuntu 20.04 with GTK 3.24.13, importing sugar3.activity.activity
fails with RuntimeError: could not create signal for _closing, preceeded
by an assertion is_valid_signal_name failed.

Cause is upstream 89f955d ("gsignal: Canonicalise signal names at
installation time ") which requires application signal names to not
start with a hyphen or underscore.

Remove the prefix from our signal name.  The signal remains reserved and
private to the Activity class.
4 years ago
James Cameron 90c2539135 Fix unnecessary whitespace in warning
Regression introduced by 3b28597 ("flake8 fixes").

Fixes https://github.com/sugarlabs/sugar-toolkit-gtk3/issues/424
5 years ago
James Cameron 381c9b1b61 Fix install TypeError
Activity install target used by downstream activity packaging did fail
with;

Traceback (most recent call last):
  File "setup.py", line 21, in <module>
    bundlebuilder.start()
  File "/usr/lib/python3.7/dist-packages/sugar3/activity/bundlebuilder.py", line 633, in start
    globals()['cmd_' + options.command](config, options)
  File "/usr/lib/python3.7/dist-packages/sugar3/activity/bundlebuilder.py", line 513, in cmd_install
    options.install_desktop_file)
  File "/usr/lib/python3.7/dist-packages/sugar3/activity/bundlebuilder.py", line 290, in install
    for f in self.get_files_in_git():
  File "/usr/lib/python3.7/dist-packages/sugar3/activity/bundlebuilder.py", line 209, in get_files_in_git
    stdout.strip('\n').split('\n')]
TypeError: a bytes-like object is required, not 'str'

Workaround was to hide .git directory.

Cause was subprocess pipe returning a bytes-like object in Python 3.

Regression introduced by incomplete ed46c21 ("Port to six").

Fixes https://github.com/sugarlabs/sugar-toolkit-gtk3/issues/426
5 years ago
James Cameron 7b85b807b2 Fix AppStream metadata warning
* wrong pydoc module reference,

* was too verbose.
5 years ago
James Cameron 6e517aa3c7 Clean activity logs successful completion
Status zero is normal, so don't report it.

Also don't print the log_file object.

Changes log messages such as this;

Exited with status 0, pid 3765 data (<_io.TextIOWrapper name=13 mode='w'
encoding='UTF-8'>, '5312a7726254b3b0b9a15267c54600aec9db187e')

To this;

Normal successful completion, pid 3765 activity_id 5312a7726254b3b0b9a15267c54600aec9db187e
5 years ago
James Cameron ec753badbc Fix whitespace in AppStream metadata warning
Encountered on Hello World activity.
5 years ago
James Cameron a62bb885fc Port to Python 3 - use rb for message catalog file
Reported and patch proposed by Bas Hulsken.

Fixes https://github.com/sugarlabs/sugar-toolkit-gtk3/issues/425

Signed-off-by: James Cameron <quozl@laptop.org>
5 years ago
Aniket21mathur e4725ad196 Fix utf encoding error via six 5 years ago
Aniket21mathur ed46c219a9 Port to six 5 years ago
Aniket21mathur 3b28597486 flake8 fixes 5 years ago
James Cameron f5c86da271 flake8 fixes (several remain to be fixed) 5 years ago
Aniket Mathur 88ea8e1f4f Port to TelepathyGLib
Co-authored-by: tonadev <tonadevv@gmail.com> [initial port]
Co-authored-by: Aniket21mathur <aniketmathur320@gmail.com> [further work]
Co-authored-by: James Cameron <quozl@laptop.org> [minimising changes]
5 years ago
James Cameron 12a899f374 Defer Gtk.Window.iconify
Defer iconify call to after the activity has been shown.  Remember the
iconify call was requested, and make the call just prior to entering the
main loop.

On Ubuntu 18.04 with Metacity 3.32.0 the Journal does appear over the
Home View on Sugar start on a VM with two virtual CPUs, yet the previous
fix in Metacity (074af8f) is present.  This is suggestive of a race
condition.

Tests with a minimal GTK reproducer shows order of three specific calls
is critical to success of iconify.  The ordering and results are;

* iconify, maximize, show; not iconified,

* maximize, iconify, show; not iconified,

* iconify, show, maximize; not iconified,

* maximize, show, iconify; app with focus will flicker, iconified,

* show, maximize, iconify; app with focus may flicker, iconified,

* show, iconify, maximize; app with focus may flicker, iconified,

Sugar Toolkit combined with Journal uses the "maximize, iconify, show"
ordering.  Using a Hello World activity with a call to iconify, the new
activity is not iconified.

When changed to "mazimise, show, iconify" ordering, there is no flicker
of the app in focus, and the new activity is iconified.
5 years ago
James Cameron 2453d13b03 Clean up activity environment variables
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>
5 years ago
Pro-Panda aa8a5e70c4 Port from Python 2 to six
Signed-off-by: James Cameron <quozl@laptop.org>
5 years ago
James Cameron 6345da8e07 docs - move get_activity_root description
When it was moved from the class to the module, the full description did
not move with it.
5 years ago
James Cameron 87fcfb62e4 Fedora 18 backport - GLib does not have unix_signal_add 5 years ago
James Cameron 84a7286986 Review: Port from GObject to GLib
Fix new flake8 issues introduced by cb0d6e2.
6 years ago
Rahul Bothra 13a2282e5e Port from GObject to GLib 6 years ago
James Cameron 6730d129cd Handle SIGINT from Ctrl+C in shell
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.
6 years ago
Pro-Panda 5407ae4cdb Remove unused imports 6 years ago
Pro-Panda 8f047b5819 Remove redundant code in get_activity_root
- same condition is being checked in the module function get_activity_root
6 years ago
Pro-Panda a07bef8be5 Change signal name on enter keypress in title entry
- 'enter-key-press' is more intuitive for the reader than 'entered'
6 years ago
Pro-Panda 1bc171d5d6 enter key after editing title will closes the activity toolbar(if present)
- No change for activities having titleEntry without the toolbar (Eg: chat)

Tested on:
Ubuntu 16.04, Sugar 0.112, GTK 3.18.9
6 years ago
James Cameron 5876bc4a00 TitleEntry - clear selection
When editing stops, clear the selection.
6 years ago
James Cameron 1cf9ba8190 TitleEntry - rename callbacks, use arguments 6 years ago
Pro-Panda f3dd2c2042 TitleEntry - save title on activate (Enter)
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>
6 years ago
James Cameron a77ae5fb57 Activity.get_preview fails for no window in canvas
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.
6 years ago
James Cameron e2ea171cfb Sort list of po files 7 years ago
James Cameron 1875a30075 Fix Python GI API warnings for web activities 7 years ago
James Cameron 5750773dda Documentation - rewrite activity section
- rewrite of activity section, bundle section, graphics.alert, and
  graphics.window.
7 years ago
James Cameron 4652b7ca2a Bundlebuilder - update documentation 7 years ago
James Cameron 72a34528f2 Bundlebuilder - accept repository for AppStream metadata
AppStream metadata generator was looking for key repository_url, but
Wiki and common usage has adopted repository.
7 years ago
James Cameron ae62708a7f Documentation - small typos 7 years ago
Utkarsh Tiwari ba6993d705 Save As - show a save-as alert on stop
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>
7 years ago
James Cameron 3a574ae778 Save As - add busy cursor methods
Add methods for use by activity for showing and removing a busy cursor.
7 years ago
James Cameron 6bcd664289 Save As - track stop buttons in Activity instance
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.
7 years ago
James Cameron b1d1129759 Save As - document keep failure
- add a comment to explain the causes of keep failure,

- rename the keep failure response callback to fit convention,

- fix typo and whitespace nearby.
7 years ago
James Cameron 7d5abe2684 Predictable POT file ordering
Every time an activity maintainer uses the `python setup.py genpot`
command the resulting po/Activity.pot file has changes caused by random
ordering of filesystem inodes.

This makes the output unpredictable.

Sort the list of source files.
7 years ago
James Cameron 2c3d1d0707 Specify library version prior to import
- web activities caused two warnings every time they were started,

- warnings cost disk write wait time.
7 years ago
György Balló 281e56c442 Allow to disable installing .desktop files 7 years ago
James Cameron a6e62a52b6
Fix screen resize race
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
7 years ago
Eduard Sanou 05a18a2dc6
[PATCH] Sort translation files
Sort translation files when generating the .desktop file to output
reproducible results.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=848633

Reviewed-by: James Cameron <quozl@laptop.org>
7 years ago
James Cameron ee93ad3bef Further gi.require_version calls
Activity logs have continued to report GObject Introspection version
warnings.
8 years ago
Sebastian Silva 4f3f32fd5a Assign icon to window regardless of environment.
Makes Sugar Activities more standard.
8 years ago
Sam Parkinson 2f9ae6ef51
Bundlebuilder: relabel repository url as bugtracker
Many activities already have the repository url pointing to their GitHub
page - which also serves as a bug tracker for many of the projects.  The
repository url is not part of the spec, but the bug tracker url is.
8 years ago