1169 Commits (master)

Author SHA1 Message Date
AbrahmAB cd449e7149 Ellipsis in title and msg of alert 8 years ago
Sam Parkinson 824e6dcb69 Set css class on toolitems when a palette or toolbar popsdown 8 years ago
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.
8 years ago
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
8 years ago
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>
8 years ago
radicalonion 79d11c3a28 Write docs for sugar3.graphics.xocolor 8 years ago
Sam Parkinson c374b63990 Merge branch 'scrolldetector-docs' of https://github.com/ndefilippis/sugar-toolkit-gtk3 8 years ago
Sam Parkinson 37d3b63a90 Merge branch 'notebook-docs' of https://github.com/ndefilippis/sugar-toolkit-gtk3 8 years ago
radicalonion 28053c83b1 Improve docs for sugar3.activity.activityhandle 8 years ago
radicalonion 8b947ed02f Write docs for sugar3.graphics.scrollingdetector 8 years ago
radicalonion 486988035a Write docs for sugar3.graphics.notebook 8 years ago
Sam Parkinson 8d66786a31 Merge branch 'radiotoolbutton-docs' of https://github.com/ndefilippis/sugar-toolkit-gtk3 8 years ago
radicalonion db89aca86a Write docs for sugar3.graphics.radiotoolbutton 8 years ago
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.
8 years ago
radicalonion ec2dca92f1 Write docs for sugar3.graphics.toolbox 8 years ago
radicalonion 031af31029 Write docs for sugar3.graphics.style 8 years ago
mandarj7 51057baef5 Add usage example to sugar3.graphics.objectchooser 8 years ago
mandarj7 c95d74eab4 Improve docstrings in sugar3.graphics.objectchooser 8 years ago
mandarj7 264ee2b5a3 Add and improve docs for sugar3.graphics.objectchooser 8 years ago
erilyth 3ceb14f884 et value of "ph" to 0 if division by zero takes place 8 years ago
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.
8 years ago
Sam Parkinson b1386665b1 Merge branch 'master' of https://github.com/mjuvekar7/sugar-toolkit-gtk3 8 years ago
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.
8 years ago
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.
8 years ago
James Cameron 70bc4dbe6a Fix remaining icon_size references
icon_size was changed to pixel_size, yet references remained, causing
extra log data.
8 years ago
mandarj7 c75655a134 Add documentation for sugar3.graphics.window module 8 years ago
James Cameron a11639eb86 demote warning to debug for sugar_accel_group 9 years ago
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>
9 years ago
Sam Parkinson a334888eb9 Write documentation for sugar3.graphics.combobox 9 years ago
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.
9 years ago
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.
9 years ago
Sam Parkinson d2e1793108 Merge branch '12813-e' of https://github.com/quozl/sugar-toolkit-gtk3 9 years ago
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.
9 years ago
James Cameron 9de70acfff fix alerts documentation
- s/Set/Get for a get property method,

- fix two typos.
9 years ago
Ignacio Rodríguez e16f8ec61b Merge pull request #255 from samdroid-apps/gtype-name-toolbarbox
Add gtype name to ToolbarBox for gtk css styling
9 years ago
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
9 years ago
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.
9 years ago
Sam Parkinson 61882e3df2 Add docs for sugar3.graphics.palettemenu 9 years ago
Sam Parkinson f91da7b0f6 Add gtype name to ToolbarBox for gtk css styling 9 years ago
Gonzalo Odiard 7c804354a0 Improve documentation on activity module 9 years ago
Sam Parkinson 0bed21ccc8 Change graphics.alert docs to work well with Sphinx 9 years ago
Sam Parkinson b9f19521fe Write docs for graphics.animator 9 years ago
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.
9 years ago
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
9 years ago
Sam Parkinson e990ec7703 Merge branch 'activate_on_left_click_only' of https://github.com/godiard/sugar-toolkit-gtk3 9 years ago
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
9 years ago
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.
9 years ago
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.
9 years ago
Sam Parkinson ecc2f491b6 Merge branch 'fix_mousedetector_stop' of https://github.com/godiard/sugar-toolkit-gtk3 9 years ago
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
9 years ago
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.
9 years ago
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.
9 years ago
Sam Parkinson 9fc5b49329 Only activate menu items if the mouse releases in them - fixes #4863
Ticket URL <http://bugs.sugarlabs.org/ticket/4863>
9 years ago
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
9 years ago
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
9 years ago
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.
9 years ago
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.
9 years ago
Sam Parkinson 78dcd5a7e4 Fix GtkMenu palette positioning in Gtk 3.16 9 years ago
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>
9 years ago
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.
9 years ago
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>
9 years ago
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.
9 years ago
James Cameron 4c22ba5b35 Add escape key to palette windows
Popdown a palette window in response to escape key.
9 years ago
Gonzalo Odiard 8224fefc50 Pep8 and pyflakes fixes 9 years ago
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()
9 years ago
Gonzalo Odiard 5818721818 Merge branch 'treeview_perf2-try2' of https://github.com/godiard/sugar-toolkit-gtk3 into godiard-treeview_perf2-try2 9 years ago
Gonzalo Odiard bbdebce0d4 Simplify routine used to get the list of files from git
This change remove duplicated code
9 years ago
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.
9 years ago
Gonzalo Odiard 7a9510a187 Remove CellRendererInvoker
This invoker is not used anymore, now is replaced by TreeViewInvoker.
9 years ago
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
9 years ago
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>
9 years ago
Gonzalo Odiard 862176de38 Merge branch 'cell_renderer_icon_optimizations' of https://github.com/godiard/sugar-toolkit-gtk3 into godiard-cell_renderer_icon_optimizations 9 years ago
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.
9 years ago
James Cameron 2ddd64bace power: suppress failure to remove file
It does not matter if the file cannot be removed, so do not report it.
9 years ago
James Cameron 561271bad1 power: set path to file once 9 years ago
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>
9 years ago
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>
9 years ago
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>
9 years ago
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
9 years ago
Gonzalo Odiard 026146a081 Pep8 fixes 9 years ago
Gonzalo Odiard 954be953ca Remove new line chars when create linfo files
If a translator add a '\n' char in the summary translation
ConfigParser can't parse the linfo file.
Remove them when the file is created and show a message to warning
to the developer.
9 years ago
Martin Abente Lahaye 06c3f01998 Revert "Add ability to launch a bundle"
This reverts commit 8fcb0b48d3.
9 years ago
Manuel Quiñones 8fcb0b48d3 Add ability to launch a bundle
FIXME, to be written.
9 years ago
Gonzalo Odiard f7966382b8 Read icon attach points when is not possible get the info from gtk
Gtk has deprecated gtk-icon-get-attach-points on version 3.14
We need that information to place pur badges,
this fix read the information from the .icon file

[1] https://developer.gnome.org/gtk3/stable/GtkIconTheme.html#gtk-icon-info-get-attach-points
9 years ago
Gonzalo Odiard a43b972d1b Don't break activity startup if .info have 'class' instead of 'exec'
When we ported sugar to Gtk3 we removed the support of the fields
exec and service_name due they were deprecated for a long time [1].
But this is still a problem in deployments, and we already added
compatibility for the service_name field.
Here [3] there is a long thred were we discussed this issue.

[1] ae85dd62d4
[2] 32f97b48c3
[3] http://lists.sugarlabs.org/archive/sugar-devel/2013-October/045404.html
9 years ago
Ignacio Rodríguez ee564948bc Raise the palette window when its mapped
This patch raise the palette window when its mapped
Its use: Gtk.Window.present [1] the user will
be able to saw the palette now when your apply the
test case of #4463

[1] https://developer.gnome.org/gtk3/stable/GtkWindow.html#gtk-window-present
Fixes #4463
9 years ago
Martin Abente Lahaye 7739336fb6 Provide access to Gtk.Clipboard.set_with_data
As described in SL#4307 Gtk.Clipboard.set_with_data is not
introspectable, therefore it can't be accessed though python
Gtk bindings.

Therefore, as a workaround for this issue, we provide acesss
to this method though a custom SugarExt binding.

This solution uses Carlos Garnacho annotations as described in
https://bugzilla.gnome.org/show_bug.cgi?id=656312#c18

Fixes SL#4307.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
9 years ago
Ignacio Rodríguez 47692f56f0 Log error when the espeak plugin is not installed.
Now when the espeak plugin is not installed there will be an
error (logging.error) in the log. Instead of the ugly message
of Gst
Also, if Gst isnt installed it debug a error too.

Fixes #3345
9 years ago
Goutam b5cae5fb56 Ellipses defaulted to end of long activity titles;fixes 1429 9 years ago
Ignacio Rodríguez cef1ad7590 Get markup text as default
Now sugar-toolkit get markup (glib.markup_escape_text) and
set it.

This fixes SL#4456
10 years ago
Gonzalo Odiard 3c4ac98baf Fix import of exception from ConfigParser
In the commit f0927c364c
the ParsingError is not properly imported.
10 years ago
Gonzalo Odiard f0927c364c Don't break if translation can't be parsed
If the .linfo file can't be parsed, use the untranslated name/summary,
but don't  break activity load.
10 years ago
Sam Parkinson 712682a3b0 BundleBuilder: Don't crash on malformed translation files
The BundleBuilder currently crashes on a malformed translation file.  This is
good for humans (makes them fix their issues) but crashes bots who need it
compiled and don't care about that single translation file.

This patch adds a --no-fail option which stops the builder from crashing
10 years ago
Gonzalo Odiard b78989b755 Add parameters to configure tts
Activities can set pitch, rate or voice used to play text to speech
10 years ago
Gonzalo Odiard 7b82eb6ae8 Add a structure to store the translated voice names 10 years ago
Gonzalo Odiard 44f9201e79 Initialize Gst before use speech
In sugar gst was initialized at startup, now we need initialize Gst
in the speech code.
10 years ago
Gonzalo Odiard 31d8de55a7 TTS: Cache the voices list 10 years ago
Gonzalo Odiard 57bd0890f5 Add a list of language names to translate
To display a list of translated language names in the UI,
we add a list of the available languages, because the espeak
language names are not translated.
10 years ago
Gonzalo Odiard d7c9645b60 Move SpeechManager from sugar to sugar-toolkit-gtk3
This is done to be able to use this implementation of the feature
in the activities. A complementary patch is needed in sugar module.
10 years ago
Gonzalo Odiard 952b8275a1 Add a testing method to open a activity with a uri
This can be used in the test to check if the activity can manage
different file formats.
10 years ago
Sam Parkinson f48c3247f6 Merge branch 'godiard-bundlebuilder_gitls' 10 years ago
Gonzalo Odiard e50a90c243 Bundlebuilder check if activity files are in git
git version 1.9.3, in a activity directory created inside sugar-build/activities
return a empty string when the command "git ls-files" is executed,
and no repository is configured.
We need verify that condition, and process a file list from the filesystem.
10 years ago
Martin Abente Lahaye 98a29ae12c Save spent time on activities
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>
10 years ago
Martin Abente Lahaye 85b173eb25 Remove Palette logic out of PaletteWindow
PaletteWindow is the parent class of two different subclases,
Palette and _ToolBarPalette. Palette uses state changes intensively
in order to display secondary content, but _ToolBarPalette does not.

Because of this, Palette overwrites PaletteWindow's popup and popdown
methods adding one extra param called "state". This param is not required
either in PaletteWindow and specially not in _ToolBarPalette.

Therefore, any piece of code inside PaletteWindow which is meant for
Palette subclassing, should be moved out of PaletteWindow and placed
in the Palette class, where it corresponds.

