[Sugar-devel] Read port to Gtk 3 status

Gonzalo Odiard gonzalo at laptop.org
Fri Nov 4 17:39:04 EDT 2011


A topic probably interesting to hackers working in sugar-toolkit:

If I start Read without selecting a file, will try to open a ObjectChooser
to select the file:
But after the port crash with a error:

1320441958.125536 ERROR dbus.connection: Unable to set arguments
(<ReadActivity object at 0x282f960 (readactivity+ReadActivity at
0x28bd020)>, 'Text') according to signature u'is': <type
'exceptions.TypeError'>: an integer is required
Traceback (most recent call last):
  File "/home/gonzalo/sugar-jhbuild/install/bin/sugar-activity", line 147,
in <module>
    main()
  File "/home/gonzalo/sugar-jhbuild/install/bin/sugar-activity", line 142,
in main
    instance = create_activity_instance(activity_constructor,
activity_handle)
  File "/home/gonzalo/sugar-jhbuild/install/bin/sugar-activity", line 35,
in create_activity_instance
    activity = constructor(handle)
  File "/home/gonzalo/Activities/Read.activity/readactivity.py", line 335,
in __init__
    self._show_journal_object_picker()
  File "/home/gonzalo/Activities/Read.activity/readactivity.py", line 569,
in _show_journal_object_picker
    result = chooser.run()
  File
"/home/gonzalo/sugar-jhbuild/install/lib/python2.7/site-packages/sugar3/graphics/objectchooser.py",
line 86, in run
    self._chooser_id = journal.ChooseObject(self._parent_xid, what_filter)
  File "/usr/lib/python2.7/site-packages/dbus/proxies.py", line 68, in
__call__
    return self._proxy_method(*args, **keywords)
  File "/usr/lib/python2.7/site-packages/dbus/proxies.py", line 140, in
__call__
    **keywords)
  File "/usr/lib/python2.7/site-packages/dbus/connection.py", line 620, in
call_blocking
    message.append(signature=signature, *args)
TypeError: an integer is required

The code in Read is:

        chooser = ObjectChooser(_('Choose document'), self,
                                Gtk.DialogFlags.MODAL |
                                Gtk.DialogFlags.DESTROY_WITH_PARENT,
                                what_filter=mime.GENERIC_TYPE_TEXT)
        try:
            result = chooser.run()

and apparently the problem is with the parameter "parent".

I can put:
        chooser = ObjectChooser(_('Choose document'), None,
                                Gtk.DialogFlags.MODAL |
                                Gtk.DialogFlags.DESTROY_WITH_PARENT,
                                what_filter=mime.GENERIC_TYPE_TEXT)

and the activity will start, but with gtk2 sugar-toolkit we had a problem
when the activities do not set the parent, and the dialog was over any
activity,
if the user change the activity.

In the code of ObjectChooser in the gtk3 branch of sugar toolkit there is
the following code:

        if parent is None:
            parent_xid = 0
        elif hasattr(parent, 'window') and hasattr(parent.window, 'xid'):
            parent_xid = parent.window.xid
        else:
            parent_xid = parent

but the activity do not have a window and if I replace with get_window, I
couldn't find xdi.

Any idea about what to do with this issue?

Gonzalo




On Fri, Nov 4, 2011 at 5:42 PM, Gonzalo Odiard <gonzalo at laptop.org> wrote:

> And the patch is here :P
>
> Gonzalo
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20111104/acbc7c37/attachment.html>


More information about the Sugar-devel mailing list