Fix CompletionView.completion_item_del for new API.

The new function based completion models work a little differently so the view
needed slightly different error handling.
This commit is contained in:
Ryan Roden-Corrent 2017-02-12 18:03:49 -05:00
parent b381148e06
commit 5bd047b70b

View File

@ -368,7 +368,7 @@ class CompletionView(QTreeView):
"""Delete the current completion item."""
if not self.currentIndex().isValid():
raise cmdexc.CommandError("No item selected!")
try:
self.model().srcmodel.delete_cur_item(self)
except NotImplementedError:
if self.model().srcmodel.delete_cur_item is None:
raise cmdexc.CommandError("Cannot delete this item.")
else:
self.model().srcmodel.delete_cur_item(self)