only open the tab for output once the job has finished running
This commit is contained in:
parent
def2920a35
commit
132095c98c
@ -1217,10 +1217,18 @@ class CommandDispatcher:
|
|||||||
|
|
||||||
log.procs.debug("Executing {} with args {}, userscript={}".format(
|
log.procs.debug("Executing {} with args {}, userscript={}".format(
|
||||||
cmd, args, userscript))
|
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:
|
if userscript:
|
||||||
def _selection_callback(s):
|
def _selection_callback(s):
|
||||||
try:
|
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:
|
except cmdexc.CommandError as e:
|
||||||
message.error(str(e))
|
message.error(str(e))
|
||||||
|
|
||||||
@ -1239,11 +1247,7 @@ class CommandDispatcher:
|
|||||||
proc.start_detached(cmd, args)
|
proc.start_detached(cmd, args)
|
||||||
else:
|
else:
|
||||||
proc.start(cmd, args)
|
proc.start(cmd, args)
|
||||||
|
proc.finished.connect(_on_proc_finished)
|
||||||
if output:
|
|
||||||
tabbed_browser = objreg.get('tabbed-browser', scope='window',
|
|
||||||
window='last-focused')
|
|
||||||
tabbed_browser.openurl(QUrl('qute://spawn-output'), newtab=True)
|
|
||||||
|
|
||||||
@cmdutils.register(instance='command-dispatcher', scope='window')
|
@cmdutils.register(instance='command-dispatcher', scope='window')
|
||||||
def home(self):
|
def home(self):
|
||||||
@ -1284,10 +1288,11 @@ class CommandDispatcher:
|
|||||||
env['QUTE_URL'] = url.toString(QUrl.FullyEncoded)
|
env['QUTE_URL'] = url.toString(QUrl.FullyEncoded)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
userscripts.run_async(tab, cmd, *args, win_id=self._win_id,
|
runner = userscripts.run_async(
|
||||||
env=env, verbose=verbose)
|
tab, cmd, *args, win_id=self._win_id, env=env, verbose=verbose)
|
||||||
except userscripts.Error as e:
|
except userscripts.Error as e:
|
||||||
raise cmdexc.CommandError(e)
|
raise cmdexc.CommandError(e)
|
||||||
|
return runner
|
||||||
|
|
||||||
@cmdutils.register(instance='command-dispatcher', scope='window')
|
@cmdutils.register(instance='command-dispatcher', scope='window')
|
||||||
def quickmark_save(self):
|
def quickmark_save(self):
|
||||||
|
@ -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)
|
runner.prepare_run(cmd_path, *args, env=env, verbose=verbose)
|
||||||
tab.dump_async(runner.store_html)
|
tab.dump_async(runner.store_html)
|
||||||
tab.dump_async(runner.store_text, plain=True)
|
tab.dump_async(runner.store_text, plain=True)
|
||||||
|
return runner
|
||||||
|
Loading…
Reference in New Issue
Block a user