Source code for simvx.editor.panels.file_browser

"""Editor File Browser -- project file navigation with drag-to-scene."""


from __future__ import annotations

from pathlib import Path

from simvx.core.ui.file_browser import _EXT_ICONS, _HIDDEN_DIRS, _icon_for_path  # noqa: F401 (re-exported for tests)
from simvx.core.ui.file_browser import FileBrowserPanel as _BaseFileBrowserPanel

__all__ = ["FileBrowserPanel"]


[docs] class FileBrowserPanel(_BaseFileBrowserPanel): """Editor file browser with drag-to-scene and scene file actions.""" def __init__(self, editor_state=None, **kwargs): super().__init__(title="File Browser", show_icons=True, drag_enabled=True, show_scene_actions=True, **kwargs) self.name = "FileBrowser" self.state = editor_state # Connect file_activated to open scenes in editor self.file_activated.connect(self._on_file_activated) def _on_file_activated(self, path: str): """Open .json scene files in the editor.""" if self.state and Path(path).suffix.lower() == ".json": self.state.open_scene(Path(path))