diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index fdd552b32..55af2c50a 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1622,8 +1622,8 @@ class CommandDispatcher: caret_position = elem.caret_position() ed = editor.ExternalEditor(self._tabbed_browser) - ed.editing_finished.connect(functools.partial( - self.on_editing_finished, elem)) + ed.file_updated.connect(functools.partial( + self.on_file_updated, elem)) ed.edit(text, caret_position) @cmdutils.register(instance='command-dispatcher', scope='window') @@ -1636,7 +1636,7 @@ class CommandDispatcher: tab = self._current_widget() tab.elements.find_focused(self._open_editor_cb) - def on_editing_finished(self, elem, text): + 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. @@ -2146,7 +2146,7 @@ class CommandDispatcher: ed = editor.ExternalEditor(self._tabbed_browser) # Passthrough for openurl args (e.g. -t, -b, -w) - ed.editing_finished.connect(functools.partial( + ed.file_updated.connect(functools.partial( self._open_if_changed, old_url=old_url, bg=bg, tab=tab, window=window, private=private, related=related)) diff --git a/qutebrowser/config/configcommands.py b/qutebrowser/config/configcommands.py index 93a1f7ce0..faf31d718 100644 --- a/qutebrowser/config/configcommands.py +++ b/qutebrowser/config/configcommands.py @@ -253,7 +253,7 @@ class ConfigCommands: Args: no_source: Don't re-source the config file after editing. """ - def on_editing_finished(): + def on_file_updated(): """Source the new config when editing finished. This can't use cmdexc.CommandError as it's run async. @@ -265,7 +265,7 @@ class ConfigCommands: ed = editor.ExternalEditor(self._config) if not no_source: - ed.editing_finished.connect(on_editing_finished) + ed.file_updated.connect(on_file_updated) filename = os.path.join(standarddir.config(), 'config.py') ed.edit_file(filename) diff --git a/qutebrowser/mainwindow/statusbar/command.py b/qutebrowser/mainwindow/statusbar/command.py index 26ba802c0..6689d3bf5 100644 --- a/qutebrowser/mainwindow/statusbar/command.py +++ b/qutebrowser/mainwindow/statusbar/command.py @@ -193,7 +193,7 @@ class Command(misc.MinimalLineEditMixin, misc.CommandLineEdit): if run: self.command_accept() - ed.editing_finished.connect(callback) + ed.file_updated.connect(callback) ed.edit(self.text()) @pyqtSlot(usertypes.KeyMode) diff --git a/qutebrowser/misc/editor.py b/qutebrowser/misc/editor.py index 53067ca2c..f300bc2e1 100644 --- a/qutebrowser/misc/editor.py +++ b/qutebrowser/misc/editor.py @@ -43,7 +43,7 @@ class ExternalEditor(QObject): _watcher: A QFileSystemWatcher to watch the edited file for changes. """ - editing_finished = pyqtSignal(str) + file_updated = pyqtSignal(str) def __init__(self, parent=None): super().__init__(parent) @@ -128,7 +128,7 @@ class ExternalEditor(QObject): message.error("Failed to read back edited file: {}".format(e)) return log.procs.debug("Read back: {}".format(text)) - self.editing_finished.emit(text) + self.file_updated.emit(text) def edit_file(self, filename): """Edit the file with the given filename.""" diff --git a/tests/unit/misc/test_editor.py b/tests/unit/misc/test_editor.py index 55425a1c4..b0ddbff25 100644 --- a/tests/unit/misc/test_editor.py +++ b/tests/unit/misc/test_editor.py @@ -173,7 +173,7 @@ def test_modify(qtbot, editor, initial_text, edited_text): with open(editor._filename, 'r', encoding='utf-8') as f: assert f.read() == initial_text - with qtbot.wait_signal(editor.editing_finished) as blocker: + with qtbot.wait_signal(editor.file_updated) as blocker: with open(editor._filename, 'w', encoding='utf-8') as f: f.write(edited_text)