Build list in focusCid and specify exception
model.cards may be a protobuf sequence but focusCid needs list's index method, so convert to list, but only if needed.
This commit is contained in:
parent
4745b55d27
commit
9e9d8b9c7a
@ -190,7 +190,7 @@ class DataModel(QAbstractTableModel):
|
|||||||
ctx = SearchContext(search=txt, browser=self.browser)
|
ctx = SearchContext(search=txt, browser=self.browser)
|
||||||
gui_hooks.browser_will_search(ctx)
|
gui_hooks.browser_will_search(ctx)
|
||||||
if ctx.card_ids is None:
|
if ctx.card_ids is None:
|
||||||
ctx.card_ids = list(self.col.find_cards(ctx.search, order=ctx.order))
|
ctx.card_ids = self.col.find_cards(ctx.search, order=ctx.order)
|
||||||
gui_hooks.browser_did_search(ctx)
|
gui_hooks.browser_did_search(ctx)
|
||||||
self.cards = ctx.card_ids
|
self.cards = ctx.card_ids
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
@ -1829,8 +1829,8 @@ where id in %s"""
|
|||||||
|
|
||||||
def focusCid(self, cid):
|
def focusCid(self, cid):
|
||||||
try:
|
try:
|
||||||
row = self.model.cards.index(cid)
|
row = list(self.model.cards).index(cid)
|
||||||
except:
|
except ValueError:
|
||||||
return
|
return
|
||||||
self.form.tableView.clearSelection()
|
self.form.tableView.clearSelection()
|
||||||
self.form.tableView.selectRow(row)
|
self.form.tableView.selectRow(row)
|
||||||
|
Loading…
Reference in New Issue
Block a user