Rename editing_finished to file_updated.
ExternalEditor now fires an event on save rather than on exit, so the signal name should be updated to match the behavior.
This commit is contained in:
parent
23eb6a6c53
commit
a940de3717
@ -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))
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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."""
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user