mirror of
https://github.com/anufrievroman/waypaper.git
synced 2024-08-16 19:50:46 +03:00
Add class retrieve metadata from importlib
Signed-off-by: Björn Bidar <bjorn.bidar@thaodan.de>
This commit is contained in:
parent
4fb3f27d3d
commit
b539759298
@ -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
|
||||
|
||||
|
2
setup.py
2
setup.py
@ -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
19
waypaper/aboutdata.py
Normal 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']
|
Loading…
Reference in New Issue
Block a user