main
Bob Mottram 2020-07-25 11:13:24 +01:00
parent 0dc5efb77e
commit 5a735e46ca
1 changed files with 24 additions and 62 deletions

View File

@ -592,14 +592,6 @@ def setThemeImages(baseDir: str, name: str) -> None:
themeNameLower = name.lower() themeNameLower = name.lower()
if themeNameLower == 'default': if themeNameLower == 'default':
loginBackgroundImageFilename = \
baseDir + '/img/login-background.png'
sharesBackgroundImageFilename = \
baseDir + '/img/shares-background.png'
deleteBackgroundImageFilename = \
baseDir + '/img/delete-background.png'
followBackgroundImageFilename = \
baseDir + '/img/follow-background.png'
profileImageFilename = \ profileImageFilename = \
baseDir + '/img/image.png' baseDir + '/img/image.png'
bannerFilename = \ bannerFilename = \
@ -607,14 +599,6 @@ def setThemeImages(baseDir: str, name: str) -> None:
searchBannerFilename = \ searchBannerFilename = \
baseDir + '/img/search_banner.png' baseDir + '/img/search_banner.png'
else: else:
loginBackgroundImageFilename = \
baseDir + '/img/login_background_' + themeNameLower + '.png'
sharesBackgroundImageFilename = \
baseDir + '/img/shares_background_' + themeNameLower + '.png'
deleteBackgroundImageFilename = \
baseDir + '/img/delete_background_' + themeNameLower + '.png'
followBackgroundImageFilename = \
baseDir + '/img/follow_background_' + themeNameLower + '.png'
profileImageFilename = \ profileImageFilename = \
baseDir + '/img/image_' + themeNameLower + '.png' baseDir + '/img/image_' + themeNameLower + '.png'
bannerFilename = \ bannerFilename = \
@ -632,53 +616,31 @@ def setThemeImages(baseDir: str, name: str) -> None:
accountDir = \ accountDir = \
os.path.join(baseDir + '/accounts', acct) os.path.join(baseDir + '/accounts', acct)
if os.path.isfile(loginBackgroundImageFilename): backgroundNames = ('login', 'shares', 'delete', 'follow',
try: 'options', 'block', 'search', 'calendar')
copyfile(loginBackgroundImageFilename, for backgroundType in backgroundNames:
accountDir + '/login-background.png') if themeNameLower == 'default':
except BaseException: backgroundImageFilename = \
pass baseDir + '/img/' + backgroundType + '-background.png'
elif os.path.isfile(accountDir + '/login-background.png'): else:
try: backgroundImageFilename = \
os.remove(accountDir + '/login-background.png') baseDir + '/img/' + backgroundType + '_background_' + \
except BaseException: themeNameLower + '.png'
pass
if os.path.isfile(sharesBackgroundImageFilename): if os.path.isfile(backgroundImageFilename):
try: try:
copyfile(sharesBackgroundImageFilename, copyfile(backgroundImageFilename,
accountDir + '/shares-background.png') accountDir + '/' + backgroundType +
except BaseException: '-background.png')
pass except BaseException:
elif os.path.isfile(accountDir + '/shares-background.png'): pass
try: elif os.path.isfile(accountDir + '/' + backgroundType +
os.remove(accountDir + '/shares-background.png') '-background.png'):
except BaseException: try:
pass os.remove(accountDir + '/' + backgroundType +
'-background.png')
if os.path.isfile(deleteBackgroundImageFilename): except BaseException:
try: pass
copyfile(deleteBackgroundImageFilename,
accountDir + '/delete-background.png')
except BaseException:
pass
elif os.path.isfile(accountDir + '/delete-background.png'):
try:
os.remove(accountDir + '/delete-background.png')
except BaseException:
pass
if os.path.isfile(followBackgroundImageFilename):
try:
copyfile(followBackgroundImageFilename,
accountDir + '/follow-background.png')
except BaseException:
pass
elif os.path.isfile(accountDir + '/follow-background.png'):
try:
os.remove(accountDir + '/follow-background.png')
except BaseException:
pass
if os.path.isfile(profileImageFilename) and \ if os.path.isfile(profileImageFilename) and \
os.path.isfile(bannerFilename): os.path.isfile(bannerFilename):