278 Commits (master)

Author SHA1 Message Date
Srevin Saju 6fc675e848 Fix icon size in ColorButton
ColorButton did not show button icon, and swatches were too small
making it almost unusable. Color chooser toolbar had been using
Gtk.IconSize.LARGE_TOOLBAR which return 0 as size.
style.GRID_CELL_SIZE was used as size reference
4 years ago
James Cameron c911c6cb30 Port to Python 3 - preview metadata is bytes
Preview metadata in 0.114 and earlier was returned by datastore client
as a dbus.ByteArray.

Regression introduced by aa8a5e7 ("Port from Python 2 to six").

Traceback (most recent call last):
  File "/usr/lib/python3.7/dist-packages/jarabe/journal/expandedentry.py", line 378, in _create_preview
    pixbuf = get_preview_pixbuf(metadata.get('preview', ''))
  File "/usr/lib/python3.7/dist-packages/sugar3/graphics/objectchooser.py", line 85, in get_preview_pixbuf
    preview_data = base64.b64decode(preview_data)
  File "/usr/lib/python3.7/base64.py", line 87, in b64decode
    return binascii.a2b_base64(s)
binascii.Error: Invalid base64-encoded string: number of data characters (237) cannot be 1 more than a multiple of 4

Related to
https://github.com/sugarlabs/sugar-datastore/issues/16
5 years ago
Ibiam Chihurumnaya fc81121f19 Dash in signal names
GLib accepts signal names with dash or underscore and
documents the signals with a dash.

Use of signal names in Sugar was mixed, change to using
dash only.

No functional change.
5 years ago
Aniket21mathur 3b28597486 flake8 fixes 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 85fc4680e9 Fedora 18 backport - GObject.ParamFlags does not have READWRITE 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 58224cb15d Fix traceback when an icon name matches a GNOME theme icon
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
6 years ago
Pro-Panda 5407ae4cdb Remove unused imports 6 years ago
Pro-Panda af31aa8059 Fix: TimeoutAlert response on Timeout
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
6 years ago
James Cameron aaea86066d Icon - increase LRU cache sizes
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.
6 years ago
James Cameron 04a1ff181f Fix Python GI API version warning in Wikipedia
The Wikipedia activity imports from sugar3.graphics.icon without any
other use of GTK+, causing a version warning.
7 years ago
James Cameron dd512c9c29 Fix common typo, occured should be occurred 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 ae62708a7f Documentation - small typos 7 years ago
James Cameron 83697d21f9 Save As - add an optional Gtk.Entry to Alert
An Alert may have a Gtk.Entry, which is placed between the title and the
buttons.  It is for when text is to be input during the alert.
7 years ago
Sam Parkinson f17e1a66b4 Write docs for constants in sugar3.graphics.style
The constants must be documented, because otherwise they are hidden
from the generated online documentation.

[changes arising from review comments and flake8 compliance]
Signed-off-by: James Cameron <quozl@laptop.org>
7 years ago
Hrishi f4fc8c0d1f
Write documentation for sugar3.graphics.ColorToolButton
- add one example,

- part of feature Sugar3 Docs,
  https://wiki.sugarlabs.org/go/Features/Sugar3_Docs

Added documentation and example for Colorbutton
7 years ago
Hrishi 4f7ab56c3e Write documentation for sugar3.graphics.ProgressIcon
- add one example,

- part of feature Sugar3 Docs,
  https://wiki.sugarlabs.org/go/Features/Sugar3_Docs
7 years ago
James Cameron a71a011496 Fix documentation typo, SPCAING 7 years ago
Hrishi c7d1c7acfb Write documentation for sugar3.graphics.ToggleToolButton
- add one example,

- part of feature Sugar3 Docs,
  https://wiki.sugarlabs.org/go/Features/Sugar3_Docs

Signed-off-by: James Cameron <quozl@laptop.org>
7 years ago
James Cameron c92d0009df Write documentation for sugar3.graphics.ToolButton
- add two examples,

- document critical properties as keyword arguments in the class init,

- ensure documentation is consistent between RadioToolButton and
  ToolButton, (as some of the text is similar),

- part of feature Sugar3 Docs,
  https://wiki.sugarlabs.org/go/Features/Sugar3_Docs

- follow How To Guide
  https://wiki.sugarlabs.org/go/Features/Sugar3_Docs/How_To_Write

Derived from work by

- Hrishi <hrishipatel99@gmail.com> (31176ea) and

- radicalonion <ndefilippis98@gmail.com> (db89aca).
8 years ago
James Cameron ee93ad3bef Further gi.require_version calls
Activity logs have continued to report GObject Introspection version
warnings.
8 years ago
Sam Parkinson 2330ef8ebc
Proper deprecation of Palette.popdown state argument
The popdown state argument was removed in 90cec5b, as the palette
popdowns were unified.  However, this is a public api.  Removing
the argument caused exceptions to be raised, breaking applications.
Most uses of the state argument were for the SECONDARY state, which
is now the default behaviour.

This commit re-adds the argument with a deprecation notice.
8 years ago
Sam Parkinson 92ea35d724
Fix typos in sugar3.graphics.animator docs 8 years ago
Sam Parkinson d37da7ee88
Add do_stop method for animations
This adds a explicit method for cleaning up the animation.  Previously,
animations expected the next_frame to be called where frame=end.

That guarantee was never provided by the api.  This resulted in
animations sometimes being in odd states.  For example, Browse activity
had an animation that overrode the Gtk "draw" signal.  If the signal
was not unbound, the animated object was mistakenly rendered after
the completion of the animation, obstructing the user's view.

