From f4df0e46546f7ef49b325e842bed1ad182563dde Mon Sep 17 00:00:00 2001 From: elwld Date: Sat, 13 Aug 2022 17:10:59 +0500 Subject: [PATCH] change config rules --- src/wallpyperFuncs.py | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/wallpyperFuncs.py b/src/wallpyperFuncs.py index b837210..c9a34f2 100644 --- a/src/wallpyperFuncs.py +++ b/src/wallpyperFuncs.py @@ -86,14 +86,16 @@ def setTheme(themeName = None, nightMode = False): theme = config[themeName]["night"] else: theme = config[themeName] - - if theme["type"] == "static": - if "random" in theme and theme["random"]: - setRandomWallpaper(theme["path"]) - else: - setWallpaper(theme["url"]) - elif theme["type"] == "dynamic": + dynamic = False + random = False + + 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():