import deskbar from deskbar.Handler import Handler from deskbar.Match import Match import twitter from gettext import gettext as _ _debug=False if _debug: import traceback #We register our handler with deskbar applet using the HANDLERS variable. This is a dictionary, and the elements of the dictionary are mostly self-explanatory. The key of the HANDLER ("HelloHandler" in this case) should be the name of the class that subclasses deskbar.Handler.Handler. HANDLERS = { "TwitterHandler" : { "name" : _("Twitter"), "description" : _("What are you doing?"), "version" : "0.1", } } #This is the bare minimum Match subclass example. #It simply always displays "Hello World" in the dropdown list. class TwitterMatch(Match): def action(self, text=None): api = twitter.Api() api.PostUpdate('TWITTER_USERNAME', 'TWITTER_PASSWORD', self.name) def get_category(self): return "actions" def get_verb(self): return _("Twitter: %(name)s") #This is the bare minimum handler. No matter what the query is, it returns one match. The match has no interesting information. class TwitterHandler(Handler): def __init__ (self): deskbar.Handler.Handler.__init__ (self, "/home/YOUR_USERNAME/.gnome2/deskbar-applet/handlers/twitter.png") def query(self, query): return [TwitterMatch(self, name=query)]