Reorder initialization

marcos.init() really belongs into _init_modules, and we need to do _process_args
after everything has been initialized.

Fixes #2408.
This commit is contained in:
Florian Bruhin 2017-03-07 06:43:05 +01:00
parent 35a58b27af
commit d42dff67f2
2 changed files with 15 additions and 4 deletions

View File

@ -142,8 +142,6 @@ def init(args, crash_handler):
pre_text="Error while initializing")
sys.exit(usertypes.Exit.err_init)
_process_args(args)
log.init.debug("Initializing eventfilter...")
event_filter = EventFilter(qApp)
qApp.installEventFilter(event_filter)
@ -154,12 +152,12 @@ def init(args, crash_handler):
config_obj.style_changed.connect(style.get_stylesheet.cache_clear)
qApp.focusChanged.connect(on_focus_changed)
_process_args(args)
QDesktopServices.setUrlHandler('http', open_desktopservices_url)
QDesktopServices.setUrlHandler('https', open_desktopservices_url)
QDesktopServices.setUrlHandler('qute', open_desktopservices_url)
macros.init()
QTimer.singleShot(10, functools.partial(_init_late_modules, args))
log.init.debug("Init done!")
@ -449,6 +447,7 @@ def _init_modules(args, crash_handler):
os.environ['QT_WAYLAND_DISABLE_WINDOWDECORATION'] = '1'
else:
os.environ.pop('QT_WAYLAND_DISABLE_WINDOWDECORATION', None)
macros.init()
# Init backend-specific stuff
browsertab.init()

View File

@ -249,3 +249,15 @@ def test_webengine_download_suffix(request, quteproc_new, tmpdir):
files = download_dir.listdir()
assert len(files) == 1
assert files[0].basename == 'download.bin'
def test_command_on_start(request, quteproc_new):
"""Make sure passing a command on start works.
See https://github.com/qutebrowser/qutebrowser/issues/2408
"""
args = (['--temp-basedir'] + _base_args(request.config) +
[':quickmark-add https://www.example.com/ example'])
quteproc_new.start(args)
quteproc_new.send_cmd(':quit')
quteproc_new.wait_for_quit()