From 4f0b519a8ece3b9e55f9669b409ef7e737a7c537 Mon Sep 17 00:00:00 2001 From: Weilbyte Date: Tue, 22 Sep 2020 01:59:25 +0200 Subject: [PATCH] Remove fstrings Fixes #26 --- PVEDiscordDark.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/PVEDiscordDark.py b/PVEDiscordDark.py index fa90996..f45134f 100644 --- a/PVEDiscordDark.py +++ b/PVEDiscordDark.py @@ -59,7 +59,7 @@ def checkPVE(): cprint(colors.NORMAL, 'A Proxmox installation could not be detected.') exit(1) else: - cprint(colors.OKGREEN, f'\nPVE {ver} detected.') + cprint(colors.OKGREEN, '\nPVE ' + ver + ' detected.') def checkConn(): try: @@ -84,20 +84,21 @@ def themeIsInstalled(): def installTheme(): clear() doHeader() - baseURL = os.getenv('BASEURL', f'https://github.com/Weilbyte/PVEDiscordDark/raw/{os.getenv("BRANCH", "master")}') + baseURL = os.getenv('BASEURL', 'https://github.com/Weilbyte/PVEDiscordDark/raw/' + os.getenv("BRANCH", "master")) cprint(colors.NORMAL, '\nBacking up index template file..') shutil.copyfile('/usr/share/pve-manager/index.html.tpl', '/usr/share/pve-manager/index.html.tpl.bak') cprint(colors.NORMAL, 'Downloading stylesheet..') - urllib.request.urlretrieve(f'{baseURL}/PVEDiscordDark/sass/PVEDiscordDark.css', '/usr/share/pve-manager/css/dd_style.css') + urllib.request.urlretrieve(baseURL + '/PVEDiscordDark/sass/PVEDiscordDark.css', '/usr/share/pve-manager/css/dd_style.css') cprint(colors.NORMAL, 'Downloading patcher..') - urllib.request.urlretrieve(f'{baseURL}/PVEDiscordDark/js/PVEDiscordDark.js', '/usr/share/pve-manager/js/dd_patcher.js') + urllib.request.urlretrieve(baseURL + '/PVEDiscordDark/js/PVEDiscordDark.js', '/usr/share/pve-manager/js/dd_patcher.js') cprint(colors.NORMAL, 'Applying stylesheet and patcher..') with open('/usr/share/pve-manager/index.html.tpl', 'a') as tplFile: tplFile.write("") tplFile.write("") for index, image in enumerate(images): - cprint(colors.NORMAL, f'Downloading images [{index + 1}/{len(images)}]..\r', False, True) - urllib.request.urlretrieve(f'{baseURL}/PVEDiscordDark/images/{image}', f'/usr/share/pve-manager/images/{image}') + imageCurrent = index + 1 + cprint(colors.NORMAL, 'Downloading images [' + imageCurrent + '/' + len(images) + ']..\r', False, True) + urllib.request.urlretrieve(baseURL + '/PVEDiscordDark/images/' + image, '/usr/share/pve-manager/images/' + image) cprint(colors.OKGREEN, '\nTheme installed successfully!', True) if ACTION == None: cprint(colors.NORMAL, 'Press [ENTER] to go back.') @@ -129,7 +130,7 @@ def uninstallTheme(): cprint(colors.NORMAL, 'Removing images..') for asset in os.listdir('/usr/share/pve-manager/images/'): if asset.startswith('dd_'): - os.remove(f'/usr/share/pve-manager/images/{asset}') + os.remove('/usr/share/pve-manager/images/' + asset) cprint(colors.OKGREEN, '\n\nTheme uninstalled successfully!', True) if ACTION == None: cprint(colors.NORMAL, 'Press [ENTER] to go back.') @@ -186,4 +187,4 @@ def main(): uninstallTheme() if __name__ == "__main__": - main() \ No newline at end of file + main()