[Sugar-devel] [PATCH] Browse: Add support for creating multiple tabs

2010-07-24 Thread anishmangal2002
This patch adds support to create multiple tabbed windows
in Browse. A tab may be added by either clicking the add tab
('+') icon in the activity toolbar or by pressing 'ctrl+t'.

HACK: Currently, the multiple tabs feature crashes the Browse activity
on cairo versions 1.8.10 or later. The exact cause for this
isn't exactly known. Thus, this patch disables the multiple tabs feature
if we are using cairo versions = 1.08.10
More information can be found here:
[1] http://lists.sugarlabs.org/archive/sugar-devel/2010-July/025187.html

Signed-off-by: anishmangal2002 anishmangal2...@gmail.com
---
 icons/tab-add.svg |   12 
 webactivity.py|   35 ---
 webtoolbar.py |   19 +++
 3 files changed, 59 insertions(+), 7 deletions(-)
 create mode 100644 icons/tab-add.svg

diff --git a/icons/tab-add.svg b/icons/tab-add.svg
new file mode 100644
index 000..c1457bd
--- /dev/null
+++ b/icons/tab-add.svg
@@ -0,0 +1,12 @@
+?xml version=1.0 ?!DOCTYPE svg  PUBLIC '-//W3C//DTD SVG 1.1//EN'  
'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'[
+   !ENTITY stroke_color #010101
+   !ENTITY fill_color #FF
+]svg enable-background=new 0 0 55.125 55 height=55px 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 display=block id=tab-add
+g transform=scale(.80)
+g transform=translate(6.5, 6.5)
+   path d=M0,50 l55,0 l0,-15 l-5,0 l0,-25 q0,-5 -5,-5 l-35,0 q-5,0 -5,5 
l0,25 l-5,0z 
M30.768,38.767c-0.002,1.774-1.438,3.216-3.214,3.214c-0.889,0.001-1.693-0.359-2.275-0.941c-0.582-0.581-0.94-1.385-0.94-2.27
   
l0-8.146h-8.146c-0.886-0.001-1.689-0.359-2.271-0.94c-0.582-0.583-0.942-1.388-0.942-2.276c0-1.773,1.439-3.213,3.217-3.211h8.143
   
v-8.143c-0.003-1.776,1.438-3.217,3.212-3.217c1.774,0,3.218,1.438,3.215,3.215l0.001,8.145l8.146,0.001
   
c1.775-0.005,3.212,1.438,3.213,3.213c0.002,1.775-1.441,3.214-3.215,3.215h-8.143V38.767z
 fill=fill_color;/
+/g
+/g
+/g
+/svg
\ No newline at end of file
diff --git a/webactivity.py b/webactivity.py
index d7d8651..bba1032 100644
--- a/webactivity.py
+++ b/webactivity.py
@@ -31,6 +31,7 @@ import sqlite3
 import cjson
 import gconf
 import locale
+import cairo
 
 # HACK: Needed by http://dev.sugarlabs.org/ticket/456
 import gnome
@@ -154,6 +155,7 @@ def _set_accept_languages():
 logging.debug('LANG set')
 
 from browser import TabbedView
+from browser import Browser
 from webtoolbar import PrimaryToolbar
 from edittoolbar import EditToolbar
 from viewtoolbar import ViewToolbar
@@ -192,9 +194,24 @@ class WebActivity(activity.Activity):
 branch = pref_service.getBranch(mozilla.widget.)
 branch.setBoolPref(disable-native-theme, True)
 
-self._primary_toolbar = PrimaryToolbar(self._tabbed_view, self)
+# HACK
+# Currently, the multiple tabs feature crashes the Browse activity
+# on cairo versions 1.8.10 or later. The exact cause for this
+# isn't exactly known. Thus, disable the multiple tabs feature
+# if we come across cairo versions = 1.08.10
+# More information can be found here:
+# [1] 
http://lists.sugarlabs.org/archive/sugar-devel/2010-July/025187.html
+self._disable_multiple_tabs = cairo.cairo_version() = 10810
+if self._disable_multiple_tabs:
+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._tray = HTray()
 self.set_tray(self._tray, gtk.POS_BOTTOM)
 self._tray.show()
@@ -258,6 +275,9 @@ class WebActivity(activity.Activity):
 else:
 _logger.debug('Created activity')
 
+def _new_tab_cb(self, gobject):
+self._load_homepage(new_tab=True)
+
 def _shared_cb(self, activity_):
 _logger.debug('My activity was shared')
 self.initiating = True
@@ -354,8 +374,14 @@ class WebActivity(activity.Activity):
 self.messenger = Messenger(self.tube_conn, self.initiating,
self.model)
 
-def _load_homepage(self):
-browser = self._tabbed_view.current_browser
+def _load_homepage(self, new_tab=False):
+# If new_tab is True, open the homepage in a new tab.
+if new_tab:
+browser = Browser()
+self._tabbed_view._append_tab(browser)
+else:
+browser = self._tabbed_view.current_browser
+
 if os.path.isfile(_LIBRARY_PATH):
 browser.load_uri('file://' + _LIBRARY_PATH)
 else:
@@ -451,6 +477,9 @@ class WebActivity(activity.Activity):
 elif key_name == 'r':

Re: [Sugar-devel] [PATCH] Browse: Add support for creating multiple tabs

2010-07-22 Thread Lucian Branescu
Could you please attach a patch against mainline master HEAD? (not
inline in the email)

