diff options
author | Guillaume Seguin <guillaume@segu.in> | 2007-12-18 01:57:13 +0100 |
---|---|---|
committer | Guillaume Seguin <guillaume@segu.in> | 2007-12-18 01:57:13 +0100 |
commit | 2338bc9f493a8bc2e3a7b33b90cb6a633b28e7ff (patch) | |
tree | 7ebc78704d6217a0ea22d21fe7b5f710743fde75 | |
parent | 5355ca1cef56a8f40937ec26c1d029ed5969a5f8 (diff) | |
download | tsp-2338bc9f493a8bc2e3a7b33b90cb6a633b28e7ff.tar.gz tsp-2338bc9f493a8bc2e3a7b33b90cb6a633b28e7ff.tar.bz2 |
* Make sure the runner thread gets correctly halted upon exit
-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 |