ocarina/src/extra/sgtk.py

88 lines
1.4 KiB
Python

# This is a simple test plugin, to make sure everything is working
__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.message import write
from manager import manager
import settings
from guiGTK import *
import gtk
global win
global vbox
global bar
def test(button, name):
write("Test!")
def pluginWindow(item):
plugins = window.PluginWindow()
def loop():
global vbox,bar,win
manager.run("disable",["cli"])
win = window.Window(settings.get("appname").title())
vbox = box.VBox()
win.add(vbox)
bar = menu.Bar()
vbox.pack(bar)
plugins = menu.Item("Plugins",pluginWindow)
tools = menu.Item("Tools",None,[plugins])
bar.append(tools)
#but = button.Button("button",test,None,"I'm a button!")
#vbox.pack(but)
#lab = label.Label("Hello, World!")
#vbox.pack(lab)
settings.set("guirunning",True)
gtk.main()
# Called every time the plugin is enabled
def open():
settings.init("guirunning",False)
if settings.get("guirunning") == True:
settings.set("loop",loop)
pass
# Called every time the plugin is stopped
def close():
gtk.main_quit()
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