ocarina/src/extra/oGtk/window.py

50 lines
1020 B
Python

#! /usr/bin/python
# To change this template, choose Tools | Templates
# and open the template in the editor.
__author__="bjschuma"
__date__ ="$Mar 14, 2010 10:23:17 PM$"
import gtk
import guibuilder
import ocarina
from oGtk import progbar
class Window(gtk.Window):
def __init__(self, attrs):
gtk.Window.__init__(self,gtk.WINDOW_TOPLEVEL)
self.quitEvent = ""
self.connect("delete_event", self.onQuit)
size = [240,800]
for a in attrs:
if a == "title":
self.set_title(attrs[a])
elif a == "width":
size[0] = int(attrs[a])
elif a == "height":
size[1] = int(attrs[a])
elif a == "close":
self.quitEvent = attrs[a]
self.resize(size[0], size[1])
self.show()
def onQuit(self,a,b):
ocarina.events.start(self.quitEvent)
class LibScanWin(gtk.Window):
def __init__(self):
gtk.Window.__init__(self)
self.bar = progbar.LibScanBar()
self.add(self.bar)
self.bar.show()
self.show()
def make_window(attrs):return Window(attrs)
guibuilder.parts["window"] = make_window