Modified all extra plugins for new interface

This commit is contained in:
bjschuma 2010-01-22 00:02:05 -05:00
parent 7de5fbfd39
commit e485b1e187
7 changed files with 89 additions and 152 deletions

View File

@ -34,6 +34,8 @@ class Plugin:
def start(self,args=None):
try:
return self.run(args)
# Find out information about the error
except:
trace = inspect.trace()
frame = trace[len(trace)-1]
@ -41,14 +43,8 @@ class Plugin:
filename = frame[1]
lineno = str(frame[2])
#filename = frame[1]
#lineno = str(inspect.currentframe().f_back.f_lineno)
#filename = inspect.currentframe().f_forward.f_code.co_filename
filename = filename.rsplit(os.sep,1)[1]
write(filename+" ("+lineno+")")
#print e
def run(self,args=None):

View File

@ -123,7 +123,7 @@ write("Setting default values...", True)
# Find who is running the program
user = os.path.expanduser("~")
set("USER", user)
set("PLUGPATH", ["../core" ]) #, "../extra"])
set("PLUGPATH", ["../core", "../extra"])
# Find out what platform we are running on
set("ARCH", sys.platform)

View File

@ -14,6 +14,7 @@ class Plugin(plugin.Plugin):
plugin.Plugin.__init__(self)
self.help = "Returns a short description of the plugin"
def run(self, args=None):
if args == None:
plugin = "help"

View File

@ -4,31 +4,21 @@ __author__="bjschuma"
__date__ ="$Dec 7, 2009 9:12:00 AM$"
global name, app, type, path, opt
name = "test"
app = "scion"
type = "extra"
path = ""
opt = []
from bt import plugin
from bt.message import write
# Called every time the plugin is enabled
def open():
class Plugin(plugin.Plugin):
def __init__(self):
plugin.Plugin.__init__(self)
self.help = "An example plugin."
def open(self):
write("Example plugin has been started",True)
#write("Example plugin has been changed",True)
# Called every time the plugin is stopped
def close():
def close(self):
write("Example plugin has been stopped",True)
def help():
return "Just a simple example plugin"
# Called when the plugin needs to perform some action
def run(args=None):
pass

View File

@ -4,33 +4,18 @@ __author__="bjschuma"
__date__ ="$Dec 27, 2009 6:35:45 PM$"
global name, app, type, path, opt
name = "lsmod"
app = "scion"
type = "extra"
path = ""
opt = []
from bt.message import write
from manager import manager
from bt import plugin
# Called every time the plugin is enabled
def open():
pass
class Plugin(plugin.Plugin):
def __init__(self):
plugin.Plugin.__init__(self)
self.help = "Used to list currently loaded plugins"
# Called every time the plugin is stopped
def close():
pass
def help():
return "Used to list currently loaded plugins"
# Called when the plugin needs to perform some action
def run(args=None):
def run(self, args=None):
mods = []
if (args == None) or (("enabled" in args)==True) or (("all" in args)==True):
for plugin in manager.enabled.keys():

View File

@ -4,33 +4,19 @@ __author__="bjschuma"
__date__ ="$Jan 9, 2010 7:22:31 PM$"
global name, app, type, path, opt
name = "lsset"
app = "scion"
type = "extra"
path = ""
opt = []
from bt.message import write
import settings
from bt import plugin
# Called every time the plugin is enabled
def open():
pass
class Plugin(plugin.Plugin):
def __init__(self):
plugin.Plugin.__init__(self)
self.help = "Used to show the current state of settings"
# Called every time the plugin is stopped
def close():
pass
def help():
return "Used to show the current state of settings"
# Called when the plugin needs to perform some action
def run(args=None):
def run(self, args=None):
keys = settings.settings.keys()
join = ", "

View File

@ -4,13 +4,8 @@ __author__="bjschuma"
__date__ ="$Jan 13, 2010 12:02:58 AM$"
global name, app, type, path, opt
name = "sgtk"
app = "scion"
type = "extra"
path = ""
opt = []
from bt import plugin
from bt.message import write
from bt import signal
from manager import manager
@ -23,15 +18,43 @@ global vbox
global bar
def test(button, name):
class Plugin(plugin.Plugin):
def __init__(self):
plugin.Plugin.__init__(self)
self.help = "Allows the usage of GTK"
def open(self):
settings.set("guirunning",False)
if settings.get("guirunning") == True:
signal.register("run",self.loop)
signal.register("quit",self.close)
def close(self):
gtk.main_quit()
settings.delete("gtkfuncs")
def run(self, args=None):
global win,box
if args == None:
self.loop()
elif args[0] == "getwin":
return win
elif args[0] == "getbox":
return box
def test(self, button, name):
write("Test!")
def pluginWindow(item):
def pluginWindow(self, item):
plugins = window.PluginWindow()
def loop():
def loop(self):
global vbox,bar,win
manager.run("disable",["cli"])
@ -41,58 +64,14 @@ def loop():
bar = menu.Bar()
vbox.pack(bar)
plugins = menu.Item("Plugins",pluginWindow)
plugins = menu.Item("Plugins",self.pluginWindow)
tools = menu.Item("Tools",None,[plugins])
bar.append(tools)
#vbox.pack(tabs.Tabs())
#but = button.Button("button",test,None,"I'm a button!")
#vbox.pack(but)
#lab = label.Label("Hello, World!")
#vbox.pack(lab)
if settings.has("gtkfuncs") == True:
for func in settings.get("gtkfuncs", True):
func([win,vbox,bar])
settings.set("guirunning",True)
gtk.main()
# Called every time the plugin is stopped
def close():
gtk.main_quit()
settings.delete("gtkfuncs")
pass
# Called every time the plugin is enabled
def open():
settings.set("guirunning",False)
#settings.init("gtkfuncs", [])
if settings.get("guirunning") == True:
signal.register("run",loop)
signal.register("quit",close)
#1settings.set("loop",loop)
pass
def help():
return "Allows the usage of GTK"
# Called when the plugin needs to perform some action
def run(args=None):
global win,box
if args == None:
loop()
elif args[0] == "getwin":
return win
elif args[0] == "getbox":
return box