[Sugar-devel] Problem converting an activity from 0.82 to 0.86

Behavior Vehikel b.vehikel at googlemail.com
Sun Nov 8 15:23:47 EST 2009


Last months I developed a activity for sugar. I used sugar 0.82 on
Ubuntu 8.10. The activity is not ready yet, but works running in
Xephyr.
Now I am testing my new activity using Trisquel 3.0 with sugar 0.86.2.
But I can not get the GUI running. On sugar 0.86.2 I got an exception
when I try to set the canvas. Same source code works on 0.82. Maybe
there is an error in my  source code and 0.82 is more tolerant.

How to port from 0.82 to 0.86?
Is there a list of (breaking) changes or deprecated methods?

Tanks, Thomas

Here are the details:
Log-File:
1257703419.020482 DEBUG Kandid: searching for extensions in
/usr/share/sugar/activities/Kandid.activity

1257703419.114374 DEBUG Kandid: Starting activity...

1257703419.209278 WARNING root: No gtk.AccelGroup in the top level window.

1257703419.217976 WARNING root: No gtk.AccelGroup in the top level window.

/var/lib/python-support/python2.6/sugar/graphics/window.py:290:
DeprecationWarning: use toolbar_box instead of toolbox

  warnings.warn('use toolbar_box instead of toolbox', DeprecationWarning)

1257703419.278926 DEBUG Kandid: set_canvas(self._main_view) [<gtk.HBox
object at 0xa59ce3c (GtkHBox at 0xad9c628)>]

Traceback (most recent call last):

  File "/usr/bin/sugar-activity", line 21, in <module>

    main.main()

  File "/var/lib/python-support/python2.6/sugar/activity/main.py",
line 146, in main

    create_activity_instance(activity_constructor, activity_handle)

  File "/var/lib/python-support/python2.6/sugar/activity/main.py",
line 35, in create_activity_instance

    activity = constructor(handle)

  File "/usr/share/sugar/activities/Kandid.activity/activity.py", line
69, in __init__

    self.set_canvas(self._main_view)

  File "/var/lib/python-support/python2.6/sugar/activity/activity.py",
line 402, in set_canvas

    Window.set_canvas(self, canvas)

  File "/var/lib/python-support/python2.6/sugar/graphics/window.py",
line 174, in set_canvas

    self._event_box.remove(self._canvas)

TypeError: GtkContainer.remove() argument 1 must be gtk.Widget, not KandidCanvas

Activity died: pid 5473 condition 256 data (None, <open file
'<fdopen>', mode 'w' at 0x9d137a0>)

Source code:
    def __init__(self, handle):
        activity.Activity.__init__(self, handle)
        self._name = handle
        ka_debug.info('Starting activity...')

        # Set title for our Activity
        self.set_title('Kandid')

        # Attach sugar toolbox (Share, ...)
        toolbox = activity.ActivityToolbox(self)
        self.set_toolbox(toolbox)
        toolbox.show()

        # Create the main container
#        self._main_view = gtk.VBox()
        self._main_view = gtk.HBox()

        # Create GUI and attach that widget to our window
        self._canvas = ka_canvas.KandidCanvas()
        self._main_view.pack_start(self._canvas.widget)

        # Display everything
        self._canvas.widget.show()
        self._main_view.show()
        ka_debug.info('set_canvas(self._main_view) [%s]' % (self._main_view))
        self.set_canvas(self._main_view)               # <-- Activity died here




-- 
http://digital-defect.org


More information about the Sugar-devel mailing list