Get rid of self._completing in completion

This commit is contained in:
Florian Bruhin 2014-06-03 10:06:50 +02:00
parent 8914614f7b
commit ce8ada5024

View File

@ -57,7 +57,6 @@ class CompletionView(QTreeView):
_lastmodel: The model set in the last iteration. _lastmodel: The model set in the last iteration.
_models: dict of available completion models. _models: dict of available completion models.
_enabled: Whether showing the CompletionView is enabled. _enabled: Whether showing the CompletionView is enabled.
_completing: Whether we're currently completing something.
_height: The height to use for the CompletionView. _height: The height to use for the CompletionView.
_height_perc: Either None or a percentage if height should be relative. _height_perc: Either None or a percentage if height should be relative.
_delegate: The item delegate used. _delegate: The item delegate used.
@ -117,7 +116,6 @@ class CompletionView(QTreeView):
} }
self._init_command_completion() self._init_command_completion()
self._init_setting_completions() self._init_setting_completions()
self._completing = False
self._delegate = CompletionItemDelegate(self) self._delegate = CompletionItemDelegate(self)
self.setItemDelegate(self._delegate) self.setItemDelegate(self._delegate)
@ -257,7 +255,7 @@ class CompletionView(QTreeView):
Args: Args:
prev: True for prev item, False for next one. prev: True for prev item, False for next one.
""" """
if not self._completing: if not self.isVisible():
# No completion running at the moment, ignore keypress # No completion running at the moment, ignore keypress
return return
idx = self._next_idx(prev) idx = self._next_idx(prev)
@ -308,7 +306,6 @@ class CompletionView(QTreeView):
# anything (yet) # anything (yet)
# FIXME complete searchs # FIXME complete searchs
self.hide() self.hide()
self._completing = False
return return
model = self._get_new_completion(parts, cursor_part) model = self._get_new_completion(parts, cursor_part)
@ -323,10 +320,8 @@ class CompletionView(QTreeView):
self._lastmodel = model self._lastmodel = model
if model is None: if model is None:
self.hide() self.hide()
self._completing = False
return return
self.set_model(model) self.set_model(model)
self._completing = True
if model is None: if model is None:
return return