diff --git a/Orange/widgets/data/owfile.py b/Orange/widgets/data/owfile.py index 3e21d54b536..926383a1a9a 100644 --- a/Orange/widgets/data/owfile.py +++ b/Orange/widgets/data/owfile.py @@ -215,6 +215,8 @@ def __init__(self): callback=lambda: self.browse_file(True), autoDefault=False) gui.rubber(box) + gui.button( + box, self, "Reset", callback=self.reset_domain_edit) self.apply_button = gui.button( box, self, "Apply", callback=self.apply_domain_edit) self.apply_button.setEnabled(False) @@ -440,6 +442,10 @@ def retrieveSpecificSettings(self): if hasattr(self.current_context, "modified_variables"): self.variables[:] = self.current_context.modified_variables + def reset_domain_edit(self): + self.domain_editor.reset_domain() + self.apply_domain_edit() + def apply_domain_edit(self): if self.data is None: table = None diff --git a/Orange/widgets/utils/domaineditor.py b/Orange/widgets/utils/domaineditor.py index 956cee84ad0..e4aeeb2118f 100644 --- a/Orange/widgets/utils/domaineditor.py +++ b/Orange/widgets/utils/domaineditor.py @@ -52,6 +52,9 @@ def set_orig_variables(self, variables): def reset_variables(self): self.set_variables(deepcopy(self.orig_variables)) + def reset_variables(self): + self.set_variables(self.orig_variables) + def set_variables(self, variables): self.modelAboutToBeReset.emit() self.variables = variables @@ -357,6 +360,10 @@ def set_domain(self, domain): self.variables = self.parse_domain(domain) self.model().set_orig_variables(self.variables) + def reset_domain(self): + self.model().reset_variables() + self.variables = self.model().variables + @staticmethod def parse_domain(domain): """Convert domain into variable representation used by