diff --git a/img/login_background_starlight.jpg b/img/login_background_starlight.jpg new file mode 100644 index 00000000..de3be58d Binary files /dev/null and b/img/login_background_starlight.jpg differ diff --git a/theme.py b/theme.py index 0033dc71..620ad42a 100644 --- a/theme.py +++ b/theme.py @@ -608,6 +608,7 @@ def setThemeImages(baseDir: str, name: str) -> None: backgroundNames = ('login', 'shares', 'delete', 'follow', 'options', 'block', 'search', 'calendar') + extensions = ('png', 'jpg', 'gif') for subdir, dirs, files in os.walk(baseDir + '/accounts'): for acct in dirs: @@ -619,28 +620,36 @@ def setThemeImages(baseDir: str, name: str) -> None: os.path.join(baseDir + '/accounts', acct) for backgroundType in backgroundNames: - if themeNameLower == 'default': - backgroundImageFilename = \ - baseDir + '/img/' + backgroundType + '-background.png' - else: - backgroundImageFilename = \ - baseDir + '/img/' + backgroundType + '_background_' + \ - themeNameLower + '.png' + for ext in extensions: + if themeNameLower == 'default': + backgroundImageFilename = \ + baseDir + '/img/' + backgroundType + \ + '-background.' + ext + else: + backgroundImageFilename = \ + baseDir + '/img/' + backgroundType + \ + '_background_' + \ + themeNameLower + '.' + ext - if os.path.isfile(backgroundImageFilename): - try: - copyfile(backgroundImageFilename, - baseDir + '/accounts/' + backgroundType + - '-background.png') - except BaseException: - pass - elif os.path.isfile(baseDir + '/accounts/' + backgroundType + - '-background.png'): - try: - os.remove(baseDir + '/accounts/' + backgroundType + - '-background.png') - except BaseException: - pass + if os.path.isfile(backgroundImageFilename): + try: + copyfile(backgroundImageFilename, + baseDir + '/accounts/' + backgroundType + + '-background.' + ext) + break + except BaseException: + pass + # background image was not found + # so remove any existing file + if os.path.isfile(baseDir + '/accounts/' + + backgroundType + + '-background.' + ext): + try: + os.remove(baseDir + '/accounts/' + + backgroundType + + '-background.' + ext) + except BaseException: + pass if os.path.isfile(profileImageFilename) and \ os.path.isfile(bannerFilename):