refactor(types): auto -> None sweep across entire codebase
Applied 236 return type annotations to functions with no return values across 100+ files (core modules, tests, scripts, simulations). Added Phase 4 to python_style_refactor track for remaining 597 items (untyped params, vars, and functions with return values). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
12
theme.py
12
theme.py
@@ -1,4 +1,4 @@
|
||||
# theme.py
|
||||
# theme.py
|
||||
"""
|
||||
Theming support for manual_slop GUI.
|
||||
|
||||
@@ -289,7 +289,7 @@ def get_palette_colours(name: str) -> dict:
|
||||
"""Return a copy of the colour dict for the named palette."""
|
||||
return dict(_PALETTES.get(name, {}))
|
||||
|
||||
def apply(palette_name: str, overrides: dict | None = None):
|
||||
def apply(palette_name: str, overrides: dict | None = None) -> None:
|
||||
"""
|
||||
Build a global DPG theme from the named palette plus optional per-colour
|
||||
overrides, and bind it as the default theme.
|
||||
@@ -332,7 +332,7 @@ def apply(palette_name: str, overrides: dict | None = None):
|
||||
dpg.bind_theme(t)
|
||||
_current_theme_tag = t
|
||||
|
||||
def apply_font(font_path: str, size: float = 14.0):
|
||||
def apply_font(font_path: str, size: float = 14.0) -> None:
|
||||
"""
|
||||
Load the TTF at font_path at the given point size and bind it globally.
|
||||
Safe to call multiple times. Uses a single persistent font_registry; only
|
||||
@@ -362,13 +362,13 @@ def apply_font(font_path: str, size: float = 14.0):
|
||||
_current_font_tag = font
|
||||
dpg.bind_font(font)
|
||||
|
||||
def set_scale(factor: float):
|
||||
def set_scale(factor: float) -> None:
|
||||
"""Set the global Dear PyGui font/UI scale factor."""
|
||||
global _current_scale
|
||||
_current_scale = factor
|
||||
dpg.set_global_font_scale(factor)
|
||||
|
||||
def save_to_config(config: dict):
|
||||
def save_to_config(config: dict) -> None:
|
||||
"""Persist theme settings into the config dict under [theme]."""
|
||||
config.setdefault("theme", {})
|
||||
config["theme"]["palette"] = _current_palette
|
||||
@@ -376,7 +376,7 @@ def save_to_config(config: dict):
|
||||
config["theme"]["font_size"] = _current_font_size
|
||||
config["theme"]["scale"] = _current_scale
|
||||
|
||||
def load_from_config(config: dict):
|
||||
def load_from_config(config: dict) -> None:
|
||||
"""Read [theme] from config and apply everything."""
|
||||
t = config.get("theme", {})
|
||||
palette = t.get("palette", "DPG Default")
|
||||
|
||||
Reference in New Issue
Block a user