This patch fixes the cases where _ToolBarPalette breaks because of this
mismatch.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
10 years ago
Martin Abente Lahaye 2f19a41432 Fix black palettes
Push the palette widget opening process to the latest
in order to avoid the race condition where the animation
takes of the place of the real palette.

Fixes #2184

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
10 years ago
Gonzalo Odiard 2456465d79 Enable collaboration by default on activities
When we implemented read max_participants from activity.info [1]
we changed the default value of max_participants, from 0 to 1.
Before, was responsability of the activities set max_participants == 1,
when the activity not implemented collaboration.
This change make the default backwards compatible.

[1] d0cca91fe8
10 years ago
Sam Parkinson 6e81c67622 Remove a double / in webkit1 activity's request's filenames 10 years ago
Gonzalo Odiard c70e5c678d Fix regression introduced by b9d6b628a9
When calculated the palette height based in the size of children,
forgoten add the border size. That moved the palette in the device icons
4 pixels to the bottom, then the gap was miscalcuated and the border
button border was not draw.

Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
10 years ago
Gonzalo Odiard dfeba6184e Fix drawing of gap on palettes attached to widget - Fixes #4776
In Gtk 3.10, Gtk.Window is drawing a gray border around the palette.
This patch draw a black rectangle defore we draw Gtk.render_frame_gap
to draw the border but with a gap to connect to the attached widget.

Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
10 years ago
Martin Abente Lahaye 45e7ba5ed6 Fix and clean Palette secondary label
Removes unnecessary code ie., changing label color.

Refactor label settings, to put all in the same place.

Fix changes to label_alignment that does not honor
original vertical padding settings.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
10 years ago
Gonzalo Odiard b9d6b628a9 Show palettes at the screen bottom with the right size - Fixes #4673
On Gtk 3.10, Gtk.Menu at the bottom of the screen are resized
to avoid fall out of the screen, then report a wrong height.
We need calculate the size of the children and move the Menu up.

This problem is visible on the Clipboard icon palettes,
and in journal objects palettes at the bottom of the screen.

This patch also rename a variable 'rect' to 'req', because is
a Requisition (width, height) and not a Rectangle (x, y, width, height).

Finally, to avoid a error with the secondary text on the palette,
when copy text from the terminal, reove the '¬r' character.

Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
10 years ago
Gonzalo Odiard 4a565dacac Add a method to get all the extensions associated to a mime type
This is needed to solve problems with mismanaged extensions in the journal.
10 years ago
Gonzalo Odiard 568e0254d7 Pep8 fix 10 years ago
Walter Bender d0cca91fe8 Assign max_participants in activity.info
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.
10 years ago
Martin Abente Lahaye 72994bd73c Add Icon.get_badge_size
Add get_badge_size method to Icon class, so it can be accessed
by other Icon sub-classes.

ie., jarabe.frame.notification.NotificationPulsingIcon.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
10 years ago
Gonzalo Odiard e47feb3b0f Make webactivity and webkit1 implementations independient
We can't import webkit and Webkit2 in the same process
and that was introduced in 4ea52b3173

Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
10 years ago
Prasoon Shukla 9e253b5965 Add description in journal object palette - Fixes #4686 10 years ago
edudev 7f1061acbd Add capture device support
Extend acme-volume-alsa.c so it be used to handle not
only the speaker but also the microphone.
10 years ago
Sam Parkinson 4ea52b3173 Now show sugar object choosers as file pickers in web activities 10 years ago
Daniel Narvaez 01ed63ee4b Fixes for pep8 1.5 10 years ago
Sam Parkinson cbf325d994 Extend API for activities notifications
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')
10 years ago
Daniel Narvaez f92f0efe06 Fix pep8 10 years ago
Sebastian Silva 2a7d4da38a Implementation of pixbufs for use with X11 window icons. 10 years ago
James Michael DuPont a082cf1cca better debugging 10 years ago
gauravp94 cf45a7a732 Add verbosity to the activity tests 10 years ago
gauravp94 d4b2e87276 port optparse to argparse in bundlebuilder.py 10 years ago
Gonzalo Odiard 7678540056 Remove c implementation of mime methods
Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
10 years ago
Gonzalo Odiard b02ade879a Implement mime.get_mime_parents using python
This is the only method pending implemented in c,
then we can remove seven files previously used.

