Skip to content

Commit

Permalink
Merge pull request #2050 from jerneju/valueerror-owfile
Browse files Browse the repository at this point in the history
[FIX] File: Disallow changing string columns to datetime
  • Loading branch information
lanzagar authored Mar 3, 2017
2 parents f025f83 + 0f76144 commit c3e2f7a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Orange/widgets/data/tests/test_owfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ def test_file_not_found(self):

def test_check_column_noname(self):
"""
GH-2018
Column name cannot be changed to an empty string or a string with whitespaces.
GH-2039
"""
self.open_dataset("iris")
idx = self.widget.domain_editor.model().createIndex(1, 0)
Expand Down
12 changes: 9 additions & 3 deletions Orange/widgets/utils/domaineditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,15 @@ def setEditorData(self, combo, index):
combo.clear()
no_numeric = not self.view.model().variables[
index.row()][Column.not_valid]
ind = self.items.index(index.data())
combo.addItems(self.items[:1] + self.items[1 + no_numeric:])
combo.setCurrentIndex(ind - (no_numeric and ind > 1))
if no_numeric:
# Do not allow selection of numeric and datetime
items = [i for i in self.items if i not in ("numeric", "datetime")]
else:
items = self.items

ind = items.index(index.data())
combo.addItems(items)
combo.setCurrentIndex(ind)


class PlaceDelegate(ComboDelegate):
Expand Down

0 comments on commit c3e2f7a

Please sign in to comment.