passing command back to main program

This commit is contained in:
Josh Holtrop 2010-12-03 00:45:29 -05:00
parent 40d433d815
commit df2d40afb2
2 changed files with 6 additions and 1 deletions

View File

@ -18,7 +18,9 @@ class CmdWindow:
self.window.show_all()
def main(self):
self.text = ''
gtk.main()
return self.text
def delete_event(self, widget, event, data=None):
return False
@ -27,4 +29,5 @@ class CmdWindow:
gtk.main_quit()
def activate_event(self, widget, data=None):
self.text = self.entry.get_text()
self.window.destroy()

4
dwtt
View File

@ -25,12 +25,14 @@ def main(argv):
sys.exit(1)
timedbfile = os.path.expanduser('~/.' + PROGRAM_NAME + '.db')
timenow = datetime.now()
for opt, arg in opts:
if opt in ("-d", "--dbfile"):
timedbfile = arg
elif opt == '-c':
cmd = doCmdWindow()
print "cmd was:", cmd
elif opt == "--help":
usage()
sys.exit()
@ -49,7 +51,7 @@ def createdb(dbfile):
def doCmdWindow():
c = CmdWindow()
c.main()
return c.main()
if __name__ == "__main__":
main(sys.argv)