Skip to content

Commit 11cfc87

Browse files
committed
Frequent itemsets: more straightforward set_data
1 parent 50e1d5e commit 11cfc87

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

orangecontrib/associate/widgets/owitemsets.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ def data(self, column, role):
217217
@gui.deferred
218218
def find_itemsets(self):
219219
if self.data is None or not len(self.data):
220+
self.tree.clear()
220221
return
221222
if self._is_running:
222223
self._is_running = False
@@ -316,26 +317,22 @@ def __init__(self, item):
316317
@Inputs.data
317318
def set_data(self, data):
318319
self.data = data
319-
is_error = False
320+
self.output = None
321+
self.X = None
322+
self.Warning.cont_attrs.clear()
323+
self.Error.no_disc_features.clear()
320324
if data is not None:
321-
self.Warning.cont_attrs.clear()
322-
self.Error.no_disc_features.clear()
323-
self.button.setDisabled(False)
324325
self.X = data.X
325326
if issparse(data.X):
326327
self.X = data.X.tocsc()
327328
else:
328329
if not data.domain.has_discrete_attributes():
330+
self.data = self.X = None # invalidate input
329331
self.Error.no_disc_features()
330-
is_error = True
331-
self.button.setDisabled(True)
332332
elif data.domain.has_continuous_attributes():
333333
self.Warning.cont_attrs()
334-
else:
335-
self.output = None
336-
self.commit.now()
337-
if not is_error:
338-
self.find_itemsets.now()
334+
self.find_itemsets.now()
335+
self.commit.now()
339336

340337
@classmethod
341338
def migrate_settings(cls, settings, _):

0 commit comments

Comments
 (0)