All pastes #74824 Raw Edit

kamstrup

public python v1 · immutable
#74824 ·published 2006-06-29 14:28 UTC
rendered paste body
from gettext import gettext as _import gtkimport deskbarfrom deskbar.Handler import Handlerfrom deskbar.Match import Matchimport reHANDLERS = {        "MySQLBugHandler" : {                "name": _("MySQL Bugs"),                "description": _("goes to the web page for a MySQL bug number"),        }}BUGEXPR = re.compile(r"^BUG(?P<bugno>\d+)")class MySQLBugMatch(Match):        def __init__(self, backend, bugno, **args):                deskbar.Match.Match.__init__(self, backend, **args)		self.bugno= bugno                        def action(self, text=None):		gnomevfs.url_show("http://bugs.mysql.com/" + self.bugno)        def get_category(self):                return "actions"	def get_name (self, text=None):		# SEE Match.py for 		return {"bugno":self.bugno}        def get_verb(self):                return _("Open MySQL Bug <b>%(bugno)s</b>")                def get_hash(self, text=None):                return self.bugnoclass MySQLBugHandler(Handler):        def __init__(self):                deskbar.Handler.Handler.__init__(self, "mysql_bugs")                        def query(self, query, max=1):  # ADD max=1		match = BUGEXPR.match(query)		if match != None:			return [MySQLBugMatch(self, match.group('bugno'))]		return []