Simplify showing of main windows.
This commit is contained in:
parent
2dea47b162
commit
16c067e32d
@ -114,10 +114,6 @@ class Application(QApplication):
|
|||||||
log.init.debug("Connecting signals...")
|
log.init.debug("Connecting signals...")
|
||||||
self._connect_signals()
|
self._connect_signals()
|
||||||
|
|
||||||
log.init.debug("Showing mainwindow...")
|
|
||||||
if not args.nowindow:
|
|
||||||
objreg.get('main-window', scope='window', window=0).show()
|
|
||||||
|
|
||||||
log.init.debug("Applying python hacks...")
|
log.init.debug("Applying python hacks...")
|
||||||
self._python_hacks()
|
self._python_hacks()
|
||||||
|
|
||||||
@ -155,7 +151,7 @@ class Application(QApplication):
|
|||||||
download_manager = downloads.DownloadManager(self)
|
download_manager = downloads.DownloadManager(self)
|
||||||
objreg.register('download-manager', download_manager)
|
objreg.register('download-manager', download_manager)
|
||||||
log.init.debug("Initializing main window...")
|
log.init.debug("Initializing main window...")
|
||||||
mainwindow.create_window()
|
mainwindow.create_window(False if self._args.nowindow else True)
|
||||||
log.init.debug("Initializing debug console...")
|
log.init.debug("Initializing debug console...")
|
||||||
debug_console = console.ConsoleWidget()
|
debug_console = console.ConsoleWidget()
|
||||||
objreg.register('debug-console', debug_console)
|
objreg.register('debug-console', debug_console)
|
||||||
|
@ -108,7 +108,7 @@ class CommandDispatcher:
|
|||||||
elif window:
|
elif window:
|
||||||
# We have to import this here to avoid a circular import.
|
# We have to import this here to avoid a circular import.
|
||||||
from qutebrowser.widgets import mainwindow
|
from qutebrowser.widgets import mainwindow
|
||||||
win_id = mainwindow.create_window()
|
win_id = mainwindow.create_window(True)
|
||||||
tabbed_browser = objreg.get('tabbed-browser', scope='window',
|
tabbed_browser = objreg.get('tabbed-browser', scope='window',
|
||||||
window=win_id)
|
window=win_id)
|
||||||
tabbed_browser.tabopen(url)
|
tabbed_browser.tabopen(url)
|
||||||
|
@ -39,14 +39,19 @@ from qutebrowser.browser import hints
|
|||||||
win_id_gen = itertools.count(0)
|
win_id_gen = itertools.count(0)
|
||||||
|
|
||||||
|
|
||||||
def create_window():
|
def create_window(show):
|
||||||
"""Create a new main window.
|
"""Create a new main window.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
show: Show the window after creating.
|
||||||
|
|
||||||
Return:
|
Return:
|
||||||
The new window id.
|
The new window id.
|
||||||
"""
|
"""
|
||||||
win_id = next(win_id_gen)
|
win_id = next(win_id_gen)
|
||||||
MainWindow(win_id)
|
win = MainWindow(win_id)
|
||||||
|
if show:
|
||||||
|
win.show()
|
||||||
return win_id
|
return win_id
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user