But the effort has born its fruits, and now we can run all of Gnash as a gtk widget inside a Sugar activity:
And this is the code:
import os
import gtk
import gnash
from sugar.activity import activity
class EatBoomActivity(activity.Activity):
def __init__(self, handle, browser=None):
activity.Activity.__init__(self, handle)
toolbox = activity.ActivityToolbox(self)
self.set_toolbox(toolbox)
toolbox.show()
view = gnash.View()
view.load_movie(os.path.join(activity.get_bundle_path(), 'EatBoom.swf'))
view.start()
self.set_canvas(view)
view.show()
For non-Sugar-enabled gtk people, you will be able to embed gnash doing something like this:
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
view = gnash_view_new ();
gtk_container_add (GTK_CONTAINER (window), view);
gtk_widget_show (view);
gtk_widget_show (window);
gnash_view_load_movie(GNASH_VIEW(view), argv[1]);
gnash_view_start(GNASH_VIEW(view));
This is without using GtkPlug and, of course, running inside the same process. So by adding methods to the C widget we can control all of the Gnash engine and expose it trivially to python with pygtk. And through the use of Gnash extensions, we can extend the ActionScript class library with Sugar specifics so it integrates well with the rest of the environment.
This is still a proof of concept, but plan to start working right now in finding a way to integrate it in upstream Gnash.