This commit is contained in:
Florian Bruhin 2014-06-03 13:48:12 +02:00
parent 02e92fd0ed
commit 0f41366269
3 changed files with 7 additions and 10 deletions

1
TODO
View File

@ -20,7 +20,6 @@ Before 0.1
Style
=====
- initialize completion models at some nicer place (not in widget)
- somehow clean up init() and save() calls
New big features

View File

@ -29,7 +29,6 @@ from qutebrowser.models.completion import (
SettingOptionCompletionModel, SettingValueCompletionModel)
from qutebrowser.models.basecompletion import NoCompletionsError
from qutebrowser.utils.usertypes import FakeDict
from qutebrowser.utils.log import completion as logger
class Completer(QObject):
@ -139,14 +138,14 @@ class Completer(QObject):
model = self._models.get(completion_name)
return model
def selection_changed(self, selected, deselected):
def selection_changed(self, selected, _deselected):
"""Emit change_completed_part if a new item was selected.
Called from the views selectionChanged method.
Args:
selected: New selection.
delected: Previous selection.
_delected: Previous selection.
Emit:
change_completed_part: Emitted when there's data for the new item.
@ -221,6 +220,5 @@ class Completer(QObject):
return
self.view.model().mark_all_items(pattern)
if self.view._enabled:
if self.view.enabled:
self.view.show()

View File

@ -46,7 +46,7 @@ class CompletionView(QTreeView):
Attributes:
completer: The Completer instance to use.
_enabled: Whether showing the CompletionView is enabled.
enabled: Whether showing the CompletionView is enabled.
_height: The height to use for the CompletionView.
_height_perc: Either None or a percentage if height should be relative.
_delegate: The item delegate used.
@ -92,7 +92,7 @@ class CompletionView(QTreeView):
def __init__(self, parent=None):
super().__init__(parent)
self.completer = Completer(self)
self._enabled = config.get('completion', 'show')
self.enabled = config.get('completion', 'show')
self._delegate = CompletionItemDelegate(self)
self.setItemDelegate(self._delegate)
@ -184,9 +184,9 @@ class CompletionView(QTreeView):
@pyqtSlot(str, str)
def on_config_changed(self, section, option):
"""Update self._enabled when the config changed."""
"""Update self.enabled when the config changed."""
if section == 'completion' and option == 'show':
self._enabled = config.get('completion', 'show')
self.enabled = config.get('completion', 'show')
elif section == 'aliases':
self._init_command_completion()