Add a test for a corner case untested previously

Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
10 years ago
Gonzalo Odiard faa0d42084 Use Gio.content_type_guess to identify mime type - Fixes #4715
Replace the use of a custom implentation in SugarExt

Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
10 years ago
Gonzalo Odiard e762fa938c Add accelerator to PaletteMenuItem - Fixes #4716
With the port to Gtk3, we lost the display of the keybord shortcut
available in MenuItem.

Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
10 years ago
Gonzalo Odiard 53a148f88c Restore suspend catch the wrong exception
Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
10 years ago
Gonzalo Odiard 62b60fa1e1 Inhibit suspend while a activity is shared
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>
10 years ago
Gonzalo Odiard cf7a5905fd Remove unused code
Fixes pyflakes error

Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
10 years ago
Gonzalo Odiard 30b67cc3d1 Webkit1 compatibility: send 404 error if the file don't exists
Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
10 years ago
Sam Parkinson 8c8c913cb2 Fixes #1929, update toolbar examples in activity doc strings 10 years ago
Martin Abente Lahaye 6c64a7d020 Revert "Keep updated CellRendererInvoker self.path updated - Fixes #4717"
This reverts commit 353e05a086.
10 years ago
Gonzalo Odiard 353e05a086 Keep updated CellRendererInvoker self.path updated - Fixes #4717
Since CellRendererInvoker can set the path at None if a mouse event
is out of the area of the renderer, can break the use of touch,
if happen after the mouse movement. This patch set the path,
in the point_in_cell_renderer test, for the positive case,
solving the issue.

Signed-off-by: Gonzalo Odiard <godiard@sugarlabs.org>
10 years ago
Manuel Quiñones 5802d67ee1 Icon: deprecate icon_size
pixel_size should be always used now.

Change SMALL_ICON_SIZE to cover the other sizes at settings.ini.

Adds a transformation to keep backwards compatibility for some
time. This will be removed in the future.
10 years ago
Ignacio Rodriguez 1ced93e14b pep8 fixes for 'Add menu width chars' 10 years ago
Ignacio Rodriguez 463101b19d Add menu width chars to sugar3 10 years ago
Daniel Narvaez 71b42a2da0 Fix chaining up to the parent 10 years ago
Daniel Narvaez acff63467d Fix pyflakes errors 10 years ago
Sai Vineet 29738c9087 Add Activity Testing API and check command to setup.py
./setup.py check now invokes tests in tests/ directory. tests directory should
have integration(UI tests) and unit(unit tests) sub directories, but it isn't
necessary to have any dir. of the above.
10 years ago
Emil Dudev c0319389e8 Touch UI: esc fullscreen
This patch moves sugar3.graphics.Window key-press-event handling.
It will now be after any other event handling from deived classes.
Fixes #475
10 years ago
Emil Dudev d918e7afff Remove GConf completely
Removes sugar-gconf from SugarExt
Removes gconf-2 dependency
10 years ago
Emil Dudev db2ba3e579 GConf to GSettings port 10 years ago
Gonzalo Odiard 93437ddedf Add get_show_launcher() in bundles other than activitybundle
This is needed now by Sugar, after (sugar commit)
f4638b5f481478e96195d55aa38c90fd33db9aee

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
10 years ago
akskumarnot 81b388c554 Use proper formatting syntax, fixes #2170 10 years ago
Sam f43d5f8d24 Fixes #4634, issue where spaces in bundle ids crashed sugar 10 years ago
Gonzalo Odiard dee29c0e75 Be able to click in a tooltip - Fixes #991
This issue was reported many times, when new users see a tooltip
try to click, and are confused when there are no action.

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
11 years ago
Gonzalo Odiard f52b4e1a96 Make webactivity compatible with webkit1
If a env variable SUGAR_USE_WEBKIT1 exists,
uses a different module to start the activity using a local webserver,
borrowed from wikipedia activity.
When use webkit1 the web inspector is not enabled, because do not work.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
11 years ago
Gonzalo Odiard c47b842fb9 Fix mistake in the last commit
Error detected by the tests.

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
11 years ago
Gonzalo Odiard b8074549f6 Fix cloning activity in sugar - SL #4608
Probably this code was not included in the initial port from gtk2 to
gtk3, because is only used by Sugar, but now we need it.

