fix(ui): Correct font asset loading paths for test workspace isolation
This commit is contained in:
23
src/gui_2.py
23
src/gui_2.py
@@ -2752,16 +2752,27 @@ class App:
|
||||
if self.perf_profiling_enabled: self.perf_monitor.end_component("_render_theme_panel")
|
||||
|
||||
def _load_fonts(self) -> None:
|
||||
# Set hello_imgui assets folder to the actual absolute path
|
||||
assets_dir = Path(__file__).parent.parent / "assets"
|
||||
if assets_dir.exists():
|
||||
hello_imgui.set_assets_folder(str(assets_dir.absolute()))
|
||||
|
||||
font_path, font_size = theme.get_font_loading_params()
|
||||
if font_path and Path(font_path).exists():
|
||||
self.main_font = hello_imgui.load_font_ttf_with_font_awesome_icons(font_path, font_size)
|
||||
|
||||
if font_path:
|
||||
# Just try loading it directly; hello_imgui will look in the assets folder
|
||||
try:
|
||||
self.main_font = hello_imgui.load_font_ttf_with_font_awesome_icons(font_path, font_size)
|
||||
except Exception as e:
|
||||
print(f"Failed to load main font {font_path}: {e}")
|
||||
self.main_font = None
|
||||
else:
|
||||
self.main_font = None
|
||||
|
||||
mono_path = Path("assets/fonts/MapleMono-Regular.ttf")
|
||||
if mono_path.exists():
|
||||
self.mono_font = hello_imgui.load_font(str(mono_path), font_size)
|
||||
else:
|
||||
try:
|
||||
self.mono_font = hello_imgui.load_font("fonts/MapleMono-Regular.ttf", font_size)
|
||||
except Exception as e:
|
||||
print(f"Failed to load mono font: {e}")
|
||||
self.mono_font = None
|
||||
|
||||
def _post_init(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user