Replaced disable, enable, reload, and lsmod with one plugin
This commit is contained in:
parent
e485b1e187
commit
39140bc3c7
|
@ -35,6 +35,8 @@ from bt import xm
|
||||||
# Return the value at key
|
# Return the value at key
|
||||||
def get(key):
|
def get(key):
|
||||||
key = key.upper()
|
key = key.upper()
|
||||||
|
if has(key) == False:
|
||||||
|
return None
|
||||||
return settings[key]
|
return settings[key]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
# This is a simple test plugin, to make sure everything is working
|
|
||||||
|
|
||||||
__author__="bjschuma"
|
|
||||||
__date__ ="$Jan 20, 2010 7:51:32 PM$"
|
|
||||||
|
|
||||||
|
|
||||||
from bt import plugin
|
|
||||||
from manager import manager
|
|
||||||
|
|
||||||
|
|
||||||
class Plugin(plugin.Plugin):
|
|
||||||
def __init__(self):
|
|
||||||
plugin.Plugin.__init__(self)
|
|
||||||
self.help = "Used to disable plugins"
|
|
||||||
|
|
||||||
|
|
||||||
def run(self,args=None):
|
|
||||||
if args == None:
|
|
||||||
return
|
|
||||||
|
|
||||||
dont = ["disable", "enable", "exit"]
|
|
||||||
for plugin in args:
|
|
||||||
# Only disable if plugin is not in the "do not disable" list
|
|
||||||
if not (plugin in dont):
|
|
||||||
manager.disablePlugin(plugin)
|
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
# This is a simple test plugin, to make sure everything is working
|
|
||||||
|
|
||||||
__author__="bjschuma"
|
|
||||||
__date__ ="$Jan 20, 2010 7:59:07 PM$"
|
|
||||||
|
|
||||||
|
|
||||||
from bt import plugin
|
|
||||||
from manager import manager
|
|
||||||
|
|
||||||
|
|
||||||
class Plugin(plugin.Plugin):
|
|
||||||
def __init__(self):
|
|
||||||
plugin.Plugin.__init__(self)
|
|
||||||
self.help = "This plugin is used to reenable other plugins"
|
|
||||||
|
|
||||||
|
|
||||||
def run(self, args=None):
|
|
||||||
if args == None:
|
|
||||||
return
|
|
||||||
|
|
||||||
for plugin in args:
|
|
||||||
manager.enablePlugin(plugin)
|
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
# Basic plugin class
|
||||||
|
|
||||||
|
__author__="bjschuma"
|
||||||
|
__date__ ="$Jan 22, 2010 12:14:01 AM$"
|
||||||
|
|
||||||
|
|
||||||
|
from bt.message import write
|
||||||
|
from bt import plugin
|
||||||
|
from manager import manager
|
||||||
|
|
||||||
|
|
||||||
|
class Plugin(plugin.Plugin):
|
||||||
|
def __init__(self):
|
||||||
|
plugin.Plugin.__init__(self)
|
||||||
|
self.help = "Enable, disable, or reload plugins"
|
||||||
|
self.usage = "Usage: plugins [enable, disable, reload, list]"
|
||||||
|
|
||||||
|
|
||||||
|
def list(self,args):
|
||||||
|
usage = "Usage: plugins list [enabled, disabled]"
|
||||||
|
if len(args) == 0:
|
||||||
|
write(usage)
|
||||||
|
return
|
||||||
|
|
||||||
|
if args[0] == "enabled":
|
||||||
|
enabled = True
|
||||||
|
elif args[0] == "disabled":
|
||||||
|
enabled = False
|
||||||
|
else:
|
||||||
|
write(usage)
|
||||||
|
return
|
||||||
|
|
||||||
|
if enabled == True:
|
||||||
|
list = manager.enabled.keys()
|
||||||
|
type = "Enabled"
|
||||||
|
else:
|
||||||
|
list = manager.disabled.keys()
|
||||||
|
type = "Disabled"
|
||||||
|
|
||||||
|
if len(list) == 0:
|
||||||
|
write("Nothing to list")
|
||||||
|
return
|
||||||
|
|
||||||
|
write(type + " plugins")
|
||||||
|
write("----------------")
|
||||||
|
join = ", "
|
||||||
|
joined = join.join(list)
|
||||||
|
write(joined)
|
||||||
|
return list
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def run(self, args=None):
|
||||||
|
if args == None:
|
||||||
|
write(self.usage)
|
||||||
|
return
|
||||||
|
|
||||||
|
if args[0] == "enable":
|
||||||
|
func = manager.enablePlugin
|
||||||
|
elif args[0] == "disable":
|
||||||
|
func = manager.disablePlugin
|
||||||
|
elif args[0] == "reload":
|
||||||
|
func = manager.reloadPlugin
|
||||||
|
elif args[0] == "list":
|
||||||
|
return self.list(args[1:])
|
||||||
|
else:
|
||||||
|
write(self.usage)
|
||||||
|
return
|
||||||
|
|
||||||
|
for plugin in args[1:]:
|
||||||
|
func(plugin)
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
# Basic plugin class
|
|
||||||
|
|
||||||
__author__="bjschuma"
|
|
||||||
__date__ ="$Jan 21, 2010 12:11:23 PM$"
|
|
||||||
|
|
||||||
|
|
||||||
from bt import plugin
|
|
||||||
from manager import manager
|
|
||||||
|
|
||||||
|
|
||||||
class Plugin(plugin.Plugin):
|
|
||||||
def __init__(self):
|
|
||||||
plugin.Plugin.__init__(self)
|
|
||||||
self.help = "Closes, then reopens a plugin"
|
|
||||||
|
|
||||||
|
|
||||||
def run(self, args=None):
|
|
||||||
if args == None:
|
|
||||||
return
|
|
||||||
|
|
||||||
for plugin in args:
|
|
||||||
manager.reloadPlugin(plugin)
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ class PluginWindow(Window):
|
||||||
self.vbox.pack(self.hbox,True,True)
|
self.vbox.pack(self.hbox,True,True)
|
||||||
self.add(self.vbox)
|
self.add(self.vbox)
|
||||||
|
|
||||||
settings.set("write",empty)
|
#settings.set("write",empty)
|
||||||
|
|
||||||
self.enabled = list.List(gtk.ListStore(str), ["Enabled"])
|
self.enabled = list.List(gtk.ListStore(str), ["Enabled"])
|
||||||
self.enabled.connect("cursor-changed", self.changeLabel, "enabled")
|
self.enabled.connect("cursor-changed", self.changeLabel, "enabled")
|
||||||
|
@ -75,7 +75,7 @@ class PluginWindow(Window):
|
||||||
for mod in disabledMods:
|
for mod in disabledMods:
|
||||||
self.disabled.insert([mod])
|
self.disabled.insert([mod])
|
||||||
|
|
||||||
settings.pop("write")
|
#settings.pop("write")
|
||||||
|
|
||||||
enable = button.Button("button",self.enable,None,"<<<")
|
enable = button.Button("button",self.enable,None,"<<<")
|
||||||
disable = button.Button("button", self.disable,None,">>>")
|
disable = button.Button("button", self.disable,None,">>>")
|
||||||
|
@ -123,7 +123,7 @@ class PluginWindow(Window):
|
||||||
else:
|
else:
|
||||||
list, path, plugin = self.getPlugin(self.disabled)
|
list, path, plugin = self.getPlugin(self.disabled)
|
||||||
|
|
||||||
settings.set("write", empty)
|
#settings.set("write", empty)
|
||||||
message = manager.run("help",[plugin])
|
message = manager.run("help",[plugin])
|
||||||
self.lbl.change(message)
|
self.lbl.change(message)
|
||||||
settings.pop("write")
|
#settings.pop("write")
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
# This is a simple test plugin, to make sure everything is working
|
|
||||||
|
|
||||||
__author__="bjschuma"
|
|
||||||
__date__ ="$Dec 27, 2009 6:35:45 PM$"
|
|
||||||
|
|
||||||
|
|
||||||
from bt.message import write
|
|
||||||
from manager import manager
|
|
||||||
from bt import plugin
|
|
||||||
|
|
||||||
|
|
||||||
class Plugin(plugin.Plugin):
|
|
||||||
def __init__(self):
|
|
||||||
plugin.Plugin.__init__(self)
|
|
||||||
self.help = "Used to list currently loaded plugins"
|
|
||||||
|
|
||||||
|
|
||||||
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():
|
|
||||||
mods += [plugin]
|
|
||||||
|
|
||||||
if not(args==None) and ( (("disabled" in args) == True) or (("all" in args)==True) ):
|
|
||||||
for plugin in manager.disabled.keys():
|
|
||||||
mods += [plugin]
|
|
||||||
|
|
||||||
if len(mods) == 0:
|
|
||||||
return
|
|
||||||
comma = ', '
|
|
||||||
list = comma.join(mods)
|
|
||||||
write(list)
|
|
||||||
|
|
||||||
return mods
|
|
|
@ -25,14 +25,17 @@ class Plugin(plugin.Plugin):
|
||||||
|
|
||||||
|
|
||||||
def open(self):
|
def open(self):
|
||||||
settings.set("guirunning",False)
|
#settings.set("guirunning",False)
|
||||||
if settings.get("guirunning") == True:
|
if settings.get("guirunning") == True:
|
||||||
signal.register("run",self.loop)
|
signal.register("run",self.loop)
|
||||||
signal.register("quit",self.close)
|
signal.register("quit",self.close)
|
||||||
|
else:
|
||||||
|
settings.set("guirunning",False)
|
||||||
|
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
gtk.main_quit()
|
if settings.get("guirunning") == True:
|
||||||
|
gtk.main_quit()
|
||||||
settings.delete("gtkfuncs")
|
settings.delete("gtkfuncs")
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue