def disconnect(self): global reconnect reconnect = True dbconnect.disconnect() self.destroy()
# There are scenarios where the rule engine can't stop because it is # still waiting on EVENT to be set, so we set it. It is robust, so no # problem if the rule engine has already stopped: tweetprocessor.EVENT.set() # Stop the HTTP server in a clean way: tweetprocessor.shutdown_tweetprocessor(reason) # Stop the Obserer instance created as global in DUI.py: observer.info(None) if __name__ == '__main__': ## INCOMPLETE check if a running tweetprocessor has to be killed try: tpt = tweetprocessorThread() tpt.name = "tpt_thread" tpt.start() root = tk.Tk() while True: # if not show_connect(): # break if not show_controls(master=root): break dbconnect.disconnect() cleanup("Main graphical user interface window closed") except KeyboardInterrupt: # This exception is raised upon receiving CTRL-C or SIGINT cleanup("CTRL-C or SIGINT received") root.destroy()