I changed the way the parameter dist_name is used,
then a complementary patch in sugar is needed

Fixes #4608

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
11 years ago
Walter Bender cd5292881e Add single_instance field to activity bundle
This field can be used by activities that need to be restricted to a
single open instance. Usage is:

single_instance = yes

jarabe/model/shell.py has been modified look for this field in a
separate patch to Sugar.

Together these two patches constitute the implementation of Sugar
feature Launch Limits [1]

[1] http://wiki.sugarlabs.org/go/Features/Launch_Limits
11 years ago
Manuel Quiñones 1baebb2051 Merge branch 'gir' of https://github.com/dnarvaez/sugar-toolkit-gtk3 into dnarvaez-gir 11 years ago
Diego Naula ddd566c847 Fixes #3665: add is_fullscreen() method to Window class
Signed-off-by: Diego Naula <dnaula1997@gmail.com>
11 years ago
Ezequiel Pereira f13a14a2b3 Add journal filter for .xo bundles
Fix #1712
11 years ago
Daniel Narvaez 28423249f6 Make gir files depend on their library
Otherwise with parallel builds we might try to build gir files
before the library causing an error. This happened once in the
buildbot.

Fix #4606
11 years ago
Gonzalo Odiard 32f97b48c3 Workaround to enable start of activities still using service_name
While we deprecated service_name a long time ago, still there are activities
using it, and is a source of frequent problems.

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
11 years ago
Daniel Narvaez cf392735a0 Ensure logs path exists when initializing logs
Otherwise, for example, if we start datastore alone
like we do in the tests, we try to create logs without
the directory and traceback.
11 years ago
Daniel Narvaez 6d6469ee12 Remove now unused method 11 years ago
Daniel Narvaez fd831931ad Remove duplicated code
And deprecate duplicated function.
11 years ago
Daniel Narvaez a1b6b129aa Make the debug script profile aware 11 years ago
Daniel Narvaez fe192be798 Add a SUGAR_HOME environment variable
We should really use XDG directories but that will be a bit
more complicated and require migration scripts. This is a
short time solution to "expose" the dot sugar directory in
sugar-build.
11 years ago
Daniel Narvaez e908aeb8ca Remove unused imports 11 years ago
Daniel Narvaez d12a1d5131 Fix translations domains to point to new toolkit 11 years ago
Daniel Narvaez b83ddaefaf Revert "Fix translations domains to point to new toolkit"
This reverts commit abe0de3ef8.
11 years ago
Daniel Narvaez abe0de3ef8 Fix translations domains to point to new toolkit 11 years ago
Daniel Narvaez 9717e5954b Fix translations in non standard prefix
This drops a lot of code at the same time. The code in
__init__ was:

* Using a SUGAR_PREFIX environment variable that is not
defined anywhere
* Hardcoding prefix to /usr
* Setting up the sugar-base domain which doesn't exist anymore

The i18n module code was overcomplex because it was thought
for language packs which we don't support anymore, it was
not handling correctly locales with a country prefix, it
was hard coding the python prefix and it was not sorting
the directories as it intended too anyway.

