Re: [Sugar-devel] [PATCH] fix SL #2001 - Write does not pass parent window xid to ObjectChooser

2010-10-15 Thread Tomeu Vizoso
On Thu, Oct 14, 2010 at 20:09,  godi...@sugarlabs.org wrote:
 From: Gonzalo Odiard godi...@sugarlabs.org

 This is a regresion, probably introduced when changed the toolbar.
 May be pass self.abiword_canvas and self to ImageToolbar is not the smarter 
 option.

You are right, would be better if the activity listened to signals in
the toolbar and called methods on the canvas as a result.

But in this case, the toolbar can get a reference to the top level window with:

http://www.pygtk.org/docs/pygtk/class-gtkwidget.html#method-gtkwidget--get-toplevel

Btw, is Write maintained these days?

Regards,

Tomeu

 ---
  AbiWordActivity.py |    2 +-
  toolbar.py         |    5 +++--
  2 files changed, 4 insertions(+), 3 deletions(-)

 diff --git a/AbiWordActivity.py b/AbiWordActivity.py
 index f6c54fa..7deab8c 100644
 --- a/AbiWordActivity.py
 +++ b/AbiWordActivity.py
 @@ -110,7 +110,7 @@ class AbiWordActivity (activity.Activity):
         toolbar_box.toolbar.insert(list_toolbar, -1)

         insert_toolbar = ToolbarButton()
 -        insert_toolbar.props.page = InsertToolbar(self.abiword_canvas)
 +        insert_toolbar.props.page = InsertToolbar(self.abiword_canvas, self)
         insert_toolbar.props.icon_name = 'insert-table'
         insert_toolbar.props.label = _('Table')
         toolbar_box.toolbar.insert(insert_toolbar, -1)
 diff --git a/toolbar.py b/toolbar.py
 index 75243c7..a16803c 100644
 --- a/toolbar.py
 +++ b/toolbar.py
 @@ -176,10 +176,11 @@ class EditToolbar(gtk.Toolbar):
         tool_item.show()

  class InsertToolbar(gtk.Toolbar):
 -    def __init__(self, abiword_canvas):
 +    def __init__(self, abiword_canvas, parent):
         gtk.Toolbar.__init__(self)

         self._abiword_canvas = abiword_canvas
 +        self._parent = parent

         self._table = abiword.TableCreator()
         self._table.set_labels(_('Table'), _('Cancel'))
 @@ -234,7 +235,7 @@ class InsertToolbar(gtk.Toolbar):
         def cb(object):
             logging.debug('ObjectChooser: %r' % object)
             self._abiword_canvas.insert_image(object.file_path, True)
 -        chooser.pick(what=chooser.IMAGE, cb=cb)
 +        chooser.pick(parent=self._parent, what=chooser.IMAGE, cb=cb)

     def _table_cb(self, abi, rows, cols):
         self._abiword_canvas.insert_table(rows, cols)
 --
 1.7.2.3

 ___
 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] fix SL #2001 - Write does not pass parent window xid to ObjectChooser

2010-10-15 Thread Tomeu Vizoso
On Fri, Oct 15, 2010 at 17:00, Gonzalo Odiard godi...@sugarlabs.org wrote:


 On Fri, Oct 15, 2010 at 8:36 AM, Tomeu Vizoso to...@sugarlabs.org wrote:

 On Thu, Oct 14, 2010 at 20:09,  godi...@sugarlabs.org wrote:
  From: Gonzalo Odiard godi...@sugarlabs.org
 
  This is a regresion, probably introduced when changed the toolbar.
  May be pass self.abiword_canvas and self to ImageToolbar is not the
  smarter option.

 You are right, would be better if the activity listened to signals in
 the toolbar and called methods on the canvas as a result.

 But in this case, the toolbar can get a reference to the top level window
 with:


 http://www.pygtk.org/docs/pygtk/class-gtkwidget.html#method-gtkwidget--get-toplevel


 Ok, i will redo the patch.


 Btw, is Write maintained these days?


 Good question :) You are one of the co-maintainers ;)
 http://wiki.sugarlabs.org/go/Development_Team/Release/Modules

I used to be just a peer until someone changed that page to say co-maintainer :)

Regards,

Tomeu

 Regards

 Gonzalo

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


Re: [Sugar-devel] [PATCH] fix SL #2001 - Write does not pass parent window xid to ObjectChooser

2010-10-15 Thread Gonzalo Odiard
What is the status of the other maintainers?
I can volunteer to be co-co-maintainer :)

Gonzalo

On Fri, Oct 15, 2010 at 12:05 PM, Tomeu Vizoso to...@sugarlabs.org wrote:

 On Fri, Oct 15, 2010 at 17:00, Gonzalo Odiard godi...@sugarlabs.org
 wrote:
 
 
  On Fri, Oct 15, 2010 at 8:36 AM, Tomeu Vizoso to...@sugarlabs.org
 wrote:
 
  On Thu, Oct 14, 2010 at 20:09,  godi...@sugarlabs.org wrote:
   From: Gonzalo Odiard godi...@sugarlabs.org
  
   This is a regresion, probably introduced when changed the toolbar.
   May be pass self.abiword_canvas and self to ImageToolbar is not the
   smarter option.
 
  You are right, would be better if the activity listened to signals in
  the toolbar and called methods on the canvas as a result.
 
  But in this case, the toolbar can get a reference to the top level
 window
  with:
 
 
 
 http://www.pygtk.org/docs/pygtk/class-gtkwidget.html#method-gtkwidget--get-toplevel
 
 
  Ok, i will redo the patch.
 
 
  Btw, is Write maintained these days?
 
 
  Good question :) You are one of the co-maintainers ;)
  http://wiki.sugarlabs.org/go/Development_Team/Release/Modules

 I used to be just a peer until someone changed that page to say
 co-maintainer :)

 Regards,

 Tomeu

  Regards
 
  Gonzalo
 




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


[Sugar-devel] [PATCH] fix SL #2001 - Write does not pass parent window xid to ObjectChooser

2010-10-14 Thread godiard
From: Gonzalo Odiard godi...@sugarlabs.org

This is a regresion, probably introduced when changed the toolbar.
May be pass self.abiword_canvas and self to ImageToolbar is not the smarter 
option.
---
 AbiWordActivity.py |2 +-
 toolbar.py |5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/AbiWordActivity.py b/AbiWordActivity.py
index f6c54fa..7deab8c 100644
--- a/AbiWordActivity.py
+++ b/AbiWordActivity.py
@@ -110,7 +110,7 @@ class AbiWordActivity (activity.Activity):
 toolbar_box.toolbar.insert(list_toolbar, -1)
 
 insert_toolbar = ToolbarButton()
-insert_toolbar.props.page = InsertToolbar(self.abiword_canvas)
+insert_toolbar.props.page = InsertToolbar(self.abiword_canvas, self)
 insert_toolbar.props.icon_name = 'insert-table'
 insert_toolbar.props.label = _('Table')
 toolbar_box.toolbar.insert(insert_toolbar, -1)
diff --git a/toolbar.py b/toolbar.py
index 75243c7..a16803c 100644
--- a/toolbar.py
+++ b/toolbar.py
@@ -176,10 +176,11 @@ class EditToolbar(gtk.Toolbar):
 tool_item.show()
 
 class InsertToolbar(gtk.Toolbar):
-def __init__(self, abiword_canvas):
+def __init__(self, abiword_canvas, parent):
 gtk.Toolbar.__init__(self)
 
 self._abiword_canvas = abiword_canvas
+self._parent = parent
 
 self._table = abiword.TableCreator()
 self._table.set_labels(_('Table'), _('Cancel'))
@@ -234,7 +235,7 @@ class InsertToolbar(gtk.Toolbar):
 def cb(object):
 logging.debug('ObjectChooser: %r' % object)
 self._abiword_canvas.insert_image(object.file_path, True)
-chooser.pick(what=chooser.IMAGE, cb=cb)
+chooser.pick(parent=self._parent, what=chooser.IMAGE, cb=cb)
 
 def _table_cb(self, abi, rows, cols):
 self._abiword_canvas.insert_table(rows, cols)
-- 
1.7.2.3

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