Skip to content

Commit 6b001f6

Browse files
committed
owselectrows: Fix duplicated intial filter when context is not restored
1 parent 286b101 commit 6b001f6

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

Orange/widgets/data/owselectrows.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -371,14 +371,17 @@ def set_data(self, data):
371371
except Exception:
372372
pass
373373

374-
if not self.conditions and len(data.domain.variables):
374+
variables = list(filter_visible(chain(data.domain.variables,
375+
data.domain.metas)))
376+
varnames = [v.name for v in variables]
377+
if self.conditions:
378+
for attr, cond_type, cond_value in self.conditions:
379+
if attr in varnames:
380+
self.add_row(varnames.index(attr), cond_type, cond_value)
381+
elif variables:
375382
self.add_row()
383+
376384
self.update_info(data, self.data_in_variables, "In: ")
377-
for attr, cond_type, cond_value in self.conditions:
378-
attrs = [a.name for a in
379-
filter_visible(chain(data.domain.variables, data.domain.metas))]
380-
if attr in attrs:
381-
self.add_row(attrs.index(attr), cond_type, cond_value)
382385
self.unconditional_commit()
383386

384387
def conditions_changed(self):

0 commit comments

Comments
 (0)