[Sugar-devel] [PATCH sugar] Group View: add search toolbar

2012-08-27 Thread Simon Schampijer
From: Simon Schampijer si...@laptop.org

This adds a search toolbar to the Group View. The toolbar in the
Neighborhood View has been outsourced to be usable in both Views.

Signed-off-by: Simon Schampijer si...@laptop.org
---
 src/jarabe/desktop/Makefile.am|  3 +-
 src/jarabe/desktop/groupbox.py| 41 +
 src/jarabe/desktop/meshbox.py | 77 +--
 src/jarabe/desktop/viewtoolbar.py | 97 +++
 4 files changed, 132 insertions(+), 86 deletions(-)
 create mode 100644 src/jarabe/desktop/viewtoolbar.py

diff --git a/src/jarabe/desktop/Makefile.am b/src/jarabe/desktop/Makefile.am
index b36404e..e27bc9c 100644
--- a/src/jarabe/desktop/Makefile.am
+++ b/src/jarabe/desktop/Makefile.am
@@ -15,4 +15,5 @@ sugar_PYTHON =\
 schoolserver.py\
snowflakelayout.py  \
transitionbox.py\
-   viewcontainer.py
+   viewcontainer.py\
+   viewtoolbar.py
diff --git a/src/jarabe/desktop/groupbox.py b/src/jarabe/desktop/groupbox.py
index 8beec90..94a5c10 100644
--- a/src/jarabe/desktop/groupbox.py
+++ b/src/jarabe/desktop/groupbox.py
@@ -16,27 +16,23 @@
 
 import logging
 
-import gconf
+import gtk
 
 from sugar.graphics import style
-from sugar.graphics.xocolor import XoColor
 
 from jarabe.view.buddyicon import BuddyIcon
-from jarabe.view.buddymenu import BuddyMenu
-from jarabe.view.eventicon import EventIcon
 from jarabe.model.buddy import get_owner_instance
 from jarabe.model import friends
 from jarabe.desktop.friendview import FriendView
 from jarabe.desktop.viewcontainer import ViewContainer
 from jarabe.desktop.favoriteslayout import SpreadLayout
+from jarabe.desktop.viewtoolbar import ViewToolbar
 
 
-class GroupBox(ViewContainer):
-__gtype_name__ = 'SugarGroupBox'
+class GroupContainer(ViewContainer):
+__gtype_name__ = 'SugarGroupContainer'
 
 def __init__(self):
-logging.debug('STARTUP: Loading the group view')
-
 layout = SpreadLayout()
 
 # Round off icon size to an even number to ensure that the icon
@@ -44,6 +40,25 @@ class GroupBox(ViewContainer):
style.LARGE_ICON_SIZE  ~1)
 ViewContainer.__init__(self, layout, owner_icon)
 
+
+class GroupBox(gtk.VBox):
+__gtype_name__ = 'SugarGroupBox'
+
+def __init__(self):
+logging.debug('STARTUP: Loading the group view')
+
+gtk.VBox.__init__(self)
+
+self._query = ''
+self._toolbar = ViewToolbar()
+self._toolbar.connect('query-changed', self._toolbar_query_changed_cb)
+self.pack_start(self._toolbar, expand=False)
+self._toolbar.show()
+
+self._group_container = GroupContainer()
+self.add(self._group_container)
+self._group_container.show()
+
 self._friends = {}
 
 friends_model = friends.get_model()
@@ -56,7 +71,7 @@ class GroupBox(ViewContainer):
 
 def add_friend(self, buddy_info):
 icon = FriendView(buddy_info)
-self.add(icon)
+self._group_container.add(icon)
 self._friends[buddy_info.get_key()] = icon
 icon.show()
 
@@ -65,6 +80,12 @@ class GroupBox(ViewContainer):
 
 def _friend_removed_cb(self, data_model, key):
 icon = self._friends[key]
-self.remove(icon)
+self._group_container.remove(icon)
 del self._friends[key]
 icon.destroy()
+
+def _toolbar_query_changed_cb(self, toolbar, query):
+self._query = query.lower()
+for icon in self._group_container.get_children():
+if hasattr(icon, 'set_filter'):
+icon.set_filter(self._query)
diff --git a/src/jarabe/desktop/meshbox.py b/src/jarabe/desktop/meshbox.py
index 412a093..8002a33 100644
--- a/src/jarabe/desktop/meshbox.py
+++ b/src/jarabe/desktop/meshbox.py
@@ -29,21 +29,19 @@ import gconf
 from sugar.graphics.icon import Icon
 from sugar.graphics import style
 from sugar.graphics import palette
-from sugar.graphics import iconentry
 from sugar.graphics.menuitem import MenuItem
-from sugar.graphics.xocolor import XoColor
 
 from jarabe.desktop.snowflakelayout import SnowflakeLayout
 from jarabe.model import neighborhood
 from jarabe.model.buddy import get_owner_instance
 from jarabe.view.buddyicon import BuddyIcon
-from jarabe.view.buddymenu import BuddyMenu
 from jarabe.view.eventicon import EventIcon
 from jarabe.desktop.networkviews import WirelessNetworkView
 from jarabe.desktop.networkviews import OlpcMeshView
 from jarabe.desktop.networkviews import SugarAdhocView
 from jarabe.desktop.viewcontainer import ViewContainer
 from jarabe.desktop.favoriteslayout import SpreadLayout
+from jarabe.desktop.viewtoolbar import ViewToolbar
 from jarabe.model import network
 from jarabe.model.network import AccessPoint
 from jarabe.model.olpcmesh import OlpcMeshManager
@@ -54,9 +52,6 @@ from jarabe.journal import misc
 _AP_ICON_NAME = 'network-wireless'
 

Re: [Sugar-devel] [PATCH sugar] Group View: add search toolbar

2012-08-27 Thread Manuel Quiñones
Great Simon,

the only thing I see is that we should focus the search entry, like in
the other views:

--- a/src/jarabe/desktop/homewindow.py
+++ b/src/jarabe/desktop/homewindow.py
@@ -182,6 +182,7 @@ class HomeWindow(gtk.Window):
 elif level == ShellModel.ZOOM_GROUP:
 self.add(self._group_box)
 self._group_box.show()
+self._group_box.focus_search_entry()
 elif level == ShellModel.ZOOM_MESH:
 self.add(self._mesh_box)
 self._mesh_box.show()


2012/8/27 Simon Schampijer si...@schampijer.de:
 From: Simon Schampijer si...@laptop.org

 This adds a search toolbar to the Group View. The toolbar in the
 Neighborhood View has been outsourced to be usable in both Views.

 Signed-off-by: Simon Schampijer si...@laptop.org

Acked-by: Manuel Quiñones ma...@laptop.org

 ---
  src/jarabe/desktop/Makefile.am|  3 +-
  src/jarabe/desktop/groupbox.py| 41 +
  src/jarabe/desktop/meshbox.py | 77 +--
  src/jarabe/desktop/viewtoolbar.py | 97 
 +++
  4 files changed, 132 insertions(+), 86 deletions(-)
  create mode 100644 src/jarabe/desktop/viewtoolbar.py

 diff --git a/src/jarabe/desktop/Makefile.am b/src/jarabe/desktop/Makefile.am
 index b36404e..e27bc9c 100644
 --- a/src/jarabe/desktop/Makefile.am
 +++ b/src/jarabe/desktop/Makefile.am
 @@ -15,4 +15,5 @@ sugar_PYTHON =\
  schoolserver.py\
 snowflakelayout.py  \
 transitionbox.py\
 -   viewcontainer.py
 +   viewcontainer.py\
 +   viewtoolbar.py
 diff --git a/src/jarabe/desktop/groupbox.py b/src/jarabe/desktop/groupbox.py
 index 8beec90..94a5c10 100644
 --- a/src/jarabe/desktop/groupbox.py
 +++ b/src/jarabe/desktop/groupbox.py
 @@ -16,27 +16,23 @@

  import logging

 -import gconf
 +import gtk

  from sugar.graphics import style
 -from sugar.graphics.xocolor import XoColor

  from jarabe.view.buddyicon import BuddyIcon
 -from jarabe.view.buddymenu import BuddyMenu
 -from jarabe.view.eventicon import EventIcon
  from jarabe.model.buddy import get_owner_instance
  from jarabe.model import friends
  from jarabe.desktop.friendview import FriendView
  from jarabe.desktop.viewcontainer import ViewContainer
  from jarabe.desktop.favoriteslayout import SpreadLayout
 +from jarabe.desktop.viewtoolbar import ViewToolbar


 -class GroupBox(ViewContainer):
 -__gtype_name__ = 'SugarGroupBox'
 +class GroupContainer(ViewContainer):
 +__gtype_name__ = 'SugarGroupContainer'

  def __init__(self):
 -logging.debug('STARTUP: Loading the group view')
 -
  layout = SpreadLayout()

  # Round off icon size to an even number to ensure that the icon
 @@ -44,6 +40,25 @@ class GroupBox(ViewContainer):
 style.LARGE_ICON_SIZE  ~1)
  ViewContainer.__init__(self, layout, owner_icon)

 +
 +class GroupBox(gtk.VBox):
 +__gtype_name__ = 'SugarGroupBox'
 +
 +def __init__(self):
 +logging.debug('STARTUP: Loading the group view')
 +
 +gtk.VBox.__init__(self)
 +
 +self._query = ''
 +self._toolbar = ViewToolbar()
 +self._toolbar.connect('query-changed', 
 self._toolbar_query_changed_cb)
 +self.pack_start(self._toolbar, expand=False)
 +self._toolbar.show()
 +
 +self._group_container = GroupContainer()
 +self.add(self._group_container)
 +self._group_container.show()
 +
  self._friends = {}

  friends_model = friends.get_model()
 @@ -56,7 +71,7 @@ class GroupBox(ViewContainer):

  def add_friend(self, buddy_info):
  icon = FriendView(buddy_info)
 -self.add(icon)
 +self._group_container.add(icon)
  self._friends[buddy_info.get_key()] = icon
  icon.show()

 @@ -65,6 +80,12 @@ class GroupBox(ViewContainer):

  def _friend_removed_cb(self, data_model, key):
  icon = self._friends[key]
 -self.remove(icon)
 +self._group_container.remove(icon)
  del self._friends[key]
  icon.destroy()
 +
 +def _toolbar_query_changed_cb(self, toolbar, query):
 +self._query = query.lower()
 +for icon in self._group_container.get_children():
 +if hasattr(icon, 'set_filter'):
 +icon.set_filter(self._query)
 diff --git a/src/jarabe/desktop/meshbox.py b/src/jarabe/desktop/meshbox.py
 index 412a093..8002a33 100644
 --- a/src/jarabe/desktop/meshbox.py
 +++ b/src/jarabe/desktop/meshbox.py
 @@ -29,21 +29,19 @@ import gconf
  from sugar.graphics.icon import Icon
  from sugar.graphics import style
  from sugar.graphics import palette
 -from sugar.graphics import iconentry
  from sugar.graphics.menuitem import MenuItem
 -from sugar.graphics.xocolor import XoColor

  from jarabe.desktop.snowflakelayout import SnowflakeLayout
  from jarabe.model import neighborhood
  from jarabe.model.buddy 

