Test python plugin

master
Yevgen Muntyan 2006-04-29 04:39:54 -05:00
parent d95dbe058d
commit 2b49767130
1 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,41 @@
import moo
import gobject
PLUGIN_ID = "TestPythonPlugin"
class Action(moo.edit.Action):
def __init__(self):
moo.edit.Action.__init__(self)
print "__init__"
def do_check_state(self):
self.set_property("label", "AnAction")
print "check_state"
return True
class Plugin(moo.edit.Plugin):
def __init__(self):
moo.edit.Plugin.__init__(self)
self.info = {
"id" : PLUGIN_ID,
"name" : "Test python plugin",
"description" : "Test python plugin",
"author" : "Yevgen Muntyan <muntyan@math.tamu.edu>",
"version" : "3.1415926",
"enabled" : True,
"visible" : True,
"langs" : "c",
}
moo.edit.edit_class_add_action(moo.edit.Edit, "AnAction", Action)
self.ui.append(moo.edit.Plugin.UIInfo("Editor/Popup", "AnAction"))
def attach_doc(self, doc, window):
print "attaching to", doc
def detach_doc(self, doc, window):
print "detaching from", doc
gobject.type_register(Action)
moo.edit.plugin_register(Plugin)