Skip to content

Commit

Permalink
OwLouvain: Disable PCA slider if Apply PCA is unchecked
Browse files Browse the repository at this point in the history
  • Loading branch information
pavlin-policar committed Feb 4, 2019
1 parent 0c8c15b commit de07f08
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Orange/widgets/unsupervised/owlouvainclustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def __init__(self):
) # type: QCheckBox
self.apply_pca_cbx = gui.checkBox(
preprocessing_box, self, "apply_pca", label="Apply PCA preprocessing",
callback=self._invalidate_graph,
callback=self._apply_pca_changed,
) # type: QCheckBox
self.pca_components_slider = gui.hSlider(
preprocessing_box, self, "pca_components", label="PCA Components: ", minValue=2,
Expand Down Expand Up @@ -145,6 +145,10 @@ def __init__(self):
callback=lambda: self._on_auto_commit_changed(),
) # type: QWidget

def _apply_pca_changed(self):
self.controls.pca_components.setEnabled(self.apply_pca)
self._invalidate_graph()

def _invalidate_preprocessed_data(self):
self.preprocessed_data = None
self._invalidate_pca_projection()
Expand Down Expand Up @@ -404,6 +408,8 @@ def set_data(self, data):

prev_data, self.data = self.data, data
self.openContext(self.data)
# Make sure to properly enable/disable slider based on `apply_pca` setting
self._apply_pca_changed()

# If X hasn't changed, there's no reason to recompute clusters
if prev_data and self.data and np.array_equal(self.data.X, prev_data.X):
Expand Down

0 comments on commit de07f08

Please sign in to comment.