Remove debug console completing completely.
Turns out pylint doesn't like it if stuff is unused because we commented code out ;)
This commit is contained in:
parent
813ce9a513
commit
0ebef4069e
@ -21,16 +21,14 @@
|
||||
|
||||
import sys
|
||||
import code
|
||||
import rlcompleter
|
||||
|
||||
from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QStringListModel
|
||||
from PyQt5.QtWidgets import (QTextEdit, QWidget, QVBoxLayout, QApplication,
|
||||
QCompleter)
|
||||
from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt
|
||||
from PyQt5.QtWidgets import QTextEdit, QWidget, QVBoxLayout, QApplication
|
||||
from PyQt5.QtGui import QTextCursor
|
||||
|
||||
from qutebrowser.config import config
|
||||
from qutebrowser.misc import cmdhistory, miscwidgets
|
||||
from qutebrowser.utils import utils, log, objreg
|
||||
from qutebrowser.utils import utils, objreg
|
||||
|
||||
|
||||
class ConsoleLineEdit(miscwidgets.CommandLineEdit):
|
||||
@ -39,8 +37,6 @@ class ConsoleLineEdit(miscwidgets.CommandLineEdit):
|
||||
|
||||
Attributes:
|
||||
_history: The command history of executed commands.
|
||||
_rlcompleter: The rlcompleter.Completer instance.
|
||||
_qcompleter: The QCompleter instance.
|
||||
|
||||
Signals:
|
||||
execute: Emitted when a commandline should be executed.
|
||||
@ -48,46 +44,18 @@ class ConsoleLineEdit(miscwidgets.CommandLineEdit):
|
||||
|
||||
execute = pyqtSignal(str)
|
||||
|
||||
def __init__(self, namespace, parent):
|
||||
def __init__(self, _namespace, parent):
|
||||
"""Constructor.
|
||||
|
||||
Args:
|
||||
namespace: The local namespace of the interpreter.
|
||||
_namespace: The local namespace of the interpreter.
|
||||
"""
|
||||
super().__init__(parent)
|
||||
self.update_font()
|
||||
objreg.get('config').changed.connect(self.update_font)
|
||||
#self.textChanged.connect(self.on_text_changed)
|
||||
|
||||
#self._rlcompleter = rlcompleter.Completer(namespace)
|
||||
#qcompleter = QCompleter(self)
|
||||
#self._model = QStringListModel(qcompleter)
|
||||
#qcompleter.setModel(self._model)
|
||||
#qcompleter.setCompletionMode(
|
||||
# QCompleter.UnfilteredPopupCompletion)
|
||||
#qcompleter.setModelSorting(
|
||||
# QCompleter.CaseSensitivelySortedModel)
|
||||
#self.setCompleter(qcompleter)
|
||||
|
||||
self._history = cmdhistory.History(parent=self)
|
||||
self.returnPressed.connect(self.on_return_pressed)
|
||||
|
||||
@pyqtSlot(str)
|
||||
def on_text_changed(self, text):
|
||||
"""Update completion when text changed."""
|
||||
strings = set()
|
||||
i = 0
|
||||
while True:
|
||||
s = self._rlcompleter.complete(text, i)
|
||||
if s is None:
|
||||
break
|
||||
else:
|
||||
strings.add(s)
|
||||
i += 1
|
||||
strings = sorted(list(strings))
|
||||
self._model.setStringList(strings)
|
||||
log.misc.vdebug('completions: {!r}'.format(strings))
|
||||
|
||||
@pyqtSlot(str)
|
||||
def on_return_pressed(self):
|
||||
"""Execute the line of code which was entered."""
|
||||
|
Loading…
Reference in New Issue
Block a user