[Sugar-devel] [PATCH sugar] Use the new toolbars in the Journal

2012-08-27 Thread Manuel Quiñones
Initial patch provided by Gonzalo Odiard for the shell port.

Signed-off-by: Manuel Quiñones ma...@laptop.org
---
 src/jarabe/journal/journalactivity.py | 20 +++---
 src/jarabe/journal/journaltoolbox.py  | 49 +++
 src/jarabe/journal/objectchooser.py   |  4 +--
 3 files changed, 26 insertions(+), 47 deletions(-)

diff --git a/src/jarabe/journal/journalactivity.py 
b/src/jarabe/journal/journalactivity.py
index bb1c7f6..1132f82 100644
--- a/src/jarabe/journal/journalactivity.py
+++ b/src/jarabe/journal/journalactivity.py
@@ -181,16 +181,15 @@ class JournalActivity(JournalWindow):
 self._volumes_toolbar.connect('volume-error', self.__volume_error_cb)
 self._main_view.pack_start(self._volumes_toolbar, expand=False)
 
-search_toolbar = self._main_toolbox.search_toolbar
-search_toolbar.connect('query-changed', self._query_changed_cb)
-search_toolbar.set_mount_point('/')
+self._main_toolbox.connect('query-changed', self._query_changed_cb)
+self._main_toolbox.set_mount_point('/')
 
 def _setup_secondary_view(self):
 self._secondary_view = gtk.VBox()
 
 self._detail_toolbox = DetailToolbox()
-self._detail_toolbox.entry_toolbar.connect('volume-error',
-   self.__volume_error_cb)
+self._detail_toolbox.connect('volume-error',
+ self.__volume_error_cb)
 
 self._detail_view = DetailView()
 self._detail_view.connect('go-back-clicked', self.__go_back_clicked_cb)
@@ -206,7 +205,7 @@ class JournalActivity(JournalWindow):
 self._show_secondary_view(object_id)
 
 def __clear_clicked_cb(self, list_view):
-self._main_toolbox.search_toolbar.clear_query()
+self._main_toolbox.clear_query()
 
 def __go_back_clicked_cb(self, detail_view):
 self.show_main_view()
@@ -227,7 +226,7 @@ class JournalActivity(JournalWindow):
 def _show_secondary_view(self, object_id):
 metadata = model.get(object_id)
 try:
-self._detail_toolbox.entry_toolbar.set_metadata(metadata)
+self._detail_toolbox.set_metadata(metadata)
 except Exception:
 logging.exception('Exception while displaying entry:')
 
@@ -252,12 +251,12 @@ class JournalActivity(JournalWindow):
 
 def __volume_changed_cb(self, volume_toolbar, mount_point):
 logging.debug('Selected volume: %r.', mount_point)
-self._main_toolbox.search_toolbar.set_mount_point(mount_point)
+self._main_toolbox.set_mount_point(mount_point)
 self._main_toolbox.set_current_toolbar(0)
 
 def __model_created_cb(self, sender, **kwargs):
 self._check_for_bundle(kwargs['object_id'])
-self._main_toolbox.search_toolbar.refresh_filters()
+self._main_toolbox.refresh_filters()
 self._check_available_space()
 
 def __model_updated_cb(self, sender, **kwargs):
@@ -315,8 +314,7 @@ class JournalActivity(JournalWindow):
 model.write(metadata)
 
 def search_grab_focus(self):
-search_toolbar = self._main_toolbox.search_toolbar
-search_toolbar.give_entry_focus()
+self._main_toolbox.give_entry_focus()
 
 def __window_state_event_cb(self, window, event):
 logging.debug('window_state_event_cb %r', self)
diff --git a/src/jarabe/journal/journaltoolbox.py 
b/src/jarabe/journal/journaltoolbox.py
index 9a5f5a2..70e58ac 100644
--- a/src/jarabe/journal/journaltoolbox.py
+++ b/src/jarabe/journal/journaltoolbox.py
@@ -28,7 +28,7 @@ import glib
 import gtk
 
 from sugar.graphics.palette import Palette
-from sugar.graphics.toolbox import Toolbox
+from sugar.graphics.toolbarbox import ToolbarBox
 from sugar.graphics.toolcombobox import ToolComboBox
 from sugar.graphics.toolbutton import ToolButton
 from sugar.graphics.toggletoolbutton import ToggleToolButton
@@ -65,17 +65,7 @@ _ACTION_MY_FRIENDS = 1
 _ACTION_MY_CLASS = 2
 
 
-class MainToolbox(Toolbox):
-def __init__(self):
-Toolbox.__init__(self)
-
-self.search_toolbar = SearchToolbar()
-self.search_toolbar.set_size_request(-1, style.GRID_CELL_SIZE)
-self.add_toolbar(_('Search'), self.search_toolbar)
-self.search_toolbar.show()
-
-
-class SearchToolbar(gtk.Toolbar):
+class MainToolbox(ToolbarBox):
 __gtype_name__ = 'SearchToolbar'
 
 __gsignals__ = {
@@ -84,7 +74,7 @@ class SearchToolbar(gtk.Toolbar):
 }
 
 def __init__(self):
-gtk.Toolbar.__init__(self)
+ToolbarBox.__init__(self)
 
 self._mount_point = None
 
@@ -100,25 +90,25 @@ class SearchToolbar(gtk.Toolbar):
 self._favorite_button = ToggleToolButton('emblem-favorite')
 self._favorite_button.connect('toggled',
   self.__favorite_button_toggled_cb)
-self.insert(self._favorite_button, -1)
+self.toolbar.insert(self._favorite_button, -1)
 

[Sugar-devel] [sugar-toolkit-gtk3] Set default python encoding to utf-8

2012-08-27 Thread godiard
From: Gonzalo Odiard godi...@gmail.com

As spoted by Daniel Narvaez in [1], pygi does not set the default encoding
anymore as the old gtk did. This change break ported activities.
The change in gtk was discussed upstream here [2]
A better solution will be implemented when we port to python 3,
when we will be able to use real unicode strings.

Signed-off-by: Gonzalo Odiard gonz...@laptop.org

[1] http://lists.sugarlabs.org/archive/sugar-devel/2012-August/038993.html
[2] https://bugzilla.gnome.org/show_bug.cgi?id=681915
---
 bin/sugar-activity | 5 +
 1 file changed, 5 insertions(+)

diff --git a/bin/sugar-activity b/bin/sugar-activity
index 5aef1ae..839174a 100644
--- a/bin/sugar-activity
+++ b/bin/sugar-activity
@@ -18,6 +18,11 @@
 
 import os
 import sys
+# Change the default encoding to avoid UnicodeDecodeError
+# http://lists.sugarlabs.org/archive/sugar-devel/2012-August/038928.html
+reload(sys)
+sys.setdefaultencoding('utf-8')
+
 import gettext
 from optparse import OptionParser
 
-- 
1.7.11.2

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


[Sugar-devel] [PATCH sugar] Add toolbar to the TransitionBox

2012-08-27 Thread Manuel Quiñones
With the new frame behaviour the toolbar was appearing and
disappearing while the transition took place.  this patch adds a
toolbar in the transition box with a fake search entry, that is set
editable=False to prevent issues.

Signed-off-by: Manuel Quiñones ma...@laptop.org
---
 src/jarabe/desktop/transitionbox.py | 75 +++--
 1 file changed, 71 insertions(+), 4 deletions(-)

