[Sugar-devel] [PATCH browse] Highlight the search results correctly

2012-01-12 Thread Simon Schampijer
Inspired by the Epiphany code we now highlight the
search results in the default color, yellow.

Signed-off-by: Simon Schampijer si...@laptop.org
---
 edittoolbar.py |   18 --
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/edittoolbar.py b/edittoolbar.py
index 958b6ad..f77cbbe 100644
--- a/edittoolbar.py
+++ b/edittoolbar.py
@@ -123,15 +123,21 @@ class EditToolbar(BaseEditToolbar):
 def __paste_cb(self, button):
 self._browser.paste_clipboard()
 
-def __search_entry_activate_cb(self, entry):
-search_text = entry.get_text()
-self._browser.search_text(search_text, case_sensitive=False,
-  forward=True, wrap=True)
-
-def __search_entry_changed_cb(self, entry):
+def _find_and_mark_text(self, entry):
 search_text = entry.get_text()
+self._browser.unmark_text_matches()
+self._browser.mark_text_matches(search_text, case_sensitive=False,
+limit=0)
+self._browser.set_highlight_text_matches(True)
 found = self._browser.search_text(search_text, case_sensitive=False,
   forward=True, wrap=True)
+return found
+
+def __search_entry_activate_cb(self, entry):
+self._find_and_mark_text(entry)
+
+def __search_entry_changed_cb(self, entry):
+found = self._find_and_mark_text(entry)
 if not found:
 self._prev.props.sensitive = False
 self._next.props.sensitive = False
-- 
1.7.7.5

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH sugar-toolkit-gtk3] ActivityBundle: clean from deprecated code

2012-01-12 Thread Simon Schampijer

On 12/01/12 04:42, Alan Jhonn Aguiar Schwyn wrote:



- activity.info file: removed deprecated field 'service_name' use 'bundle_id' 
instead
-  activity.info file: removed deprecated field 'class' use 'exec' instead



We must use: exec = sugar-activity activity.Activity ?
In old sugar also works good?   


The usage of 'class' has been deprecated since ages already [1], and 
'exec' works for a long time already, definitely since 0.84 (maybe even 
before). Here is an example of a activity.info file.


Regards,
   Simon

[1] http://wiki.sugarlabs.org/go/0.90/Notes#API
[2] 
http://git.sugarlabs.org/hello-world/mainline/blobs/master/activity/activity.info

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH read] Adopt to removal of the old toolbar

2012-01-12 Thread Simon Schampijer
As part of the removal of the old toolbar, old API has been removed,
adopt to that change, see 
http://lists.sugarlabs.org/archive/sugar-devel/2012-January/035201.html

Signed-off-by: Simon Schampijer si...@laptop.org
---
 readtoolbar.py |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/readtoolbar.py b/readtoolbar.py
index b52d19c..14b629c 100644
--- a/readtoolbar.py
+++ b/readtoolbar.py
@@ -29,17 +29,17 @@ from sugar3.graphics.toggletoolbutton import 
ToggleToolButton
 from sugar3.graphics.toolcombobox import ToolComboBox
 from sugar3.graphics.menuitem import MenuItem
 from sugar3.graphics import iconentry
-from sugar3.activity import activity
+from sugar3.activity.widgets import EditToolbar as BaseEditToolbar
 
 import speech
 
 
-class EditToolbar(activity.EditToolbar):
+class EditToolbar(BaseEditToolbar):
 
 __gtype_name__ = 'EditToolbar'
 
 def __init__(self):
-activity.EditToolbar.__init__(self)
+BaseEditToolbar.__init__(self)
 
 self._view = None
 
-- 
1.7.7.5

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [ImageViewer] Changes in the toolbar according to design team review

2012-01-12 Thread godiard
From: Gonzalo Odiard godi...@gmail.com

Change order in the full screen button, and icons in rotate buttons.

Signed-off-by: Agustin Zubiaga aguzubiag...@gmail.com
Reviewed-by: Gonzalo Odiard gonz...@laptop.org
---
 ImageViewerActivity.py |   22 
 icons/object-rotate-left.svg   |   16 +
 icons/object-rotate-right.svg  |   15 
 icons/rotate_anticlockwise.svg |   71 
 icons/rotate_clockwise.svg |   71 
 5 files changed, 39 insertions(+), 156 deletions(-)
 create mode 100644 icons/object-rotate-left.svg
 create mode 100644 icons/object-rotate-right.svg
 delete mode 100644 icons/rotate_anticlockwise.svg
 delete mode 100644 icons/rotate_clockwise.svg

diff --git a/ImageViewerActivity.py b/ImageViewerActivity.py
index 9bb06e5..e87ffc0 100644
--- a/ImageViewerActivity.py
+++ b/ImageViewerActivity.py
@@ -193,35 +193,29 @@ class ImageViewerActivity(activity.Activity):
 toolbar_box.toolbar.insert(zoom_original_button, -1)
 zoom_original_button.show()
 
+fullscreen_button = ToolButton('view-fullscreen')
+fullscreen_button.set_tooltip(_('Fullscreen'))
+fullscreen_button.connect('clicked', self.__fullscreen_cb)
+toolbar_box.toolbar.insert(fullscreen_button, -1)
+fullscreen_button.show()
+
 spacer = gtk.SeparatorToolItem()
-spacer.props.draw = False
 toolbar_box.toolbar.insert(spacer, -1)
 spacer.show()
 
