Skip to content

Commit

Permalink
owfeatureconstructor: Always update models on data change
Browse files Browse the repository at this point in the history
  • Loading branch information
ales-erjavec committed Jan 25, 2022
1 parent 2b857a3 commit 6b987ca
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 6b987ca

Please sign in to comment.