From aaf594cbfa6d8bb580fa0884f7e691fb4f414b1c Mon Sep 17 00:00:00 2001 From: Ales Erjavec Date: Tue, 3 Jan 2017 16:17:53 +0100 Subject: [PATCH] owselectrows: Fix duplicated intial filter when context is not restored --- Orange/widgets/data/owselectrows.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Orange/widgets/data/owselectrows.py b/Orange/widgets/data/owselectrows.py index 97d97c8e6c6..7d233726b2a 100644 --- a/Orange/widgets/data/owselectrows.py +++ b/Orange/widgets/data/owselectrows.py @@ -371,14 +371,17 @@ def set_data(self, data): except Exception: pass - if not self.conditions and len(data.domain.variables): + variables = list(filter_visible(chain(data.domain.variables, + data.domain.metas))) + varnames = [v.name for v in variables] + if self.conditions: + for attr, cond_type, cond_value in self.conditions: + if attr in varnames: + self.add_row(varnames.index(attr), cond_type, cond_value) + elif variables: self.add_row() + self.update_info(data, self.data_in_variables, "In: ") - for attr, cond_type, cond_value in self.conditions: - attrs = [a.name for a in - filter_visible(chain(data.domain.variables, data.domain.metas))] - if attr in attrs: - self.add_row(attrs.index(attr), cond_type, cond_value) self.unconditional_commit() def conditions_changed(self):