[review] force_raise -> no_raise
This commit is contained in:
parent
e1f5da3eff
commit
ba1a7a8de8
@ -300,24 +300,20 @@ def process_pos_args(args, via_ipc=False, cwd=None, target_arg=None):
|
||||
win_id = open_url(url, target=open_target)
|
||||
|
||||
|
||||
def open_url(url, target=None, force_raise=None):
|
||||
def open_url(url, target=None, no_raise=False):
|
||||
"""Open an URL in new window/tab
|
||||
|
||||
Args:
|
||||
url: An URL to open
|
||||
target: same as new_instance_open_target (used as a default)
|
||||
force_raise: control target window raising:
|
||||
* None - obey new_instance_open_target
|
||||
* True - always raise
|
||||
* False - never raise
|
||||
no_raise: suppress target window raising
|
||||
|
||||
Return:
|
||||
ID of a window that was used to open URL
|
||||
"""
|
||||
target = target or config.val.new_instance_open_target
|
||||
background = target in {'tab-bg', 'tab-bg-silent'}
|
||||
win_id = mainwindow.get_window(True, force_target=target,
|
||||
force_raise=force_raise)
|
||||
win_id = mainwindow.get_window(True, force_target=target, no_raise=no_raise)
|
||||
tabbed_browser = objreg.get('tabbed-browser', scope='window',
|
||||
window=win_id)
|
||||
log.init.debug("About to open URL: {}".format(url.toDisplayString()))
|
||||
@ -844,7 +840,7 @@ class Application(QApplication):
|
||||
|
||||
def event(self, e):
|
||||
if e.type() == QEvent.FileOpen:
|
||||
open_url(e.url(), force_raise=False)
|
||||
open_url(e.url(), no_raise=True)
|
||||
else:
|
||||
return super().event(e)
|
||||
|
||||
|
@ -43,7 +43,7 @@ win_id_gen = itertools.count(0)
|
||||
|
||||
|
||||
def get_window(via_ipc, force_window=False, force_tab=False,
|
||||
force_target=None, force_raise=None):
|
||||
force_target=None, no_raise=False):
|
||||
"""Helper function for app.py to get a window id.
|
||||
|
||||
Args:
|
||||
@ -51,10 +51,7 @@ def get_window(via_ipc, force_window=False, force_tab=False,
|
||||
force_window: Whether to force opening in a window.
|
||||
force_tab: Whether to force opening in a tab.
|
||||
force_target: Override the new_instance_open_target config
|
||||
force_raise: control target window raising:
|
||||
* None - obey new_instance_open_target
|
||||
* True - always raise
|
||||
* False - never raise
|
||||
no_raise: suppress target window raising
|
||||
|
||||
Return:
|
||||
ID of a window that was used to open URL
|
||||
@ -91,7 +88,7 @@ def get_window(via_ipc, force_window=False, force_tab=False,
|
||||
window.show()
|
||||
should_raise = True
|
||||
|
||||
if (force_raise is True) or (force_raise is None and should_raise):
|
||||
if should_raise and not no_raise:
|
||||
raise_window(window)
|
||||
|
||||
return window.win_id
|
||||
|
Loading…
Reference in New Issue
Block a user