From 34024d0a21f54c38c0117614cf3459ebc508583a Mon Sep 17 00:00:00 2001
From: "Michael D. M. Dryden" <mdryden@chem.utoronto.ca>
Date: Tue, 15 Jul 2014 19:36:40 -0400
Subject: [PATCH] Fixed issue #12. Forgot about how processes work. Added
 button state changes to exceptions and experiment_done method.

---
 dstatInterface/interface_test.py | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/dstatInterface/interface_test.py b/dstatInterface/interface_test.py
index 4dd0ab9..e2cf81f 100644
--- a/dstatInterface/interface_test.py
+++ b/dstatInterface/interface_test.py
@@ -364,26 +364,32 @@ class main:
                 
             else:
                 self.statusbar.push(self.error_context_id, "Experiment not yet implemented.")
+                self.startbutton.set_sensitive(True)
+                self.stopbutton.set_sensitive(False)
                 
         except ValueError:
             self.spinner.stop()
             self.statusbar.push(self.error_context_id, "Experiment parameters must be integers.")
+            self.startbutton.set_sensitive(True)
+            self.stopbutton.set_sensitive(False)
         
         except InputError as e:
             self.spinner.stop()
             self.statusbar.push(self.error_context_id, e.msg)
+            self.startbutton.set_sensitive(True)
+            self.stopbutton.set_sensitive(False)
         
         except SerialException:
             self.spinner.stop()
             self.statusbar.push(self.error_context_id, "Could not establish serial connection.")
+            self.startbutton.set_sensitive(True)
+            self.stopbutton.set_sensitive(False)
 
         except AssertionError as e:
             self.spinner.stop()
             self.statusbar.push(self.error_context_id, str(e))
-
-        finally:
-            self.startbutton.set_sensitive(False)
-            self.stopbutton.set_sensitive(True)
+            self.startbutton.set_sensitive(True)
+            self.stopbutton.set_sensitive(False)
 
     def experiment_running(self):
         try:
@@ -436,7 +442,9 @@ class main:
         
         
         self.spinner.stop()
-    
+        self.startbutton.set_sensitive(True)
+        self.stopbutton.set_sensitive(False)
+
     def on_pot_stop_clicked(self, data=None):
         if self.recv_p:
             print "stop"
-- 
GitLab