Fix publisher combobox not being cleared before initializing

This commit is contained in:
Kovid Goyal 2011-04-10 10:25:43 -06:00
parent f6d0ef1814
commit fb8fc927cf

View File

@ -988,13 +988,13 @@ class PublisherEdit(MultiCompleteComboBox): # {{{
all_publishers.sort(key=lambda x : sort_key(x[1])) all_publishers.sort(key=lambda x : sort_key(x[1]))
self.update_items_cache([x[1] for x in all_publishers]) self.update_items_cache([x[1] for x in all_publishers])
publisher_id = db.publisher_id(id_, index_is_id=True) publisher_id = db.publisher_id(id_, index_is_id=True)
idx, c = None, 0 idx = None
for i in all_publishers: self.clear()
id, name = i for i, x in enumerate(all_publishers):
if id == publisher_id: id_, name = x
idx = c if id_ == publisher_id:
idx = i
self.addItem(name) self.addItem(name)
c += 1
self.setEditText('') self.setEditText('')
if idx is not None: if idx is not None: