Re: [Sugar-devel] [PATCH] Fall back to old style toolbars in old sugar

2011-05-27 Thread Simon Schampijer

On 05/26/2011 08:58 PM, Rafael Ortiz wrote:

On Thu, May 26, 2011 at 1:53 AM, Simon Schampijersi...@schampijer.dewrote:


On 05/26/2011 06:46 AM, Sebastian Silva wrote:


From: Sebastian Silvaicar...@sugarlabs.org

Based on patch by Wade from 2009:

http://git.sugarlabs.org/~wadeb/browse/backwards-compatibility/commit/584939d3bc217b9463703e9a903caadf80c50d00



Hi Sebastian,

Browse is not as backward compatible as other activities, due to changes in
hulahop and the underlying technologies. That is why it was ok to break
compatibility when moving to new toolbars in Browse.

Regards,
   Simon

Simon, thinking about sugar 0.84 users it would be nice to have this

applied, although they cannot have the underlaying changes they could have
the latest fixes on the upper level code of the activity.

cheers.


But does the activity even run on a 0.84 build like 10.1.3?

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


Re: [Sugar-devel] [PATCH] Fall back to old style toolbars in old sugar

2011-05-27 Thread James Cameron
On Fri, May 27, 2011 at 10:27:39AM +0200, Simon Schampijer wrote:
 But does the activity even run on a 0.84 build like 10.1.3?

I thought there were users (integrators) of sugar-0.84 apart from OLPC,
such as the Ubuntu Sugar Remix, and they may well have satisfied the
dependencies ... but if you think there are none at all I guess the
patch is uninteresting?

-- 
James Cameron
http://quozl.linux.org.au/
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] Fall back to old style toolbars in old sugar

2011-05-27 Thread Sebastian Silva

El 27/05/11 03:27, Simon Schampijer escribió:

But does the activity even run on a 0.84 build like 10.1.3?

Interesting. That is the entire point of the patch. Now it does.
I tested it on 10.1.3 based -sugar 8 peru image and it runs well. I 
think Rafael tested on vanilla 10.1.3.


Is there is a technical reason no to upgrade? Upgrading from 108 to 122 
seems to help with dialog box related problems 
http://bugs.sugarlabs.org/ticket/2659 , 
https://bugs.sugarlabs.org/ticket/2615 and does not leave partial 
downloads in the instance dir https://bugs.sugarlabs.org/ticket/2155 to 
name a few benefits for the user.

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


Re: [Sugar-devel] [PATCH] Fall back to old style toolbars in old sugar

2011-05-26 Thread Simon Schampijer

On 05/26/2011 06:46 AM, Sebastian Silva wrote:

From: Sebastian Silvaicar...@sugarlabs.org

Based on patch by Wade from 2009:
http://git.sugarlabs.org/~wadeb/browse/backwards-compatibility/commit/584939d3bc217b9463703e9a903caadf80c50d00


Hi Sebastian,

Browse is not as backward compatible as other activities, due to changes 
in hulahop and the underlying technologies. That is why it was ok to 
break compatibility when moving to new toolbars in Browse.


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


Re: [Sugar-devel] [PATCH] Fall back to old style toolbars in old sugar

2011-05-26 Thread Rafael Ortiz
On Thu, May 26, 2011 at 1:53 AM, Simon Schampijer si...@schampijer.dewrote:

 On 05/26/2011 06:46 AM, Sebastian Silva wrote:

 From: Sebastian Silvaicar...@sugarlabs.org

 Based on patch by Wade from 2009:

 http://git.sugarlabs.org/~wadeb/browse/backwards-compatibility/commit/584939d3bc217b9463703e9a903caadf80c50d00


 Hi Sebastian,

 Browse is not as backward compatible as other activities, due to changes in
 hulahop and the underlying technologies. That is why it was ok to break
 compatibility when moving to new toolbars in Browse.

 Regards,
   Simon

 Simon, thinking about sugar 0.84 users it would be nice to have this
applied, although they cannot have the underlaying changes they could have
the latest fixes on the upper level code of the activity.

cheers.

 ___
 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] Fall back to old style toolbars in old sugar

2011-05-25 Thread Sebastian Silva
From: Sebastian Silva icar...@sugarlabs.org

Based on patch by Wade from 2009:
http://git.sugarlabs.org/~wadeb/browse/backwards-compatibility/commit/584939d3bc217b9463703e9a903caadf80c50d00
---
 webactivity.py |   87 +---
 webtoolbar.py  |   47 ++
 2 files changed, 92 insertions(+), 42 deletions(-)

diff --git a/webactivity.py b/webactivity.py
index 5f1ea5e..f43c9b4 100644
--- a/webactivity.py
+++ b/webactivity.py
@@ -47,15 +47,26 @@ from sugar.graphics.tray import HTray
 from sugar import profile
 from sugar.graphics.alert import Alert
 from sugar.graphics.icon import Icon
-from sugar.graphics.toolbarbox import ToolbarButton
 from sugar import mime
 
+# Attempt to import the new toolbar classes.  If the import fails,
+# fall back to the old toolbar style.
+try:
+from sugar.graphics.toolbarbox import ToolbarButton
+NEW_TOOLBARS = True
+except ImportError:
+NEW_TOOLBARS = False
+
 PROFILE_VERSION = 2
 
 _profile_version = 0
 _profile_path = os.path.join(activity.get_activity_root(), 'data/gecko')
 _version_file = os.path.join(_profile_path, 'version')
 
+if not NEW_TOOLBARS:
+_TOOLBAR_EDIT = 1
+_TOOLBAR_BROWSE = 2
+
 if os.path.exists(_version_file):
 f = open(_version_file)
 _profile_version = int(f.read())
@@ -208,34 +219,56 @@ class WebActivity(activity.Activity):
 logging.warning('Not enabling the multiple tabs feature due'
 ' to a bug in cairo/mozilla')
 
-self._primary_toolbar = PrimaryToolbar(self._tabbed_view, self,
-self._disable_multiple_tabs)
-self._primary_toolbar.connect('add-link', self._link_add_button_cb)
-
-self._primary_toolbar.connect('add-tab', self._new_tab_cb)
-
-self._primary_toolbar.connect('go-home', self._go_home_button_cb)
-
 self._tray = HTray()
 self.set_tray(self._tray, gtk.POS_BOTTOM)
 self._tray.show()
 
+self._primary_toolbar = PrimaryToolbar(self._tabbed_view, self,
+self._disable_multiple_tabs)
 self._edit_toolbar = EditToolbar(self)
-self._edit_toolbar_button = ToolbarButton(
-page=self._edit_toolbar,
-icon_name='toolbar-edit')
-self._primary_toolbar.toolbar.insert(
-self._edit_toolbar_button, 1)
-
 self._view_toolbar = ViewToolbar(self)
-view_toolbar_button = ToolbarButton(
-page=self._view_toolbar,
-icon_name='toolbar-view')
-self._primary_toolbar.toolbar.insert(
-view_toolbar_button, 2)
 
-self._primary_toolbar.show_all()
-self.set_toolbar_box(self._primary_toolbar)
+self._primary_toolbar.connect('add-link', self._link_add_button_cb)
+
+self._primary_toolbar.connect('add-tab', self._new_tab_cb)
+
+self._primary_toolbar.connect('go-home', self._go_home_button_cb)
+
+if NEW_TOOLBARS:
+logging.debug('Using new toolbars')
+
+self._edit_toolbar_button = ToolbarButton(
+page=self._edit_toolbar,
+icon_name='toolbar-edit')
+self._primary_toolbar.toolbar.insert(
+self._edit_toolbar_button, 1)
+
+view_toolbar_button = ToolbarButton(
+page=self._view_toolbar,
+icon_name='toolbar-view')
+self._primary_toolbar.toolbar.insert(
+view_toolbar_button, 2)
+
+self._primary_toolbar.show_all()
+self.set_toolbar_box(self._primary_toolbar)
+else:
+_logger.debug('Using old toolbars')
+
+toolbox = activity.ActivityToolbox(self)
+
+toolbox.add_toolbar(_('Edit'), self._edit_toolbar)
+self._edit_toolbar.show()
+
+toolbox.add_toolbar(_('Browse'), self._primary_toolbar)
+self._primary_toolbar.show()
+   
+toolbox.add_toolbar(_('View'), self._view_toolbar)
+self._view_toolbar.show()   
+
+self.set_toolbox(toolbox)
+toolbox.show()
+
+self.toolbox.set_current_toolbar(_TOOLBAR_BROWSE)
 
 self.set_canvas(self._tabbed_view)
 self._tabbed_view.show()
@@ -494,10 +527,15 @@ class WebActivity(activity.Activity):
 self._add_link()
 elif key_name == 'f':
 _logger.debug('keyboard: Find')
-self._edit_toolbar_button.set_expanded(True)
+if NEW_TOOLBARS:
+self._edit_toolbar_button.set_expanded(True)
+else:
+self.toolbox.set_current_toolbar(_TOOLBAR_EDIT)
 self._edit_toolbar.search_entry.grab_focus()
 elif key_name == 'l':
 _logger.debug('keyboard: Focus url entry')
+if not NEW_TOOLBARS:
+