Skip to content

Commit

Permalink
OWFile: Don't report an error on empty URL
Browse files Browse the repository at this point in the history
  • Loading branch information
janezd committed Sep 25, 2016
1 parent 2ae604a commit 1e83e16
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
10 changes: 9 additions & 1 deletion Orange/widgets/data/owfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down Expand Up @@ -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:
Expand Down
19 changes: 11 additions & 8 deletions Orange/widgets/utils/domaineditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 1e83e16

Please sign in to comment.