diff options
Diffstat (limited to 'qutebrowser/misc/editor.py')
-rw-r--r-- | qutebrowser/misc/editor.py | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/qutebrowser/misc/editor.py b/qutebrowser/misc/editor.py index 1c4c6ca03..03ecd6368 100644 --- a/qutebrowser/misc/editor.py +++ b/qutebrowser/misc/editor.py @@ -22,16 +22,13 @@ import os import tempfile -from qutebrowser.qt.core import (pyqtSignal, pyqtSlot, QObject, QProcess, - QFileSystemWatcher) - from qutebrowser.config import config from qutebrowser.utils import message, log from qutebrowser.misc import guiprocess -from qutebrowser.qt import sip +from qutebrowser.qt import core, sip -class ExternalEditor(QObject): +class ExternalEditor(core.QObject): """Class to simplify editing a text in an external editor. @@ -51,15 +48,15 @@ class ExternalEditor(QObject): editing_finished: The editor process was closed. """ - file_updated = pyqtSignal(str) - editing_finished = pyqtSignal() + file_updated = core.pyqtSignal(str) + editing_finished = core.pyqtSignal() def __init__(self, parent=None, watch=False): super().__init__(parent) self._filename = None self._proc = None self._remove_file = None - self._watcher = QFileSystemWatcher(parent=self) if watch else None + self._watcher = core.QFileSystemWatcher(parent=self) if watch else None self._content = None def _cleanup(self, *, successful): @@ -94,7 +91,7 @@ class ExternalEditor(QObject): message.info(f"Keeping file {self._filename} as the editor process exited " "abnormally") - @pyqtSlot(int, QProcess.ExitStatus) + @core.pyqtSlot(int, core.QProcess.ExitStatus) def _on_proc_closed(self, _exitcode, exitstatus): """Write the editor text into the form field and clean up tempfile. @@ -105,7 +102,7 @@ class ExternalEditor(QObject): return log.procs.debug("Editor closed") - if exitstatus != QProcess.ExitStatus.NormalExit: + if exitstatus != core.QProcess.ExitStatus.NormalExit: # No error/cleanup here, since we already handle this in # on_proc_error. return @@ -116,7 +113,7 @@ class ExternalEditor(QObject): self.editing_finished.emit() self._cleanup(successful=self._proc.outcome.was_successful()) - @pyqtSlot(QProcess.ProcessError) + @core.pyqtSlot(core.QProcess.ProcessError) def _on_proc_error(self, _err): self._cleanup(successful=False) @@ -164,7 +161,7 @@ class ExternalEditor(QObject): fobj.write(text) return fobj.name - @pyqtSlot(str) + @core.pyqtSlot(str) def _on_file_changed(self, path): try: with open(path, 'r', encoding=config.val.editor.encoding) as f: |