Add class retrieve metadata from importlib

Signed-off-by: Björn Bidar <bjorn.bidar@thaodan.de>
This commit is contained in:
Björn Bidar 2023-10-15 01:37:10 +03:00 committed by Roman
parent 4fb3f27d3d
commit b539759298
3 changed files with 21 additions and 1 deletions

View File

@ -46,6 +46,7 @@ The `waypaper` package is available thanks to Basil Keeler.
- `swww` or `swaybg` or `feh` or `wallutils`
- gobject python library (it might be called `python-gobject` or `python3-gi` or `python3-gobject` in your package manager.)
- `python-importlib_metadata`
## Usage

View File

@ -22,7 +22,7 @@ setuptools.setup(
"waypaper = waypaper.__main__:run"
]
},
install_requires=["PyGObject"],
install_requires=["PyGObject", "importlib_metadata"],
version=version,
python_requires='>3.9',
classifiers=[

19
waypaper/aboutdata.py Normal file
View File

@ -0,0 +1,19 @@
"""Module to store acces application metadata"""
from importlib_metadata import metadata
class AboutData():
"""This class stores application about data in a central place"""
def __init__(self):
self.__app_metadata = metadata(__package__)
def applicationName(self):
return self.__app_metadata['Name']
def applicationSummary(self):
return self.__app_metadata['Summary']
def applicationLogo(self):
return str(self.__app_metadata['Name'])+".svg"
def applicationVersion(self):
return self.__app_metadata['Version'] # pylint: disable=no-member
def homePage(self):
return self.__app_metadata['Home-page']
def Author(self):
return self.__app_metadata['Author']