Google Summer of Code project, sugarbot

Zach Riggle zachriggle at gmail.com
Tue May 20 13:04:52 EDT 2008


Hi Tom, thanks for the interest in the project.

Right now everything is more towards the "exploratory" phase, in  
seeing what can be done.  I thought that I had a method picked out  
that worked fairly well on standalone PyGTK apps, that doesn't work so  
well for OLPC Activities.

The approach that I found works with zero-to-minimal modification of  
the target applications is the same employed by kiwi.ui.test of the  
Kiwi project (http://www.async.com.br/projects/kiwi/).  The majority  
of the functionality stems from a call to gtk.gdk.event_handler_set to  
intercept all GTK Events (gtk.Event).  This allows me to build a very  
accurate picture of how a given application is laid out, through the  
various gdk.MAP (and related) Events.  Additionally, since I am doing  
a great deal of work with GTK Events, I will already have a great deal  
of infrastructure in place to deal with events, and can use them to  
drive the GUI automation.  I find that this method is very  
straightforward and non-intrusive, and allows me to see /everything/  
that goes on inside GTK.

However, the limitation of this method should be readily apparent: It  
only works when the target code is executing in the same process as my  
code.  In order to handle this for normal PyGTK apps, a simple call to  
exec() would suffice in getting the code to execute in the same process.

For actually working with OLPC Activities, it was suggested to port  
what code I had into a Sugar Activity (not a difficult task,  
thankfully), and attempt to "call" other Activities from there, for  
example:

class sugarbot(activity.Activity):
	def launchCalculateActivity(self,handle):
		sys.path.insert(1,"/home/zriggle/Activities/Calculate.activity")
		from calculate import Calculate
		doActivity = Calculate(handle)
	
	def __init__(self, handle):
		self.launchCalculateActivity(handle)

However, this method causes issues with sugarbot.__init__ never  
completing, which results in exceptions being raised when sugar- 
activity tries to perform some manipulation on a sugarbot object.  The  
only workaround I've thought of so far is to launch a separate thread  
for the called Activity.

Thanks for the interest :-)
Zach



More information about the Devel mailing list