-rotate_anticlockwise_button = ToolButton('rotate_anticlockwise')
+rotate_anticlockwise_button = ToolButton('object-rotate-left')
 rotate_anticlockwise_button.set_tooltip(_('Rotate anticlockwise'))
 rotate_anticlockwise_button.connect('clicked',
 self.__rotate_anticlockwise_cb)
 toolbar_box.toolbar.insert(rotate_anticlockwise_button, -1)
 rotate_anticlockwise_button.show()
 
-rotate_clockwise_button = ToolButton('rotate_clockwise')
+rotate_clockwise_button = ToolButton('object-rotate-right')
 rotate_clockwise_button.set_tooltip(_('Rotate clockwise'))
 rotate_clockwise_button.connect('clicked', self.__rotate_clockwise_cb)
 toolbar_box.toolbar.insert(rotate_clockwise_button, -1)
 rotate_clockwise_button.show()
 
-spacer = gtk.SeparatorToolItem()
-spacer.props.draw = False
-toolbar_box.toolbar.insert(spacer, -1)
-spacer.show()
-
-fullscreen_button = ToolButton('view-fullscreen')
-fullscreen_button.set_tooltip(_('Fullscreen'))
-fullscreen_button.connect('clicked', self.__fullscreen_cb)
-toolbar_box.toolbar.insert(fullscreen_button, -1)
-fullscreen_button.show()
-
 separator = gtk.SeparatorToolItem()
 separator.props.draw = False
 separator.set_expand(True)
diff --git a/icons/object-rotate-left.svg b/icons/object-rotate-left.svg
new file mode 100644
index 000..5dfa334
--- /dev/null
+++ b/icons/object-rotate-left.svg
@@ -0,0 +1,16 @@
+?xml version=1.0 encoding=utf-8?
+!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 
6.00 Build 14948)  --
+!DOCTYPE svg PUBLIC -//W3C//DTD SVG 1.1//EN 
http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd;
+svg version=1.1 xmlns=http://www.w3.org/2000/svg; 
xmlns:xlink=http://www.w3.org/1999/xlink; x=0px y=0px width=55px
+height=55px viewBox=0 0 55 55 enable-background=new 0 0 55 55 
xml:space=preserve
+
+g id=Rotate_Left__x28_90_xBA__CCW_x29_ 
+   g display=inline
+   polygon fill=#FF stroke=#FF 
stroke-linejoin=round points=12.183,32.074 7.513,23.012 21.07,27.354/  
   
+   path fill=none stroke=#FF stroke-width=3.5 
stroke-linecap=round d=M13.95,28.242
+   
c0-7.416,6.01-13.426,13.426-13.426s13.427,6.011,13.427,13.426c0,7.416-6.011,13.427-13.427,13.427
+   c-2.4,0-4.654-0.63-6.604-1.733/
+   /g
+/g
+
+/svg
diff --git a/icons/object-rotate-right.svg b/icons/object-rotate-right.svg
new file mode 100644
index 000..84c1638
--- /dev/null
+++ b/icons/object-rotate-right.svg
@@ -0,0 +1,15 @@
+?xml version=1.0 encoding=utf-8?
+!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 
6.00 Build 14948)  --
+!DOCTYPE svg PUBLIC -//W3C//DTD SVG 1.1//EN 
http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd;
+svg version=1.1 xmlns=http://www.w3.org/2000/svg; 
xmlns:xlink=http://www.w3.org/1999/xlink; x=0px y=0px width=55px
+height=55px viewBox=0 0 55 55 enable-background=new 0 0 55 55 
xml:space=preserve
+
+g id=Rotate_Right__x28_90_xBA__CW_x29_ 
+   polygon display=inline fill=#FF stroke=#FF 
stroke-linejoin=round points=42.693,31.332 47.363,22.27 
+   33.806,26.611   /
+   path display=inline fill=none stroke=#FF stroke-width=3.5 
stroke-linecap=round d=M40.926,27.5
+   

Re: [Sugar-devel] [FEATURE] Global Text to Speech

2012-01-12 Thread Simon Schampijer

On 22/11/11 03:23, Gonzalo Odiard wrote:

Attached is a first try of implementation, to discuss.

Is using gstreamer-plugins-espeak, already included in the last images,
and used in all the activities using text-to-speech. Do not add any new
dependency.

A device is added in the frame to configure pitch and velocity,
and the hotkey alt-shift-s is used to say the selected text.

The SpeechManager provide a simple say_text method to be used by activities
if needed.

A pending functionality is add a list of languages, to translate it and
have a single list,
and do not need translate this list in every activity. There are code in
Speak activity to do this,
I need look at this.

Gonzalo


Hi Gonzalo,

thanks for the patch! Here are a few notes:

- when you have a text selected and want it to be spoken out a clipboard 
entry is created (I guess you need to have a look at why the clipboard 
tray reacts to that selection)


- you specify gconf keys, those would need to be added to the schema as well

- when you select a long text for reading there is no way to pause/stop 
it, might be worth having that option as well


- the shortcut is a bit long, maybe 'alt+s' is enough? (see above, maybe 
there is a shortcut as well for stopping? or hitting it again does stop 
the current playing one?)


- it would be great to write in the Feature page a bit more about the 
what the Feature does and what it does not do, after discussing with you 
the other day: it is available in the Shell+Activities for any text you 
select, it does not allow you to do activity specific operations like 
reading a chapter in Read, or a whole book or a wikipedia activity in 
Browse nor does it is a primary tool for Accessibility (no criticism 
intended just to note what it does and what not)


Formal:

- there are a few items that do not need to be public e.g. 
'self.pipeline' in 'AudioGrabGst'


- the copyright in the files is a bit all over the place

Regards,
   Simon
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [ImageViewer] Changes in the toolbar according to design team review

2012-01-12 Thread Aleksey Lim
On Thu, Jan 12, 2012 at 10:44:11AM -0300, godi...@sugarlabs.org wrote:
 From: Gonzalo Odiard godi...@gmail.com
 
 Change order in the full screen button

Hi, whats the reason to swap fullscreen and rotate buttons?
Afaik, mostly all activities have fullscreen button as a leftmost.
That will be confusing to have ImageViewer unique (and change existing
users experience for ImageViewer itself.

 , and icons in rotate buttons.

Well, I'm not a designer and specialist of users experience, but new
buttons:

- look similar to each other and similar to Refresh functionality button
  + old ones are more distinct
- all image viewers I managed to find screenshots for, do not use
  circles for rotate buttons
  + old buttons look similar to the majority on image viewers

-- 
Aleksey
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [ImageViewer] Changes in the toolbar according to design team review

2012-01-12 Thread Gonzalo Odiard
On Thu, Jan 12, 2012 at 11:30 AM, Aleksey Lim
alsr...@activitycentral.orgwrote:

 On Thu, Jan 12, 2012 at 10:44:11AM -0300, godi...@sugarlabs.org wrote:
  From: Gonzalo Odiard godi...@gmail.com
 
  Change order in the full screen button

 Hi, whats the reason to swap fullscreen and rotate buttons?
 Afaik, mostly all activities have fullscreen button as a leftmost.
 That will be confusing to have ImageViewer unique (and change existing
 users experience for ImageViewer itself.



The idea is have all the View operations in the same order than in other
activities.
And yes, Full Screen is the last of the View buttons.



  , and icons in rotate buttons.

 Well, I'm not a designer and specialist of users experience, but new
 buttons:

 - look similar to each other and similar to Refresh functionality button
  + old ones are more distinct
 - all image viewers I managed to find screenshots for, do not use
  circles for rotate buttons
  + old buttons look similar to the majority on image viewers


Well, I am not an expert.
We wanted use the same icons to rotate in Paint, ImageViewer and Fototoon.
I have asked to Gary what icons should we use, and he said the Paint icons
are the better.
I cc to Gary to see if he can explain better .

Gonzalo
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] Rainbow violation?

2012-01-12 Thread Walter Bender
I have been making some changes to the Portfolio activity based on
some feedback from the Pedagogy Team. (They are testing the latest bit
available on git and also [1].) One of the changes that they requested
was the ability to modify metadata['description'] so that the text
displayed on a slide could be changed from within Portfolio. Easy
enough. But what is not so easy is to save these changes to the
datastore. In order to do this, I will have to make Portfolio behave
more like the Journal, with the ability to write to the datastore of
any object, not just its own instance. Feedback as to whether or not I
should go down this path, and if so, how to ensure that I am not
creating a gapping hole in Rainbow would be appreciated.

regards.

-walter


[1] http://wiki.sugarlabs.org/images/3/3f/Portfolio-20.xo

-- 
Walter Bender
Sugar Labs
http://www.sugarlabs.org
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [ImageViewer] Changes in the toolbar according to design team review

2012-01-12 Thread Aleksey Lim
On Thu, Jan 12, 2012 at 11:39:14AM -0300, Gonzalo Odiard wrote:
 On Thu, Jan 12, 2012 at 11:30 AM, Aleksey Lim
 alsr...@activitycentral.orgwrote:
 
  On Thu, Jan 12, 2012 at 10:44:11AM -0300, godi...@sugarlabs.org wrote:
   From: Gonzalo Odiard godi...@gmail.com
  
   Change order in the full screen button
 
  Hi, whats the reason to swap fullscreen and rotate buttons?
  Afaik, mostly all activities have fullscreen button as a leftmost.
  That will be confusing to have ImageViewer unique (and change existing
  users experience for ImageViewer itself.
 
 
 
 The idea is have all the View operations in the same order than in other
 activities.
 And yes, Full Screen is the last of the View buttons.
 
 
 
   , and icons in rotate buttons.
 
  Well, I'm not a designer and specialist of users experience, but new
  buttons:
 
  - look similar to each other and similar to Refresh functionality button
   + old ones are more distinct
  - all image viewers I managed to find screenshots for, do not use
   circles for rotate buttons
   + old buttons look similar to the majority on image viewers
 
 
 Well, I am not an expert.
 We wanted use the same icons to rotate in Paint, ImageViewer and Fototoon.
 I have asked to Gary what icons should we use, and he said the Paint icons
 are the better.
 I cc to Gary to see if he can explain better .

I see only one useful way here:

* for icons, create rotate buttons for sugar-artwork and trying to switch
  all activities to these icons
* for fullscreen button, have a section in HIG regarding this button
  (it is useless to have it in different places for different activities).

And only after that, patch ImageViewer and other activities.

-- 
Aleksey
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Rainbow violation?

2012-01-12 Thread James Simmons
Walter,

I do much the same thing you're proposing to do in the Sugar Commander
Activity, actually more than you're proposing.  I let users change all the
standard metadata, resize image files, delete Journal entries, etc.  If
Rainbow prevents modifying metadata of Journal entries not created by or
resumed by the current Activity that might be a bit too much security.

James Simmons


On Thu, Jan 12, 2012 at 8:48 AM, Walter Bender walter.ben...@gmail.comwrote:

 I have been making some changes to the Portfolio activity based on
 some feedback from the Pedagogy Team. (They are testing the latest bit
 available on git and also [1].) One of the changes that they requested
 was the ability to modify metadata['description'] so that the text
 displayed on a slide could be changed from within Portfolio. Easy
 enough. But what is not so easy is to save these changes to the
 datastore. In order to do this, I will have to make Portfolio behave
 more like the Journal, with the ability to write to the datastore of
 any object, not just its own instance. Feedback as to whether or not I
 should go down this path, and if so, how to ensure that I am not
 creating a gapping hole in Rainbow would be appreciated.

 regards.

 -walter


 [1] http://wiki.sugarlabs.org/images/3/3f/Portfolio-20.xo

 --
 Walter Bender
 Sugar Labs
 http://www.sugarlabs.org
 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [ImageViewer] Changes in the toolbar according to design team review

2012-01-12 Thread Gonzalo Odiard
Ok. Work for Gary or Manuel, when he came back from vacation.

Gonzalo

On Thu, Jan 12, 2012 at 12:51 PM, Aleksey Lim
alsr...@activitycentral.orgwrote:

 On Thu, Jan 12, 2012 at 11:39:14AM -0300, Gonzalo Odiard wrote:
  On Thu, Jan 12, 2012 at 11:30 AM, Aleksey Lim
  alsr...@activitycentral.orgwrote:
 
   On Thu, Jan 12, 2012 at 10:44:11AM -0300, godi...@sugarlabs.org wrote:
From: Gonzalo Odiard godi...@gmail.com
   
Change order in the full screen button
  
   Hi, whats the reason to swap fullscreen and rotate buttons?
   Afaik, mostly all activities have fullscreen button as a leftmost.
   That will be confusing to have ImageViewer unique (and change existing
   users experience for ImageViewer itself.
  
  
 
  The idea is have all the View operations in the same order than in
 other
  activities.
  And yes, Full Screen is the last of the View buttons.
 
 
 
, and icons in rotate buttons.
  
   Well, I'm not a designer and specialist of users experience, but new
   buttons:
  
   - look similar to each other and similar to Refresh functionality
 button
+ old ones are more distinct
   - all image viewers I managed to find screenshots for, do not use
circles for rotate buttons
+ old buttons look similar to the majority on image viewers
  
  
  Well, I am not an expert.
  We wanted use the same icons to rotate in Paint, ImageViewer and
 Fototoon.
  I have asked to Gary what icons should we use, and he said the Paint
 icons
  are the better.
  I cc to Gary to see if he can explain better .

 I see only one useful way here:

 * for icons, create rotate buttons for sugar-artwork and trying to switch
  all activities to these icons
 * for fullscreen button, have a section in HIG regarding this button
  (it is useless to have it in different places for different activities).

 And only after that, patch ImageViewer and other activities.

 --
 Aleksey




-- 
Gonzalo Odiard
SugarLabs Argentina
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH read] Adopt to removal of the old toolbar

2012-01-12 Thread Gonzalo Odiard
Thanks, pushed.

Gonzalo

On Thu, Jan 12, 2012 at 10:27 AM, Simon Schampijer si...@schampijer.dewrote:

 As part of the removal of the old toolbar, old API has been removed,
 adopt to that change, see
 http://lists.sugarlabs.org/archive/sugar-devel/2012-January/035201.html

 Signed-off-by: Simon Schampijer si...@laptop.org
 ---
  readtoolbar.py |6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)

 diff --git a/readtoolbar.py b/readtoolbar.py
 index b52d19c..14b629c 100644
 --- a/readtoolbar.py
 +++ b/readtoolbar.py
 @@ -29,17 +29,17 @@ from sugar3.graphics.toggletoolbutton import
 ToggleToolButton
  from sugar3.graphics.toolcombobox import ToolComboBox
  from sugar3.graphics.menuitem import MenuItem
  from sugar3.graphics import iconentry
 -from sugar3.activity import activity
 +from sugar3.activity.widgets import EditToolbar as BaseEditToolbar

  import speech


 -class EditToolbar(activity.EditToolbar):
 +class EditToolbar(BaseEditToolbar):

 __gtype_name__ = 'EditToolbar'

 def __init__(self):
 -activity.EditToolbar.__init__(self)
 +BaseEditToolbar.__init__(self)

 self._view = None

 --
 1.7.7.5

 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH] added new icon for write to journal description action

2012-01-12 Thread Walter Bender
From: Walter Bender walter.ben...@gmail.com

This patch adds a new icon to sugar-artwork to be used as part of the standard
activity toolbar (used by widgets.py) to invoke a palette used to write to
metadata['description']. Plesase see the discussion on the feature page [1]
for Write to Journal anytime for more details.

[1] http://wiki.sugarlabs.org/go/Features/Write_to_journal_anytime

---
 icons/scalable/actions/Makefile.am   |1 +
 icons/scalable/actions/write-journal.svg |   36 ++
 2 files changed, 37 insertions(+), 0 deletions(-)
 create mode 100644 icons/scalable/actions/write-journal.svg

diff --git a/icons/scalable/actions/Makefile.am 
b/icons/scalable/actions/Makefile.am
index 19bcabc..7f53aab 100644
--- a/icons/scalable/actions/Makefile.am
+++ b/icons/scalable/actions/Makefile.am
@@ -104,6 +104,7 @@ icon_DATA = \
view-spiral.svg \
view-source.svg \
view-triangle.svg   \
+   write-journal.svg   \
zoom-activity.svg   \
zoom-best-fit.svg   \
zoom-groups.svg \
diff --git a/icons/scalable/actions/write-journal.svg 
b/icons/scalable/actions/write-journal.svg
new file mode 100644
index 000..33f10af
--- /dev/null
+++ b/icons/scalable/actions/write-journal.svg
@@ -0,0 +1,36 @@
+?xml version=1.0 ?!-- Generator: Adobe Illustrator 13.0.2, SVG Export 
Plug-In . SVG Version: 6.00 Build 14948)  --!DOCTYPE svg  PUBLIC '-//W3C//DTD 
SVG 1.1//EN'  'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' [
+   !ENTITY stroke_color #FF
+   !ENTITY fill_color #A0A0A0
+]svg enable-background=new 0 0 55.125 55 height=55px id=Layer_1 
version=1.1 viewBox=0 0 55.125 55 width=55.125px x=0px 
xml:space=preserve xmlns=http://www.w3.org/2000/svg; 
xmlns:xlink=http://www.w3.org/1999/xlink; y=0px
+  g
+   transform=translate(-0.25691667,0)
+   style=fill:none;stroke:stroke_color;;stroke-opacity:1
+g
+   transform=translate(-3.1255,0)
+   id=write-journal
+   style=fill:none;stroke:stroke_color;;stroke-opacity:1;display:block
+  path
+   d=m 8.9375,6 0,43 29.46875,0 c 2.804,0 4.34375,-1.83275 4.34375,-4.34375 l 
0,-19.53125 0.1875,-0.25 8.03125,-10.34375 c 0.022,-0.023 0.125,-0.1875 
0.125,-0.1875 0.096,-0.161 0.15625,-0.3515 0.15625,-0.5625 0,-0.061 
0.012,-0.1295 0,-0.1875 -0.087,-0.763 -0.73225,-1.67525 -1.65625,-2.40625 
-0.923,-0.728 -1.95975,-1.12025 -2.71875,-1.03125 -0.326,0.042 -0.78125,0.375 
-0.78125,0.375 l -3.15625,4.15625 -0.1875,0.25 0,-4.59375 C 42.75,8.16775 
40.55625,6 38.40625,6 L 8.9375,6 z
+   transform=translate(3.1255,0)
+   
style=fill:none;stroke:stroke_color;;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1
 /
