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:
theme = config[themeName]
if theme["type"] == "static":
if "random" in theme and theme["random"]:
setRandomWallpaper(theme["path"])
else:
setWallpaper(theme["url"])
dynamic = False
random = False
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.reverse()
while len(delay) < 3:
@ -101,15 +103,9 @@ def setTheme(themeName = None, nightMode = False):
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():
globals()['threadIsAlive'] = True
global threadIsAlive
while threadIsAlive:
if random:
@ -117,9 +113,11 @@ def setTheme(themeName = None, nightMode = False):
else:
setNextWallpaper(theme["path"])
sleep(delay)
else:
printHelpInfo()
if random:
setRandomWallpaper(theme["path"])
else:
setWallpaper(theme["path"])
def getThemes():