From e6d8d36aebf1200c4cbaaa7a7347df5e429adfe8 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Sat, 1 Jan 2011 23:14:12 -0500 Subject: [PATCH] loop to handle commands & possibly re-show window --- dwtt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/dwtt b/dwtt index 3b5f8ca..f947083 100755 --- a/dwtt +++ b/dwtt @@ -37,13 +37,20 @@ def main(argv): ds = DataStore(timedbfile) - cmdline = doCmdWindow() - cmd = Command(cmdline) - print "Command:", cmd + while True: + cmdline = doCmdWindow() + cmd = Command(cmdline) + if not processCommand(cmd, ds): + break def doCmdWindow(): c = CmdWindow() return c.main() +# Returns boolean for whether the command prompt should be displayed again +def processCommand(cmd, store): + print cmd + return cmd.command == 'status' + if __name__ == "__main__": main(sys.argv)