diff --git a/src/jarabe/desktop/transitionbox.py 
b/src/jarabe/desktop/transitionbox.py
index 54a70de..62764d7 100644
--- a/src/jarabe/desktop/transitionbox.py
+++ b/src/jarabe/desktop/transitionbox.py
@@ -14,10 +14,12 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
+import gtk
 import gobject
 
 from sugar.graphics import style
 from sugar.graphics import animator
+from sugar.graphics import iconentry
 
 from jarabe.model.buddy import get_owner_instance
 from jarabe.view.buddyicon import BuddyIcon
@@ -36,7 +38,63 @@ class _Animation(animator.Animation):
 self._icon.props.pixel_size = int(self.start_size + d)
 
 
-class TransitionBox(BuddyIcon):
+class ViewToolbar(gtk.Toolbar):
+def __init__(self):
+gtk.Toolbar.__init__(self)
+
+separator = gtk.SeparatorToolItem()
+separator.props.draw = False
+separator.set_size_request(style.GRID_CELL_SIZE,
+   style.GRID_CELL_SIZE)
+self.insert(separator, -1)
+separator.show()
+
+tool_item = gtk.ToolItem()
+self.insert(tool_item, -1)
+tool_item.show()
+
+self.search_entry = iconentry.IconEntry()
+self.search_entry.set_icon_from_name(iconentry.ICON_ENTRY_PRIMARY,
+ 'system-search')
+self.search_entry.set_width_chars(25)
+self.search_entry.props.editable = False
+tool_item.add(self.search_entry)
+self.search_entry.show()
+
+
+class ViewContainer(gtk.HBox):
+def __init__(self, owner_icon):
+gtk.Container.__init__(self)
+self._owner_icon = owner_icon
+self.add(self._owner_icon)
+self._owner_icon.show()
+self.connect('size-allocate', self.__on_size_allocate)
+
+def __on_size_allocate(self, widget, allocation):
+owner_width, owner_height = self._owner_icon.size_request()
+height = allocation.height + allocation.y
+width = allocation.width
+
+# Find vertical center point of screen
+y = height / 2
+
+# This container may be offset from the top by a certain amount
+# (e.g. for a toolbar at the top of the screen). Adjust the
+# center-point for that
+y -= allocation.y
+
+# Now subtract half of the owner height. This gives us the y
+# coordinate for the top of the owner icon.
+y -= owner_height / 2
+
+# calculate x coordinate and create allocation
+x = (width - owner_width) / 2
+owner_icon_allocation = gtk.gdk.Rectangle(x, allocation.y + y,
+  owner_width, owner_height)
+self._owner_icon.size_allocate(owner_icon_allocation)
+
+
+class TransitionBox(gtk.VBox):
 __gtype_name__ = 'SugarTransitionBox'
 
 __gsignals__ = {
@@ -44,8 +102,17 @@ class TransitionBox(BuddyIcon):
 }
 
 def __init__(self):
-BuddyIcon.__init__(self, buddy=get_owner_instance(),
-   pixel_size=style.XLARGE_ICON_SIZE)
+gtk.VBox.__init__(self)
+
+self._toolbar = ViewToolbar()
+self.pack_start(self._toolbar, expand=False)
+self._toolbar.show()
+
+self._owner_icon = BuddyIcon(buddy=get_owner_instance(),
+ pixel_size=style.XLARGE_ICON_SIZE)
+view_container = ViewContainer(self._owner_icon)
+self.add(view_container)
+view_container.show()
 
 self._animator = animator.Animator(0.3)
 self._animator.connect('completed', self._animation_completed_cb)
@@ -55,5 +122,5 @@ class TransitionBox(BuddyIcon):
 
 def start_transition(self, start_size, end_size):
 self._animator.remove_all()
-self._animator.add(_Animation(self, start_size, end_size))
+self._animator.add(_Animation(self._owner_icon, start_size, end_size))
 self._animator.start()
-- 
1.7.11.4

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


Re: [Sugar-devel] [PATCH sugar] Add toolbar to the TransitionBox

2012-08-27 Thread Gonzalo Odiard
Can't you use the ViewToolbar in the last patch from erikos?

from jarabe.desktop.viewtoolbar import ViewToolbar

Gonzalo



On Mon, Aug 27, 2012 at 11:29 AM, Manuel Quiñones ma...@laptop.org wrote:

 With the new frame behaviour the toolbar was appearing and
 disappearing while the transition took place.  this patch adds a
 toolbar in the transition box with a fake search entry, that is set
 editable=False to prevent issues.

 Signed-off-by: Manuel Quiñones ma...@laptop.org
 ---
  src/jarabe/desktop/transitionbox.py | 75
 +++--
  1 file changed, 71 insertions(+), 4 deletions(-)

 diff --git a/src/jarabe/desktop/transitionbox.py
 b/src/jarabe/desktop/transitionbox.py
 index 54a70de..62764d7 100644
 --- a/src/jarabe/desktop/transitionbox.py
 +++ b/src/jarabe/desktop/transitionbox.py
 @@ -14,10 +14,12 @@
  # along with this program; if not, write to the Free Software
  # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
  USA

 +import gtk
  import gobject

  from sugar.graphics import style
  from sugar.graphics import animator
 +from sugar.graphics import iconentry

  from jarabe.model.buddy import get_owner_instance
  from jarabe.view.buddyicon import BuddyIcon
 @@ -36,7 +38,63 @@ class _Animation(animator.Animation):
  self._icon.props.pixel_size = int(self.start_size + d)


 -class TransitionBox(BuddyIcon):
 +class ViewToolbar(gtk.Toolbar):
 +def __init__(self):
 +gtk.Toolbar.__init__(self)
 +
 +separator = gtk.SeparatorToolItem()
 +separator.props.draw = False
 +separator.set_size_request(style.GRID_CELL_SIZE,
 +   style.GRID_CELL_SIZE)
 +self.insert(separator, -1)
 +separator.show()
 +
 +tool_item = gtk.ToolItem()
 +self.insert(tool_item, -1)
 +tool_item.show()
 +
 +self.search_entry = iconentry.IconEntry()
 +self.search_entry.set_icon_from_name(iconentry.ICON_ENTRY_PRIMARY,
 + 'system-search')
 +self.search_entry.set_width_chars(25)
 +self.search_entry.props.editable = False
 +tool_item.add(self.search_entry)
 +self.search_entry.show()
 +
 +
 +class ViewContainer(gtk.HBox):
 +def __init__(self, owner_icon):
 +gtk.Container.__init__(self)
 +self._owner_icon = owner_icon
 +self.add(self._owner_icon)
 +self._owner_icon.show()
 +self.connect('size-allocate', self.__on_size_allocate)
 +
 +def __on_size_allocate(self, widget, allocation):
 +owner_width, owner_height = self._owner_icon.size_request()
 +height = allocation.height + allocation.y
 +width = allocation.width
 +
 +# Find vertical center point of screen
 +y = height / 2
 +
 +# This container may be offset from the top by a certain amount
 +# (e.g. for a toolbar at the top of the screen). Adjust the
 +# center-point for that
 +y -= allocation.y
 +
 +# Now subtract half of the owner height. This gives us the y
 +# coordinate for the top of the owner icon.
 +y -= owner_height / 2
 +
 +# calculate x coordinate and create allocation
 +x = (width - owner_width) / 2
 +owner_icon_allocation = gtk.gdk.Rectangle(x, allocation.y + y,
 +  owner_width,
 owner_height)
 +self._owner_icon.size_allocate(owner_icon_allocation)
 +
 +
 +class TransitionBox(gtk.VBox):
  __gtype_name__ = 'SugarTransitionBox'

  __gsignals__ = {
 @@ -44,8 +102,17 @@ class TransitionBox(BuddyIcon):
  }

  def __init__(self):
 -BuddyIcon.__init__(self, buddy=get_owner_instance(),
 -   pixel_size=style.XLARGE_ICON_SIZE)
 +gtk.VBox.__init__(self)
 +
 +self._toolbar = ViewToolbar()
 +self.pack_start(self._toolbar, expand=False)
 +self._toolbar.show()
 +
 +self._owner_icon = BuddyIcon(buddy=get_owner_instance(),
 + pixel_size=style.XLARGE_ICON_SIZE)
 +view_container = ViewContainer(self._owner_icon)
 +self.add(view_container)
 +view_container.show()

  self._animator = animator.Animator(0.3)
  self._animator.connect('completed', self._animation_completed_cb)
 @@ -55,5 +122,5 @@ class TransitionBox(BuddyIcon):

  def start_transition(self, start_size, end_size):
  self._animator.remove_all()
 -self._animator.add(_Animation(self, start_size, end_size))
 +self._animator.add(_Animation(self._owner_icon, start_size,
 end_size))
  self._animator.start()
 --
 1.7.11.4

 ___
 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

Re: [Sugar-devel] [PATCH sugar] Add toolbar to the TransitionBox

2012-08-27 Thread Manuel Quiñones
2012/8/27 Gonzalo Odiard gonz...@laptop.org:
 Can't you use the ViewToolbar in the last patch from erikos?

 from jarabe.desktop.viewtoolbar import ViewToolbar

I based this one on that.  But this is a fake one, doesn't need logic,
doesn't need to connect to events, and the entry has editable=False.

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


Re: [Sugar-devel] [PATCH sugar] Add toolbar to the TransitionBox

