Browse Source

Remove fstrings

Fixes #26
pull/32/head
Weilbyte 4 years ago
committed by GitHub
parent
commit
4f0b519a8e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      PVEDiscordDark.py

15
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("<link rel='stylesheet' type='text/css' href='/pve2/css/dd_style.css'>")
tplFile.write("<script type='text/javascript' src='/pve2/js/dd_patcher.js'></script>")
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.')

Loading…
Cancel
Save