The logic is very simple now. Use the locale directory in
the same prefix sugar-toolkit-gtk3 was installed, unless
SUGAR_LOCALEDIR is defined (for self contained bundles).
11 years ago
Walter Bender ec5f064c10 Ensure entity value is type str
There are times when the entity value passed in for substitution
is of type unicode. This causes Rsvg to fail when processing the
SVG. This patch checks for unicode and converts it to utf-8.

Fixes #4621
11 years ago
Daniel Drake e01837f8be Drop use of deprecated dbus.glib
When writing Python apps that will use asynchronous DBus calls and
signals, python-dbus must be initialised with the appropriate main
loop.

sugar currently does this by importing the datastore module from
sugar-toolkit-gtk3, and the datastore module uses the deprecated
and confusing dbus.glib module (which automatically and non-obviously
sets the default GLib main context as the DBus mainloop).

Eliminate the dbus.glib usage from sugar-toolkit-gtk3 as part
of the effort to make sugar initialised the DBus mainloop in a
more explicit and non-deprecated fashion.
11 years ago
Manuel Quiñones fa7a765f4e Drop session.py
SessionManager has been moved to shell, and the other class has
nothing inside.
11 years ago
Manuel Quiñones d45560e3c7 Web activity: quit the GTK main loop when activity is destroyed
Fixes #4603 .

In GTK activities, this is done by _ActivitySession when the activity
unregisters itself, in _complete_close method.

Making the web activity aware of session logout will be handled in
another patch for the shell, see http://bugs.sugarlabs.org/ticket/4611
11 years ago
Manuel Quiñones c8fa6bd694 Web activity: set activity name as the title of the window - SL #4605
At least View Source uses it.
11 years ago
Martin Abente Lahaye ba8c435e50 Include string.h to sugar-fatattr
According to dsd's wisdom, without being
included, strerror is undeclared.

Fixes #4600 sugar crashing when copying
journal entries to documents folder.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>
11 years ago
Walter Bender 7d931c845e Fix annotation for xdg_mime_list_parents
There is a fatal crash in Sugar when retrieving mimetypes for some Journal
entries when contructing the icon palette (for both the Journal list view
and detail view). We isolated the problem to xdgmime.c, the call to
xdg_get_mime_parents. Dnarvaez observed that the annotation for the
return argument was missing and that the annotation for the return for
mime_list_parents was wrong. This patch fixes these annotations.

Fixes #4530
11 years ago
Daniel Drake 147d80aa78 ActivityFactory: don't run which to check for rainbow
One less thing to do in the common activity startup path.
Also, which might not be available.
11 years ago
Manuel Quiñones 0b47dd37b1 Merge branch 'objectchooser_preview-try2' of https://github.com/godiard/sugar-toolkit-gtk3 into godiard-objectchooser_preview-try2 11 years ago
Gonzalo Odiard 3e6507af6e Add a option to the objectchooser to show the object preview
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
11 years ago
Gonzalo Odiard 8e975bd5c9 Add a method to create a Pixbuf with the preview in the metadata
This code was moved from sugar expandedentry.py to be available to use
in other places. Some activities like Portfolio or JournalShare
have this code copied.

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
11 years ago
Daniel Drake 670fc44b1a Icon: handle image loading errors
If the icon can't be found, fall back on showing a generic icon.

Useful when activity/content bundles specify a bad icon, which is
unfortunately true for most content bundles in current existance
(because the icon field was previously unused).
11 years ago
Daniel Drake f46ac7ba6a ContentBundle cleanups
Share get_installation_time() between all bundle types so that it works
with content bundles.

Add get_tags() stub, this is called by Sugar.

Remove unused fields: l10n, category, subcategory, etc.

We remove support for running OLPC's content bundle indexer.
This is assumed to go away now that Sugar will support content bundles
as first-class objects.

Some minor behavioural fixes and cleanups.

