add cpu module with /proc/stat collector, visible grid cells, dark background, and fullscreen dashboard
This commit is contained in:
parent
5aabc1f7ef
commit
499df2846c
6 changed files with 190 additions and 3 deletions
|
|
@ -91,10 +91,27 @@ func _build_cells() -> void:
|
|||
var cell := PanelContainer.new()
|
||||
cell.name = "Cell_%d_%d" % [col, row]
|
||||
cell.mouse_filter = Control.MOUSE_FILTER_PASS
|
||||
_style_cell(cell)
|
||||
add_child(cell)
|
||||
_cells[row].append(cell)
|
||||
|
||||
|
||||
func _style_cell(cell: PanelContainer) -> void:
|
||||
var style := StyleBoxFlat.new()
|
||||
style.bg_color = Color(0.14, 0.14, 0.18, 1.0)
|
||||
style.border_width_left = 1
|
||||
style.border_width_top = 1
|
||||
style.border_width_right = 1
|
||||
style.border_width_bottom = 1
|
||||
style.border_color = Color(0.25, 0.25, 0.35, 1.0)
|
||||
style.corner_radius_top_left = 6
|
||||
style.corner_radius_top_right = 6
|
||||
style.corner_radius_bottom_right = 6
|
||||
style.corner_radius_bottom_left = 6
|
||||
cell.add_theme_stylebox_override("panel", style)
|
||||
cell.add_theme_stylebox_override("panel_focused", style)
|
||||
|
||||
|
||||
func _teardown_cells() -> void:
|
||||
for child in get_children():
|
||||
remove_child(child)
|
||||
|
|
@ -138,8 +155,8 @@ func _save_modules() -> void:
|
|||
|
||||
func _restore_modules() -> void:
|
||||
for key in _module_positions:
|
||||
var parts := key.split(",")
|
||||
var col := int(parts[0])
|
||||
var parts: PackedStringArray = key.split(",")
|
||||
var col: int = int(parts[0])
|
||||
var row := int(parts[1])
|
||||
var module: Control = _module_positions[key]
|
||||
|
||||
|
|
@ -149,7 +166,7 @@ func _restore_modules() -> void:
|
|||
# Place in the last available cell if original position no longer exists
|
||||
if _cells.size() > 0 and _cells[0].size() > 0:
|
||||
var last_row := _cells.size() - 1
|
||||
var last_col := _cells[last_row].size() - 1
|
||||
var last_col: int = _cells[last_row].size() - 1
|
||||
_set_cell_child(_cells[last_row][last_col], module)
|
||||
else:
|
||||
module.queue_free()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue