Rename model to _model for completionview

This commit is contained in:
Florian Bruhin 2014-03-23 21:34:02 +01:00
parent d5456fcae1
commit 8ebd2929fd

View File

@ -50,7 +50,7 @@ class CompletionView(QTreeView):
Highlights completions based on marks in the UserRole. Highlights completions based on marks in the UserRole.
Attributes: Attributes:
model: The currently active filter model. _model: The currently active filter model.
_STYLESHEET: The stylesheet template for the CompletionView. _STYLESHEET: The stylesheet template for the CompletionView.
_completion_models: dict of available completion models. _completion_models: dict of available completion models.
_ignore_next: Whether to ignore the next cmd_text_changed signal. _ignore_next: Whether to ignore the next cmd_text_changed signal.
@ -139,14 +139,14 @@ class CompletionView(QTreeView):
idx = self.selectionModel().currentIndex() idx = self.selectionModel().currentIndex()
if not idx.isValid(): if not idx.isValid():
# No item selected yet # No item selected yet
return self.model.first_item() return self._model.first_item()
while True: while True:
idx = self.indexAbove(idx) if upwards else self.indexBelow(idx) idx = self.indexAbove(idx) if upwards else self.indexBelow(idx)
# wrap around if we arrived at beginning/end # wrap around if we arrived at beginning/end
if not idx.isValid() and upwards: if not idx.isValid() and upwards:
return self.model.last_item() return self._model.last_item()
elif not idx.isValid() and not upwards: elif not idx.isValid() and not upwards:
return self.model.first_item() return self._model.first_item()
elif idx.parent().isValid(): elif idx.parent().isValid():
# Item is a real item, not a category header -> success # Item is a real item, not a category header -> success
return idx return idx
@ -185,7 +185,7 @@ class CompletionView(QTreeView):
""" """
m = self._completion_models[model] m = self._completion_models[model]
self.setModel(m) self.setModel(m)
self.model = m self._model = m
self.expandAll() self.expandAll()
self.resizeColumnToContents(0) self.resizeColumnToContents(0)
@ -229,8 +229,8 @@ class CompletionView(QTreeView):
self.set_model(model) self.set_model(model)
self._completing = True self._completing = True
pattern = parts[-1] if parts else '' pattern = parts[-1] if parts else ''
self.model.pattern = pattern self._model.pattern = pattern
self.model.srcmodel.mark_all_items(text) self._model.srcmodel.mark_all_items(text)
if self._enabled: if self._enabled:
self.show() self.show()
@ -254,10 +254,10 @@ class CompletionView(QTreeView):
idx = self._next_idx(shift) idx = self._next_idx(shift)
self.selectionModel().setCurrentIndex( self.selectionModel().setCurrentIndex(
idx, QItemSelectionModel.ClearAndSelect) idx, QItemSelectionModel.ClearAndSelect)
data = self.model.data(idx) data = self._model.data(idx)
if data is not None: if data is not None:
self._ignore_next = True self._ignore_next = True
self.append_cmd_text.emit(self.model.data(idx)) self.append_cmd_text.emit(self._model.data(idx))
class _CompletionItemDelegate(QStyledItemDelegate): class _CompletionItemDelegate(QStyledItemDelegate):