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
|
|
@ -1,70 +0,0 @@
|
|||
extends ModuleBase
|
||||
class_name CpuModule
|
||||
|
||||
|
||||
@onready var title_label: Label = %Title
|
||||
@onready var label: Label = %Label
|
||||
@onready var vial_fill: ColorRect = %VialFill
|
||||
|
||||
var _collector: CpuCollector
|
||||
var _displayed_fill: float = 0.0
|
||||
var _fill_tween: Tween
|
||||
|
||||
|
||||
func initialize() -> void:
|
||||
module_title = "CPU"
|
||||
_collector = CpuCollector.new()
|
||||
_setup_shader()
|
||||
_style()
|
||||
|
||||
|
||||
func refresh(data: Dictionary) -> void:
|
||||
var usage: float = _collector.collect()
|
||||
if usage < 0.0:
|
||||
return
|
||||
|
||||
var pct: int = roundi(usage)
|
||||
label.text = "%d%%" % pct
|
||||
|
||||
# Smoothly tween the vial fill
|
||||
var target: float = usage / 100.0
|
||||
if _fill_tween and _fill_tween.is_valid():
|
||||
_fill_tween.kill()
|
||||
_fill_tween = create_tween()
|
||||
_fill_tween.tween_method(_set_fill, _displayed_fill, target, 0.4).set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_CUBIC)
|
||||
|
||||
|
||||
func _set_fill(value: float) -> void:
|
||||
_displayed_fill = value
|
||||
var mat := vial_fill.material as ShaderMaterial
|
||||
if mat:
|
||||
mat.set_shader_parameter("fill", value)
|
||||
|
||||
|
||||
func _setup_shader() -> void:
|
||||
var mat := ShaderMaterial.new()
|
||||
mat.shader = preload("res://shaders/vial_fill.gdshader")
|
||||
mat.set_shader_parameter("liquid_color", Color(0.2, 0.5, 0.8, 1.0))
|
||||
mat.set_shader_parameter("fill", 0.0)
|
||||
mat.set_shader_parameter("noise_tex", load("res://assets/textures/noise_100.png"))
|
||||
vial_fill.material = mat
|
||||
|
||||
|
||||
func _style() -> void:
|
||||
# Transparent root panel — the VialFill shader provides the background
|
||||
var panel := StyleBoxFlat.new()
|
||||
panel.bg_color = Color.TRANSPARENT
|
||||
panel.corner_radius_top_left = 12
|
||||
panel.corner_radius_top_right = 12
|
||||
panel.corner_radius_bottom_right = 12
|
||||
panel.corner_radius_bottom_left = 12
|
||||
add_theme_stylebox_override("panel", panel)
|
||||
add_theme_stylebox_override("panel_focused", panel)
|
||||
|
||||
title_label.add_theme_color_override("font_color", Color(0.7, 0.7, 0.8, 1.0))
|
||||
title_label.add_theme_constant_override("outline_size", 2)
|
||||
title_label.add_theme_color_override("font_outline_color", Color(0.0, 0.0, 0.0, 0.5))
|
||||
label.add_theme_color_override("font_color", Color(0.9, 0.9, 1.0, 1.0))
|
||||
label.add_theme_font_size_override("font_size", 48)
|
||||
label.add_theme_constant_override("outline_size", 3)
|
||||
label.add_theme_color_override("font_outline_color", Color(0.0, 0.0, 0.0, 0.7))
|
||||
Loading…
Add table
Add a link
Reference in a new issue