YouTubeDownloader v1.1.2
YouTube content downloader
Loading...
Searching...
No Matches
app_data.py
Go to the documentation of this file.
1"""!
2********************************************************************************
3@file app_data.py
4@brief Data module (constants and functions related to path and ini file)
5********************************************************************************
6"""
7
8import sys
9import os
10import enum
11import logging
12
13from Source.version import __title__
14
15log = logging.getLogger(__title__)
16
17
18def resource_path(s_relative_path: str) -> str:
19 """!
20 @brief Returns the absolute path to a resource given by a relative path depending on the environment (EXE or Python)
21 @param s_relative_path : the relative path to a file or directory
22 @return absolute path to the resource
23 """
24 if hasattr(sys, "_MEIPASS"):
25 # PyInstaller creates a temp folder and stores path in _MEIPASS
26 s_base_path = sys._MEIPASS
27 else:
28 s_base_path = os.path.abspath("../")
29 s_resource_path = os.path.join(s_base_path, s_relative_path)
30 log.debug("Resource Path (relative %s): %s", s_relative_path, s_resource_path)
31 return s_resource_path
32
33
34# Files and Paths
35ICON_APP_PATH = "Resources/app.ico"
36ICON_APP_FAVICON_PATH = "Resources/favicon.ico"
37ICON_APP = resource_path(ICON_APP_PATH)
38
39
40class ETheme(str, enum.Enum):
41 """!
42 @brief Available application themes
43 """
44 LIGHT = "light"
45 DARK = "dark"
46 SYSTEM = "system"
Available application themes.
Definition app_data.py:40
str resource_path(str s_relative_path)
Returns the absolute path to a resource given by a relative path depending on the environment (EXE or...
Definition app_data.py:18