From 596bf7e6a083b9df835e04baaa58f331308089e6 Mon Sep 17 00:00:00 2001 From: mlncn Date: Sun, 2 May 2021 12:04:02 -0400 Subject: [PATCH] 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. --- prompt_window.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/prompt_window.py b/prompt_window.py index f097fb4..f5b8275 100644 --- a/prompt_window.py +++ b/prompt_window.py @@ -55,11 +55,18 @@ class PromptWindow(Gtk.Window): self.entry.set_text(self.orig_task) def retrieve(self): - return self.task + if 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() -win.show_all() -Gtk.main() -tha_task = win.retrieve() -print(tha_task) +if __name__ == '__main__': + win = PromptWindow("I'mma tell you what i'm gonna do.") + win.show_all() + Gtk.main() + tha_task = win.retrieve() + print(tha_task)