Source code for prsctrl_gui.resources
from importlib.resources import files, as_file
from os import path
from devctrl.resources import get_resource_path_from, load_icon, find_icon_path, ICON_LOAD_PATH, ICON_LOAD_PATH_DARK
[docs]
def get_resource_path_from(module: str, rel_path: str) -> str:
with as_file(files(module)) as file:
p = path.join(file, rel_path)
return p
[docs]
def get_resource_path(rel_path: str) -> str:
"""
Convenience function to get the path to a resource file from this packages resource directory
"""
return get_resource_path_from("prsctrl_gui.resources", rel_path)
ICON_LOAD_PATH.insert(0, get_resource_path("icons/iconpark"))
ICON_LOAD_PATH.insert(0, get_resource_path("icons"))
ICON_LOAD_PATH_DARK.insert(0, get_resource_path("icons-dark/iconpark"))
ICON_LOAD_PATH_DARK.insert(0, get_resource_path("icons-dark"))