Commit Graph

514 Commits

Author SHA1 Message Date
Sam Parkinson
64f58d3992
Don't assume all connection managers support Sugar
If the user has a "random" telepathy connection manager
installed and running on the system (eg. telepathy idle being
active if they are chatting on irc with GNOME's Polari), activities
will crash on startup.

Steps to reproduce the crash:
1. Run Polari (eg. via the Terminal activity)
2. Join an irc channel in Polari (eg. #sugar on freenode)
3. Try to open an activity from the home view
    - notice that opening any sugar3 activity will crash
2016-06-05 20:04:34 +10:00
Sebastian Silva
966c65082e Allow running GTK3 Sugar Activities in HTML5 2016-06-04 22:32:05 -05:00
Sam Parkinson
52ce5af493 Merge branch 'popup' of https://github.com/AbrahmAB/sugar-toolkit-gtk3 2016-06-05 10:25:18 +10:00
AbrahmAB
a803876fbf Added new popwindow module in sugar3.graphics 2016-06-05 01:53:16 +05:30
James Cameron
6f2550cde0 Ignore empty translated summary 2016-05-23 14:02:45 +10:00
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.
2016-05-08 21:49:46 +10:00
Sam Parkinson
ea3b673f51 Merge branch 'master' of https://github.com/icarito/sugar-toolkit-gtk3 2016-04-27 21:39:12 +10:00
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!
2016-04-21 03:10:30 -05:00
Sam Parkinson
66c01ba2c6 Merge branch 'smooth-animations-try3' of https://github.com/samdroid-apps/sugar-toolkit-gtk3 2016-04-21 07:37:06 +10:00
Sam Parkinson
bde85bc7e8 Merge branch 'activityhandle-docs2' of https://github.com/ndefilippis/sugar-toolkit-gtk3 2016-04-21 07:36:18 +10:00
Sam Parkinson
4325c056a4 Merge branch 'styledocs' of https://github.com/ndefilippis/sugar-toolkit-gtk3 2016-04-21 07:35:40 +10:00
Sam Parkinson
526c87d7c6 Merge branch 'divbyzero' of https://github.com/erilyth/sugar-toolkit-gtk3 2016-04-21 07:34:24 +10:00
Sam Parkinson
9c0f7df739 Merge branch 'gi-require-version' of https://github.com/samdroid-apps/sugar-toolkit-gtk3 2016-04-21 07:33:15 +10:00
Sam Parkinson
79a45ba8e8 Merge branch 'doc-palettemenu' of https://github.com/samdroid-apps/sugar-toolkit-gtk3 2016-04-21 07:30:56 +10:00
Sam Parkinson
ab0f5a18aa Merge branch 'doc-combobox' of https://github.com/samdroid-apps/sugar-toolkit-gtk3 2016-04-06 07:15:21 +10:00
Sam Parkinson
79e0dd44c6 Merge branch 'master' of github.com:sugarlabs/sugar-toolkit-gtk3 2016-04-05 21:32:00 +10:00
Sam Parkinson
a62ddb1d87 Merge branch 'xocolor-docs' of https://github.com/ndefilippis/sugar-toolkit-gtk3 2016-04-05 21:30:32 +10:00
leonardcj
1b9da5b1d6 Update speech.py
Improve the i18n of speech strings with wiki links
2016-03-26 17:11:07 -04:00
Sam Parkinson
57fe093886 Merge branch 'ellipsize' of https://github.com/AbrahmAB/sugar-toolkit-gtk3 2016-03-26 13:18:44 +11:00
Sam Parkinson
d3fbecf110 Merge branch 'gtk-3-20' of https://github.com/samdroid-apps/sugar-toolkit-gtk3 2016-03-03 20:00:18 +11:00
AbrahmAB
cd449e7149 Ellipsis in title and msg of alert 2016-02-27 06:06:26 +05:30
Sam Parkinson
824e6dcb69 Set css class on toolitems when a palette or toolbar popsdown 2016-02-19 07:18:45 +11:00
James Cameron
8d4298ee9e Remove Rainbow, avoid race in creating directories
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.
2016-02-15 11:41:31 +11:00
Sam Parkinson
0a50431b98 Handle git submodules in bundlebuilder
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
2016-01-05 21:05:11 +11:00
Martin Abente Lahaye
0494f704fb collaboration: handle tubes channel failure gracefully
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>
2016-01-04 18:08:32 -03:00
radicalonion
79d11c3a28 Write docs for sugar3.graphics.xocolor 2016-01-03 20:16:43 -05:00
Sam Parkinson
c374b63990 Merge branch 'scrolldetector-docs' of https://github.com/ndefilippis/sugar-toolkit-gtk3 2016-01-03 16:47:12 +11:00
Sam Parkinson
37d3b63a90 Merge branch 'notebook-docs' of https://github.com/ndefilippis/sugar-toolkit-gtk3 2016-01-03 16:45:10 +11:00
radicalonion
28053c83b1 Improve docs for sugar3.activity.activityhandle 2016-01-02 23:48:17 -05:00
radicalonion
8b947ed02f Write docs for sugar3.graphics.scrollingdetector 2016-01-02 23:42:55 -05:00
radicalonion
486988035a Write docs for sugar3.graphics.notebook 2016-01-02 23:35:44 -05:00
Sam Parkinson
8d66786a31 Merge branch 'radiotoolbutton-docs' of https://github.com/ndefilippis/sugar-toolkit-gtk3 2016-01-03 15:12:26 +11:00
radicalonion
db89aca86a Write docs for sugar3.graphics.radiotoolbutton 2016-01-02 23:08:17 -05:00
Sam Parkinson
8d0cc98e43 Set css name for widgets
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.
2016-01-01 12:28:42 +11:00
radicalonion
ec2dca92f1 Write docs for sugar3.graphics.toolbox 2015-12-31 09:19:05 -05:00
radicalonion
031af31029 Write docs for sugar3.graphics.style 2015-12-27 20:10:54 -05:00
mandarj7
51057baef5 Add usage example to sugar3.graphics.objectchooser 2015-12-23 16:59:26 +05:30
mandarj7
c95d74eab4 Improve docstrings in sugar3.graphics.objectchooser 2015-12-23 16:55:25 +05:30
mandarj7
264ee2b5a3 Add and improve docs for sugar3.graphics.objectchooser 2015-12-23 15:31:58 +05:30
erilyth
3ceb14f884 et value of "ph" to 0 if division by zero takes place 2015-12-22 15:12:15 +05:30
James Cameron
7ba120fe25 Fix persistent tree view palettes
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.
2015-12-22 09:49:16 +11:00
Sam Parkinson
b1386665b1 Merge branch 'master' of https://github.com/mjuvekar7/sugar-toolkit-gtk3 2015-12-20 17:21:01 +11:00
James Cameron
ae80df7725 Fix remaining icon_size references
icon_size was changed to pixel_size, yet references remained, causing
extra log data.

Additional change missed from already merged 70bc4db.
2015-12-16 10:22:21 +11:00
Sam Parkinson
739dacbd01 Position palette based on event coords, fixes #4897
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.
2015-12-15 12:51:42 -03:00
James Cameron
70bc4dbe6a Fix remaining icon_size references
icon_size was changed to pixel_size, yet references remained, causing
extra log data.
2015-12-15 16:44:04 +11:00
mandarj7
c75655a134 Add documentation for sugar3.graphics.window module 2015-12-12 17:00:08 +05:30
James Cameron
a11639eb86 demote warning to debug for sugar_accel_group 2015-12-08 15:11:17 +11:00
James Cameron
280c74cd9e allow start on full disk
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/4cde481
	https://bugs.sugarlabs.org/ticket/1720
	http://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/0e45f9d
	https://github.com/sugarlabs/sugar/commit/19db9c5

Reported-by: Nathan Riddle <nathanr333@charter.net>
Tested-by: James Cameron <quozl@laptop.org>
2015-11-23 17:26:29 +11:00
Sam Parkinson
a334888eb9 Write documentation for sugar3.graphics.combobox 2015-11-15 07:03:59 +11:00
Sam Parkinson
aea65408f0 Specify library version prior to import, fixes #4900
Gi has been emitting warnings into the log to do this for some
time now. Not doing this has also caused bugs, such as #4900.
2015-10-31 14:44:46 +11:00
James Cameron
0e724a78eb move guts of TimeoutAlert and NotifyAlert to a private class
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.
2015-10-16 14:06:51 +11:00
Sam Parkinson
d2e1793108 Merge branch '12813-e' of https://github.com/quozl/sugar-toolkit-gtk3 2015-10-15 21:35:13 +11:00
James Cameron
cfeabdc3af remove GSource used by TimeoutAlert
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.
2015-10-15 11:17:41 +11:00
James Cameron
9de70acfff fix alerts documentation
- s/Set/Get for a get property method,

- fix two typos.
2015-10-15 11:12:02 +11:00
Ignacio Rodríguez
e16f8ec61b Merge pull request #255 from samdroid-apps/gtype-name-toolbarbox
Add gtype name to ToolbarBox for gtk css styling
2015-10-10 02:25:49 -03:00
Sam Parkinson
381ec5fbdb Add a widget parameter to the Animator (tick based animations)
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
2015-10-06 10:08:59 +11:00
Gonzalo Odiard
1bd8349b84 Deprecate create_jobject parameter on activity.py - Fixes #3450
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.
2015-10-05 00:41:21 -03:00
Sam Parkinson
61882e3df2 Add docs for sugar3.graphics.palettemenu 2015-09-15 20:48:48 +10:00
Sam Parkinson
f91da7b0f6 Add gtype name to ToolbarBox for gtk css styling 2015-09-09 18:18:15 +10:00
Gonzalo Odiard
7c804354a0 Improve documentation on activity module 2015-08-25 16:25:55 -03:00
Sam Parkinson
0bed21ccc8 Change graphics.alert docs to work well with Sphinx 2015-08-11 08:06:08 -03:00
Sam Parkinson
b9f19521fe Write docs for graphics.animator 2015-08-11 08:05:44 -03:00
Gonzalo Odiard
84ad1b84cc Init the datastore on demand
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.
2015-08-10 22:39:43 -03:00
Gonzalo Odiard
9314fd89fa Do not calculate palette height on PaletteWindowWidget - Fixes #4792
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
2015-08-07 12:58:07 -03:00
Sam Parkinson
e990ec7703 Merge branch 'activate_on_left_click_only' of https://github.com/godiard/sugar-toolkit-gtk3 2015-08-07 20:58:53 +10:00
Gonzalo Odiard
88213f6408 EventIcon: only trigger 'activate' signal on principal button click
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
2015-08-06 16:59:13 -03:00
Gonzalo Odiard
100a6b56b6 Check if parameter 'options' is None in cmd_dist_xo
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.
2015-08-05 17:13:17 -03:00
Sam Parkinson
16107a3985 Show proper state indication for CanvasIcons
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.
2015-08-04 11:58:06 -03:00
Sam Parkinson
ecc2f491b6 Merge branch 'fix_mousedetector_stop' of https://github.com/godiard/sugar-toolkit-gtk3 2015-07-26 09:32:02 +10:00
Gonzalo Odiard
fd15e76dab MouseDetector timeout_id need reset
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
2015-07-24 15:07:09 -03:00
Gonzalo Odiard
a8e75af790 Check release mouse postion in CursorInvoker
This affect when a palette will be opened, by example in the BuddyIcon
in the Sugar home.
2015-07-24 12:00:02 -03:00
Gonzalo Odiard
a19cf9ed27 Do not trigger events on EventIcons when button release is outside - #4863
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.
2015-07-24 11:40:49 -03:00
Sam Parkinson
9fc5b49329 Only activate menu items if the mouse releases in them - fixes #4863
Ticket URL <http://bugs.sugarlabs.org/ticket/4863>
2015-07-24 21:32:05 +10:00
Gonzalo Odiard
7a3d23e2b6 Don't add a label on RadioToolButton when set icon_widget - Fixes #4875
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
2015-07-08 14:25:47 -03:00
Gonzalo Odiard
04d8f596bc Add get_bundle method to activity.py
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
2015-07-03 15:03:27 -03:00
Gonzalo Odiard
a873cfc04e Remove _HeaderSeparator
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.
2015-06-30 16:27:12 -04:00
Gonzalo Odiard
8af97e3e17 Replace use of deprecated icon_size by pixel_size
It's a trivial change, but the warning message was filling the logs.
2015-06-30 09:53:52 -04:00
Sam Parkinson
78dcd5a7e4 Fix GtkMenu palette positioning in Gtk 3.16 2015-06-29 13:53:19 -03:00
Gonzalo Odiard
9087eab839 Properly fix wrap mode on secondary text for toolbars
This patch solves a bug introduced on:
034706a482

Pep8 fix by Martin Abente Lahaye (reviewer).

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
2015-06-23 12:04:45 -04:00
Gonzalo Odiard
034706a482 Secondary text on palettes should respect the max width - Fixes #4862
When a activity have a title very long without spaces,
the text can't be wraped with the default wrap mode (WORD)
Use WRAP_CHAR to solve this issue.
2015-06-19 08:41:34 -03:00
Martin Abente Lahaye
e8553c13a1 Add skip-install-mime option to bundlebuilder
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>
2015-05-28 16:30:04 -04:00
Gonzalo Odiard
fc4d629b50 TTS in the toolkit need initialize gstreamer - Fixes #4851
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.
2015-05-26 12:05:09 -04:00
James Cameron
4c22ba5b35 Add escape key to palette windows
Popdown a palette window in response to escape key.
2015-05-25 12:41:24 +10:00
Gonzalo Odiard
8224fefc50 Pep8 and pyflakes fixes 2015-05-16 19:13:34 +10:00
Gonzalo Odiard
2186c53aeb Palettes based in GtkMenu do not have present() method
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()
2015-05-16 19:13:34 +10:00
Gonzalo Odiard
5818721818 Merge branch 'treeview_perf2-try2' of https://github.com/godiard/sugar-toolkit-gtk3 into godiard-treeview_perf2-try2 2015-05-15 18:12:58 -03:00
Gonzalo Odiard
bbdebce0d4 Simplify routine used to get the list of files from git
This change remove duplicated code
2015-05-15 20:37:21 +10:00
Gonzalo Odiard
34b0e17e95 Add screenshots to ignored dirs in bundlebuilder
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.
2015-05-15 20:37:21 +10:00
Gonzalo Odiard
7a9510a187 Remove CellRendererInvoker
This invoker is not used anymore, now is replaced by TreeViewInvoker.
2015-05-14 19:05:34 -03:00
Gonzalo Odiard
49365e132c New invoker, TreeViewInvoker
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
2015-05-14 12:04:07 -03:00
Gonzalo Odiard
5626a6c182 Detect scrolling in treviews and optimize drawing
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>
2015-05-14 12:04:07 -03:00
Gonzalo Odiard
862176de38 Merge branch 'cell_renderer_icon_optimizations' of https://github.com/godiard/sugar-toolkit-gtk3 into godiard-cell_renderer_icon_optimizations 2015-05-14 11:52:27 -03:00
James Cameron
f1fc9886cc power: avoid filesystem access if powerd absent
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.
2015-05-14 20:24:32 +10:00
James Cameron
2ddd64bace power: suppress failure to remove file
It does not matter if the file cannot be removed, so do not report it.
2015-05-14 20:24:32 +10:00
James Cameron
561271bad1 power: set path to file once 2015-05-14 20:24:32 +10:00
Gonzalo Odiard
d9e6fa6813 CellRendererIcon: cache offsets
Instead of calculating them on each render.  The cache is removed when
the size is changed.

Signed-off-by: Manuel Quiñones <manuel.por.aca@gmail.com>
2015-05-13 19:24:17 -03:00
Gonzalo Odiard
f08757d75f CellRendererIcon: remove unused frame
The white frame is not visible over the white background.

Signed-off-by: Manuel Quiñones <manuel.por.aca@gmail.com>
2015-05-13 19:24:11 -03:00
Gonzalo Odiard
3a6427cdc6 CellRendererIcon: improve calculation in do_render
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>
2015-05-13 19:24:01 -03:00
Sam Parkinson
a56282991f Add ability to launch a bundle
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
2015-05-12 16:11:49 -03:00
Gonzalo Odiard
026146a081 Pep8 fixes 2015-04-17 08:05:58 +10:00