From d6bd9b98184945737c202532da9e3a926d0f7525 Mon Sep 17 00:00:00 2001 From: CPD Date: Wed, 5 Mar 2025 14:35:46 +0100 Subject: [PATCH] Move into package --- cpdctrl_gui/resources/__init__.py | 8 ++++++++ {resources => cpdctrl_gui/resources}/logo.png | Bin {resources => cpdctrl_gui/resources}/logo.svg | 0 3 files changed, 8 insertions(+) create mode 100644 cpdctrl_gui/resources/__init__.py rename {resources => cpdctrl_gui/resources}/logo.png (100%) rename {resources => cpdctrl_gui/resources}/logo.svg (100%) diff --git a/cpdctrl_gui/resources/__init__.py b/cpdctrl_gui/resources/__init__.py new file mode 100644 index 0000000..ee5d36a --- /dev/null +++ b/cpdctrl_gui/resources/__init__.py @@ -0,0 +1,8 @@ +from importlib.resources import files, as_file +from os import path + +def get_resource_path(module: str, name: str) -> str: + with as_file(files(module)) as file: + p = path.join(file, name) + return p +# print(get_resource_path("resources", "about.md")) diff --git a/resources/logo.png b/cpdctrl_gui/resources/logo.png similarity index 100% rename from resources/logo.png rename to cpdctrl_gui/resources/logo.png diff --git a/resources/logo.svg b/cpdctrl_gui/resources/logo.svg similarity index 100% rename from resources/logo.svg rename to cpdctrl_gui/resources/logo.svg