Skip to content

Commit

Permalink
gui: Fix an type error in CallFrontListView
Browse files Browse the repository at this point in the history
... when the displayed model is empty.
  • Loading branch information
ales-erjavec committed Apr 11, 2018
1 parent f4343dc commit d1c26fd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Orange/widgets/data/oweditdomain.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,8 @@ def __init__(self):

self.domain_model = itemmodels.VariableListModel()
self.domain_view = QListView(
selectionMode=QListView.SingleSelection
selectionMode=QListView.SingleSelection,
uniformItemSizes=True
)
self.domain_view.setModel(self.domain_model)
self.domain_view.selectionModel().selectionChanged.connect(
Expand Down
9 changes: 7 additions & 2 deletions Orange/widgets/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,7 @@ def listView(widget, master, value=None, model=None, box=None, callback=None,
CallFrontListView(view),
CallBackListView(model, view, master, value))
misc.setdefault('addSpace', True)
misc.setdefault('uniformItemSizes', True)
miscellanea(view, bg, widget, **misc)
return view

Expand Down Expand Up @@ -2500,6 +2501,7 @@ def action(self, values):

selection = QItemSelection()
for value in values:
index = None
if not isinstance(value, int):
if isinstance(value, Variable):
search_role = TableVariable
Expand All @@ -2508,9 +2510,12 @@ def action(self, values):
value = str(value)
for i in range(model.rowCount()):
if model.data(model.index(i), search_role) == value:
value = i
index = i
break
selection.select(model.index(value), model.index(value))
else:
index = value
if index is not None:
selection.select(model.index(index), model.index(index))
sel_model.select(selection, sel_model.ClearAndSelect)


Expand Down
1 change: 1 addition & 0 deletions Orange/widgets/utils/listfilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def __init__(self, parent=None, acceptedType=Orange.data.Variable):
self.setDragDropMode(self.DragDrop)
self.setDefaultDropAction(Qt.MoveAction)
self.setDragDropOverwriteMode(False)
self.setUniformItemSizes(True)
self.viewport().setAcceptDrops(True)

#: type | Tuple[type]
Expand Down

0 comments on commit d1c26fd

Please sign in to comment.