1
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2026-03-05 00:12:49 +01:00

fix(developer widget): save before executing a scripts

This commit is contained in:
2026-01-07 15:13:48 +01:00
committed by Klaus Wakonig
parent f121d09baa
commit 1bb0f1a855

View File

@@ -311,6 +311,12 @@ class DeveloperWidget(DockAreaWidget):
widget = self.script_editor_tab.widget()
if not isinstance(widget, MonacoWidget):
return
if widget.modified:
# Save the file before execution if there are unsaved changes
self.monaco.save_file()
if widget.modified:
# If still modified, user likely cancelled save dialog
return
self.current_script_id = upload_script(self.client.connector, widget.get_text())
self.console.write(f'bec._run_script("{self.current_script_id}")')
print(f"Uploaded script with ID: {self.current_script_id}")