Prepare for being a helper script and stop messing with it
The 'main' trick is cool, all that stuff within it only happens if it's called directly.
This commit is contained in:
parent
1d07fe08b9
commit
596bf7e6a0
1 changed files with 13 additions and 6 deletions
|
@ -55,11 +55,18 @@ class PromptWindow(Gtk.Window):
|
||||||
self.entry.set_text(self.orig_task)
|
self.entry.set_text(self.orig_task)
|
||||||
|
|
||||||
def retrieve(self):
|
def retrieve(self):
|
||||||
|
if self.task:
|
||||||
return self.task
|
return self.task
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
# started to do conditional like this but maybe main program handles.
|
||||||
|
# else if self.orig_task:
|
||||||
|
# return "Pomodoro cancelled, original goal was:"
|
||||||
|
|
||||||
|
|
||||||
win = PromptWindow()
|
if __name__ == '__main__':
|
||||||
win.show_all()
|
win = PromptWindow("I'mma tell you what i'm gonna do.")
|
||||||
Gtk.main()
|
win.show_all()
|
||||||
tha_task = win.retrieve()
|
Gtk.main()
|
||||||
print(tha_task)
|
tha_task = win.retrieve()
|
||||||
|
print(tha_task)
|
||||||
|
|
Loading…
Reference in a new issue