63 lines
1.5 KiB
Python
63 lines
1.5 KiB
Python
"""
|
|
Static resources and assets for the Cluster4NPU application.
|
|
|
|
This module manages static resources including icons, images, stylesheets,
|
|
and other assets used throughout the application.
|
|
|
|
Available Resources:
|
|
- icons/: Application icons and graphics
|
|
- styles/: Additional stylesheet files
|
|
- assets/: Other static resources
|
|
|
|
Usage:
|
|
from cluster4npu_ui.resources import get_icon_path, get_style_path
|
|
|
|
icon_path = get_icon_path('node_model.png')
|
|
style_path = get_style_path('dark_theme.qss')
|
|
"""
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
def get_resource_path(resource_name: str) -> str:
|
|
"""
|
|
Get the full path to a resource file.
|
|
|
|
Args:
|
|
resource_name: Name of the resource file
|
|
|
|
Returns:
|
|
Full path to the resource file
|
|
"""
|
|
resources_dir = Path(__file__).parent
|
|
return str(resources_dir / resource_name)
|
|
|
|
def get_icon_path(icon_name: str) -> str:
|
|
"""
|
|
Get the full path to an icon file.
|
|
|
|
Args:
|
|
icon_name: Name of the icon file
|
|
|
|
Returns:
|
|
Full path to the icon file
|
|
"""
|
|
return get_resource_path(f"icons/{icon_name}")
|
|
|
|
def get_style_path(style_name: str) -> str:
|
|
"""
|
|
Get the full path to a stylesheet file.
|
|
|
|
Args:
|
|
style_name: Name of the stylesheet file
|
|
|
|
Returns:
|
|
Full path to the stylesheet file
|
|
"""
|
|
return get_resource_path(f"styles/{style_name}")
|
|
|
|
__all__ = [
|
|
"get_resource_path",
|
|
"get_icon_path",
|
|
"get_style_path"
|
|
] |