Skip to content

Commit

Permalink
Merge pull request #5804 from ales-erjavec/fixes/feature-constructor-…
Browse files Browse the repository at this point in the history
…update-models

[FIX] owfeatureconstructor: Always update models on data change
  • Loading branch information
janezd authored Feb 3, 2022
2 parents ef36780 + 6b987ca commit aa14e94
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions Orange/widgets/data/owfeatureconstructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit aa14e94

Please sign in to comment.