debug-console: Only create when needed
This commit is contained in:
parent
637ceb9bdd
commit
b42d701b0c
@ -40,7 +40,7 @@ from qutebrowser.commands import cmdutils, runners
|
||||
from qutebrowser.config import style, config, websettings
|
||||
from qutebrowser.network import qutescheme, proxy
|
||||
from qutebrowser.browser import quickmarks, cookies, downloads, cache
|
||||
from qutebrowser.widgets import mainwindow, console, crash
|
||||
from qutebrowser.widgets import mainwindow, crash
|
||||
from qutebrowser.keyinput import modeman
|
||||
from qutebrowser.utils import (log, version, message, readline, utils, qtutils,
|
||||
urlutils, debug, objreg, usertypes, standarddir)
|
||||
@ -161,9 +161,6 @@ class Application(QApplication):
|
||||
False if self._args.nowindow else True)
|
||||
main_window = objreg.get('main-window', scope='window', window=win_id)
|
||||
self.setActiveWindow(main_window)
|
||||
log.init.debug("Initializing debug console...")
|
||||
debug_console = console.ConsoleWidget()
|
||||
objreg.register('debug-console', debug_console)
|
||||
|
||||
def _handle_segfault(self):
|
||||
"""Handle a segfault from a previous run."""
|
||||
|
@ -27,6 +27,7 @@ from PyQt5.QtCore import QCoreApplication
|
||||
from qutebrowser.utils import log, objreg, usertypes
|
||||
from qutebrowser.commands import cmdutils, runners, cmdexc
|
||||
from qutebrowser.config import style
|
||||
from qutebrowser.widgets import console
|
||||
|
||||
|
||||
@cmdutils.register(scope='window')
|
||||
@ -111,4 +112,9 @@ def debug_cache_stats():
|
||||
@cmdutils.register(debug=True)
|
||||
def debug_console():
|
||||
"""Show the debugging console."""
|
||||
objreg.get('debug-console').show()
|
||||
try:
|
||||
debug_console = objreg.get('debug-console')
|
||||
except KeyError:
|
||||
debug_console = console.ConsoleWidget()
|
||||
objreg.register('debug-console', debug_console)
|
||||
debug_console.show()
|
||||
|
Loading…
Reference in New Issue
Block a user