Fix lint and bugs
This commit is contained in:
parent
2b60cdb64c
commit
9aa65a2341
@ -369,7 +369,7 @@ class Application(QApplication):
|
||||
|
||||
def _connect_signals(self):
|
||||
"""Connect all signals to their slots."""
|
||||
# pylint: disable=too-many-statements
|
||||
# pylint: disable=too-many-statements, too-many-locals
|
||||
# syntactic sugar
|
||||
kp = self._keyparsers
|
||||
main_window = self.registry['main-window']
|
||||
@ -747,8 +747,10 @@ class Application(QApplication):
|
||||
# event loop, so we can shut down immediately.
|
||||
self._shutdown(status)
|
||||
|
||||
def _shutdown(self, status): # noqa, pylint: disable=too-many-branches
|
||||
def _shutdown(self, status): # noqa
|
||||
"""Second stage of shutdown."""
|
||||
# pylint: disable=too-many-branches, too-many-statements
|
||||
# FIXME refactor this
|
||||
log.destroy.debug("Stage 2 of shutting down...")
|
||||
# Remove eventfilter
|
||||
try:
|
||||
|
@ -270,8 +270,9 @@ class HintManager(QObject):
|
||||
else:
|
||||
display = 'none'
|
||||
rect = elem.geometry()
|
||||
return self.HINT_CSS.format(left=rect.x(), top=rect.y(),
|
||||
config=config.instance(), display=display)
|
||||
return self.HINT_CSS.format(
|
||||
left=rect.x(), top=rect.y(), config=utils.get_object('config'),
|
||||
display=display)
|
||||
|
||||
def _draw_label(self, elem, string):
|
||||
"""Draw a hint label over an element.
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
"""Message singleton so we don't have to define unneeded signals."""
|
||||
|
||||
from PyQt5.QtCore import pyqtSignal, QCoreApplication, QObject, QTimer
|
||||
from PyQt5.QtCore import pyqtSignal, QObject, QTimer
|
||||
|
||||
from qutebrowser.utils import usertypes, log, utils
|
||||
|
||||
|
@ -27,7 +27,7 @@ from PyQt5.QtCore import QCoreApplication
|
||||
|
||||
from qutebrowser.utils import usertypes, log, utils
|
||||
from qutebrowser.commands import runners, cmdexc, cmdutils
|
||||
from qutebrowser.config import config, style
|
||||
from qutebrowser.config import style
|
||||
|
||||
|
||||
_timers = []
|
||||
@ -96,7 +96,7 @@ def debug_all_objects():
|
||||
@cmdutils.register(debug=True)
|
||||
def debug_cache_stats():
|
||||
"""Print LRU cache stats."""
|
||||
config_info = config.instance().get.cache_info()
|
||||
config_info = utils.get_object('config').get.cache_info()
|
||||
style_info = style.get_stylesheet.cache_info()
|
||||
log.misc.debug('config: {}'.format(config_info))
|
||||
log.misc.debug('style: {}'.format(style_info))
|
||||
|
@ -29,7 +29,6 @@ from PyQt5.QtCore import Qt, QSize
|
||||
from PyQt5.QtWidgets import (QDialog, QLabel, QTextEdit, QPushButton,
|
||||
QVBoxLayout, QHBoxLayout)
|
||||
|
||||
from qutebrowser.config import config
|
||||
from qutebrowser.utils import version, log, utils
|
||||
|
||||
|
||||
@ -131,8 +130,8 @@ class _CrashDialog(QDialog):
|
||||
except Exception:
|
||||
self._crash_info.append(("Version info", traceback.format_exc()))
|
||||
try:
|
||||
self._crash_info.append(("Config",
|
||||
config.instance().dump_userconfig()))
|
||||
conf = utils.get_object('config')
|
||||
self._crash_info.append(("Config", conf.dump_userconfig()))
|
||||
except Exception:
|
||||
self._crash_info.append(("Config", traceback.format_exc()))
|
||||
|
||||
|
@ -95,10 +95,7 @@ class MainWindow(QWidget):
|
||||
# When we're here the statusbar might not even really exist yet, so
|
||||
# resizing will fail. Therefore, we use singleShot QTimers to make sure
|
||||
# we defer this until everything else is initialized.
|
||||
QTimer.singleShot(
|
||||
0, lambda: self._completion.resize_completion.connect(
|
||||
self.resize_completion))
|
||||
QTimer.singleShot(0, self.resize_completion)
|
||||
QTimer.singleShot(0, self._connect_resize_completion)
|
||||
#self.retranslateUi(MainWindow)
|
||||
#self.tabWidget.setCurrentIndex(0)
|
||||
#QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||
@ -106,6 +103,11 @@ class MainWindow(QWidget):
|
||||
def __repr__(self):
|
||||
return '<{}>'.format(self.__class__.__name__)
|
||||
|
||||
def _connect_resize_completion(self):
|
||||
"""Connect the resize_completion signal and resize it once."""
|
||||
self._completion.resize_completion.connect(self.resize_completion)
|
||||
self.resize_completion()
|
||||
|
||||
def _set_default_geometry(self):
|
||||
"""Set some sensible default geometry."""
|
||||
self.setGeometry(QRect(50, 50, 800, 600))
|
||||
|
@ -25,7 +25,6 @@ import datetime
|
||||
from PyQt5.QtCore import pyqtSignal, pyqtSlot, pyqtProperty, Qt
|
||||
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QStackedLayout, QSizePolicy
|
||||
|
||||
from qutebrowser.keyinput import modeman
|
||||
from qutebrowser.config import config, style
|
||||
from qutebrowser.utils import usertypes, log, utils
|
||||
from qutebrowser.widgets.statusbar import (command, progress, keystring,
|
||||
|
@ -359,7 +359,7 @@ class WebView(QWebView):
|
||||
if not config.get('input', 'auto-insert-mode'):
|
||||
return
|
||||
cur_mode = utils.get_object('mode-manager').mode()
|
||||
if curmode == usertypes.KeyMode.insert or not ok:
|
||||
if cur_mode == usertypes.KeyMode.insert or not ok:
|
||||
return
|
||||
frame = self.page().currentFrame()
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user