80 lines
1.5 KiB
Python
80 lines
1.5 KiB
Python
# This is a simple test plugin, to make sure everything is working
|
|
|
|
__author__="bjschuma"
|
|
__date__ ="$Jan 13, 2010 12:02:58 AM$"
|
|
|
|
|
|
|
|
from bt import plugin
|
|
from bt.message import write
|
|
from bt import signal
|
|
#from manager import manager
|
|
from session import settings,manager
|
|
from guiGTK import *
|
|
import gtk
|
|
|
|
global win
|
|
global vbox
|
|
global bar
|
|
|
|
|
|
class Plugin(plugin.Plugin):
|
|
def __init__(self):
|
|
plugin.Plugin.__init__(self)
|
|
self.help = "Allows the usage of GTK"
|
|
self.usage = "sgtk"
|
|
|
|
|
|
def open(self):
|
|
#settings.set("guirunning",False)
|
|
if settings["guirunning"] == True:
|
|
signal.register("scion-begin",self.loop,90)
|
|
signal.register("scion-end",self.close,90)
|
|
else:
|
|
settings["guirunning"] = False
|
|
|
|
|
|
def close(self):
|
|
if settings["guirunning"] == True:
|
|
gtk.main_quit()
|
|
#del settings["gtkfuncs"]
|
|
signal.remove("scion-begin",self.loop)
|
|
signal.remove("scion-end",self.close)
|
|
|
|
|
|
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(self, item):
|
|
plugins = window.PluginWindow()
|
|
|
|
|
|
def loop(self):
|
|
global vbox,bar,win
|
|
manager.run("plugins", ["disable","cli"])
|
|
|
|
win = window.Window(settings.get("appname").title())
|
|
vbox = box.VBox()
|
|
win.add(vbox)
|
|
|
|
bar = menu.makeBar()
|
|
vbox.pack(bar)
|
|
|
|
#if settings.has("gtkfuncs") == True:
|
|
# for func in settings.get("gtkfuncs", True):
|
|
# func([win,vbox,bar])
|
|
|
|
settings["guirunning"] = True
|
|
gtk.main()
|