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.utilities import getHelp, check_requirements
from utils.consoleoutput import consoleTitle, clearConsole, printMainMenu
from utils.utilities import check_requirements
from handlers.handle_input import createInputLists, getInput
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():

View File

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

View File

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