Now that we know the basic steps to create and run the applet, we're going to structure the code in a simple way. We'll create a sample class, that will contain all the applet code. The new sample_applet_factory will call the class constructor:
def sample_applet_factory(applet, iid):
Sample(applet,iid)
return gtk.TRUE
The sample class will have the following skeleton, that we'll explain soon:
[import section]
class Sample:
[class methods]
[callbacks methods]
.....
[optional timeout callback method]
[create popup menu with the applet options]
[
__init__ method
[some instance variable definitions]
[signals handlers definitions]
[widget definitions]
[optionally reading glade.XML]
[signal_autoconnect to handlers]
]