change config rules

This commit is contained in:
elwld 2022-08-13 17:10:59 +05:00
parent 65236d5671
commit f4df0e4654

View File

@ -87,13 +87,15 @@ def setTheme(themeName = None, nightMode = False):
else: else:
theme = config[themeName] theme = config[themeName]
if theme["type"] == "static": dynamic = False
if "random" in theme and theme["random"]: random = False
setRandomWallpaper(theme["path"])
else:
setWallpaper(theme["url"])
elif theme["type"] == "dynamic": if "dynamic" in theme and theme["dynamic"]:
dynamic = True
if "random" in theme and theme["random"]:
random = True
if dynamic:
delay = list(map(int,theme["delay"].split(":"))) delay = list(map(int,theme["delay"].split(":")))
delay.reverse() delay.reverse()
while len(delay) < 3: while len(delay) < 3:
@ -101,15 +103,9 @@ def setTheme(themeName = None, nightMode = False):
delay = delay[0] + delay[1]*60 + delay[2]*3600 delay = delay[0] + delay[1]*60 + delay[2]*3600
random = False
if "random" in theme and theme["random"]:
random = True
if 'threadIsAlive' not in globals(): if 'threadIsAlive' not in globals():
globals()['threadIsAlive'] = True globals()['threadIsAlive'] = True
global threadIsAlive global threadIsAlive
while threadIsAlive: while threadIsAlive:
if random: if random:
@ -117,9 +113,11 @@ def setTheme(themeName = None, nightMode = False):
else: else:
setNextWallpaper(theme["path"]) setNextWallpaper(theme["path"])
sleep(delay) sleep(delay)
else: else:
printHelpInfo() if random:
setRandomWallpaper(theme["path"])
else:
setWallpaper(theme["path"])
def getThemes(): def getThemes():