Commits

Aleš Erjavec  committed 50498c1

Fixed contextmanager generators. Disable widget GUI update on new data and changed distance measure.

  • Participants
  • Parent commits 6f61e6b

Comments (0)

Files changed (1)

File widgets/OWQualityControl.py

     """A context to disable the widget (enabled property)  
     """
     widget.setEnabled(False)
-    yield
-    widget.setEnabled(True)
+    try:
+        yield
+    finally:
+        widget.setEnabled(True)
     
     
 @contextmanager
     
     """
     widget._disable_updates = True
-    yield
-    widget._disable_updates = False
+    try:
+        yield
+    finally:
+        widget._disable_updates = False
 
 
 def group_label(splits, groups):
 
 class OWQualityControl(OWWidget):
     contextHandlers = {"": SetContextHandler("")}
-    settingsList = []
+    settingsList = ["selected_distance_index"]
     
     DISTANCE_FUNCTIONS = [("Distance from Pearson correlation",
                            exp.dist_pcorr),
 
         ## Settings
         self.selected_distance_index = 0
-        self.replicate_id = "replicate"
 
         ## Attributes
         self.data = None
                                 )
                               )
         
+        self.base_group_index = 0
+        
         keys = self.get_suitable_keys(self.data)
         self.openContext("", keys)
         
             select(self.sort_by_view.model(),
                    self.sort_by_view.selectionModel(),
                    sort_by_labels)
-            
-        self.split_and_update()
+        
+        with widget_disable(self):
+            self.split_and_update()
         
     def on_split_key_changed(self, *args):
         """Split key has changed
     def on_distance_measure_changed(self):
         """Distance measure has changed
         """
-        self.update_distances()
-        self.replot_experiments()
+        with widget_disable(self):
+            self.update_distances()
+            self.replot_experiments()
         
     def on_view_resize(self, size):
         """The view with the quality plot has changed
                 update = True
             
         if update:
-            self.split_and_update()
+            with widget_disable(self):
+                self.split_and_update()
         
     def split_and_update(self):
         """