diff options
-rwxr-xr-x | tsp.py | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -639,6 +639,16 @@ class AlgoGui (gtk.Window): self.resume_button.set_sensitive (True) self.stop_button.set_sensitive (False) + def halt (self): + '''Final halt''' + if self.thread: + self.thread.stop () + self.thread.join (0.1) + if self.thread.isAlive (): + gobject.timeout_add (100, self.halt) + return + gtk.main_quit () + def update_best (self, length, time): '''Update best solution length label''' if not length: @@ -667,4 +677,9 @@ if __name__ == "__main__": gtk.main () except KeyboardInterrupt: pass - gui.stop () + gui.hide () + gobject.timeout_add (100, gui.halt) + try: + gtk.main () + except KeyboardInterrupt: + pass |