1
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-12-30 10:41:18 +01:00

feat(web console): add set_readonly method

This commit is contained in:
2025-07-24 17:20:20 +02:00
parent bbcefbb88f
commit fa06da1ed6

View File

@@ -261,6 +261,14 @@ class WebConsole(BECWidget, QWidget):
"document.querySelector('textarea.xterm-helper-textarea').dispatchEvent(new KeyboardEvent('keypress', {charCode: 3}))"
)
def set_readonly(self, readonly: bool):
"""
Set the web console to read-only mode.
"""
if not isinstance(readonly, bool):
raise ValueError("Readonly must be a boolean.")
self.setEnabled(not readonly)
def cleanup(self):
"""
Clean up the registry by removing any instances that are no longer valid.