+  line
+   
style=fill:none;stroke:stroke_color;;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1
+   x1=21.341
+   x2=21.341
+   y1=6.121
+   y2=48.881 /
+  path
+   d=m 7.384,14.464 c 0,0 2.084,0.695 4.17,0.695 2.086,0 4.173,-0.695 
4.173,-0.695
+   
style=fill:none;stroke:stroke_color;;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1
 /
+  path
+   d=m 7.384,28.021 c 0,0 1.912,0.695 4.345,0.695 2.433,0 3.999,-0.695 
3.999,-0.695
+   
style=fill:none;stroke:stroke_color;;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1
 /
+  path
+   d=m 7.384,41.232 c 0,0 1.736,0.695 4.518,0.695 2.781,0 3.825,-0.695 
3.825,-0.695
+   
style=fill:none;stroke:stroke_color;;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1
 /
+/g
+path
+   d=m 42.806917,14.85 -11.91627,15.831262 -3.475,8.266 c -0.046,0.104 
-0.018,0.223 0.069,0.295 0.089,0.072 0.211,0.084 0.307,0.02 l 7.826,-5.037 
7.18927,-9.175262
+   style=fill:none;stroke:stroke_color;;stroke-width:3.5;stroke-opacity:1 /
+  /g
+/svg
\ No newline at end of file
-- 
1.7.7.5

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH] Add Write to Journal button to standard activity toolbar

2012-01-12 Thread Walter Bender
From: Walter Bender walter.ben...@gmail.com

This patch adds a new button to the standard activity toolbar (between the
activity title and the sharing button). The button involes a palette that
contains a textview widget that lets the user make changes to
metadata['description']. Additional dependencies introduced by this patch
include a new icon, write-journal.svg, and the introduction of a new
string for translation, _('Reflections').

Details regarding this patch can be found at [1]. Note that while this patch
is independent of the Naming Alert, it makes that alert largely obsolete.

[1] http://wiki.sugarlabs.org/go/Features/Write_to_journal_anytime


---
 src/sugar/activity/widgets.py |   60 +
 1 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/src/sugar/activity/widgets.py b/src/sugar/activity/widgets.py
index e5c4063..2a106e9 100644
--- a/src/sugar/activity/widgets.py
+++ b/src/sugar/activity/widgets.py
@@ -1,4 +1,5 @@
 # Copyright (C) 2009, Aleksey Lim, Simon Schampijer
+# Copyright (C) 2012, Walter Bender
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -235,6 +236,60 @@ class TitleEntry(gtk.ToolItem):
 shared_activity.props.name = title
 
 
+class DescriptionEntry(gtk.ToolItem):
+
+def __init__(self, activity, **kwargs):
+gtk.ToolItem.__init__(self)
+self.activity = activity
+
+write_journal_button = ToolButton('write-journal')
+write_journal_button.show()
+# TRANS: Reflections are saved to the description metadata field
+write_journal_button.set_tooltip(_('Reflections'))
+self._palette = write_journal_button.get_palette()
+
+msg_box = gtk.HBox()
+
+sw = gtk.ScrolledWindow()
+sw.set_size_request(int(gtk.gdk.screen_width() / 2),
+2 * style.GRID_CELL_SIZE)
+sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+self.text_view = gtk.TextView()
+self.text_view.set_left_margin(style.DEFAULT_PADDING)
+self.text_view.set_right_margin(style.DEFAULT_PADDING)
+text_buffer = gtk.TextBuffer()
+if 'description' in self.activity.metadata:
+text_buffer.set_text(self.activity.metadata['description'])
+self.text_view.set_buffer(text_buffer)
+self.text_view.connect('focus-out-event',
+   self._text_view_focus_out_event_cb)
+sw.add(self.text_view)
+sw.show()
+msg_box.pack_start(sw, expand=False)
+msg_box.show_all()
+
+self._palette.set_content(msg_box)
+write_journal_button.connect('clicked',
+ self._write_journal_button_cb)
+self.add(write_journal_button)
+
+def _write_journal_button_cb(self, button):
+if self._palette:
+if not self._palette.is_up():
+self._palette.popup(immediate=True,
+state=self._palette.SECONDARY)
+else:
+self._palette.popdown(immediate=True)
+return 
+
+def _text_view_focus_out_event_cb(self, widget, event):
+buffer = self.text_view.get_buffer()
+start_iter = buffer.get_start_iter()
+end_iter = buffer.get_end_iter()
+self.activity.metadata['description'] = \
+buffer.get_text(start_iter, end_iter)
+
+
 class ActivityToolbar(gtk.Toolbar):
 The Activity toolbar with the Journal entry title, sharing
and Stop buttons
@@ -261,6 +316,11 @@ class ActivityToolbar(gtk.Toolbar):
 self.insert(separator, -1)
 separator.show()
 
+if activity.metadata:
+description_palette = DescriptionEntry(activity)
+description_palette.show()
+self.insert(description_palette, -1)
+
 self.share = ShareButton(activity)
 self.share.show()
 self.insert(self.share, -1)
-- 
1.7.7.5

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH] add activity counter to metadata

2012-01-12 Thread Walter Bender
From: Walter Bender walter.ben...@gmail.com

This patch adds/updates a new metadata field to instances of Sugar Activities.
Specifically, it maintains a count of how many times an activity instance has
be accessed. The mechanism used is to increment a counter each time an activity
is launched. (The counter is initialized to 1 on first launch.) This is part
of the Activity-specific metadata Feature described here [1].

[1] http://wiki.sugarlabs.org/go/Features/Activity_specific_metadata_in_Journal

---
 src/sugar/activity/widgets.py |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/sugar/activity/widgets.py b/src/sugar/activity/widgets.py
index 2a106e9..15eface 100644
--- a/src/sugar/activity/widgets.py
+++ b/src/sugar/activity/widgets.py
@@ -332,7 +332,16 @@ class ActivityToolbar(gtk.Toolbar):
 self.insert(self.stop, -1)
 self.stop.show()
 
+if activity.metadata:
+# activity count is the number of times this instance
+# has been accessed
+if 'activity count' in activity.metadata:
+count = int(activity.metadata['activity count'])
+count += 1
+else:
+count = 1
+activity.metadata['activity count'] = str(count)
+
 
 class EditToolbar(gtk.Toolbar):
 Provides the standard edit toolbar for Activities.
-- 
1.7.7.5

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [Chat] Enable palette over urls

2012-01-12 Thread godiard
From: Gonzalo Odiard godi...@gmail.com

This patch solves the problems pointed by Aleksey in the last patch,
disable the standard menu in the textview, reorganize the event_after method
and stop the mouse_slow detector when the palette popup.

Signed-by: Gonzalo Odiard gonz...@laptop.org
---
 chat/box.py |   26 +++---
 1 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/chat/box.py b/chat/box.py
index bfc8156..e82e19a 100644
--- a/chat/box.py
+++ b/chat/box.py
@@ -72,23 +72,20 @@ class TextBox(gtk.TextView):
 self._mouse_detector.connect('motion-slow', self._mouse_slow_cb)
 self.modify_base(gtk.STATE_NORMAL, bg_color.get_gdk_color())
 self.connect(event-after, self.event_after)
+self.connect('button-press-event', self.__button_press_cb)
 self.motion_notify_id = self.connect(motion-notify-event, \
 self.motion_notify_event)
 self.connect(visibility-notify-event, self.visibility_notify_event)
 
+def __button_press_cb(self, widget, event):
+if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
+# To disable the standard textview popup
+return True
+
 # Links can be activated by clicking.
 def event_after(self, widget, event):
 if event.type != gtk.gdk.BUTTON_RELEASE:
 return False
-if event.button == 2:
-# XXX `tag` is not defined
-#palette = tag.get_data('palette')
-#xw, yw = self.get_toplevel().get_pointer()
-#logging.debug('Popop palette by secondary button click')
-#palette.move(event.x, event.y)
-#palette.popup()
-#return False
-pass
 
 x, y = self.window_to_buffer_coords(gtk.TEXT_WINDOW_WIDGET,
 int(event.x), int(event.y))