2012-08-27 Thread Gonzalo Odiard
On Mon, Aug 27, 2012 at 11:46 AM, Manuel Quiñones ma...@laptop.org wrote:

 2012/8/27 Gonzalo Odiard gonz...@laptop.org:
  Can't you use the ViewToolbar in the last patch from erikos?
 
  from jarabe.desktop.viewtoolbar import ViewToolbar

 I based this one on that.  But this is a fake one, doesn't need logic,
 doesn't need to connect to events, and the entry has editable=False.


Hmm, is not a good reason to cpy/paste the code IMHO

Gonzalo



 --
 .. manuq ..

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


[Sugar-devel] [PATCH sugar-artwork] Remove radius between the two sides of the GtkScale trough

2012-08-27 Thread Manuel Quiñones
We had a radius set for all the corners of the trough, and that was
making the bar rounded at the two sides of the slider.  This was
partially hidden below the slider.

Also remove the hardcoded number for the radius.

The GtkScale still needs love.

Signed-off-by: Manuel Quiñones ma...@laptop.org
---
 gtk3/theme/gtk-widgets.css.em | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/gtk3/theme/gtk-widgets.css.em b/gtk3/theme/gtk-widgets.css.em
index 5549970..ba30804 100644
--- a/gtk3/theme/gtk-widgets.css.em
+++ b/gtk3/theme/gtk-widgets.css.em
@@ -562,11 +562,18 @@ GtkScale {
 
 GtkScale.trough {
 border-style: solid;
-border-radius: 30px;
 border-color: @button_grey;
 border-width: 2px;
 }
 
+GtkVScale.trough {
+border-radius: 0px 0px $(2*subcell_size)px $(2*subcell_size)px;
+}
+
+GtkHScale.trough {
+border-radius: 0px $(2*subcell_size)px $(2*subcell_size)px 0px;
+}
+
 GtkScale.trough:focused {
 border-color: @white;
 }
@@ -575,6 +582,13 @@ GtkScale.trough.top, GtkScale.trough.left {
 background-color: @white;
 }
 
+GtkScale.trough.top {
+border-radius: $(2*subcell_size)px $(2*subcell_size)px 0px 0px;
+}
+GtkScale.trough.left {
+border-radius: $(2*subcell_size)px 0px 0px $(2*subcell_size)px;
+}
+
 GtkScale.slider {
 color: alpha(@theme_base_color, 0.0);
 background-color: alpha(@theme_base_color, 0.0);
-- 
1.7.11.4

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


Re: [Sugar-devel] Sugar Activity template for HTML5/Enyo

2012-08-27 Thread James Simmons
What it sounds like you could do is incorporate the ENYO framework into the
Read Activity, then make EPUB format books that include JavaScript.  Since
Read uses WebKit it already renders EPUB books created from web pages (like
those from Project Gutenberg) better than Nooks and Kindles do, and having
some JavaScript on the pages would be a natural thing to experiment with.

James Simmons

On Sun, Aug 26, 2012 at 3:34 PM, lio...@olpc-france.org wrote:


 Hi Edward,

 Thanks.

 Using my template in existing activity is easy. It just need a WebView
 Widget which encapsulate the WebKit browser.
 But, of course, it require Sugar 0.96 - Gtk3.
 Creating interactive tutorial could be a good idea because, with this
 framework, the HTML5 page could be notified when a Widget has changed or
 could launch an action on a Widget. So, it's basic for an interactive
 tutorial.
 I don't know for Scratch but AFAK, EToys is built with a very different
 approach than Sugar Python so I'm afraid it could not use in the same way.

 Best regards from France.

 Lionel.



 --

 Message: 3
 Date: Sat, 25 Aug 2012 18:11:54 -0400
 From: Edward Mokurai Cherlin moku...@sugarlabs.org
 To: Sugar Devel sugar-devel@lists.sugarlabs.org
 Subject: [Sugar-devel]  Sugar Activity template for HTML5/Enyo
 Message-ID:
 
 cadmpiaaokhd-4skfbmnvm7wba1bqqonax9xrfdqfoylzzcp...@mail.gmail.com
 Content-Type: text/plain; charset=UTF-8

 Excellent. I have been wanting a way to use HTML5 with various Sugar
 activities in the Replacing Textbooks program, both to write
 interactive tutorials on the activities, and to write subject-matter
 materials incorporating Sugar. Can you see how to do this? Can we
 adapt existing activities in Python and other languages to work with
 your template? What would it take to link to Etoys and Scratch, as the
 next language extension?


 ___
 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] [PATCH sugar] Drop support for XdndDirectSave

2012-08-27 Thread Simon Schampijer

On 08/24/2012 02:12 PM, Daniel Narvaez wrote:

From: Daniel Narvaez dwnarv...@gmail.com

It was added to allow dragging images from the old mozilla based
web browser to the frame. The mozilla side of the patch was never
upstreamed and anyway the new webkit based browser doesn't support
the protocol.

This is preliminary to the gtk3 port, we are trying to get rid of
window.property_change calls which are not working with introspection.
---


Thanks Daniel!

I adjusted the commit message slightly and removed a few unneeded 
imports after your changes. Pushed as: 
http://git.sugarlabs.org/sugar/mainline/commit/2a25005eda0eecdfb2c10d730b90ae306b4eda89


Regards,
   Simon

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


Re: [Sugar-devel] [PATCH v3 sugar-toolkit-gtk3] Fix the drawing of ColorToolButton, RadioToolButton and ToggleToolButton

2012-08-27 Thread Simon Schampijer

On 08/24/2012 02:13 AM, Manuel Quiñones wrote:

Draw a black background in the buttons when the palette is up, as
commit 01a06943 did with the ToolButton.  As the comment for that
commit states, we can change the prelight background color in the
theme, but not when the mouse moves over the Palette.

Also add testcase to test the three toolbuttons.

Signed-off-by: Manuel Quiñones ma...@laptop.org

---

v2: Paint the background color as per Simon's feedback.
v3: Add testcase.


Thanks Manuel for the follow up. Looks good to me now. Acked-by me.

As a follow up we need to see the theming of the sliders in the color 
button palette and the theming issue we diagnosed in .button:focused.


Cheers,
   Simon

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


Re: [Sugar-devel] [PATCH v3 sugar-toolkit-gtk3] Fix the drawing of ColorToolButton, RadioToolButton and ToggleToolButton

2012-08-27 Thread Manuel Quiñones
2012/8/27 Simon Schampijer si...@schampijer.de:
 On 08/24/2012 02:13 AM, Manuel Quiñones wrote:

 Draw a black background in the buttons when the palette is up, as
 commit 01a06943 did with the ToolButton.  As the comment for that
 commit states, we can change the prelight background color in the
 theme, but not when the mouse moves over the Palette.

 Also add testcase to test the three toolbuttons.

 Signed-off-by: Manuel Quiñones ma...@laptop.org

 ---

 v2: Paint the background color as per Simon's feedback.
 v3: Add testcase.


 Thanks Manuel for the follow up. Looks good to me now. Acked-by me.

Thanks, pushed.

 As a follow up we need to see the theming of the sliders in the color button
 palette and the theming issue we diagnosed in .button:focused.

Yes!  Patch coming for artwork.

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


Re: [Sugar-devel] Sugar Activity template for HTML5/Enyo

2012-08-27 Thread Gonzalo Odiard
I don't understand the relation.
We already use webkit, then, we can use play javascript if needed.
I think epub2 standard does not allow javascript, I don't know epub3

Gonzalo

On Mon, Aug 27, 2012 at 1:39 PM, James Simmons nices...@gmail.com wrote:

 What it sounds like you could do is incorporate the ENYO framework into
 the Read Activity, then make EPUB format books that include JavaScript.
 Since Read uses WebKit it already renders EPUB books created from web pages
 (like those from Project Gutenberg) better than Nooks and Kindles do, and
 having some JavaScript on the pages would be a natural thing to experiment
 with.

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


[Sugar-devel] [PATCH Jukebox] Stop player on focus lost

2012-08-27 Thread Manuel Kaufmann
Stop the player when the user is reproducing a video and switch to
another activity.

Signed-off-by: Manuel Kaufmann humi...@gmail.com
---
 jukeboxactivity.py | 23 ---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/jukeboxactivity.py b/jukeboxactivity.py
index e900263..cb116a8 100644
--- a/jukeboxactivity.py
+++ b/jukeboxactivity.py
@@ -131,6 +131,11 @@ class JukeboxActivity(activity.Activity):
 toolbar_box.show_all()
 self.connect(key_press_event, self._key_press_event_cb)
 
+# We want to be notified when the activity gets the focus or
+# loses it.  When it is not active, we don't need to keep
+# reproducing the video
+self.connect(notify::active, self._notify_active_cb)
+
 if handle.uri:
 pass
 elif self._shared_activity:
@@ -155,7 +160,6 @@ class JukeboxActivity(activity.Activity):
 self.playflag = False
 self.tags = {}
 self.only_audio = False
-self.got_stream_info = False
 
 self.tag_reader = TagReader()
 self.tag_reader.connect('get-tags', self.__get_tags_cb)
@@ -187,6 +191,20 @@ class JukeboxActivity(activity.Activity):
 self.uri = handle.uri
 gobject.idle_add(self._start, self.uri, handle.title)
 
+def _notify_active_cb(self, widget, event):
+Sugar notify us that the activity is becoming active or
+inactive.
+
+When we are inactive, we stop the player if it is reproducing
+a video.
+
+
+if self.player is not None and not self.only_audio:
+if not self.player.is_playing() and self.props.active:
+self.player.play()
+if self.player.is_playing() and not self.props.active:
+self.player.pause()
+
 def _switch_canvas(self, show_video):
 Show or hide the video visualization in the canvas.
 
@@ -333,7 +351,7 @@ class JukeboxActivity(activity.Activity):
 self.tags[gst.TAG_ARTIST], album)
 
 def _player_stream_info_cb(self, widget, stream_info):
