mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
ce5d235131
commit
69d3521647
65
theme.py
65
theme.py
|
@ -338,6 +338,42 @@ def setThemeLight(baseDir: str):
|
||||||
setThemeFromDict(baseDir, 'light', themeParams)
|
setThemeFromDict(baseDir, 'light', themeParams)
|
||||||
|
|
||||||
|
|
||||||
|
def setThemeImages(baseDir: str, name: str) -> None:
|
||||||
|
"""Changes the profile background image
|
||||||
|
and banner to the defaults
|
||||||
|
"""
|
||||||
|
themeNameLower = name.lower()
|
||||||
|
|
||||||
|
if themeNameLower == 'default':
|
||||||
|
profileImageFilename = \
|
||||||
|
baseDir + '/img/image.png'
|
||||||
|
bannerFilename = \
|
||||||
|
baseDir + '/img/banner.png'
|
||||||
|
else:
|
||||||
|
profileImageFilename = \
|
||||||
|
baseDir + '/img/image_' + themeNameLower + '.png'
|
||||||
|
bannerFilename = \
|
||||||
|
baseDir + '/img/banner_' + themeNameLower + '.png'
|
||||||
|
if os.path.isfile(profileImageFilename) and \
|
||||||
|
os.path.isfile(bannerFilename):
|
||||||
|
for subdir, dirs, files in os.walk(baseDir +
|
||||||
|
'/accounts'):
|
||||||
|
for acct in dirs:
|
||||||
|
if '@' not in acct:
|
||||||
|
continue
|
||||||
|
if 'inbox@' in acct:
|
||||||
|
continue
|
||||||
|
accountDir = \
|
||||||
|
os.path.join(baseDir + '/accounts', acct)
|
||||||
|
try:
|
||||||
|
copyfile(profileImageFilename,
|
||||||
|
accountDir + '/image.png')
|
||||||
|
copyfile(bannerFilename,
|
||||||
|
accountDir + '/banner.png')
|
||||||
|
except BaseException:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def setTheme(baseDir: str, name: str) -> bool:
|
def setTheme(baseDir: str, name: str) -> bool:
|
||||||
result = False
|
result = False
|
||||||
|
|
||||||
|
@ -352,34 +388,7 @@ def setTheme(baseDir: str, name: str) -> bool:
|
||||||
if prevThemeName.lower() != themeNameLower:
|
if prevThemeName.lower() != themeNameLower:
|
||||||
# change the banner and profile image
|
# change the banner and profile image
|
||||||
# to the default for the theme
|
# to the default for the theme
|
||||||
if themeNameLower == 'default':
|
setThemeImages(baseDir, name)
|
||||||
profileImageFilename = \
|
|
||||||
baseDir + '/img/image.png'
|
|
||||||
bannerFilename = \
|
|
||||||
baseDir + '/img/banner.png'
|
|
||||||
else:
|
|
||||||
profileImageFilename = \
|
|
||||||
baseDir + '/img/image_' + themeNameLower + '.png'
|
|
||||||
bannerFilename = \
|
|
||||||
baseDir + '/img/banner_' + themeNameLower + '.png'
|
|
||||||
if os.path.isfile(profileImageFilename) and \
|
|
||||||
os.path.isfile(bannerFilename):
|
|
||||||
for subdir, dirs, files in os.walk(baseDir +
|
|
||||||
'/accounts'):
|
|
||||||
for acct in dirs:
|
|
||||||
if '@' not in acct:
|
|
||||||
continue
|
|
||||||
if 'inbox@' in acct:
|
|
||||||
continue
|
|
||||||
accountDir = \
|
|
||||||
os.path.join(baseDir + '/accounts', acct)
|
|
||||||
try:
|
|
||||||
copyfile(profileImageFilename,
|
|
||||||
accountDir + '/image.png')
|
|
||||||
copyfile(bannerFilename,
|
|
||||||
accountDir + '/banner.png')
|
|
||||||
except BaseException:
|
|
||||||
pass
|
|
||||||
result = True
|
result = True
|
||||||
|
|
||||||
if not result:
|
if not result:
|
||||||
|
|
Loading…
Reference in New Issue