@@ -97,7 +94,14 @@ class TextBox(gtk.TextView):
 for tag in iter_tags.get_tags():
 url = tag.get_data('url')
 if url is not None:
-self._show_via_journal(url)
+if event.button == 3:
+palette = tag.get_data('palette')
+xw, yw = self.get_toplevel().get_pointer()
+palette.move(int(xw), int(yw))
+palette.popup()
+else:
+self._show_via_journal(url)
+break
 
 return False
 
@@ -158,9 +162,9 @@ class TextBox(gtk.TextView):
 if hovering_over_link:
 if self.palette is not None:
 xw, yw = self.get_toplevel().get_pointer()
-logging.debug('move palette to %d %d', xw, yw)
 self.palette.move(xw, yw)
 self.palette.popup()
+self._mouse_detector.stop()
 else:
 if self.palette is not None:
 self.palette.popdown()
-- 
1.7.7.5

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Removing hippo from Chat

2012-01-12 Thread Gonzalo Odiard
I have sent a new patch solving the issues you point.

Gonzalo

On Mon, Jan 9, 2012 at 10:24 AM, Aleksey Lim alsr...@activitycentral.orgwrote:

 On Thu, Jan 05, 2012 at 10:47:33AM -0300, Gonzalo Odiard wrote:
  Hi Aleksey,
  I have addressed the pending issues, and will send the patches to
  sugar-devel.

 Thanks, I've pushed your commits w/ lint polishing (see HACKING file).

 http://git.sugarlabs.org/chat/mainline/commit/148d0d6fd47d8eb6b3bf42d21828222ee4693082

 Also, there are a couple of issues:

diff --git a/chat/box.py b/chat/box.py
index bfc8156..b639037 100644
--- a/chat/box.py
+++ b/chat/box.py
@@ -69,9 +69,11 @@ class TextBox(gtk.TextView):
 self._empty = True
 self.palette = None
 self._mouse_detector = MouseSpeedDetector(self, 200, 5)
-self._mouse_detector.connect('motion-slow',
 self._mouse_slow_cb)
+# TODO There is a mess with having sugar palette and TextView
 popup
+#self._mouse_detector.connect('motion-slow',
 self._mouse_slow_cb)
 self.modify_base(gtk.STATE_NORMAL, bg_color.get_gdk_color())
-self.connect(event-after, self.event_after)
+# TODO There is a mess with having sugar palette and TextView
 popup
+#self.connect(event-after, self.event_after)
 self.motion_notify_id = self.connect(motion-notify-event, \
 self.motion_notify_event)
 self.connect(visibility-notify-event,
 self.visibility_notify_event)

 For example,

 * in self.event_after, the commented block references to unknow `tag`
 * having two popups (sugar palette and TextBox popup) looks messy.
 * url palette pops up even for TextBox widgets that don't have urls

 --
 Aleksey

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH browse] Bring back download functionality using WebKit

2012-01-12 Thread Simon Schampijer
This brings back the download functionality to
Browse using WebKit, it handles the cases when you
click on a link and the Browser is not setup to view
this file.

Requesting a download through Palettes is still to
come.

The code is inspired by the download code in Surf.

Signed-off-by: Simon Schampijer si...@laptop.org
---
 browser.py |   14 ++
 downloadmanager.py |  379 ++--
 webactivity.py |9 +-
 3 files changed, 88 insertions(+), 314 deletions(-)

diff --git a/browser.py b/browser.py
index 2d65237..83cc7ea 100644
--- a/browser.py
+++ b/browser.py
@@ -35,6 +35,7 @@ from sugar3.graphics.icon import Icon
 
 from widgets import BrowserNotebook
 import globalhistory
+import downloadmanager
 
 _ZOOM_AMOUNT = 0.1
 _LIBRARY_PATH = '/usr/share/library-common/index.html'
@@ -389,6 +390,9 @@ class Browser(WebKit.WebView):
 self._global_history = globalhistory.get_global_history()
 self.connect('notify::load-status', self.__load_status_changed_cb)
 self.connect('notify::title', self.__title_changed_cb)
+self.connect('download-requested', self.__download_requested_cb)
+self.connect('mime-type-policy-decision-requested',
+ self.__mime_type_policy_cb)
 
 def get_history(self):
 Return the browsing history of this browser.
@@ -478,6 +482,16 @@ class Browser(WebKit.WebView):
 title = unicode(title, 'utf-8')
 self._global_history.set_page_title(uri, title)
 
+def __mime_type_policy_cb(self, webview, frame, request, mimetype,
+  policy_decision):
+if not self.can_show_mime_type(mimetype):
+policy_decision.download()
+return True
+
+def __download_requested_cb(self, browser, download):
+downloadmanager.add_download(download, browser)
+return True
+
 
 class PopupDialog(Gtk.Window):
 def __init__(self):
diff --git a/downloadmanager.py b/downloadmanager.py
index af22df4..e6d 100644
--- a/downloadmanager.py
+++ b/downloadmanager.py
@@ -18,44 +18,23 @@
 import os
 import logging
 from gettext import gettext as _
-import time
 import tempfile
+import dbus
 
 from gi.repository import Gtk
