main
Bob Mottram 2020-05-28 22:39:41 +01:00
parent ce5d235131
commit 69d3521647
1 changed files with 37 additions and 28 deletions

View File

@ -338,20 +338,12 @@ def setThemeLight(baseDir: str):
setThemeFromDict(baseDir, 'light', themeParams)
def setTheme(baseDir: str, name: str) -> bool:
result = False
def setThemeImages(baseDir: str, name: str) -> None:
"""Changes the profile background image
and banner to the defaults
"""
themeNameLower = name.lower()
prevThemeName = getTheme(baseDir)
themes = getThemesList()
for themeName in themes:
themeNameLower = themeName.lower()
if name == themeNameLower:
globals()['setTheme' + themeName](baseDir)
if prevThemeName:
if prevThemeName.lower() != themeNameLower:
# change the banner and profile image
# to the default for the theme
if themeNameLower == 'default':
profileImageFilename = \
baseDir + '/img/image.png'
@ -380,6 +372,23 @@ def setTheme(baseDir: str, name: str) -> bool:
accountDir + '/banner.png')
except BaseException:
pass
def setTheme(baseDir: str, name: str) -> bool:
result = False
prevThemeName = getTheme(baseDir)
themes = getThemesList()
for themeName in themes:
themeNameLower = themeName.lower()
if name == themeNameLower:
globals()['setTheme' + themeName](baseDir)
if prevThemeName:
if prevThemeName.lower() != themeNameLower:
# change the banner and profile image
# to the default for the theme
setThemeImages(baseDir, name)
result = True
if not result: