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

godiard at sugarlabs.org godiard at sugarlabs.org
Thu Oct 14 14:09:37 EDT 2010


From: Gonzalo Odiard <godiard at 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



More information about the Sugar-devel mailing list