Use a single function for resetting theme designer changes

main
Bob Mottram 2021-12-06 10:15:49 +00:00
parent 85136b7963
commit f54112a15c
2 changed files with 8 additions and 7 deletions

View File

@ -2204,6 +2204,7 @@ class PubServer(BaseHTTPRequestHandler):
allowLocalNetworkAccess,
systemLanguage)
# set boolean values
if 'rss-icon-at-top' in themeDesignerParams:
if themeDesignerParams['rss-icon-at-top'].lower() == 'true':
self.server.rssIconAtTop = True

View File

@ -516,6 +516,10 @@ def resetThemeDesignerSettings(baseDir: str, themeName: str, domain: str,
setTheme(baseDir, themeName, domain,
allowLocalNetworkAccess, systemLanguage)
customIconsDir = baseDir + '/accounts/customIcons'
if os.path.isdir(customIconsDir):
rmtree(customIconsDir, ignore_errors=False, onerror=None)
def _readVariablesFile(baseDir: str, themeName: str,
variablesFile: str,
@ -826,13 +830,9 @@ def setTheme(baseDir: str, name: str, domain: str,
# if the theme has changed then remove any custom settings
if prevThemeName != name:
customVariablesFile = baseDir + '/accounts/theme.json'
if os.path.isfile(customVariablesFile):
print('Removing theme designer settings')
try:
os.remove(customVariablesFile)
except OSError:
print('EX: removing theme designer settings')
resetThemeDesignerSettings(baseDir, name, domain,
allowLocalNetworkAccess,
systemLanguage)
_removeTheme(baseDir)