-if not len(stream_info) or self.got_stream_info:
+if not len(stream_info):
 return
 
 GST_STREAM_TYPE_UNKNOWN = 0
@@ -346,7 +364,6 @@ class JukeboxActivity(activity.Activity):
 if item.props.type == GST_STREAM_TYPE_VIDEO:
 only_audio = False
 self.only_audio = only_audio
-self.got_stream_info = True
 self._update_overlay()
 
 def _joined_cb(self, activity):
-- 
1.7.11.4

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


Re: [Sugar-devel] [PATCH Jukebox] Stop player on focus lost

2012-08-27 Thread Manuel Kaufmann
On Mon, Aug 27, 2012 at 2:28 PM, Manuel Kaufmann humi...@gmail.com wrote:
 Stop the player when the user is reproducing a video and switch to
 another activity.

This patch is for sugar-0.94 branch / gtk2

-- 
Kaufmann Manuel
Blog: http://humitos.wordpress.com/
Porfolio: http://fotos.mkaufmann.com.ar/
PyAr: http://www.python.com.ar/
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH sugar-toolkit-gtk3] Video Mime types

2012-08-27 Thread Manuel Kaufmann
On Mon, Aug 27, 2012 at 2:26 PM, Simon Schampijer si...@schampijer.de wrote:
 Pushed the toolkit-gtk3 patch for this with an enhanced description:

Great! I'm happy to read this email. Thanks!

-- 
Kaufmann Manuel
Blog: http://humitos.wordpress.com/
Porfolio: http://fotos.mkaufmann.com.ar/
PyAr: http://www.python.com.ar/
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH sugar-toolkit-gtk3] Video Mime types

2012-08-27 Thread Manuel Kaufmann
On Mon, Aug 27, 2012 at 2:31 PM, Manuel Kaufmann humi...@gmail.com wrote:
 On Mon, Aug 27, 2012 at 2:26 PM, Simon Schampijer si...@schampijer.de wrote:
 Pushed the toolkit-gtk3 patch for this with an enhanced description:

 Great! I'm happy to read this email. Thanks!

Sorry, I sent the email accidentally.

What's about gtk2 sugar toolkit? Should I send a patch for it as well?

-- 
Kaufmann Manuel
Blog: http://humitos.wordpress.com/
Porfolio: http://fotos.mkaufmann.com.ar/
PyAr: http://www.python.com.ar/
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH v3 sugar-toolkit-gtk3] Fix the drawing of ColorToolButton, RadioToolButton and ToggleToolButton

2012-08-27 Thread Gonzalo Odiard
It's the toolbar size already solved? http://bugs.sugarlabs.org/ticket/3388

Gonzalo

On Mon, Aug 27, 2012 at 2:15 PM, Manuel Quiñones ma...@laptop.org wrote:

 2012/8/27 Simon Schampijer si...@schampijer.de:
  On 08/24/2012 02:13 AM, Manuel Quiñones wrote:
 
  Draw a black background in the buttons when the palette is up, as
  commit 01a06943 did with the ToolButton.  As the comment for that
  commit states, we can change the prelight background color in the
  theme, but not when the mouse moves over the Palette.
 
  Also add testcase to test the three toolbuttons.
 
  Signed-off-by: Manuel Quiñones ma...@laptop.org
 
  ---
 
  v2: Paint the background color as per Simon's feedback.
  v3: Add testcase.
 
 
  Thanks Manuel for the follow up. Looks good to me now. Acked-by me.

 Thanks, pushed.

  As a follow up we need to see the theming of the sliders in the color
 button
  palette and the theming issue we diagnosed in .button:focused.

 Yes!  Patch coming for artwork.

 --
 .. manuq ..
 ___
 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 sugar-toolkit-gtk3] Add testcase for Gtk buttons

2012-08-27 Thread Manuel Quiñones
Signed-off-by: Manuel Quiñones ma...@laptop.org
---
 tests/graphics/buttons.py | 57 +++
 1 file changed, 57 insertions(+)
 create mode 100644 tests/graphics/buttons.py

diff --git a/tests/graphics/buttons.py b/tests/graphics/buttons.py
new file mode 100644
index 000..6e6969a
--- /dev/null
+++ b/tests/graphics/buttons.py
@@ -0,0 +1,57 @@
+from gi.repository import Gtk
+
+import common
+
+
+test = common.Test()
+test.show()
+
+vbox = Gtk.VBox()
+test.pack_start(vbox, True, True, 0)
+vbox.show()
+
+# test Gtk.SpinButton:
+
+adj = Gtk.Adjustment(0, 0, 10, 1, 32, 0)
+spin = Gtk.SpinButton()
+spin.set_adjustment(adj)
+vbox.pack_start(spin, False, False, 1)
+spin.show()
+
+# test Gtk.RadioButton:
+
+radio_1 = Gtk.RadioButton.new_with_label_from_widget(None, 'Radio 1')
+vbox.pack_start(radio_1, False, False, 1)
+radio_1.show()
+radio_2 = Gtk.RadioButton.new_with_label_from_widget(radio_1, 'Radio 2')
+vbox.pack_start(radio_2, False, False, 1)
+radio_2.show()
+radio_3 = Gtk.RadioButton.new_with_label_from_widget(radio_1, 'Radio 3')
+vbox.pack_start(radio_3, False, False, 1)
+radio_3.show()
+
+# test Gtk.CheckButton:
+
+check_1 = Gtk.CheckButton('Check 1')
+vbox.pack_start(check_1, False, False, 1)
+check_1.show()
+
+check_2 = Gtk.CheckButton('Check 2')
+vbox.pack_start(check_2, False, False, 1)
+check_2.show()
+
+# test Gtk.Button:
+
+button = Gtk.Button('Button')
+vbox.pack_start(button, False, False, 1)
+button.show()
+
+# test Gtk.ToggleButton:
+
+toggle_button = Gtk.ToggleButton('ToggleButton')
+vbox.pack_start(toggle_button, False, False, 1)
+toggle_button.show()
+
+
+if __name__ == '__main__':
+common.main(test)
-- 
1.7.11.4

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


[Sugar-devel] [PATCH sugar-artwork] Remove colors, borders and paddings set for all the widgets, fix Button borders

2012-08-27 Thread Manuel Quiñones
The * {} and *:active {} CSS rules apply to all the widgets so they
have to be overriden many times.  We should do that for each widget
when needed instead.

Also fix the border for the GtkButton.  We have a white outline in its
focused state.  This is implemented as a CSS border in the GTK3+
version.  But if the button doesn't have a border in the normal state,
we get a resize in the parent widget.  This patch adds a border that
is the same color than the button background for the normal state.
Also adds a white background to the active (pressed) state.

Signed-off-by: Manuel Quiñones ma...@laptop.org
---
 gtk3/theme/gtk-widgets.css.em | 32 
 1 file changed, 12 insertions(+), 20 deletions(-)

diff --git a/gtk3/theme/gtk-widgets.css.em b/gtk3/theme/gtk-widgets.css.em
index 5549970..fda6279 100644
--- a/gtk3/theme/gtk-widgets.css.em
+++ b/gtk3/theme/gtk-widgets.css.em
@@ -54,15 +54,6 @@ icon_large = icon_base * 5
 * {
 -sugar-focus-line: @white;
 
-background-color: @button_grey;
-color: @black;
-
-border-color: transparent;
-border-radius: 0px;
-border-style: none;
-
-padding: $(thickness)px;
-
 /* A lot of these will probably need to be changed, but this has to
be done when the exact sizes are known */
 -GtkWidget-interior-focus: 0;
@@ -120,11 +111,6 @@ icon_large = icon_base * 5
 -GtkCheckButton-indicator-spacing: 3;
 }
 
-*:active {
-background-color: @white;
-color: @black;
-}
-
 /* Backgrounds and windows */
 
 .background {
@@ -154,19 +140,21 @@ icon_large = icon_base * 5
 -GtkButton-inner-border: 0 0 0 0;
 padding: $(border)px $(border)px $(border)px $(border)px;
 
+border-width: $(thickness)px;
+border-color: @button_grey;
+border-style: solid;
 border-radius: $(2*subcell_size)px;
 background-color: @button_grey;
 color: @white;
 }
 
-.button * {
-color: @white;
-}
-
 .button:focused {
-border-width: $(thickness)px;
 border-color: @white;
-border-style: solid;
+}
+
+.button:active {
+background-color: @white;
+color: @black;
 }
 
 /* Spin buttons */