Also, does it still crash?

On 1 July 2010 21:02, anishmangal2002 anishmangal2...@gmail.com wrote:
 This patch adds support to create multiple tabbed windows
 in Browse. A tab may be added by either clicking the add tab
 ('+') icon in the activity toolbar or by pressing 'ctrl+t'.

 Signed-off-by: anishmangal2002 anishmangal2...@gmail.com
 ---
  icons/tab-add.svg |   12 
  webactivity.py    |   17 +++--
  webtoolbar.py     |   33 ++---
  3 files changed, 49 insertions(+), 13 deletions(-)
  create mode 100644 icons/tab-add.svg

 diff --git a/icons/tab-add.svg b/icons/tab-add.svg
 new file mode 100644
 index 000..c1457bd
 --- /dev/null
 +++ b/icons/tab-add.svg
 @@ -0,0 +1,12 @@
 +?xml version=1.0 ?!DOCTYPE svg  PUBLIC '-//W3C//DTD SVG 1.1//EN'  
 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'[
 +       !ENTITY stroke_color #010101
 +       !ENTITY fill_color #FF
 +]svg enable-background=new 0 0 55.125 55 height=55px 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 display=block id=tab-add
 +    g transform=scale(.80)
 +    g transform=translate(6.5, 6.5)
 +       path d=M0,50 l55,0 l0,-15 l-5,0 l0,-25 q0,-5 -5,-5 l-35,0 q-5,0 
 -5,5 l0,25 l-5,0z 
 M30.768,38.767c-0.002,1.774-1.438,3.216-3.214,3.214c-0.889,0.001-1.693-0.359-2.275-0.941c-0.582-0.581-0.94-1.385-0.94-2.27
    
 l0-8.146h-8.146c-0.886-0.001-1.689-0.359-2.271-0.94c-0.582-0.583-0.942-1.388-0.942-2.276c0-1.773,1.439-3.213,3.217-3.211h8.143
    
 v-8.143c-0.003-1.776,1.438-3.217,3.212-3.217c1.774,0,3.218,1.438,3.215,3.215l0.001,8.145l8.146,0.001
    
 c1.775-0.005,3.212,1.438,3.213,3.213c0.002,1.775-1.441,3.214-3.215,3.215h-8.143V38.767z
  fill=fill_color;/
 +    /g
 +    /g
 +/g
 +/svg
 \ No newline at end of file
 diff --git a/webactivity.py b/webactivity.py
 index d7d8651..877f182 100644
 --- a/webactivity.py
 +++ b/webactivity.py
 @@ -154,6 +154,7 @@ def _set_accept_languages():
     logging.debug('LANG set')

  from browser import TabbedView
 +from browser import Browser
  from webtoolbar import PrimaryToolbar
  from edittoolbar import EditToolbar
  from viewtoolbar import ViewToolbar
 @@ -194,6 +195,7 @@ class WebActivity(activity.Activity):

         self._primary_toolbar = PrimaryToolbar(self._tabbed_view, self)
         self._primary_toolbar.connect('add-link', self._link_add_button_cb)
 +        self._primary_toolbar.connect('add-tab', self._new_tab_cb)

         self._tray = HTray()
         self.set_tray(self._tray, gtk.POS_BOTTOM)
 @@ -258,6 +260,9 @@ class WebActivity(activity.Activity):
         else:
             _logger.debug('Created activity')

 +    def _new_tab_cb(self, gobject):
 +        self._load_homepage(new_tab=True)
 +
     def _shared_cb(self, activity_):
         _logger.debug('My activity was shared')
         self.initiating = True
 @@ -354,8 +359,14 @@ class WebActivity(activity.Activity):
             self.messenger = Messenger(self.tube_conn, self.initiating,
                                        self.model)

 -    def _load_homepage(self):
 -        browser = self._tabbed_view.current_browser
 +    def _load_homepage(self, new_tab=False):
 +        # If new_tab is True, open the homepage in a new tab.
 +        if new_tab:
 +            browser = Browser()
 +            self._tabbed_view._append_tab(browser)
 +        else:
 +            browser = self._tabbed_view.current_browser
 +
         if os.path.isfile(_LIBRARY_PATH):
             browser.load_uri('file://' + _LIBRARY_PATH)
         else:
 @@ -451,6 +462,8 @@ class WebActivity(activity.Activity):
             elif key_name == 'r':
                 flags = components.interfaces.nsIWebNavigation.LOAD_FLAGS_NONE
                 browser.web_navigation.reload(flags)
 +            elif gtk.gdk.keyval_name(event.keyval) == t:
 +                self._load_homepage(new_tab=True)
             else:
                 return False

 diff --git a/webtoolbar.py b/webtoolbar.py
 index e7c20be..1f718d5 100644
 --- a/webtoolbar.py
 +++ b/webtoolbar.py
 @@ -35,10 +35,8 @@ from sugar.activity import activity
  import filepicker
  import places

 -
  _MAX_HISTORY_ENTRIES = 15

 -
  class WebEntry(AddressEntry):
     _COL_ADDRESS = 0
     _COL_TITLE = 1
 @@ -68,7 +66,7 @@ class WebEntry(AddressEntry):
            recognize changes caused directly by user actions
         self.handler_block(self._change_hid)
         try:
 -            self.props.text = text
 +            self.props.text = text
         finally:
             self.handler_unblock(self._change_hid)
         self.set_position(-1)
 @@ -177,7 +175,7 @@ class WebEntry(AddressEntry):
             if selected is None:
                 selection.select_iter(model[-1].iter)
                 self._set_text(model[-1][0])
 -            else:
 +            

Re: [Sugar-devel] [PATCH] Browse: Add support for creating multiple tabs

2010-07-01 Thread Bernie Innocenti
El Wed, 30-06-2010 a las 11:13 +0200, Benjamin Otte escribió:

 I believe this is a Mozilla bug, to be exact:
 https://bugzilla.mozilla.org/show_bug.cgi?id=522635

Thanks! I asked if someone could point me at the patch, so I can apply
it to the F11 version of xulrunner.

(damn, I wish we did not have to fork xulrunner too)

-- 
   // Bernie Innocenti - http://codewiz.org/
 \X/  Sugar Labs   - http://sugarlabs.org/

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


[Sugar-devel] [PATCH] Browse: Add support for creating multiple tabs

2010-06-29 Thread anishmangal2002
This patch adds support to create multiple tabbed windows
in Browse. A tab may be added by either clicking the add tab
('+') icon in the activity toolbar or by pressing 'ctrl+t'.

Signed-off-by: anishmangal2002 anishmangal2...@gmail.com
---
 icons/add-tab.svg |   86 +
 webactivity.py|   11 +++
 webtoolbar.py |   21 +
 3 files changed, 118 insertions(+), 0 deletions(-)
 create mode 100644 icons/add-tab.svg

diff --git a/icons/add-tab.svg b/icons/add-tab.svg
new file mode 100644
index 000..0220993
--- /dev/null
+++ b/icons/add-tab.svg
@@ -0,0 +1,86 @@
+?xml version=1.0 encoding=UTF-8 standalone=no?
+!-- Created with Inkscape (http://www.inkscape.org/) --
+
+svg
+   xmlns:dc=http://purl.org/dc/elements/1.1/;
+   xmlns:cc=http://creativecommons.org/ns#;
+   xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns#;
+   xmlns:svg=http://www.w3.org/2000/svg;
+   xmlns=http://www.w3.org/2000/svg;
+   xmlns:sodipodi=http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd;
+   xmlns:inkscape=http://www.inkscape.org/namespaces/inkscape;
+   version=1.1
+   width=55
+   height=55
+   id=svg2
+   inkscape:version=0.47 r22583
+   sodipodi:docname=add-tab.svg
+  metadata
+ id=metadata10
+rdf:RDF
+  cc:Work
+ rdf:about=
+dc:formatimage/svg+xml/dc:format
+dc:type
+   rdf:resource=http://purl.org/dc/dcmitype/StillImage; /
+  /cc:Work
+/rdf:RDF
+  /metadata
+  sodipodi:namedview
+ pagecolor=#ff
+ bordercolor=#66
+ borderopacity=1
+ objecttolerance=10
+ gridtolerance=10
+ guidetolerance=10
+ inkscape:pageopacity=0
+ inkscape:pageshadow=2
+ inkscape:window-width=1280
+ inkscape:window-height=721
+ id=namedview8
+ showgrid=false
+ inkscape:zoom=4.2909091
+ inkscape:cx=27.5
+ inkscape:cy=27.033898
+ inkscape:window-x=0
+ inkscape:window-y=27
+ inkscape:window-maximized=1
+ inkscape:current-layer=layer1 /
+  defs
+ id=defs4
+inkscape:perspective
+   sodipodi:type=inkscape:persp3d
+   inkscape:vp_x=0 : 27.5 : 1
+   inkscape:vp_y=0 : 1000 : 0
+   inkscape:vp_z=55 : 27.5 : 1
+   inkscape:persp3d-origin=27.5 : 18.33 : 1
+   id=perspective12 /
+  /defs
+  g
+ transform=translate(0,-997.36218)
+ id=layer1
+rect
+   width=55
+   height=55
+   x=0
+   y=0
+   transform=translate(0,997.36218)
+   id=rect2818
+   style=fill:none;fill-opacity:1;fill-rule:evenodd;stroke:none /
+rect
+   width=9
+   height=38
+   x=23
+   y=1005.8622
+   id=rect3599
+   style=fill:#ff;fill-opacity:1;stroke:none /
+rect
+   width=8.94349
+   height=37.99044
+   x=1020.3485
+   y=-47.595592
+   transform=matrix(-0.00107369,0.9942,-0.9889,-0.00148761,0,0)
+   id=rect3599-4
+   style=fill:#ff;fill-opacity:1;stroke:none /
+  /g
+/svg
diff --git a/webactivity.py b/webactivity.py
index 4be551e..5f4f917 100644
--- a/webactivity.py
+++ b/webactivity.py
@@ -152,6 +152,7 @@ def _set_accept_languages():
 logging.debug('LANG set')
 
 from browser import TabbedView
+from browser import Browser
 from webtoolbar import PrimaryToolbar
 from edittoolbar import EditToolbar
 from viewtoolbar import ViewToolbar
@@ -443,6 +444,16 @@ class WebActivity(activity.Activity):
 _logger.debug('keyboard: Zoom in')
 self._tabbed_view.props.current_browser.zoom_in()
 return True
+elif gtk.gdk.keyval_name(event.keyval) == t:
+browser = Browser()
+self._tabbed_view._append_tab(browser)
+if os.path.isfile(_LIBRARY_PATH):
+browser.load_uri('file://' + _LIBRARY_PATH)
+else:
+default_page = os.path.join(activity.get_bundle_path(),
+data/index.html)
+browser.load_uri(default_page)
+
 return False
 
 def _add_link(self):
diff --git a/webtoolbar.py b/webtoolbar.py
index 854345c..99979ca 100644
--- a/webtoolbar.py
+++ b/webtoolbar.py
@@ -18,6 +18,9 @@
 
 from gettext import gettext as _
 
+_LIBRARY_PATH = '/usr/share/library-common/index.html'
+
+import os
 import gobject
 import gtk
 import pango
@@ -31,6 +34,7 @@ from sugar.graphics.toolbarbox import ToolbarBox
 from sugar.activity.widgets import ActivityToolbarButton
 from sugar.activity.widgets import StopButton
 from sugar.activity import activity
+from browser import Browser
 
 import filepicker
 import places
@@ -267,6 +271,13 @@ class PrimaryToolbar(ToolbarBox):
 self.toolbar.insert(self._forward, -1)
 self._forward.show()
 
+self._add_tab = ToolButton('add-tab')
+self._add_tab.set_tooltip(_('Add a tab'))
+self._add_tab.props.sensitive = True
+self._add_tab.connect('clicked', self._add_tab_cb)
+

Re: [Sugar-devel] [PATCH] Browse: Add support for creating multiple tabs

2010-06-29 Thread Anish Mangal
Note:

1. On f13 based sugar environments (such as soas3, jhbuild-0.88), this
patch will occasionally cause Browse to crash when closing tabs. This
probably happens because of a bug [1] (or something very similar to
this). As a workaround, one can downgrade the cairo package from
cairo-1.8.10 to cairo-1.8.8-1.fc11 (or upgrade to the latest
development version 1.9.10-1, though I haven't tested that).

2. This patch doesn't add an entry 'open link in new tab' to the
context menu. That can come as a separate patch.


[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=551852

--
Anish Mangal
an...@sugarlabs.org


On Wed, Jun 30, 2010 at 2:28 AM, anishmangal2002
anishmangal2...@gmail.com wrote:
 This patch adds support to create multiple tabbed windows
 in Browse. A tab may be added by either clicking the add tab
 ('+') icon in the activity toolbar or by pressing 'ctrl+t'.

 Signed-off-by: anishmangal2002 anishmangal2...@gmail.com
 ---
  icons/add-tab.svg |   86 
 +
  webactivity.py    |   11 +++
  webtoolbar.py     |   21 +
  3 files changed, 118 insertions(+), 0 deletions(-)
  create mode 100644 icons/add-tab.svg

 diff --git a/icons/add-tab.svg b/icons/add-tab.svg
 new file mode 100644
 index 000..0220993
 --- /dev/null
 +++ b/icons/add-tab.svg
 @@ -0,0 +1,86 @@
 +?xml version=1.0 encoding=UTF-8 standalone=no?
 +!-- Created with Inkscape (http://www.inkscape.org/) --
 +
 +svg
 +   xmlns:dc=http://purl.org/dc/elements/1.1/;
 +   xmlns:cc=http://creativecommons.org/ns#;
 +   xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns#;
 +   xmlns:svg=http://www.w3.org/2000/svg;
 +   xmlns=http://www.w3.org/2000/svg;
 +   xmlns:sodipodi=http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd;
 +   xmlns:inkscape=http://www.inkscape.org/namespaces/inkscape;
 +   version=1.1
 +   width=55
 +   height=55
 +   id=svg2
 +   inkscape:version=0.47 r22583
 +   sodipodi:docname=add-tab.svg
 +  metadata
 +     id=metadata10
 +    rdf:RDF
 +      cc:Work
 +         rdf:about=
 +        dc:formatimage/svg+xml/dc:format
 +        dc:type
 +           rdf:resource=http://purl.org/dc/dcmitype/StillImage; /
 +      /cc:Work
 +    /rdf:RDF
 +  /metadata
 +  sodipodi:namedview
 +     pagecolor=#ff
 +     bordercolor=#66
 +     borderopacity=1
 +     objecttolerance=10
 +     gridtolerance=10
 +     guidetolerance=10
 +     inkscape:pageopacity=0
 +     inkscape:pageshadow=2
 +     inkscape:window-width=1280
 +     inkscape:window-height=721
 +     id=namedview8
 +     showgrid=false
 +     inkscape:zoom=4.2909091
 +     inkscape:cx=27.5
 +     inkscape:cy=27.033898
 +     inkscape:window-x=0
 +     inkscape:window-y=27
 +     inkscape:window-maximized=1
 +     inkscape:current-layer=layer1 /
 +  defs
 +     id=defs4
 +    inkscape:perspective
 +       sodipodi:type=inkscape:persp3d
 +       inkscape:vp_x=0 : 27.5 : 1
 +       inkscape:vp_y=0 : 1000 : 0
 +       inkscape:vp_z=55 : 27.5 : 1
 +       inkscape:persp3d-origin=27.5 : 18.33 : 1
 +       id=perspective12 /
 +  /defs
 +  g
 +     transform=translate(0,-997.36218)
 +     id=layer1
 +    rect
 +       width=55
 +       height=55
 +       x=0
 +       y=0
 +       transform=translate(0,997.36218)
 +       id=rect2818
 +       style=fill:none;fill-opacity:1;fill-rule:evenodd;stroke:none /
 +    rect
 +       width=9
 +       height=38
 +       x=23
 +       y=1005.8622
 +       id=rect3599
 +       style=fill:#ff;fill-opacity:1;stroke:none /
 +    rect
 +       width=8.94349
 +       height=37.99044
 +       x=1020.3485
 +       y=-47.595592
 +       transform=matrix(-0.00107369,0.9942,-0.9889,-0.00148761,0,0)
 +       id=rect3599-4
 +       style=fill:#ff;fill-opacity:1;stroke:none /
 +  /g
 +/svg
 diff --git a/webactivity.py b/webactivity.py
 index 4be551e..5f4f917 100644
 --- a/webactivity.py
 +++ b/webactivity.py
 @@ -152,6 +152,7 @@ def _set_accept_languages():
     logging.debug('LANG set')

  from browser import TabbedView
 +from browser import Browser
  from webtoolbar import PrimaryToolbar
  from edittoolbar import EditToolbar
  from viewtoolbar import ViewToolbar
 @@ -443,6 +444,16 @@ class WebActivity(activity.Activity):
                 _logger.debug('keyboard: Zoom in')
                 self._tabbed_view.props.current_browser.zoom_in()
                 return True
 +            elif gtk.gdk.keyval_name(event.keyval) == t:
 +                browser = Browser()
 +                self._tabbed_view._append_tab(browser)
 +                if os.path.isfile(_LIBRARY_PATH):
 +                    browser.load_uri('file://' + _LIBRARY_PATH)
 +                else:
 +                    default_page = os.path.join(activity.get_bundle_path(),
 +                                            data/index.html)
 +                    browser.load_uri(default_page)
 +
         return False

     def _add_link(self):
 diff --git a/webtoolbar.py b/webtoolbar.py
 index 854345c..99979ca 100644
 

Re: [Sugar-devel] [PATCH] Browse: Add support for creating multiple tabs

2010-06-29 Thread Anish Mangal
 1. On f13 based sugar environments (such as soas3, jhbuild-0.88), this

Oops, I meant soas3 and jhbuild-0.88 running on f13.

On Wed, Jun 30, 2010 at 2:46 AM, Anish Mangal anishmangal2...@gmail.com wrote:
 Note:

 1. On f13 based sugar environments (such as soas3, jhbuild-0.88), this
 patch will occasionally cause Browse to crash when closing tabs. This
 probably happens because of a bug [1] (or something very similar to
 this). As a workaround, one can downgrade the cairo package from
 cairo-1.8.10 to cairo-1.8.8-1.fc11 (or upgrade to the latest
 development version 1.9.10-1, though I haven't tested that).

 2. This patch doesn't add an entry 'open link in new tab' to the
 context menu. That can
come as a separate patch.


 [1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=551852

 --
 Anish Mangal
 an...@sugarlabs.org


 On Wed, Jun 30, 2010 at 2:28 AM, anishmangal2002
 anishmangal2...@gmail.com wrote:
 This patch adds support to create multiple tabbed windows
 in Browse. A tab may be added by either clicking the add tab
 ('+') icon in the activity toolbar or by pressing 'ctrl+t'.

 Signed-off-by: anishmangal2002 anishmangal2...@gmail.com
 ---
  icons/add-tab.svg |   86 
 +
  webactivity.py    |   11 +++
  webtoolbar.py     |   21 +
  3 files changed, 118 insertions(+), 0 deletions(-)
  create mode 100644 icons/add-tab.svg

 diff --git a/icons/add-tab.svg b/icons/add-tab.svg
 new file mode 100644
 index 000..0220993
 --- /dev/null
 +++ b/icons/add-tab.svg
 @@ -0,0 +1,86 @@
 +?xml version=1.0 encoding=UTF-8 standalone=no?
 +!-- Created with Inkscape (http://www.inkscape.org/) --
 +
 +svg
 +   xmlns:dc=http://purl.org/dc/elements/1.1/;
 +   xmlns:cc=http://creativecommons.org/ns#;
 +   xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns#;
 +   xmlns:svg=http://www.w3.org/2000/svg;
 +   xmlns=http://www.w3.org/2000/svg;
 +   xmlns:sodipodi=http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd;
 +   xmlns:inkscape=http://www.inkscape.org/namespaces/inkscape;
 +   version=1.1
 +   width=55
 +   height=55
 +   id=svg2
 +   inkscape:version=0.47 r22583
 +   sodipodi:docname=add-tab.svg
 +  metadata
 +     id=metadata10
 +    rdf:RDF
 +      cc:Work
 +         rdf:about=
 +        dc:formatimage/svg+xml/dc:format
 +        dc:type
 +           rdf:resource=http://purl.org/dc/dcmitype/StillImage; /
 +      /cc:Work
 +    /rdf:RDF
 +  /metadata
 +  sodipodi:namedview
 +     pagecolor=#ff
 +     bordercolor=#66
 +     borderopacity=1
 +     objecttolerance=10
 +     gridtolerance=10
 +     guidetolerance=10
 +     inkscape:pageopacity=0
 +     inkscape:pageshadow=2
 +     inkscape:window-width=1280
 +     inkscape:window-height=721
 +     id=namedview8
 +     showgrid=false
 +     inkscape:zoom=4.2909091
 +     inkscape:cx=27.5
 +     inkscape:cy=27.033898
 +     inkscape:window-x=0
 +     inkscape:window-y=27
 +     inkscape:window-maximized=1
 +     inkscape:current-layer=layer1 /
 +  defs
 +     id=defs4
 +    inkscape:perspective
 +       sodipodi:type=inkscape:persp3d
 +       inkscape:vp_x=0 : 27.5 : 1
 +       inkscape:vp_y=0 : 1000 : 0
 +       inkscape:vp_z=55 : 27.5 : 1
 +       inkscape:persp3d-origin=27.5 : 18.33 : 1
 +       id=perspective12 /
 +  /defs
 +  g
 +     transform=translate(0,-997.36218)
 +     id=layer1
 +    rect
 +       width=55
 +       height=55
 +       x=0
 +       y=0
 +       transform=translate(0,997.36218)
 +       id=rect2818
 +       style=fill:none;fill-opacity:1;fill-rule:evenodd;stroke:none /
 +    rect
 +       width=9
 +       height=38
 +       x=23
 +       y=1005.8622
 +       id=rect3599
 +       style=fill:#ff;fill-opacity:1;stroke:none /
 +    rect
 +       width=8.94349
 +       height=37.99044
 +       x=1020.3485
 +       y=-47.595592
 +       
 transform=matrix(-0.00107369,0.9942,-0.9889,-0.00148761,0,0)
 +       id=rect3599-4
 +       style=fill:#ff;fill-opacity:1;stroke:none /
 +  /g
 +/svg
 diff --git a/webactivity.py b/webactivity.py
 index 4be551e..5f4f917 100644
 --- a/webactivity.py
 +++ b/webactivity.py
 @@ -152,6 +152,7 @@ def _set_accept_languages():
     logging.debug('LANG set')

  from browser import TabbedView
 +from browser import Browser
  from webtoolbar import PrimaryToolbar
  from edittoolbar import EditToolbar
  from viewtoolbar import ViewToolbar
 @@ -443,6 +444,16 @@ class WebActivity(activity.Activity):
                 _logger.debug('keyboard: Zoom in')
                 self._tabbed_view.props.current_browser.zoom_in()
                 return True
 +            elif gtk.gdk.keyval_name(event.keyval) == t:
 +                browser = Browser()
 +                self._tabbed_view._append_tab(browser)
 +                if os.path.isfile(_LIBRARY_PATH):
 +                    browser.load_uri('file://' + _LIBRARY_PATH)
 +                else:
 +                    default_page = os.path.join(activity.get_bundle_path(),
 +                      

Re: [Sugar-devel] [PATCH] Browse: Add support for creating multiple tabs

2010-06-29 Thread Lucian Branescu
I'm not sure it's a good idea to merge this if it causes Browse (vital
app) to occasionally crash on SoaS (very popular Sugar environment).
At the very least, the tabs feature should be disabled if that certain
version of cairo is detected.

Also, it would be more convenient if you put your work in a fork of
Browse at http://git.sugarlabs.org/projects/browse

On 29 June 2010 22:19, Anish Mangal anishmangal2...@gmail.com wrote:
 1. On f13 based sugar environments (such as soas3, jhbuild-0.88), this

 Oops, I meant soas3 and jhbuild-0.88 running on f13.

 On Wed, Jun 30, 2010 at 2:46 AM, Anish Mangal anishmangal2...@gmail.com 
 wrote:
 Note:

 1. On f13 based sugar environments (such as soas3, jhbuild-0.88), this
 patch will occasionally cause Browse to crash when closing tabs. This
 probably happens because of a bug [1] (or something very similar to
 this). As a workaround, one can downgrade the cairo package from
 cairo-1.8.10 to cairo-1.8.8-1.fc11 (or upgrade to the latest
 development version 1.9.10-1, though I haven't tested that).

 2. This patch doesn't add an entry 'open link in new tab' to the
 context menu. That can
 come as a separate patch.


 [1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=551852

 --
 Anish Mangal
 an...@sugarlabs.org


 On Wed, Jun 30, 2010 at 2:28 AM, anishmangal2002
 anishmangal2...@gmail.com wrote:
 This patch adds support to create multiple tabbed windows
 in Browse. A tab may be added by either clicking the add tab
 ('+') icon in the activity toolbar or by pressing 'ctrl+t'.

 Signed-off-by: anishmangal2002 anishmangal2...@gmail.com
 ---
  icons/add-tab.svg |   86 
 +
  webactivity.py    |   11 +++
  webtoolbar.py     |   21 +
  3 files changed, 118 insertions(+), 0 deletions(-)
  create mode 100644 icons/add-tab.svg

 diff --git a/icons/add-tab.svg b/icons/add-tab.svg
 new file mode 100644
 index 000..0220993
 --- /dev/null
 +++ b/icons/add-tab.svg
 @@ -0,0 +1,86 @@
 +?xml version=1.0 encoding=UTF-8 standalone=no?
 +!-- Created with Inkscape (http://www.inkscape.org/) --
 +
 +svg
 +   xmlns:dc=http://purl.org/dc/elements/1.1/;
 +   xmlns:cc=http://creativecommons.org/ns#;
 +   xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns#;
 +   xmlns:svg=http://www.w3.org/2000/svg;
 +   xmlns=http://www.w3.org/2000/svg;
 +   xmlns:sodipodi=http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd;
 +   xmlns:inkscape=http://www.inkscape.org/namespaces/inkscape;
 +   version=1.1
 +   width=55
 +   height=55
 +   id=svg2
 +   inkscape:version=0.47 r22583
 +   sodipodi:docname=add-tab.svg
 +  metadata
 +     id=metadata10
 +    rdf:RDF
 +      cc:Work
 +         rdf:about=
 +        dc:formatimage/svg+xml/dc:format
 +        dc:type
 +           rdf:resource=http://purl.org/dc/dcmitype/StillImage; /
 +      /cc:Work
 +    /rdf:RDF
 +  /metadata
 +  sodipodi:namedview
 +     pagecolor=#ff
 +     bordercolor=#66
 +     borderopacity=1
 +     objecttolerance=10
 +     gridtolerance=10
 +     guidetolerance=10
 +     inkscape:pageopacity=0
 +     inkscape:pageshadow=2
 +     inkscape:window-width=1280
 +     inkscape:window-height=721
 +     id=namedview8
 +     showgrid=false
 +     inkscape:zoom=4.2909091
 +     inkscape:cx=27.5
 +     inkscape:cy=27.033898
 +     inkscape:window-x=0
 +     inkscape:window-y=27
 +     inkscape:window-maximized=1
 +     inkscape:current-layer=layer1 /
 +  defs
 +     id=defs4
 +    inkscape:perspective
 +       sodipodi:type=inkscape:persp3d
 +       inkscape:vp_x=0 : 27.5 : 1
 +       inkscape:vp_y=0 : 1000 : 0
 +       inkscape:vp_z=55 : 27.5 : 1
 +       inkscape:persp3d-origin=27.5 : 18.33 : 1
 +       id=perspective12 /
 +  /defs
 +  g
 +     transform=translate(0,-997.36218)
 +     id=layer1
 +    rect
 +       width=55
 +       height=55
 +       x=0
 +       y=0
 +       transform=translate(0,997.36218)
 +       id=rect2818
 +       style=fill:none;fill-opacity:1;fill-rule:evenodd;stroke:none /
 +    rect
 +       width=9
 +       height=38
 +       x=23
 +       y=1005.8622
 +       id=rect3599
 +       style=fill:#ff;fill-opacity:1;stroke:none /
 +    rect
 +       width=8.94349
 +       height=37.99044
 +       x=1020.3485
 +       y=-47.595592
 +       
 transform=matrix(-0.00107369,0.9942,-0.9889,-0.00148761,0,0)
 +       id=rect3599-4
 +       style=fill:#ff;fill-opacity:1;stroke:none /
 +  /g
 +/svg
 diff --git a/webactivity.py b/webactivity.py
 index 4be551e..5f4f917 100644
 --- a/webactivity.py
 +++ b/webactivity.py
 @@ -152,6 +152,7 @@ def _set_accept_languages():
     logging.debug('LANG set')

  from browser import TabbedView
 +from browser import Browser
  from webtoolbar import PrimaryToolbar
  from edittoolbar import EditToolbar
  from viewtoolbar import ViewToolbar
 @@ -443,6 +444,16 @@ class WebActivity(activity.Activity):
                 _logger.debug('keyboard: Zoom in')
                 

Re: [Sugar-devel] [PATCH] Browse: Add support for creating multiple tabs

2010-06-29 Thread Walter Bender
On Tue, Jun 29, 2010 at 4:58 PM, anishmangal2002
anishmangal2...@gmail.com wrote:
 This patch adds support to create multiple tabbed windows
 in Browse. A tab may be added by either clicking the add tab
 ('+') icon in the activity toolbar or by pressing 'ctrl+t'.

 Signed-off-by: anishmangal2002 anishmangal2...@gmail.com
 ---
  icons/add-tab.svg |   86 
 +
  webactivity.py    |   11 +++
  webtoolbar.py     |   21 +
  3 files changed, 118 insertions(+), 0 deletions(-)
  create mode 100644 icons/add-tab.svg

 diff --git a/icons/add-tab.svg b/icons/add-tab.svg
 new file mode 100644
 index 000..0220993
 --- /dev/null
 +++ b/icons/add-tab.svg
 @@ -0,0 +1,86 @@
 +?xml version=1.0 encoding=UTF-8 standalone=no?
 +!-- Created with Inkscape (http://www.inkscape.org/) --
 +
 +svg
 +   xmlns:dc=http://purl.org/dc/elements/1.1/;
 +   xmlns:cc=http://creativecommons.org/ns#;
 +   xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns#;
 +   xmlns:svg=http://www.w3.org/2000/svg;
 +   xmlns=http://www.w3.org/2000/svg;
 +   xmlns:sodipodi=http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd;
 +   xmlns:inkscape=http://www.inkscape.org/namespaces/inkscape;
 +   version=1.1
 +   width=55
 +   height=55
 +   id=svg2
 +   inkscape:version=0.47 r22583
 +   sodipodi:docname=add-tab.svg
 +  metadata
 +     id=metadata10
 +    rdf:RDF
 +      cc:Work
 +         rdf:about=
 +        dc:formatimage/svg+xml/dc:format
 +        dc:type
 +           rdf:resource=http://purl.org/dc/dcmitype/StillImage; /
 +      /cc:Work
 +    /rdf:RDF
 +  /metadata
 +  sodipodi:namedview
 +     pagecolor=#ff
 +     bordercolor=#66
 +     borderopacity=1
 +     objecttolerance=10
 +     gridtolerance=10
 +     guidetolerance=10
 +     inkscape:pageopacity=0
 +     inkscape:pageshadow=2
 +     inkscape:window-width=1280
 +     inkscape:window-height=721
 +     id=namedview8
 +     showgrid=false
 +     inkscape:zoom=4.2909091
 +     inkscape:cx=27.5
 +     inkscape:cy=27.033898
 +     inkscape:window-x=0
 +     inkscape:window-y=27
 +     inkscape:window-maximized=1
 +     inkscape:current-layer=layer1 /
 +  defs
 +     id=defs4
 +    inkscape:perspective
 +       sodipodi:type=inkscape:persp3d
 +       inkscape:vp_x=0 : 27.5 : 1
 +       inkscape:vp_y=0 : 1000 : 0
 +       inkscape:vp_z=55 : 27.5 : 1
 +       inkscape:persp3d-origin=27.5 : 18.33 : 1
 +       id=perspective12 /
 +  /defs
 +  g
 +     transform=translate(0,-997.36218)
 +     id=layer1
 +    rect
 +       width=55
 +       height=55
 +       x=0
 +       y=0
 +       transform=translate(0,997.36218)
 +       id=rect2818
 +       style=fill:none;fill-opacity:1;fill-rule:evenodd;stroke:none /
 +    rect
 +       width=9
 +       height=38
 +       x=23
 +       y=1005.8622
 +       id=rect3599
 +       style=fill:#ff;fill-opacity:1;stroke:none /
 +    rect
 +       width=8.94349
 +       height=37.99044
 +       x=1020.3485
 +       y=-47.595592
 +       transform=matrix(-0.00107369,0.9942,-0.9889,-0.00148761,0,0)
 +       id=rect3599-4
 +       style=fill:#ff;fill-opacity:1;stroke:none /
 +  /g
 +/svg

Please save your svg file as Simple SVG so as to eliminate all of the
Inkscape spam.

-walter

 diff --git a/webactivity.py b/webactivity.py
 index 4be551e..5f4f917 100644
 --- a/webactivity.py
 +++ b/webactivity.py
 @@ -152,6 +152,7 @@ def _set_accept_languages():
     logging.debug('LANG set')

  from browser import TabbedView
 +from browser import Browser
  from webtoolbar import PrimaryToolbar
  from edittoolbar import EditToolbar
  from viewtoolbar import ViewToolbar
 @@ -443,6 +444,16 @@ class WebActivity(activity.Activity):
                 _logger.debug('keyboard: Zoom in')
                 self._tabbed_view.props.current_browser.zoom_in()
                 return True
 +            elif gtk.gdk.keyval_name(event.keyval) == t:
 +                browser = Browser()
 +                self._tabbed_view._append_tab(browser)
 +                if os.path.isfile(_LIBRARY_PATH):
 +                    browser.load_uri('file://' + _LIBRARY_PATH)
 +                else:
 +                    default_page = os.path.join(activity.get_bundle_path(),
 +                                            data/index.html)
 +                    browser.load_uri(default_page)
 +
         return False

     def _add_link(self):
 diff --git a/webtoolbar.py b/webtoolbar.py
 index 854345c..99979ca 100644
 --- a/webtoolbar.py
 +++ b/webtoolbar.py
 @@ -18,6 +18,9 @@

  from gettext import gettext as _

 +_LIBRARY_PATH = '/usr/share/library-common/index.html'
 +
 +import os
  import gobject
  import gtk
  import pango
 @@ -31,6 +34,7 @@ from sugar.graphics.toolbarbox import ToolbarBox
  from sugar.activity.widgets import ActivityToolbarButton
  from sugar.activity.widgets import StopButton
  from sugar.activity import activity
 +from browser import Browser

  import filepicker
  import places
 @@ -267,6 +271,13 @@ class 

Re: [Sugar-devel] [PATCH] Browse: Add support for creating multiple tabs

2010-06-29 Thread Bernie Innocenti
El Tue, 29-06-2010 a las 22:26 +0100, Lucian Branescu escribió:
 I'm not sure it's a good idea to merge this if it causes Browse (vital
 app) to occasionally crash on SoaS (very popular Sugar environment).
 At the very least, the tabs feature should be disabled if that certain
 version of cairo is detected.

I'd go for the workaround, as we'd really want this feature merged in
time for F11-0.88.

Meanwhile, can someone please file a bug in RedHat's bugzilla? I've cc'd
the current Cairo maintainer in Fedora. Benjamin, this is the equivalent
bug in Debian: 

  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=551852


On 29 June 2010 22:19, Anish Mangal anishmangal2...@gmail.com wrote:
  1. On f13 based sugar environments (such as soas3, jhbuild-0.88),
this
 
  Oops, I meant soas3 and jhbuild-0.88 running on f13.
 
  On Wed, Jun 30, 2010 at 2:46 AM, Anish Mangal
anishmangal2...@gmail.com wrote:
  Note:
 
  1. On f13 based sugar environments (such as soas3, jhbuild-0.88), this
  patch will occasionally cause Browse to crash when closing tabs. This
  probably happens because of a bug [1] (or something very similar to
  this). As a workaround, one can downgrade the cairo package from
  cairo-1.8.10 to cairo-1.8.8-1.fc11 (or upgrade to the latest
  development version 1.9.10-1, though I haven't tested that).
 
  2. This patch doesn't add an entry 'open link in new tab' to the
  context menu. That can come as a separate patch.
 
 
  [1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=551852
 
  --
  Anish Mangal
  an...@sugarlabs.org

-- 
   // Bernie Innocenti - http://codewiz.org/
 \X/  Sugar Labs   - http://sugarlabs.org/

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