Source code for simvx.core.file_state

"""File lifecycle signals shared between Editor and IDE state objects."""

import logging

from .descriptors import Signal

log = logging.getLogger(__name__)

[docs] class FileStateMixin: """Mixin providing file lifecycle signals for editor/IDE state objects. Both ``simvx.editor.State`` and ``simvx.ide.State`` inherit from this to share the same signal interface. When the IDE is embedded in the editor, ``simvx.ide.State`` can accept external Signal instances to share with ``simvx.editor.State``, eliminating the need for manual signal forwarding. """ def _init_file_signals( self, *, file_opened: Signal | None = None, file_closed: Signal | None = None, file_saved: Signal | None = None, active_file_changed: Signal | None = None, ): """Initialize file lifecycle signals, optionally sharing external instances.""" self.file_opened = file_opened or Signal() self.file_closed = file_closed or Signal() self.file_saved = file_saved or Signal() self.active_file_changed = active_file_changed or Signal()