@@ -588,6 +576,10 @@ GtkScale.slider:active {
 
 /* Radio and check buttons */
 
+GtkCheckButton {
+color: @black;
+}
+
 GtkCheckButton:prelight {
 background-color: alpha(@theme_base_color, 0.0);
 }
-- 
1.7.11.4

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


Re: [Sugar-devel] [PATCH sugar-artwork] Remove colors, borders and paddings set for all the widgets, fix Button borders

2012-08-27 Thread Manuel Quiñones
Please test with the buttons.py testcase (previous patch sent for the
toolkit-gtk3).

2012/8/27 Manuel Quiñones ma...@laptop.org:
 The * {} and *:active {} CSS rules apply to all the widgets so they
 have to be overriden many times.  We should do that for each widget
 when needed instead.

 Also fix the border for the GtkButton.  We have a white outline in its
 focused state.  This is implemented as a CSS border in the GTK3+
 version.  But if the button doesn't have a border in the normal state,
 we get a resize in the parent widget.  This patch adds a border that
 is the same color than the button background for the normal state.
 Also adds a white background to the active (pressed) state.

 Signed-off-by: Manuel Quiñones ma...@laptop.org
 ---
  gtk3/theme/gtk-widgets.css.em | 32 
  1 file changed, 12 insertions(+), 20 deletions(-)

 diff --git a/gtk3/theme/gtk-widgets.css.em b/gtk3/theme/gtk-widgets.css.em
 index 5549970..fda6279 100644
 --- a/gtk3/theme/gtk-widgets.css.em
 +++ b/gtk3/theme/gtk-widgets.css.em
 @@ -54,15 +54,6 @@ icon_large = icon_base * 5
  * {
  -sugar-focus-line: @white;

 -background-color: @button_grey;
 -color: @black;
 -
 -border-color: transparent;
 -border-radius: 0px;
 -border-style: none;
 -
 -padding: $(thickness)px;
 -
  /* A lot of these will probably need to be changed, but this has to
 be done when the exact sizes are known */
  -GtkWidget-interior-focus: 0;
 @@ -120,11 +111,6 @@ icon_large = icon_base * 5
  -GtkCheckButton-indicator-spacing: 3;
  }

 -*:active {
 -background-color: @white;
 -color: @black;
 -}
 -
  /* Backgrounds and windows */

  .background {
 @@ -154,19 +140,21 @@ icon_large = icon_base * 5
  -GtkButton-inner-border: 0 0 0 0;
  padding: $(border)px $(border)px $(border)px $(border)px;

 +border-width: $(thickness)px;
 +border-color: @button_grey;
 +border-style: solid;
  border-radius: $(2*subcell_size)px;
  background-color: @button_grey;
  color: @white;
  }

 -.button * {
 -color: @white;
 -}
 -
  .button:focused {
 -border-width: $(thickness)px;
  border-color: @white;
 -border-style: solid;
 +}
 +
 +.button:active {
 +background-color: @white;
 +color: @black;
  }

  /* Spin buttons */
 @@ -588,6 +576,10 @@ GtkScale.slider:active {

  /* Radio and check buttons */

 +GtkCheckButton {
 +color: @black;
 +}
 +
  GtkCheckButton:prelight {
  background-color: alpha(@theme_base_color, 0.0);
  }
 --
 1.7.11.4




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


Re: [Sugar-devel] Sugar Activity template for HTML5/Enyo

2012-08-27 Thread James Simmons
Gonzalo,

WebKit can do things that EPUB would not normally allow.  Project Gutenberg
makes EPUBs by taking the hand crafted web page and putting it in a Zip
file with some XML files.  On Read it looks just like the original web
page.  On a Kindle it might look just awful.

I don't know if the ENYO framework is entirely JavaScript (in which case it
could be included in the EPUB) or if it has some non-JS portions.  It
sounded to me like it did.  Those portions would need to be added to Read.

James Simmons


On Mon, Aug 27, 2012 at 12:27 PM, Gonzalo Odiard gonz...@laptop.org wrote:

 I don't understand the relation.
 We already use webkit, then, we can use play javascript if needed.
 I think epub2 standard does not allow javascript, I don't know epub3

 Gonzalo


 On Mon, Aug 27, 2012 at 1:39 PM, James Simmons nices...@gmail.com wrote:

 What it sounds like you could do is incorporate the ENYO framework into
 the Read Activity, then make EPUB format books that include JavaScript.
 Since Read uses WebKit it already renders EPUB books created from web pages
 (like those from Project Gutenberg) better than Nooks and Kindles do, and
 having some JavaScript on the pages would be a natural thing to experiment
 with.

 James Simmons


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


Re: [Sugar-devel] [PATCH sugar-toolkit-gtk3] Add testcase for Gtk buttons

2012-08-27 Thread Simon Schampijer

On 08/27/2012 07:41 PM, Manuel Quiñones wrote:

Signed-off-by: Manuel Quiñones ma...@laptop.org
---
  tests/graphics/buttons.py | 57 +++
  1 file changed, 57 insertions(+)
  create mode 100644 tests/graphics/buttons.py


Looks good, pushed as: cb141505fbb0278ecf6fab170d4691f93e59f6e9

Thanks,
   Simon


diff --git a/tests/graphics/buttons.py b/tests/graphics/buttons.py
new file mode 100644
index 000..6e6969a
--- /dev/null
+++ b/tests/graphics/buttons.py
@@ -0,0 +1,57 @@
+from gi.repository import Gtk
+
+import common
+
+
+test = common.Test()
+test.show()
+
+vbox = Gtk.VBox()
+test.pack_start(vbox, True, True, 0)
+vbox.show()
+
+# test Gtk.SpinButton:
+
+adj = Gtk.Adjustment(0, 0, 10, 1, 32, 0)
+spin = Gtk.SpinButton()
+spin.set_adjustment(adj)
+vbox.pack_start(spin, False, False, 1)
+spin.show()
+
+# test Gtk.RadioButton:
+
+radio_1 = Gtk.RadioButton.new_with_label_from_widget(None, 'Radio 1')
+vbox.pack_start(radio_1, False, False, 1)
+radio_1.show()
+radio_2 = Gtk.RadioButton.new_with_label_from_widget(radio_1, 'Radio 2')
+vbox.pack_start(radio_2, False, False, 1)
+radio_2.show()
+radio_3 = Gtk.RadioButton.new_with_label_from_widget(radio_1, 'Radio 3')
+vbox.pack_start(radio_3, False, False, 1)
+radio_3.show()
+
+# test Gtk.CheckButton:
+
+check_1 = Gtk.CheckButton('Check 1')
+vbox.pack_start(check_1, False, False, 1)
+check_1.show()
+
+check_2 = Gtk.CheckButton('Check 2')
+vbox.pack_start(check_2, False, False, 1)
+check_2.show()
+
+# test Gtk.Button:
+
+button = Gtk.Button('Button')
+vbox.pack_start(button, False, False, 1)
+button.show()
+
+# test Gtk.ToggleButton:
+
+toggle_button = Gtk.ToggleButton('ToggleButton')
+vbox.pack_start(toggle_button, False, False, 1)
+toggle_button.show()
+
+
+if __name__ == '__main__':
+common.main(test)



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


Re: [Sugar-devel] [PATCH sugar-artwork] Remove colors, borders and paddings set for all the widgets, fix Button borders

2012-08-27 Thread Simon Schampijer

On 08/27/2012 08:12 PM, Manuel Quiñones wrote:

The * {} and *:active {} CSS rules apply to all the widgets so they
have to be overriden many times.  We should do that for each widget
when needed instead.

Also fix the border for the GtkButton.  We have a white outline in its
focused state.  This is implemented as a CSS border in the GTK3+
version.  But if the button doesn't have a border in the normal state,
we get a resize in the parent widget.  This patch adds a border that
is the same color than the button background for the normal state.
Also adds a white background to the active (pressed) state.

Signed-off-by: Manuel Quiñones ma...@laptop.org



Thanks for that one.

There is one regression:

- run sugar-toolkit-gtk3/tests/graphics/toolbuttons.py

- hover over the 'list-view' icon

--- the background should be just black, it has a gray outline though

Simon




---
  gtk3/theme/gtk-widgets.css.em | 32 
  1 file changed, 12 insertions(+), 20 deletions(-)

diff --git a/gtk3/theme/gtk-widgets.css.em b/gtk3/theme/gtk-widgets.css.em
index 5549970..fda6279 100644
--- a/gtk3/theme/gtk-widgets.css.em
+++ b/gtk3/theme/gtk-widgets.css.em
@@ -54,15 +54,6 @@ icon_large = icon_base * 5
  * {
  -sugar-focus-line: @white;

-background-color: @button_grey;
-color: @black;
-
-border-color: transparent;
-border-radius: 0px;
-border-style: none;
-
-padding: $(thickness)px;
-
  /* A lot of these will probably need to be changed, but this has to
 be done when the exact sizes are known */
  -GtkWidget-interior-focus: 0;
@@ -120,11 +111,6 @@ icon_large = icon_base * 5
  -GtkCheckButton-indicator-spacing: 3;
  }

-*:active {
-background-color: @white;
-color: @black;
-}
-
  /* Backgrounds and windows */

  .background {
@@ -154,19 +140,21 @@ icon_large = icon_base * 5
  -GtkButton-inner-border: 0 0 0 0;
  padding: $(border)px $(border)px $(border)px $(border)px;

+border-width: $(thickness)px;
+border-color: @button_grey;
+border-style: solid;
  border-radius: $(2*subcell_size)px;
  background-color: @button_grey;
  color: @white;
  }

-.button * {
-color: @white;
-}
-
  .button:focused {
-border-width: $(thickness)px;
  border-color: @white;
-border-style: solid;
+}
+
+.button:active {
+background-color: @white;
+color: @black;
  }

  /* Spin buttons */
@@ -588,6 +576,10 @@ GtkScale.slider:active {

  /* Radio and check buttons */

+GtkCheckButton {
+color: @black;
+}
+
  GtkCheckButton:prelight {
  background-color: alpha(@theme_base_color, 0.0);
  }



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


Re: [Sugar-devel] [PATCH sugar-toolkit] Don't cache window size in palettewindow invoker

2012-08-27 Thread Simon Schampijer

On 08/23/2012 04:55 PM, godi...@sugarlabs.org wrote:

From: Gonzalo Odiard godi...@gmail.com

The screen size can change, by example when the screen rotate,
and the stored values are not useful anymore.
Without this patch the device icons palettes in the Journal
or in the frame are not displayed if the screen is rotated
to right or left.

Signed-off-by: Gonzalo Odiard gonz...@laptop.org


Thanks.

There is one regression with the patch described in

http://bugs.sugarlabs.org/ticket/3833

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


Re: [Sugar-devel] Sugar Activity template for HTML5/Enyo

2012-08-27 Thread lionel
 

Hi James,

 

I didn’t know that EPUB format could include JavaScript.

Enyo is fully in JavaScript/CSS. So it should be include in an EPUB.

BTW, I’m not sure to understand what could be done with this sort of
integration and the template.

 

Lionel.

 

 

De : James Simmons [mailto:nices...@gmail.com] 
Envoyé : lundi 27 août 2012 20:52
À : Gonzalo Odiard
Cc : lio...@olpc-france.org; sugar-devel@lists.sugarlabs.org
Objet : Re: [Sugar-devel] Sugar Activity template for HTML5/Enyo

 

Gonzalo,

WebKit can do things that EPUB would not normally allow.  Project Gutenberg
makes EPUBs by taking the hand crafted web page and putting it in a Zip file
with some XML files.  On Read it looks just like the original web page.  On
a Kindle it might look just awful.

I don't know if the ENYO framework is entirely JavaScript (in which case it
could be included in the EPUB) or if it has some non-JS portions.  It
sounded to me like it did.  Those portions would need to be added to Read.

James Simmons



On Mon, Aug 27, 2012 at 12:27 PM, Gonzalo Odiard gonz...@laptop.org wrote:

I don't understand the relation.

We already use webkit, then, we can use play javascript if needed.

I think epub2 standard does not allow javascript, I don't know epub3

 

Gonzalo 

 

On Mon, Aug 27, 2012 at 1:39 PM, James Simmons nices...@gmail.com wrote:

What it sounds like you could do is incorporate the ENYO framework into the
Read Activity, then make EPUB format books that include JavaScript.  Since
Read uses WebKit it already renders EPUB books created from web pages (like
those from Project Gutenberg) better than Nooks and Kindles do, and having
some JavaScript on the pages would be a natural thing to experiment with.

James Simmons

 

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


Re: [Sugar-devel] [PATCH Jukebox] Stop player on focus lost

2012-08-27 Thread Gonzalo Odiard
Thanks, pushed in sugar-0.94 branch.

Gonzalo

On Mon, Aug 27, 2012 at 2:28 PM, Manuel Kaufmann humi...@gmail.com wrote:

 Stop the player when the user is reproducing a video and switch to
 another activity.

 Signed-off-by: Manuel Kaufmann humi...@gmail.com
 ---
  jukeboxactivity.py | 23 ---
  1 file changed, 20 insertions(+), 3 deletions(-)

 diff --git a/jukeboxactivity.py b/jukeboxactivity.py
 index e900263..cb116a8 100644
 --- a/jukeboxactivity.py
 +++ b/jukeboxactivity.py
 @@ -131,6 +131,11 @@ class JukeboxActivity(activity.Activity):
  toolbar_box.show_all()
  self.connect(key_press_event, self._key_press_event_cb)

 +# We want to be notified when the activity gets the focus or
 +# loses it.  When it is not active, we don't need to keep
 +# reproducing the video
 +self.connect(notify::active, self._notify_active_cb)
 +
  if handle.uri:
  pass
  elif self._shared_activity:
 @@ -155,7 +160,6 @@ class JukeboxActivity(activity.Activity):
  self.playflag = False
  self.tags = {}
  self.only_audio = False
 -self.got_stream_info = False

  self.tag_reader = TagReader()
  self.tag_reader.connect('get-tags', self.__get_tags_cb)
 @@ -187,6 +191,20 @@ class JukeboxActivity(activity.Activity):
  self.uri = handle.uri
  gobject.idle_add(self._start, self.uri, handle.title)

 +def _notify_active_cb(self, widget, event):
 +Sugar notify us that the activity is becoming active or
 +inactive.
 +
 +When we are inactive, we stop the player if it is reproducing
 +a video.
 +
 +
 +if self.player is not None and not self.only_audio:
 +if not self.player.is_playing() and self.props.active:
 +self.player.play()
 +if self.player.is_playing() and not self.props.active:
 +self.player.pause()
 +
  def _switch_canvas(self, show_video):
  Show or hide the video visualization in the canvas.

 @@ -333,7 +351,7 @@ class JukeboxActivity(activity.Activity):
  self.tags[gst.TAG_ARTIST], album)

  def _player_stream_info_cb(self, widget, stream_info):
 -if not len(stream_info) or self.got_stream_info:
 +if not len(stream_info):
  return

  GST_STREAM_TYPE_UNKNOWN = 0
 @@ -346,7 +364,6 @@ class JukeboxActivity(activity.Activity):
  if item.props.type == GST_STREAM_TYPE_VIDEO:
  only_audio = False
  self.only_audio = only_audio
 -self.got_stream_info = True
  self._update_overlay()

  def _joined_cb(self, activity):
 --
 1.7.11.4


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


