Merge remote-tracking branch 'origin/pr/3549'

This commit is contained in:
Florian Bruhin 2018-02-09 22:27:31 +01:00
commit 1ea1c1ac78
3 changed files with 15 additions and 10 deletions

View File

@ -1219,10 +1219,18 @@ class CommandDispatcher:
log.procs.debug("Executing {} with args {}, userscript={}".format(
cmd, args, userscript))
def _on_proc_finished():
if output:
tb = objreg.get('tabbed-browser', scope='window',
window='last-focused')
tb.openurl(QUrl('qute://spawn-output'), newtab=True)
if userscript:
def _selection_callback(s):
try:
self._run_userscript(s, cmd, args, verbose)
runner = self._run_userscript(s, cmd, args, verbose)
runner.finished.connect(_on_proc_finished)
except cmdexc.CommandError as e:
message.error(str(e))
@ -1241,11 +1249,7 @@ class CommandDispatcher:
proc.start_detached(cmd, args)
else:
proc.start(cmd, args)
if output:
tabbed_browser = objreg.get('tabbed-browser', scope='window',
window='last-focused')
tabbed_browser.openurl(QUrl('qute://spawn-output'), newtab=True)
proc.finished.connect(_on_proc_finished)
@cmdutils.register(instance='command-dispatcher', scope='window')
def home(self):
@ -1280,10 +1284,11 @@ class CommandDispatcher:
env['QUTE_URL'] = url.toString(QUrl.FullyEncoded)
try:
userscripts.run_async(tab, cmd, *args, win_id=self._win_id,
env=env, verbose=verbose)
runner = userscripts.run_async(
tab, cmd, *args, win_id=self._win_id, env=env, verbose=verbose)
except userscripts.Error as e:
raise cmdexc.CommandError(e)
return runner
@cmdutils.register(instance='command-dispatcher', scope='window')
def quickmark_save(self):

View File

@ -61,8 +61,7 @@ class ProxyFactory(QNetworkProxyFactory):
"""
proxy = config.val.content.proxy
if proxy is configtypes.SYSTEM_PROXY:
# On Linux, use "export http_proxy=socks5://host:port" to manually
# set system proxy.
# On Linux, use "export http_proxy=socks5://host:port" to manually set system proxy
# ref. http://doc.qt.io/qt-5/qnetworkproxyfactory.html#systemProxyForQuery
proxies = QNetworkProxyFactory.systemProxyForQuery(query)
elif isinstance(proxy, pac.PACFetcher):

View File

@ -446,3 +446,4 @@ def run_async(tab, cmd, *args, win_id, env, verbose=False):
runner.prepare_run(cmd_path, *args, env=env, verbose=verbose)
tab.dump_async(runner.store_html)
tab.dump_async(runner.store_text, plain=True)
return runner