add status line to CmdWindow

This commit is contained in:
Josh Holtrop 2011-01-03 10:58:14 -05:00
parent 987145e530
commit 4d641af494
2 changed files with 21 additions and 10 deletions

View File

@ -2,7 +2,7 @@
import gtk import gtk
class CmdWindow: class CmdWindow:
def __init__(self): def __init__(self, status = ''):
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.set_geometry_hints(min_width = 350); self.window.set_geometry_hints(min_width = 350);
self.window.connect("delete_event", self.delete_event) self.window.connect("delete_event", self.delete_event)
@ -11,10 +11,20 @@ class CmdWindow:
self.entry.connect("activate", self.activate_event) self.entry.connect("activate", self.activate_event)
self.button = gtk.Button(stock = gtk.STOCK_OK) self.button = gtk.Button(stock = gtk.STOCK_OK)
self.button.connect("clicked", self.activate_event) self.button.connect("clicked", self.activate_event)
self.hbox = gtk.HBox()
self.hbox.pack_start(self.entry) vbox = gtk.VBox()
self.hbox.pack_start(self.button, expand = False) if status != '':
self.window.add(self.hbox) hbox = gtk.HBox()
lbl = gtk.Label(status)
hbox.pack_start(lbl, expand = False)
vbox.pack_start(hbox)
hbox = gtk.HBox()
hbox.pack_start(self.entry)
hbox.pack_start(self.button, expand = False)
vbox.pack_start(hbox)
self.window.add(vbox)
self.window.show_all() self.window.show_all()
def main(self): def main(self):

11
dwtt
View File

@ -38,7 +38,12 @@ def main(argv):
ds = DataStore(timedbfile) ds = DataStore(timedbfile)
while True: while True:
cmdline = doCmdWindow() status = ''
ct = ds.getCurrentTask()
if ct is not None:
status = 'Current Task: ' + ds.getTaskByID(ct.taskid).name
cw = CmdWindow(status)
cmdline = cw.main()
if cmdline.strip() == '': if cmdline.strip() == '':
break break
cmd = Command(cmdline) cmd = Command(cmdline)
@ -52,10 +57,6 @@ def main(argv):
else: else:
print "Unknown return type '%s'" % type(res).__name__ print "Unknown return type '%s'" % type(res).__name__
def doCmdWindow():
c = CmdWindow()
return c.main()
def processStart(cmd, store): def processStart(cmd, store):
processOut(cmd, store) processOut(cmd, store)
task = store.getTaskByName(cmd.argstr) task = store.getTaskByName(cmd.argstr)