This commit is contained in:
Florian Bruhin 2018-02-07 22:26:32 +01:00
parent abd56a5abd
commit 01ccbc679d
3 changed files with 5 additions and 8 deletions

View File

@ -1639,7 +1639,7 @@ class CommandDispatcher:
def on_file_updated(self, elem, text):
"""Write the editor text into the form field and clean up tempfile.
Callback for GUIProcess when the editor was closed.
Callback for GUIProcess when the edited text was updated.
Args:
elem: The WebElementWrapper which was modified.

View File

@ -51,10 +51,7 @@ class ExternalEditor(QObject):
self._filename = None
self._proc = None
self._remove_file = None
if watch:
self._watcher = QFileSystemWatcher(parent=self)
else:
self._watcher = None
self._watcher = QFileSystemWatcher(parent=self) if watch else None
self._content = None
def _cleanup(self):
@ -125,10 +122,10 @@ class ExternalEditor(QObject):
line, column = self._calc_line_and_column(text, caret_position)
self._start_editor(line=line, column=column)
@pyqtSlot(str)
def _on_file_changed(self, path):
encoding = config.val.editor.encoding
try:
with open(path, 'r', encoding=encoding) as f:
with open(path, 'r', encoding=config.val.editor.encoding) as f:
text = f.read()
except OSError as e:
# NOTE: Do not replace this with "raise CommandError" as it's

View File

@ -84,7 +84,7 @@ def set_up_editor_wait(quteproc, tmpdir, text):
import time
import signal
def handle(sig, frame):
def handle(sig, _frame):
with open(sys.argv[1], 'w', encoding='utf-8') as f:
f.write({text!r})
if sig == signal.SIGUSR1: