[sugar] Python: distutils, setuptools, packages, etc

Owen Williams ywwg
Thu Sep 28 13:14:41 EDT 2006


On Thu, 2006-09-28 at 11:56 -0500, Ian Bicking wrote:
> Marco Pesenti Gritti wrote:
> > Is there a simple, well written setup.py you would suggest to look at to 
> > get an idea of how it might look for an activity? Also trying to 
> > actually write something like 
> > http://wiki.laptop.org/go/Sugar_Activity_Tutorial (the code, not the 
> > tutorial) using setuptools could really be interesting.
> 
> Whew, those instructions are tricky. 

I've done a little editing on the instructions a bit, and I agree that
they are still tricky.  I'm also totally new to auto* tools which is why
I added the explanatory text.  Please help make it better by making your
own changes to the wiki.

>  My impression is that you create a 
> source layout like:
> 
>    MyCode/
>      mycode/__init__.py
>      mycode/mycode.activity
>      mycode/the_actual_code.py
> 
> And I guess ultimately "sugar-setup-activity mycode/mycode.activity" is 
> called?

No, you call it like sugar-activity org.laptop.sugar.PenguinTV where the
org.laptop string is the id from the .activity file.  I had a lot of
trouble getting this part right.



> 
> But, um, the activity.  I'm actually vague about what happens *to* the 
> activity.  Also, I believe there are some security things to figure out 
> about installation.  So this is rather anticlimactic, since I can't 
> complete the setuptools/activity story...

The activity.py file has one job -- add the main widget of your program
to "self".    In most cases, this means it will simply instantiate your
program and self.add a widget from that program into the activity.

In other words, when your activity is loaded you're given a blank
widget, and it's your responsibility to put something into that widget.
Instead of a Window, you're working in a widget.

owen




More information about the Sugar-devel mailing list