diff --git a/Orange/widgets/data/owfile.py b/Orange/widgets/data/owfile.py index f0524111317..5f79e3fc3cd 100644 --- a/Orange/widgets/data/owfile.py +++ b/Orange/widgets/data/owfile.py @@ -257,7 +257,13 @@ def browse_file(self, in_demos=False): # Open a file, create data from it and send it over the data channel def load_data(self): + self.editor_model.set_domain(None) self.reader = self._get_reader() + if not self.reader: + self.data = None + self.send("Data", None) + self.info.setText("No data.") + return self._update_sheet_combo() errors = [] @@ -296,7 +302,9 @@ def _get_reader(self): reader.select_sheet(self.recent_paths[0].sheet) return reader elif self.source == self.URL: - return UrlReader(self.url_combo.currentText()) + url = self.url_combo.currentText().strip() + if url: + return UrlReader(url) def _update_sheet_combo(self): if len(self.reader.sheets) < 2: diff --git a/Orange/widgets/utils/domaineditor.py b/Orange/widgets/utils/domaineditor.py index 911ea71503b..10d02d65ab8 100644 --- a/Orange/widgets/utils/domaineditor.py +++ b/Orange/widgets/utils/domaineditor.py @@ -55,14 +55,17 @@ def discrete_value_display(value_list): return result self.modelAboutToBeReset.emit() - self.variables[:] = self.original = [ - [var.name, type(var), place, - discrete_value_display(var.values) if var.is_discrete else "", - may_be_numeric(var)] - for place, vars in enumerate( - (domain.attributes, domain.class_vars, domain.metas)) - for var in vars - ] + if domain is None: + self.variables.clear() + else: + self.variables[:] = self.original = [ + [var.name, type(var), place, + discrete_value_display(var.values) if var.is_discrete else "", + may_be_numeric(var)] + for place, vars in enumerate( + (domain.attributes, domain.class_vars, domain.metas)) + for var in vars + ] self.modelReset.emit() def reset(self):