Re: [Sugar-devel] [PATCH sugar] Group View: add search toolbar

2012-08-27 Thread Simon Schampijer

On 08/27/2012 02:01 PM, Manuel Quiñones wrote:

Great Simon,

the only thing I see is that we should focus the search entry, like in
the other views:

--- a/src/jarabe/desktop/homewindow.py
+++ b/src/jarabe/desktop/homewindow.py
@@ -182,6 +182,7 @@ class HomeWindow(gtk.Window):
  elif level == ShellModel.ZOOM_GROUP:
  self.add(self._group_box)
  self._group_box.show()
+self._group_box.focus_search_entry()
  elif level == ShellModel.ZOOM_MESH:
  self.add(self._mesh_box)
  self._mesh_box.show()



Ok, done, and added the focus_search_entry method to the groupbox. 
Pushed as 13844c18b225f46b1636fc1201e020af53c60fcd.


Thanks for the review.
   Simon

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


Re: [Sugar-devel] Sugar Activity template for HTML5/Enyo

2012-08-27 Thread James Simmons
Lionel,

Your post reminded me of a VERY old post by Sayamindu Dasgupta:

http://sayamindu.randomink.org/ramblings/

He talks about doing things with EPUB format to make more interactive
books.  He doesn't specifically mention JavaScript.

What got me thinking is this:

http://www.amazon.com/E-Book-Enlightenment-ebook/dp/B005BYST5I/ref=sr_1_1?s=digital-textie=UTF8qid=1346102690sr=1-1keywords=e-book+enlightenment

Check the book cover.  It is the Read Activity showing the EPUB of the book
E-Book Enlightenment being read.  Note that the page layout is quite nice
and includes fancy dropcaps and art that a Kindle or a Nook would make a
mess of or just ignore.  So maybe, just maybe, the Read Activity could
handle JavaScript in an EPUB as well.

If you do Look inside the book you'll see that I had to reformat the book
to leave out the art and to use a large first letter instead of the much
nicer dropcap.  The EPUB from archive.org has the original formatting.

So maybe instead of making custom wrappers for Activities that use HTML 5
and JS we could make non-standard EPUBs and accomplish much the same thing.

James Simmons


On Mon, Aug 27, 2012 at 2:40 PM, lio...@olpc-france.org wrote:

 ** **

 Hi James,

 ** **

 I didn’t know that EPUB format could include JavaScript.

 Enyo is fully in JavaScript/CSS. So it should be include in an EPUB.

 BTW, I’m not sure to understand what could be done with this sort of
 integration and the template.

 ** **

 Lionel.

 ** **

 ** **

 *De :* James Simmons [mailto:nices...@gmail.com]
 *Envoyé :* lundi 27 août 2012 20:52
 *À :* Gonzalo Odiard
 *Cc :* lio...@olpc-france.org; sugar-devel@lists.sugarlabs.org
 *Objet :* Re: [Sugar-devel] Sugar Activity template for HTML5/Enyo

 ** **

 Gonzalo,

 WebKit can do things that EPUB would not normally allow.  Project
 Gutenberg makes EPUBs by taking the hand crafted web page and putting it in
 a Zip file with some XML files.  On Read it looks just like the original
 web page.  On a Kindle it might look just awful.

 I don't know if the ENYO framework is entirely JavaScript (in which case
 it could be included in the EPUB) or if it has some non-JS portions.  It
 sounded to me like it did.  Those portions would need to be added to Read.

 James Simmons

 

 On Mon, Aug 27, 2012 at 12:27 PM, Gonzalo Odiard gonz...@laptop.org
 wrote:

 I don't understand the relation.

 We already use webkit, then, we can use play javascript if needed.

 I think epub2 standard does not allow javascript, I don't know epub3

 ** **

 Gonzalo 

 ** **

 On Mon, Aug 27, 2012 at 1:39 PM, James Simmons nices...@gmail.com wrote:
 

 What it sounds like you could do is incorporate the ENYO framework into
 the Read Activity, then make EPUB format books that include JavaScript.
 Since Read uses WebKit it already renders EPUB books created from web pages
 (like those from Project Gutenberg) better than Nooks and Kindles do, and
 having some JavaScript on the pages would be a natural thing to experiment
 with.

 James Simmons

 ** **

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