-import hulahop
-import xpcom
-from xpcom.nsError import *
-from xpcom import components
-from xpcom.components import interfaces
-from xpcom.server.factory import Factory
+from gi.repository import WebKit
 
 from sugar3.datastore import datastore
 from sugar3 import profile
 from sugar3 import mime
 from sugar3.graphics.alert import Alert, TimeoutAlert
 from sugar3.graphics.icon import Icon
-from sugar3.graphics import style
 from sugar3.activity import activity
-# #3903 - this constant can be removed and assumed to be 1 when dbus-python
-# 0.82.3 is the only version used
-import dbus
-if dbus.version = (0, 82, 3):
-DBUS_PYTHON_TIMEOUT_UNITS_PER_SECOND = 1
-else:
-DBUS_PYTHON_TIMEOUT_UNITS_PER_SECOND = 1000
-
-NS_BINDING_ABORTED = 0x804b0002 # From nsNetError.h
-NS_ERROR_SAVE_LINK_AS_TIMEOUT = 0x805d0020  # From nsURILoader.h
 
 DS_DBUS_SERVICE = 'org.laptop.sugar.DataStore'
 DS_DBUS_INTERFACE = 'org.laptop.sugar.DataStore'
 DS_DBUS_PATH = '/org/laptop/sugar/DataStore'
 
-_MIN_TIME_UPDATE = 5# In seconds
-_MIN_PERCENT_UPDATE = 10
-
-_MAX_DELTA_CACHE_TIME = 86400  # In seconds
-
 _active_downloads = []
 _dest_to_window = {}
 
@@ -70,78 +49,22 @@ def num_downloads():
 
 def remove_all_downloads():
 for download in _active_downloads:
-download.cancelable.cancel(NS_ERROR_FAILURE)
+download.cancel()
 if download.dl_jobject is not None:
 datastore.delete(download.dl_jobject.object_id)
 download.cleanup()
 
-def remove_old_parts():
-temp_path = os.path.join(activity.get_activity_root(), 'instance')
-if os.path.exists(temp_path):
-for file in os.listdir(temp_path):
-file_full_path = os.path.join(temp_path, file)
-modification_time = os.path.getmtime(file_full_path)
-if(time.time() - modification_time  _MAX_DELTA_CACHE_TIME):
-logging.debug('removing %s' % file_full_path)
-os.remove(file_full_path)
-
-class HelperAppLauncherDialog:
-_com_interfaces_ = interfaces.nsIHelperAppLauncherDialog
-
-def promptForSaveToFile(self, launcher, window_context,
-default_file, suggested_file_extension,
-force_prompt=False):
-file_class = components.classes['@mozilla.org/file/local;1']
-dest_file = file_class.createInstance(interfaces.nsILocalFile)
-
-if default_file:
-default_file = default_file.encode('utf-8', 'replace')
-base_name, extension = os.path.splitext(default_file)
-else:
-base_name = ''
-if suggested_file_extension:
-extension = '.' + suggested_file_extension
-else:
-   

[Sugar-devel] [ASLO] Release Turtle Blocks-131

2012-01-12 Thread Sugar Labs Activities
Activity Homepage:
http://activities.sugarlabs.org/addon/4027

Sugar Platform:
0.82 - 0.96

Download Now:
http://activities.sugarlabs.org/downloads/file/27819/turtle_art-131.xo

Release notes:
131

ENHANCEMENTS:
* Internalized While and Until blocks (no longer macro expansions)
* Simplified keyboard input macro (uses until block)
* Some consolidation of toolbars on smaller displays
* New data-graphing example from ClaudiaU
* New strings for Butia, Follow Me, and Sumo plugins

TOUCH ENHANCEMENTS:
* Added on-screen adjusters for numeric blocks
* Added a mouse-motion threshold for differentiating between a click and a
  drag motion

BUG FIXES:
 * While and Until blocks continue program flow after exiting
 * Until block executes once before test
 * Changed light-sensor power_state (deprecated) to level
 * Switched to panel for Save/Load buttons so that they'd all fit on
   smaller screens

Thanks to Alan Jhonn Aguiar Schwyn for testing many of these changes



Sugar Labs Activities
http://activities.sugarlabs.org

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [ASLO] Release Panorama-3

2012-01-12 Thread Sugar Labs Activities
Activity Homepage:
http://activities.sugarlabs.org/addon/4524

Sugar Platform:
0.82 - 0.96

Download Now:
http://activities.sugarlabs.org/downloads/file/27820/panorama-3.xo

Release notes:
Tranlated to SugarGame library.
Add maximum photographs to process.
Add messages to the user.


Sugar Labs Activities
http://activities.sugarlabs.org

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] Proposed addition to Sugar

2012-01-12 Thread David Mason
Hi all,

Early last year for a university assignment I wrote a UI enhancement for Sugar, 
named Glycogen. Glycogen adds the ability to define and track learning 
pathways, made up of goals within different activities. My work includes a few 
example activities.

It has been idle for a while, but I think it's about time I looked at whether 
it's appropriate to incorporate into the main Sugar distribution. If it is 
appropriate, I'll look at a time-frame for making the necessary code updates 
(I'm sure there will be many).

There are several screenshots under the developer and user documentation: 
http://davidmason.github.com/glycogen/
Note that the UI needs a lot of polishing - my focus during the project was 
getting the core functionality working, not to make a highly polished product.

Code is hosted on github at the moment: https://github.com/davidmason/glycogen

I invite your opinions and suggestions.

Cheers,

David Mason
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel