mirror of
https://github.com/anufrievroman/waypaper.git
synced 2024-08-16 19:50:46 +03:00
Rewrite main to use AboutData, drop arguments
This commit is contained in:
parent
eba4cd596a
commit
0b65600489
7
setup.py
7
setup.py
@ -1,13 +1,8 @@
|
||||
from pathlib import Path
|
||||
import re
|
||||
import setuptools
|
||||
|
||||
setup_dir = Path(__file__).resolve().parent
|
||||
|
||||
version = re.search( r'__version__ = "(.*)"', Path(setup_dir, 'waypaper/__main__.py').open().read())
|
||||
if version is None:
|
||||
raise SystemExit("Could not determine version to use")
|
||||
version = version.group(1)
|
||||
setuptools.setup(
|
||||
name='waypaper',
|
||||
author='Roman Anufriev',
|
||||
@ -23,7 +18,7 @@ setuptools.setup(
|
||||
]
|
||||
},
|
||||
install_requires=["PyGObject", "importlib_metadata", "platformdirs"],
|
||||
version=version,
|
||||
version='0.0.2',
|
||||
python_requires='>3.9',
|
||||
classifiers=[
|
||||
"Development Status :: 4 - Beta",
|
||||
|
@ -1,16 +1,40 @@
|
||||
"""Main module that runs the program and either runs GUI or just changer wallpaper"""
|
||||
|
||||
import time
|
||||
import argparse
|
||||
|
||||
|
||||
from waypaper.config import cf
|
||||
from waypaper.arguments import args
|
||||
from waypaper.config import Config
|
||||
from waypaper.app import App
|
||||
from waypaper.changer import change_wallpaper
|
||||
from waypaper.common import get_random_file
|
||||
from waypaper.aboutdata import AboutData
|
||||
from waypaper.options import FILL_OPTIONS, BACKEND_OPTIONS
|
||||
|
||||
aboutData = AboutData()
|
||||
|
||||
cf = Config()
|
||||
if cf.lang == "de":
|
||||
from waypaper.translation_de import *
|
||||
elif cf.lang == "fr":
|
||||
from waypaper.translation_fr import *
|
||||
elif cf.lang == "ru":
|
||||
from waypaper.translation_ru import *
|
||||
elif cf.lang == "pl":
|
||||
from waypaper.translation_pl import *
|
||||
else:
|
||||
from waypaper.translation_en import *
|
||||
|
||||
|
||||
__version__ = "2.0.2"
|
||||
parser = argparse.ArgumentParser(prog = aboutData.applicationName(), description = MSG_DESC,
|
||||
epilog = MSG_INFO)
|
||||
parser.add_argument("-v", "--version", help=MSG_ARG_HELP, action="store_true")
|
||||
parser.add_argument("--restore", help=MSG_ARG_REST, action="store_true")
|
||||
parser.add_argument("--random", help=MSG_ARG_RAND, action="store_true")
|
||||
parser.add_argument("--fill", help=MSG_ARG_FILL, action="store_true")
|
||||
parser.add_argument("--backend", help=MSG_ARG_BACK, choices=BACKEND_OPTIONS)
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
|
||||
def run():
|
||||
@ -29,12 +53,12 @@ def run():
|
||||
continue
|
||||
change_wallpaper(wallpaper, cf.fill_option, cf.color, cf.backend, monitor)
|
||||
time.sleep(0.1)
|
||||
exit()
|
||||
exit(0)
|
||||
|
||||
# Print the version and quit:
|
||||
if args.version:
|
||||
print(f"waypaper v.{__version__}")
|
||||
exit()
|
||||
print(f"{aboutData.applicationName()} v.{aboutData.applicationVersion()}")
|
||||
exit(0)
|
||||
|
||||
# Start GUI:
|
||||
app = App()
|
||||
|
@ -1,28 +0,0 @@
|
||||
"""Module that parses user arguments and returns them in args object"""
|
||||
|
||||
import argparse
|
||||
|
||||
from waypaper.options import FILL_OPTIONS, BACKEND_OPTIONS
|
||||
from waypaper.config import cf
|
||||
|
||||
if cf.lang == "de":
|
||||
from waypaper.translation_de import *
|
||||
elif cf.lang == "fr":
|
||||
from waypaper.translation_fr import *
|
||||
elif cf.lang == "ru":
|
||||
from waypaper.translation_ru import *
|
||||
elif cf.lang == "pl":
|
||||
from waypaper.translation_pl import *
|
||||
elif cf.lang == "zh":
|
||||
from waypaper.translation_zh import *
|
||||
else:
|
||||
from waypaper.translation_en import *
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser(prog = "waypaper", description = MSG_DESC, epilog = MSG_INFO)
|
||||
parser.add_argument("-v", "--version", help=MSG_ARG_HELP, action="store_true")
|
||||
parser.add_argument("--restore", help=MSG_ARG_REST, action="store_true")
|
||||
parser.add_argument("--random", help=MSG_ARG_RAND, action="store_true")
|
||||
parser.add_argument("--fill", help=MSG_ARG_FILL, action="store_true")
|
||||
parser.add_argument("--backend", help=MSG_ARG_BACK, choices=BACKEND_OPTIONS)
|
||||
args = parser.parse_args()
|
Loading…
Reference in New Issue
Block a user