Skip to content
Snippets Groups Projects
Commit 2aac1faa authored by Luke Campagnola's avatar Luke Campagnola
Browse files

fixes for python3

parent 4886270b
No related branches found
No related tags found
No related merge requests found
from ..Qt import QtGui, QtCore
from ..SignalProxy import SignalProxy
from ..ordereddict import OrderedDict
from ..pgcollections import OrderedDict
from ..python2_3 import asUnicode
class ComboBox(QtGui.QComboBox):
......@@ -189,9 +189,9 @@ class ComboBox(QtGui.QComboBox):
texts = items
items = dict([(x, x) for x in items])
elif isinstance(items, dict):
texts = items.keys()
texts = list(items.keys())
else:
raise TypeError("items argument must be list or dict.")
raise TypeError("items argument must be list or dict (got %s)." % type(items))
for t in texts:
if t in self._items:
......@@ -200,7 +200,7 @@ class ComboBox(QtGui.QComboBox):
for k,v in items.items():
self._items[k] = v
QtGui.QComboBox.addItems(self, texts)
QtGui.QComboBox.addItems(self, list(texts))
self.itemsChanged()
......
......@@ -24,7 +24,7 @@ def test_combobox():
assert cb.value() == 5
# Set list instead of dict
cb.setItems(items.keys())
cb.setItems(list(items.keys()))
assert str(cb.currentText()) == 'b'
cb.setValue('c')
......@@ -40,5 +40,5 @@ if __name__ == '__main__':
cb.show()
cb.setItems({'': None, 'a': 1, 'b': 2, 'c': 3})
def fn(ind):
print "New value:", cb.value()
print("New value: %s" % cb.value())
cb.currentIndexChanged.connect(fn)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment