Explain why we use subprocess/QProcess.
This commit is contained in:
parent
9e609bae8d
commit
ff37f03725
@ -399,6 +399,10 @@ class CurCommandDispatcher(QObject):
|
|||||||
The command will be run in a shell, so you can use shell features like
|
The command will be run in a shell, so you can use shell features like
|
||||||
redirections.
|
redirections.
|
||||||
|
|
||||||
|
We use subprocess rather than Qt's QProcess here because of it's
|
||||||
|
shell=True argument and because we really don't care about the process
|
||||||
|
anymore as soon as it's spawned.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
cmd: The command to execute.
|
cmd: The command to execute.
|
||||||
"""
|
"""
|
||||||
@ -409,7 +413,12 @@ class CurCommandDispatcher(QObject):
|
|||||||
@cmdutils.register(instance='mainwindow.tabs.cur', modes=['insert'],
|
@cmdutils.register(instance='mainwindow.tabs.cur', modes=['insert'],
|
||||||
name='open_editor', hide=True, needs_js=True)
|
name='open_editor', hide=True, needs_js=True)
|
||||||
def editor(self):
|
def editor(self):
|
||||||
"""Open an external editor with the current form field."""
|
"""Open an external editor with the current form field.
|
||||||
|
|
||||||
|
We use QProcess rather than subprocess here because it makes it a lot
|
||||||
|
easier to execute some code as soon as the process has been finished
|
||||||
|
and do everything async.
|
||||||
|
"""
|
||||||
frame = self._tabs.currentWidget().page_.currentFrame()
|
frame = self._tabs.currentWidget().page_.currentFrame()
|
||||||
elem = frame.findFirstElement(webelem.SELECTORS['editable_focused'])
|
elem = frame.findFirstElement(webelem.SELECTORS['editable_focused'])
|
||||||
if elem.isNull():
|
if elem.isNull():
|
||||||
|
Loading…
Reference in New Issue
Block a user