Completion pattern update
This commit is contained in:
parent
ecf405c7af
commit
df26d4ad91
@ -1,40 +1,43 @@
|
|||||||
# Copyright 2014 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
|
# Copyright 2014 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
|
||||||
#
|
#
|
||||||
# This file is part of qutebrowser.
|
# This file is part of qutebrowser.
|
||||||
#
|
#
|
||||||
# qutebrowser is free software: you can redistribute it and/or modify
|
# qutebrowser is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# qutebrowser is distributed in the hope that it will be useful,
|
# qutebrowser is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
"""A CompletionModel filled with settings and their descriptions."""
|
"""A CompletionModel filled with settings and their descriptions."""
|
||||||
|
|
||||||
from collections import OrderedDict
|
import logging
|
||||||
|
|
||||||
from qutebrowser.models.completion import CompletionModel
|
from collections import OrderedDict
|
||||||
from qutebrowser.config.configdata import configdata
|
|
||||||
|
from qutebrowser.models.completion import CompletionModel
|
||||||
|
from qutebrowser.config.configdata import configdata
|
||||||
class SettingCompletionModel(CompletionModel):
|
|
||||||
|
|
||||||
"""A CompletionModel filled with settings and their descriptions."""
|
class SettingCompletionModel(CompletionModel):
|
||||||
|
|
||||||
# pylint: disable=abstract-method
|
"""A CompletionModel filled with settings and their descriptions."""
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
# pylint: disable=abstract-method
|
||||||
super().__init__(parent)
|
|
||||||
data = OrderedDict()
|
def __init__(self, parent=None):
|
||||||
for secname, secdata in configdata().items():
|
super().__init__(parent)
|
||||||
newdata = []
|
data = OrderedDict()
|
||||||
for name in secdata.values.keys():
|
for secname, secdata in configdata().items():
|
||||||
newdata.append((name, secdata.descriptions[name]))
|
newdata = []
|
||||||
data[secname] = newdata
|
for name in secdata.values.keys():
|
||||||
self.init_data(data)
|
newdata.append((name, secdata.descriptions[name]))
|
||||||
|
data[secname] = newdata
|
||||||
|
logging.debug("Setting data: {}".format(data))
|
||||||
|
self.init_data(data)
|
||||||
|
@ -22,6 +22,7 @@ subclasses to provide completions.
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import logging
|
||||||
import html
|
import html
|
||||||
|
|
||||||
from PyQt5.QtWidgets import (QStyle, QStyleOptionViewItem, QTreeView,
|
from PyQt5.QtWidgets import (QStyle, QStyleOptionViewItem, QTreeView,
|
||||||
@ -200,8 +201,11 @@ class CompletionView(QTreeView):
|
|||||||
self.setmodel('command')
|
self.setmodel('command')
|
||||||
|
|
||||||
self._completing = True
|
self._completing = True
|
||||||
if text:
|
if text.endswith(' '):
|
||||||
|
text = ''
|
||||||
|
elif text:
|
||||||
text = text.split()[-1]
|
text = text.split()[-1]
|
||||||
|
logging.debug("pattern: {}".format(text))
|
||||||
self.model.pattern = text
|
self.model.pattern = text
|
||||||
self.model.sourceModel().mark_all_items(text)
|
self.model.sourceModel().mark_all_items(text)
|
||||||
if self._enabled:
|
if self._enabled:
|
||||||
|
Loading…
Reference in New Issue
Block a user