From def2920a3516cec1539a4221a8ed233f408cebca Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Wed, 31 Jan 2018 18:05:14 -0500 Subject: [PATCH 1/3] fix line length --- qutebrowser/browser/network/proxy.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qutebrowser/browser/network/proxy.py b/qutebrowser/browser/network/proxy.py index 9a1f80ae8..cefb5d179 100644 --- a/qutebrowser/browser/network/proxy.py +++ b/qutebrowser/browser/network/proxy.py @@ -61,8 +61,10 @@ 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 - # ref. http://doc.qt.io/qt-5/qnetworkproxyfactory.html#systemProxyForQuery + # On Linux, use "export http_proxy=socks5://host:port" + # to manually set system proxy. + # ref. http://doc.qt.io/qt-5/qnetworkproxyfactory.html + # look under the systemProxyForQuery() call proxies = QNetworkProxyFactory.systemProxyForQuery(query) elif isinstance(proxy, pac.PACFetcher): proxies = proxy.resolve(query) From 132095c98c5521ed637ef8eaef1e2b5e87bdeb30 Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Wed, 31 Jan 2018 18:05:23 -0500 Subject: [PATCH 2/3] only open the tab for output once the job has finished running --- qutebrowser/browser/commands.py | 21 +++++++++++++-------- qutebrowser/commands/userscripts.py | 1 + 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index a0c5e63ff..3619affc5 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1217,10 +1217,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)) @@ -1239,11 +1247,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): @@ -1284,10 +1288,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): diff --git a/qutebrowser/commands/userscripts.py b/qutebrowser/commands/userscripts.py index d86cb8ccf..fc6443eb3 100644 --- a/qutebrowser/commands/userscripts.py +++ b/qutebrowser/commands/userscripts.py @@ -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 From 989e60b01fe0b5c2d2e49c35450e751c7ca3217c Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Sat, 3 Feb 2018 19:10:19 -0500 Subject: [PATCH 3/3] Revert "fix line length" This reverts commit def2920a3516cec1539a4221a8ed233f408cebca. --- qutebrowser/browser/network/proxy.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/qutebrowser/browser/network/proxy.py b/qutebrowser/browser/network/proxy.py index cefb5d179..9a1f80ae8 100644 --- a/qutebrowser/browser/network/proxy.py +++ b/qutebrowser/browser/network/proxy.py @@ -61,10 +61,8 @@ 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. - # ref. http://doc.qt.io/qt-5/qnetworkproxyfactory.html - # look under the systemProxyForQuery() call + # 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): proxies = proxy.resolve(query)