simvx.editor.panels.code_editor¶
Code Editor Panel – Multi-tab code editor for the SimVX editor.
Integrates CodeTextEdit widgets within a TabContainer, supporting file open/save, modification tracking, and tab management.
Module Contents¶
Classes¶
Multi-tab code editor panel for the SimVX editor. |
Data¶
API¶
- simvx.editor.panels.code_editor.__all__¶
[‘CodeEditorPanel’]
- class simvx.editor.panels.code_editor.CodeEditorPanel(**kwargs)¶
Bases:
simvx.core.ControlMulti-tab code editor panel for the SimVX editor.
Provides file-based code editing with syntax highlighting, modification tracking, and tab management.
Features: - Open files in new tabs (or switch to existing tab) - Save files with modification indicator (*) in tab title - Syntax-highlighted Python editing via CodeTextEdit - File opened/saved signals for integration with file browser
Example: panel = CodeEditorPanel() panel.open_file(“/path/to/script.py”) panel.save_file() # saves the active tab
Initialization
- open_file(path: str)¶
Open a file in a new tab, or switch to it if already open.
Args: path: Absolute or relative path to the file to open.
- save_file(path: str | None = None)¶
Save the current tab’s content to disk.
Args: path: If provided, save to this path (Save As). Otherwise, save to the file’s original path.
- close_file(path: str | None = None)¶
Close a tab. If path is None, close the active tab.
Args: path: Path of the file to close. None for the active tab.
- property current_file: str | None¶
Return the path of the currently active file, or None.
- property is_modified: bool¶
Check if the current file has unsaved changes.
- get_open_files() list[str]¶
Return list of all open file paths.
- draw(renderer)¶
- size_x¶
‘Property(…)’
- size_y¶
‘Property(…)’
- property size: simvx.core.math.types.Vec2¶
- get_theme() simvx.core.ui.core.Theme¶
- get_rect() tuple[float, float, float, float]¶
- get_global_rect() tuple[float, float, float, float]¶
- is_point_inside(point) bool¶
- set_anchor_preset(preset: simvx.core.ui.core.AnchorPreset)¶
- set_focus()¶
- grab_focus()¶
- release_focus()¶
- has_focus() bool¶
- focus_next_control()¶
- focus_previous_control()¶
- grab_mouse()¶
- release_mouse()¶
- set_drag_preview(control: simvx.core.ui.core.Control)¶
- draw_popup(renderer)¶
- is_popup_point_inside(point) bool¶
- popup_input(event)¶
- dismiss_popup()¶
- z_index¶
‘Property(…)’
- z_as_relative¶
‘Property(…)’
- property absolute_z_index: int¶
- property rotation_rad: float¶
- property global_position: simvx.core.math.types.Vec2¶
- property global_rotation: float¶
- property global_rotation_rad: float¶
- property global_scale: simvx.core.math.types.Vec2¶
- property forward: simvx.core.math.types.Vec2¶
- property right: simvx.core.math.types.Vec2¶
- translate(offset: tuple[float, float] | numpy.ndarray)¶
- rotate_deg(degrees: float)¶
- look_at(target: tuple[float, float] | numpy.ndarray)¶
- transform_points(points: list[simvx.core.math.types.Vec2]) list[simvx.core.math.types.Vec2]¶
- draw_polygon(renderer, points: list[simvx.core.math.types.Vec2], closed=True, color=None)¶
- wrap_screen(margin: float = 20)¶
- script_error_raised¶
‘Signal(…)’
- classmethod __init_subclass__(**kwargs)¶
- property name: str¶
- reset_error() None¶
- add_child(node: simvx.core.engine.Node) simvx.core.engine.Node¶
- remove_child(node: simvx.core.engine.Node)¶
- reparent(new_parent: simvx.core.engine.Node)¶
- get_node(path: str) simvx.core.engine.Node¶
- find(node_type: type) simvx.core.engine.Node | None¶
- property path: str¶
- add_to_group(group: str)¶
- remove_from_group(group: str)¶
- is_in_group(group: str) bool¶
- ready() None¶
- enter_tree() None¶
- exit_tree() None¶
- process(dt: float) None¶
- physics_process(dt: float) None¶
- input_event(event: simvx.core.engine.InputEvent) None¶
- input(event: simvx.core.engine.TreeInputEvent) None¶
- unhandled_input(event: simvx.core.engine.TreeInputEvent) None¶
- start_coroutine(gen: simvx.core.engine.Coroutine) simvx.core.engine.CoroutineHandle¶
- stop_coroutine(gen_or_handle)¶
- destroy()¶
- queue_free¶
None
- property tree: simvx.core.engine.SceneTree¶
- get_tree() simvx.core.engine.SceneTree¶
- __getitem__(key: str)¶
- classmethod get_properties() dict[str, simvx.core.engine.Property]¶
- get_settings¶
None
- __repr__()¶