add status line to CmdWindow
This commit is contained in:
parent
987145e530
commit
4d641af494
20
CmdWindow.py
20
CmdWindow.py
@ -2,7 +2,7 @@
|
||||
import gtk
|
||||
|
||||
class CmdWindow:
|
||||
def __init__(self):
|
||||
def __init__(self, status = ''):
|
||||
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
|
||||
self.window.set_geometry_hints(min_width = 350);
|
||||
self.window.connect("delete_event", self.delete_event)
|
||||
@ -11,10 +11,20 @@ class CmdWindow:
|
||||
self.entry.connect("activate", self.activate_event)
|
||||
self.button = gtk.Button(stock = gtk.STOCK_OK)
|
||||
self.button.connect("clicked", self.activate_event)
|
||||
self.hbox = gtk.HBox()
|
||||
self.hbox.pack_start(self.entry)
|
||||
self.hbox.pack_start(self.button, expand = False)
|
||||
self.window.add(self.hbox)
|
||||
|
||||
vbox = gtk.VBox()
|
||||
if status != '':
|
||||
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()
|
||||
|
||||
def main(self):
|
||||
|
11
dwtt
11
dwtt
@ -38,7 +38,12 @@ def main(argv):
|
||||
ds = DataStore(timedbfile)
|
||||
|
||||
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() == '':
|
||||
break
|
||||
cmd = Command(cmdline)
|
||||
@ -52,10 +57,6 @@ def main(argv):
|
||||
else:
|
||||
print "Unknown return type '%s'" % type(res).__name__
|
||||
|
||||
def doCmdWindow():
|
||||
c = CmdWindow()
|
||||
return c.main()
|
||||
|
||||
def processStart(cmd, store):
|
||||
processOut(cmd, store)
|
||||
task = store.getTaskByName(cmd.argstr)
|
||||
|
Loading…
x
Reference in New Issue
Block a user