Added new progress bar and some formating

Changes:
- added simple progress bar when checking/updating plugins
- misc code cleanup
- changed logo
This commit is contained in:
Neocky 2021-03-18 23:42:02 +01:00
parent d478432396
commit 01465eb769
3 changed files with 16 additions and 16 deletions

View File

@ -1,10 +1,7 @@
from utils.consoleoutput import consoleTitle, clearConsole, printMainMenu, oColors from utils.consoleoutput import consoleTitle, clearConsole, printMainMenu
from utils.utilities import getHelp, check_requirements from utils.utilities import check_requirements
from handlers.handle_input import createInputLists, getInput from handlers.handle_input import createInputLists, getInput
from handlers.handle_config import checkConfig from handlers.handle_config import checkConfig
from plugin.plugin_downloader import searchPackage, getSpecificPackage
from plugin.plugin_updatechecker import updateInstalledPackage, checkInstalledPackage
from plugin.plugin_remover import removePlugin
def mainFunction(): def mainFunction():

View File

@ -97,8 +97,9 @@ def checkInstalledPackage(inputSelectedObject="all"):
oldPackages = 0 oldPackages = 0
print(f"Checking: {inputSelectedObject}") print(f"Checking: {inputSelectedObject}")
print("Index | Name | Installed V. | Latest V. | Update available") print("Index | Name | Installed V. | Latest V. | Update available")
print("─────────────────────────────────────────────────────────────────────────────────────")
try: try:
for plugin in track(pluginList, description="Checking plugins" ,transient=True, complete_style="cyan"): for plugin in track(pluginList, description="Checking for updates" ,transient=True, complete_style="cyan"):
try: try:
fileName = getFileName(plugin) fileName = getFileName(plugin)
fileVersion = getFileVersion(plugin) fileVersion = getFileVersion(plugin)
@ -109,7 +110,6 @@ def checkInstalledPackage(inputSelectedObject="all"):
pluginIdStr = str(pluginId) pluginIdStr = str(pluginId)
if fileVersion == '': if fileVersion == '':
fileVersion = 'N/A' fileVersion = 'N/A'
try: try:
pluginLatestVersion = INSTALLEDPLUGINLIST[i][2] pluginLatestVersion = INSTALLEDPLUGINLIST[i][2]
except IndexError: except IndexError:
@ -146,7 +146,7 @@ def checkInstalledPackage(inputSelectedObject="all"):
i += 1 i += 1
except TypeError: except TypeError:
print(oColors.brightRed + "Aborted checking for plugins." + oColors.standardWhite) print(oColors.brightRed + "Aborted checking for updates." + oColors.standardWhite)
print(oColors.brightYellow + f"Old packages: [{oldPackages}/{i}]" + oColors.standardWhite) print(oColors.brightYellow + f"Old packages: [{oldPackages}/{i}]" + oColors.standardWhite)
@ -162,8 +162,9 @@ def updateInstalledPackage(inputSelectedObject='all'):
indexNumberUpdated = 0 indexNumberUpdated = 0
print(f"Updating: {inputSelectedObject}") print(f"Updating: {inputSelectedObject}")
print("Index | Name | Old V. | New V.") print("Index | Name | Old V. | New V.")
print("───────────────────────────────────────────────────────────")
try: try:
for plugin in pluginList: for plugin in track(pluginList, description="Updating" ,transient=True, complete_style="red"):
try: try:
fileName = getFileName(plugin) fileName = getFileName(plugin)
fileVersion = getFileVersion(plugin) fileVersion = getFileVersion(plugin)
@ -177,10 +178,9 @@ def updateInstalledPackage(inputSelectedObject='all'):
continue continue
pluginIdStr = str(pluginId) pluginIdStr = str(pluginId)
if pluginId == None: if pluginId == None or pluginId == '':
print(oColors.brightRed + "Couldn't find plugin id. Sorry :(" + oColors.standardWhite) print(oColors.brightRed + "Couldn't find plugin id. Sorry :(" + oColors.standardWhite)
continue continue
if inputSelectedObject == pluginIdStr or re.search(inputSelectedObject, fileName, re.IGNORECASE): if inputSelectedObject == pluginIdStr or re.search(inputSelectedObject, fileName, re.IGNORECASE):
if INSTALLEDPLUGINLIST[i][3] == True: if INSTALLEDPLUGINLIST[i][3] == True:
print(f" [{indexNumberUpdated+1}]".ljust(8), end='') print(f" [{indexNumberUpdated+1}]".ljust(8), end='')
@ -190,7 +190,7 @@ def updateInstalledPackage(inputSelectedObject='all'):
print(f"{latestVersion}".ljust(8)) print(f"{latestVersion}".ljust(8))
if not checkConfig().localPluginFolder: if not checkConfig().localPluginFolder:
if checkConfig().sftp_pathToSeperateDownloadPath is True: if checkConfig().sftp_seperateDownloadPath is True:
pluginPath = checkConfig().sftp_pathToSeperateDownloadPath pluginPath = checkConfig().sftp_pathToSeperateDownloadPath
else: else:
pluginPath = checkConfig().sftp_folderPath pluginPath = checkConfig().sftp_folderPath
@ -243,7 +243,6 @@ def updateInstalledPackage(inputSelectedObject='all'):
pluginPath = checkConfig().sftp_pathToSeperateDownloadPath pluginPath = checkConfig().sftp_pathToSeperateDownloadPath
else: else:
pluginPath = checkConfig().sftp_folderPath pluginPath = checkConfig().sftp_folderPath
pluginPath = checkConfig().sftp_folderPath
pluginPath = f"{pluginPath}/{plugin}" pluginPath = f"{pluginPath}/{plugin}"
sftp = createSFTPConnection() sftp = createSFTPConnection()
indexNumberUpdated += 1 indexNumberUpdated += 1

View File

@ -18,6 +18,7 @@ class oColors:
brightRed = "\033[91m" brightRed = "\033[91m"
brightGreen = "\033[92m" brightGreen = "\033[92m"
darkMagenta = "\033[35m" darkMagenta = "\033[35m"
brightBlack = "\033[90m"
def printLogo(): def printLogo():
@ -72,9 +73,12 @@ def printLogo():
oColors.standardWhite) oColors.standardWhite)
print() print()
print() print()
print(oColors.brightYellow + " [" + oColors.darkMagenta + "By Neocky" + print(oColors.brightBlack + " ┌────────────────────────────────────┐" + oColors.standardWhite)
oColors.brightYellow + "] " + oColors.standardWhite) print(oColors.brightBlack + " │ [" + oColors.brightMagenta + "By Neocky" +oColors.brightBlack +
print() "] │ " + oColors.standardWhite)
print(oColors.brightBlack + "" + oColors.brightMagenta + "https://github.com/Neocky/pluGET" + oColors.brightBlack +
"" + oColors.standardWhite)
print(oColors.brightBlack + " └────────────────────────────────────┘" + oColors.standardWhite)
def printHorizontalLine(): def printHorizontalLine():