From 6b987ca7b1346759aa1d9ebbe88160c30b3c0515 Mon Sep 17 00:00:00 2001 From: Ales Erjavec Date: Tue, 25 Jan 2022 14:36:06 +0100 Subject: [PATCH] owfeatureconstructor: Always update models on data change --- Orange/widgets/data/owfeatureconstructor.py | 25 ++++++++------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/Orange/widgets/data/owfeatureconstructor.py b/Orange/widgets/data/owfeatureconstructor.py index 6a25c29ffe6..0d2fefe0362 100644 --- a/Orange/widgets/data/owfeatureconstructor.py +++ b/Orange/widgets/data/owfeatureconstructor.py @@ -681,27 +681,20 @@ def setData(self, data=None): self.data = data self.expressions_with_values = False + self.descriptors = [] + self.currentIndex = -1 if self.data is not None: - descriptors = list(self.descriptors) - currindex = self.currentIndex - self.descriptors = [] - self.currentIndex = -1 self.openContext(data) - self.fix_button.setHidden(not self.expressions_with_values) - if descriptors != self.descriptors or \ - self.currentIndex != currindex: - # disconnect from the selection model while reseting the model - selmodel = self.featureview.selectionModel() - selmodel.selectionChanged.disconnect( - self._on_selectedVariableChanged) + # disconnect from the selection model while reseting the model + selmodel = self.featureview.selectionModel() + selmodel.selectionChanged.disconnect(self._on_selectedVariableChanged) - self.featuremodel[:] = list(self.descriptors) - self.setCurrentIndex(self.currentIndex) - - selmodel.selectionChanged.connect( - self._on_selectedVariableChanged) + self.featuremodel[:] = list(self.descriptors) + self.setCurrentIndex(self.currentIndex) + selmodel.selectionChanged.connect(self._on_selectedVariableChanged) + self.fix_button.setHidden(not self.expressions_with_values) self.editorstack.setEnabled(self.currentIndex >= 0) def handleNewSignals(self):