[Sugar-devel] [PATCH ImageViewer] Use the accelerometer to rotate images

2012-08-27 Thread Agustin Zubiaga
This patch only affects the operation on the XO 1.75

Signed-off-by: Agustin Zubiaga a...@sugarlabs.org
---
 ImageView.py | 53 -
 1 file changed, 52 insertions(+), 1 deletion(-)

diff --git a/ImageView.py b/ImageView.py
index 39556d7..13eb1b0 100644
--- a/ImageView.py
+++ b/ImageView.py
@@ -62,6 +62,11 @@ class ImageViewer(Gtk.DrawingArea):
 self._temp_pixbuf = None
 self._image_changed_flag = True
 self._optimal_zoom_flag = True
+self._lock_accelerometer = False
+
+self._accelerometer = AccelerometerDevice()
+if self._accelerometer.has_accelerometer:
+GObject.timeout_add(2000, self._update_accelerometer_rotation)
 
 self.connect('draw', self.draw)
 
@@ -131,11 +136,12 @@ class ImageViewer(Gtk.DrawingArea):
 self._optimal_zoom_flag = False
 self._set_zoom(zoom)
 
-def set_angle(self, angle):
+def set_angle(self, angle, lock_accelerometer=True):
 self._image_changed_flag = True
 self._optimal_zoom_flag = True
 
 self.angle = angle
+self._lock_accelerometer = lock_accelerometer
 
 if self.props.window:
 alloc = self.get_allocation()
@@ -243,6 +249,51 @@ class ImageViewer(Gtk.DrawingArea):
 
 return pixbuf
 
+def _update_accelerometer_rotation(self):
+if not self._lock_accelerometer:
+x, y, z = self._accelerometer.read()
+if x = -700:
+self.set_angle(270, False)
+elif x = 700:
+self.set_angle(90, False)
+elif y = -700:
+self.set_angle(180, False)
+else:
+self.set_angle(0, False)
+
+return True
+else:
+return False
+
+
+class AccelerometerDevice(object):
+# http://wiki.laptop.org/go/Accelerometer
+ACCELEROMETER_DEVICE = '/sys/devices/platform/lis3lv02d/position'
+
+def __init__(self, acceleration=0.05):
+try:
+self._device = open(self.ACCELEROMETER_DEVICE, 'r')
+self.has_accelerometer = True
+except IOError:
+self.has_accelerometer = False
+
+def reseek(self):
+self._device.seek(0)
+
+def read(self):
+self.reseek()
+x, y, z = self.parse(self._device.read())
+return x, y, z
+
+def parse(self, data):
+# discard parentheses from the data
+data = data[1:-2]
+x, y, z = map(int, data.split(','))
+return x, y, z
+
+def close(self):
+self._device.close()
+
 
 def update(view_object):
 #return view_object.zoom_out()
-- 
1.7.11.4

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


[Sugar-devel] long-press touch actions in Sugar

2012-08-27 Thread Sridhar Dhanapalan
It appears [1] that long-press is becoming part of the Sugar user
experience on touchscreens:

Touch and hold _should_ trigger full display of palette content (like
a right click, no extra delay)

I have some reservations [2] about long-press actions. They don't seem
to be very intuitive or discoverable.

How are the Sugar Design Team managing this problem?


[1] http://wiki.sugarlabs.org/go/Design_Team/Sugar_Shell_Touch_Input
[2] 
http://ux.stackexchange.com/questions/24460/press-and-hold-or-long-press-gestures-unintuitive



Sridhar Dhanapalan
Engineering Manager
One Laptop per Child Australia
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [OLPC-AU] long-press touch actions in Sugar

2012-08-27 Thread Mikus Grinbergs

Sridhar wrote:

It appears that long-press is becoming part of the Sugar user
experience on touchscreens:


In my opinion the XO product is notably limited in that its front panel 
buttons will only register a 'press'.  The opportunities for use of 
the XO in e-book configuration would be greatly enhanced if those front 
panel buttons were able to register 'long press' as well as 'press'.


mikus

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


[Sugar-devel] [PATCH sugar] HomeToolbar: reuse the new ViewToolbar implementation

2012-08-27 Thread Simon Schampijer
From: Simon Schampijer si...@laptop.org

In the HomeToolbar we can resue the ViewToolbar implementation
that has been introduced in 13844c18b225f46b1636fc1201e020af53c60fcd.

Signed-off-by: Simon Schampijer si...@laptop.org
---
 src/jarabe/desktop/homebox.py | 56 +++
 1 file changed, 3 insertions(+), 53 deletions(-)

diff --git a/src/jarabe/desktop/homebox.py b/src/jarabe/desktop/homebox.py
index 33c6965..e4dba30 100644
--- a/src/jarabe/desktop/homebox.py
+++ b/src/jarabe/desktop/homebox.py
@@ -22,20 +22,17 @@ import gobject
 import gtk
 
 from sugar.graphics import style
-from sugar.graphics import iconentry
 from sugar.graphics.radiotoolbutton import RadioToolButton
 from sugar.graphics.alert import Alert
 from sugar.graphics.icon import Icon
 
 from jarabe.desktop import favoritesview
 from jarabe.desktop.activitieslist import ActivitiesList
-
+from jarabe.desktop.viewtoolbar import ViewToolbar
 
 _FAVORITES_VIEW = 0
 _LIST_VIEW = 1
 
-_AUTOSEARCH_TIMEOUT = 1000
-
 
 class HomeBox(gtk.VBox):
 __gtype_name__ = 'SugarHomeBox'
@@ -152,39 +149,16 @@ class HomeBox(gtk.VBox):
 self._favorites_box.set_filter(self._query)
 
 
-class HomeToolbar(gtk.Toolbar):
+class HomeToolbar(ViewToolbar):
 __gtype_name__ = 'SugarHomeToolbar'
 
 __gsignals__ = {
-'query-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
-  ([str])),
 'view-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
  ([object])),
 }
 
 def __init__(self):
-gtk.Toolbar.__init__(self)
-
-self._query = None
-self._autosearch_timer = None
-
-self._add_separator()
-
-tool_item = gtk.ToolItem()
-self.insert(tool_item, -1)
-tool_item.show()
-
-self.search_entry = iconentry.IconEntry()
-self.search_entry.set_icon_from_name(iconentry.ICON_ENTRY_PRIMARY,
-  'system-search')
-self.search_entry.add_clear_button()
-self.search_entry.set_width_chars(25)
-self.search_entry.connect('activate', self.__entry_activated_cb)
-self.search_entry.connect('changed', self.__entry_changed_cb)
-tool_item.add(self.search_entry)
-self.search_entry.show()
-
-self._add_separator(expand=True)
+ViewToolbar.__init__(self)
 
 favorites_button = FavoritesButton()
 favorites_button.connect('toggled', self.__view_button_toggled_cb,
@@ -219,30 +193,6 @@ class HomeToolbar(gtk.Toolbar):
 self.insert(separator, -1)
 separator.show()
 
-def __entry_activated_cb(self, entry):
-if self._autosearch_timer:
-gobject.source_remove(self._autosearch_timer)
-new_query = entry.props.text
-if self._query != new_query:
-self._query = new_query
-
-self.emit('query-changed', self._query)
-
-def __entry_changed_cb(self, entry):
-if not entry.props.text:
-entry.activate()
-return
-
-if self._autosearch_timer:
-gobject.source_remove(self._autosearch_timer)
-self._autosearch_timer = gobject.timeout_add(_AUTOSEARCH_TIMEOUT,
-self.__autosearch_timer_cb)
-
-def __autosearch_timer_cb(self):
-self._autosearch_timer = None
-self.search_entry.activate()
-return False
-
 
 class FavoritesButton(RadioToolButton):
 __gtype_name__ = 'SugarFavoritesButton'
-- 
1.7.11.4

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


Re: [Sugar-devel] [PATCH sugar] Add toolbar to the TransitionBox

2012-08-27 Thread Simon Schampijer

On 08/27/2012 04:29 PM, Manuel Quiñones wrote:

With the new frame behaviour the toolbar was appearing and
disappearing while the transition took place.  this patch adds a
toolbar in the transition box with a fake search entry, that is set
editable=False to prevent issues.

Signed-off-by: Manuel Quiñones ma...@laptop.org


Nice idea! Another way of doing it would be to have the toolbar 
permanent in the HomeWindow. The ViewToolbar only differs in the 
HomeView at the moment where we add the buttons to change the layout of 
the icons (long term Gary and myself were discussing to add a list 
layout in all the Views).


We would have to check how to best abstract the ViewToolbar code for 
that but should be doable in one way.


Regards,
   Simon

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


[Sugar-devel] Output Request List

2012-08-27 Thread Rafael Moura Sales Martins
Hello, I would like to make the list:
*
sugar-devel@lists.sugarlabs.org
sugar-devel-ow...@lists.sugarlabs.org
sugar-devel-requ...@lists.sugarlabs.org*

My e-mail:  medr...@gmail.com

Thanks.

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