Copy left and right column images when changing theme

merge-requests/8/head
Bob Mottram 2020-10-03 11:09:21 +01:00
parent 70e57fa71a
commit 68ce54563f
2 changed files with 24 additions and 1 deletions

View File

@ -887,6 +887,10 @@ def setThemeImages(baseDir: str, name: str) -> None:
baseDir + '/img/banner.png' baseDir + '/img/banner.png'
searchBannerFilename = \ searchBannerFilename = \
baseDir + '/img/search_banner.png' baseDir + '/img/search_banner.png'
leftColImageFilename = \
baseDir + '/img/left_col_image.png'
rightColImageFilename = \
baseDir + '/img/right_col_image.png'
else: else:
profileImageFilename = \ profileImageFilename = \
baseDir + '/img/image_' + themeNameLower + '.png' baseDir + '/img/image_' + themeNameLower + '.png'
@ -894,6 +898,10 @@ def setThemeImages(baseDir: str, name: str) -> None:
baseDir + '/img/banner_' + themeNameLower + '.png' baseDir + '/img/banner_' + themeNameLower + '.png'
searchBannerFilename = \ searchBannerFilename = \
baseDir + '/img/search_banner_' + themeNameLower + '.png' baseDir + '/img/search_banner_' + themeNameLower + '.png'
leftColImageFilename = \
baseDir + '/img/left_col_image_' + themeNameLower + '.png'
rightColImageFilename = \
baseDir + '/img/right_col_image_' + themeNameLower + '.png'
backgroundNames = ('login', 'shares', 'delete', 'follow', backgroundNames = ('login', 'shares', 'delete', 'follow',
'options', 'block', 'search', 'calendar') 'options', 'block', 'search', 'calendar')
@ -960,6 +968,20 @@ def setThemeImages(baseDir: str, name: str) -> None:
except BaseException: except BaseException:
pass pass
try:
if os.path.isfile(leftColImageFilename):
copyfile(leftColImageFilename,
accountDir + '/left_col_image.png')
except BaseException:
pass
try:
if os.path.isfile(rightColImageFilename):
copyfile(rightColImageFilename,
accountDir + '/right_col_image.png')
except BaseException:
pass
def setTheme(baseDir: str, name: str) -> bool: def setTheme(baseDir: str, name: str) -> bool:
result = False result = False

View File

@ -5301,7 +5301,8 @@ def getRightColumnContent(baseDir: str, nickname: str, domainFull: str,
editImageClass = 'rightColEditImage' editImageClass = 'rightColEditImage'
htmlStr += \ htmlStr += \
'\n <center>\n' + \ '\n <center>\n' + \
' <img class="rightColImg" loading="lazy" src="/users/' + \ ' <img class="rightColImg" ' + \
'loading="lazy" src="/users/' + \
nickname + '/right_col_image.png" />\n' + \ nickname + '/right_col_image.png" />\n' + \
' </center>\n' ' </center>\n'