This api is explicit and allows cleaner code in the animation
implementation.  The clean up code goes in do_stop rather than in a
conditional of next_frame.
8 years ago
Sam Parkinson 2522e0b21f
Version the GdkX11 import, fixes #4965
The unversioned import results in the following log noise:

    /usr/lib/python2.7/site-packages/sugar3/graphics/window.py:26: PyGIWarning: GdkX11 was imported without specifying a version first. Use gi.require_version('GdkX11', '3.0') before import to ensure that the right version gets loaded.
      from gi.repository import GdkX11
8 years ago
Sam Parkinson e0c38a8b8a
Merge branch 'no-2nd-popdown' of https://github.com/samdroid-apps/sugar-toolkit-gtk3 8 years ago
Sam Parkinson d60989cd92
Merge branch '2016-190-enter-notify' of https://github.com/quozl/sugar-toolkit-gtk3 8 years ago
Sam Parkinson 4009e2a476
Merge branch 'long-press-eventicons' of https://github.com/samdroid-apps/sugar-toolkit-gtk3 8 years ago
James Cameron 433d06b025 avoid uncommanded palettes
Problem #1, buddy menu appears on Sugar startup on physical hardware, or
when mouse is centre of display.

Problem #2, Terminal toolbar steals keyboard focus, when mouse is left
in home view search box at activity start time.

Regressions were introduced in the port from Gtk2 to Gtk3.

Cause is enter-notify-events that arrive because cursor is already
present in widgets as they are realised and mapped.

Fix is to capture cursor position when the widget is being created, and
ignore enter-notify-event if the same position is seen.
8 years ago
James Cameron 65fa711e53 refactor pointer position get
Move common code into a function, and cache Gdk.Device client pointer.
8 years ago
James Cameron 552c7da884 remove surplus message
The log message "PaletteWindowWidget popup get_visible True" is not
useful, and is removed.  It can be made to occur in Terminal by repeated
right-click on any of the first three toolbar button.
8 years ago
Sam Parkinson 90cec5be2e
Unify palette popdowns
Previously there was the concept of having 2 popdowns for a palette.
The first popdown showed the of tooltip the palette, and the 2nd
showed the content of the palette.  However, this was confusing
to new users, and made users wait for little reason.

This commit removes the 2nd popdown.  An example of this is when you
mouse over an icon to invoke the palette.  Previously, it showed
the tooltip, then made you wait, then showed the content of the
palette.  With this patch, the whole palette is shown at the
first popdown, making a snappy UX.
8 years ago
Sam Parkinson 74d3a4d0c8
Revert "Don't activate EventIcons after touch long press"
This commit was never reviewed or intended for the master branch.

This reverts commit ed5e50239b.
8 years ago
Sam Parkinson 4a9b35a38a
Merge branch 'icon-docs' of https://github.com/samdroid-apps/sugar-toolkit-gtk3 8 years ago
Sam Parkinson f4ec9346d2
Merge branch 'fix-4960-palette-damange' of https://github.com/samdroid-apps/sugar-toolkit-gtk3 8 years ago
Sam Parkinson 2971749b83
Fix CursorInvoker wrongly positioning EventIcon palettes
Steps to reproduce:
1.  Long press on home view favorite icon (an event icon)
Expected:  Palette invoker where finger is
Actuall:   Palette invokes in top left corner

This is because the long press controller emits coords relative
to the widget's window, and EventIcons sometimes have their own
windows.  We can't change the long press controller, as it is a
public api.  But we fix this by translating the coords to the
root window coords in the CursorInvoker.  Using root coords is
consistent with the right click handleing in the cursor invoker.
8 years ago
Sam Parkinson 0f4309a324
Don't activate EventIcons after touch long press
Steps to reproduce:

1.  Long press activity icon on homeview
Expcected:  Palette invokes, icon not activated
Actual:     Palette invokes, icon also activated, activity launched

This was because the "activate" signal was emitted before the
palette invoker got it's signal, meaning the palette invoker couldn't
scilence the event.
8 years ago
Sam Parkinson ed5e50239b
Don't activate EventIcons after touch long press
Steps to reproduce:

1.  Long press activity icon on homeview
Expcected:  Palette invokes, icon not activated
Actual:     Palette invokes, icon also activated, activity launched

This was because the "activate" signal was emitted before the
palette invoker got it's signal, meaning the palette invoker couldn't
scilence the event.
8 years ago
Sam Parkinson 3f4a5e904d
First pass sugar3.graphics.icon docs 8 years ago
Sam Parkinson 52ce5af493 Merge branch 'popup' of https://github.com/AbrahmAB/sugar-toolkit-gtk3 8 years ago
AbrahmAB a803876fbf Added new popwindow module in sugar3.graphics 8 years ago
Sam Parkinson ed5e9d072b
Fix palette damage for tool buttons, fixes #4960
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.
8 years ago
Sam Parkinson ea3b673f51 Merge branch 'master' of https://github.com/icarito/sugar-toolkit-gtk3 8 years ago
Sebastian Silva 2f2b2d20d8 Allow to run activities without Sugar shell.
- 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!
8 years ago
Sam Parkinson 66c01ba2c6 Merge branch 'smooth-animations-try3' of https://github.com/samdroid-apps/sugar-toolkit-gtk3 8 years ago
Sam Parkinson 4325c056a4 Merge branch 'styledocs' of https://github.com/ndefilippis/sugar-toolkit-gtk3 8 years ago
Sam Parkinson 526c87d7c6 Merge branch 'divbyzero' of https://github.com/erilyth/sugar-toolkit-gtk3 8 years ago