This now implements http://wiki.sugarlabs.org/go/Content_bundles
and when care is taken to include all the fields required by old
Sugar versions, there is no change in compatibility of existing or
new content bundles.

Required for http://wiki.sugarlabs.org/go/Features/Content_support
11 years ago
Daniel Narvaez 363eef5293 Fix pep8 11 years ago
surajgillespie 8c736d3870 Pass activity name to the webactivity 11 years ago
Manuel Quiñones 2643a0b25c Merge branch 'at' of https://github.com/dnarvaez/sugar-toolkit-gtk3 into dnarvaez-at 11 years ago
Daniel Drake efaf9f9b2f Avoid use of uuid module
Upon import of uuid, that module uses ctypes.util to find libuuid/libc,
which involves forking a shell process which then forks and runs ldconfig.

ldconfig performs a whole bunch of disk accesses. This is a slowdown.

uuid.getnode() is also documented to be slow. Lets avoid using it in
the activity launch path; we don't need such a high degree of
randomness.

This makes activities launch 1-2 seconds faster on XO-1.
11 years ago
Daniel Narvaez 6d2b97daec Fix pep8 errors
pep8 1.6.4 detects more issues
11 years ago
Daniel Drake 778b10f8d4 Allow override of user library path
This allows for override of ~/Library the same way that can be done
for ~/Activities. Useful for automated testing.
11 years ago
Daniel Drake be91f84a4b Avoid auto-import of bundle helpers (#4527)
The new bundle helpers were being auto-loaded with sugar3.bundle due
to their placement in __init__.py. This was causing Gi to be imported,
breaking GTK2 activity launches.

Move the helpers to a dedicated module.
11 years ago
Daniel Narvaez 8fff409046 Add missing headers
Fixes distcheck
11 years ago
Daniel Narvaez 9778f1d35f Don't set AT_SPI_CLIENT
This is not necessary anymore with latest at-spi2-atk
(See commit 683739dea15d7c02c217a404d8c5d9d7af076a57)
11 years ago
Daniel Drake 12476caa12 Improve bundle API for bundleregistry changes
The bundle API is a bit confusing and inconsistent. Fix up the
ActivityBundle and ContentBundle classes to be more consistent and to
work with the ongoing improvements being made in bundleregistry.
11 years ago
Daniel Drake f4c1bd152a Add bundle instantiation helpers
Add some helper functions for use by upcoming changes in the Sugar shell.
11 years ago
Gonzalo Odiard ad3c163023 Fix ObjectChooser backwards compatibility
The last change brak compatibility with the use in activities
without set the filter_type parameter, because None is not
a allowed value in the dbus call.

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
11 years ago
Daniel Narvaez f54229efd2 Move setting AT_SPI_CLIENT to discover
It needs to be called as early as possible before unit tests
has a chance to import gtk.

Hopefully will fix random test failures we are seeing in buildbot.
11 years ago
Daniel Narvaez 6d319619f0 Factor out the discover logic to the test module
This avoids duplication in sugar and sugar-toolkit-gtk3
makefiles.
11 years ago
Gonzalo Odiard da3786d2fb Add filter_type optative parameter to objectchooser
Constants are defined to select the different filter_type
values. A comment was added to document the use.

Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
11 years ago
Daniel Narvaez 19bc2268d4 Log the UI tree on error
The dump method doesn't actually print anything, just
returns the tree as a string.
11 years ago
Daniel Narvaez 5bef5a82d2 Set the AT_SPI_CLIENT variable in the tests
This ensures the test itself is not recognized as a client
by the registry. I'm not sure how that happens since we are
not loading gtk, but it does. Not being a real gtk client with
a mainloop we wasn't answering dbus calls and causing the registry
to hang and fail.
11 years ago
Daniel Narvaez 4dc7b9e4a4 Don't set atspi timeout
Looking at the code I'm unconvinced this behaves as expected,
in certain cases at least. So reverting it for now to avoid
confusion.
11 years ago