add plugin system with plugin/layout managers
- plugin_manager: scans res://plugins/*/plugin.cfg, loads tile definitions - plugin_tile: new base class for plugin tiles, extends ModuleBase - layout_manager: save/restore tile grid positions per named layout - migrate existing cpu/memory/testing tiles into system_monitor plugin - add module_resized signal to DashboardGrid for auto-save - dashboard reads from PluginManager + LayoutManager instead of hardcoded paths - project.godot registers PluginManager and LayoutManager autoloads - AGENTS.md updated with new structure and conventions
This commit is contained in:
parent
63af41ea61
commit
f43676e46c
19 changed files with 528 additions and 39 deletions
|
|
@ -5,6 +5,7 @@ class_name DashboardGrid
|
|||
|
||||
signal module_placed(module: Control, col: int, row: int)
|
||||
signal module_removed(module: Control)
|
||||
signal module_resized(module: Control, col: int, row: int, w: int, h: int)
|
||||
|
||||
@export var cell_min_size: Vector2 = Vector2(300, 240)
|
||||
@export var cell_spacing: float = 8.0
|
||||
|
|
@ -161,6 +162,12 @@ func remove_module(module: Control) -> void:
|
|||
_layout_cells()
|
||||
|
||||
|
||||
func get_module_at(col: int, row: int) -> Control:
|
||||
if not _is_valid_cell(col, row):
|
||||
return null
|
||||
return _grid[row][col] as Control
|
||||
|
||||
|
||||
func get_grid_size() -> Vector2i:
|
||||
return Vector2i(columns, rows)
|
||||
|
||||
|
|
@ -421,6 +428,7 @@ func _end_resize(_mouse_pos: Vector2) -> void:
|
|||
_set_module_grid_data(_resize_module, _resize_origin_col, _resize_origin_row, _resize_origin_w, _resize_origin_h)
|
||||
_occupy_cells(_resize_module, _resize_origin_col, _resize_origin_row, _resize_origin_w, _resize_origin_h)
|
||||
_layout_cells()
|
||||
module_resized.emit(_resize_module, _resize_origin_col, _resize_origin_row, _resize_origin_w, _resize_origin_h)
|
||||
|
||||
_is_resizing = false
|
||||
_resize_module = null
|
||||
|
|
|
|||
23
scripts/plugin_tile.gd
Normal file
23
scripts/plugin_tile.gd
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
extends ModuleBase
|
||||
class_name PluginTile
|
||||
## Base class for all plugin tiles.
|
||||
##
|
||||
## Extends ModuleBase with plugin-aware metadata so the system can
|
||||
## correlate tile instances with their definitions and layouts.
|
||||
|
||||
|
||||
var tile_id: String = ""
|
||||
var tile_config: Dictionary = {}
|
||||
|
||||
|
||||
## Called by PluginManager.instantiate_tile() to tag this instance.
|
||||
func set_tile_id(value: String) -> void:
|
||||
tile_id = value
|
||||
|
||||
|
||||
## Called by PluginManager.instantiate_tile() to pass the tile definition.
|
||||
func set_tile_config(config: Dictionary) -> void:
|
||||
tile_config = config
|
||||
# Store in meta so grid/layout can read it on any Control
|
||||
set_meta("tile_id", tile_id)
|
||||
set_meta("tile_config", config)
|
||||
Loading…
Add table
Add a link
Reference in a new issue