Added OS independent installer and finished console output

This commit is contained in:
Neocky 2022-06-04 16:33:46 +02:00
parent 4920689f0e
commit 8e51b1976d
8 changed files with 88 additions and 65 deletions

3
.gitignore vendored
View File

@ -133,3 +133,6 @@ dmypy.json
# PyCharm Settings
.idea
# pluGET Files
pluGET_config.yaml

12
install_requirements.py Normal file
View File

@ -0,0 +1,12 @@
"""
Install the needed python packages through this script
"""
import os
try:
print("Installing Python packages and dependencies from requirements.txt...")
os.system('py -m pip install -r requirements.txt' if os.name=='nt' else 'pip install -r requirements.txt')
except:
print("Requirements couldn't be installed. Check if file 'requirements.txt' is in the same folder and that Python3\
and pip is installed!")

View File

@ -1,34 +0,0 @@
@ECHO OFF
cd /d %~dp0
Echo ___ ___ ___ ___ ___ ___
Echo /\ \ /\__\ /\__\ /\ \ /\ \ /\ \
Echo /::\ \ /:/ / /:/ / /::\ \ /::\ \ \:\ \
Echo /:/\:\ \ /:/ / /:/ / /:/\:\ \ /:/\:\ \ \:\ \
Echo /::\~\:\ \ /:/ / /:/ / ___ /:/ \:\ \ /::\~\:\ \ /::\ \
Echo /:/\:\ \:\__\ /:/__/ /:/__/ /\__\ /:/__/_\:\__\ /:/\:\ \:\__\ /:/\:\__\
Echo \/__\:\/:/ / \:\ \ \:\ \ /:/ / \:\ /\ \/__/ \:\~\:\ \/__/ /:/ \/__/
Echo \::/ / \:\ \ \:\ /:/ / \:\ \:\__\ \:\ \:\__\ /:/ /
Echo \/__/ \:\ \ \:\/:/ / \:\/:/ / \:\ \/__/ \/__/
Echo \:\__\ \::/ / \::/ / \:\__\
Echo \/__/ \/__/ \/__/ \/__/
Echo `
Echo `
Echo ------------------------------------
Echo [By Neocky]
Echo https://github.com/Neocky/pluGET
Echo pluGET-Installer
Echo ------------------------------------
Echo `
Echo ----------------------------------------------------------------------------------
Echo Installing Python packages and dependencies...
py -m pip install -r requirements.txt
Echo `
Echo Launching pluGET...
launcher.bat
exit

View File

@ -1,4 +0,0 @@
@ECHO OFF
cd "%~dp0"
cd src
py "__main__.py"

View File

@ -1,3 +0,0 @@
#!/bin/sh
cd src/
python3 "__main__.py"

View File

@ -16,6 +16,7 @@ except:
if __name__ == "__main__":
check_config()
rename_console_title()
#check_requirements()
parser = argparse.ArgumentParser(description="Just an example",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
@ -30,14 +31,10 @@ if __name__ == "__main__":
else:
print("no arguments")
#consoleTitle()
#clearConsole()
clear_console()
#createInputLists()
#printMainMenu()
#getInput()
rename_console_title()
clear_console()
print_logo()
print_logo()
config = config_value()
validate_config()
print(config.connection)

View File

@ -17,7 +17,7 @@ class config_value():
"""
def __init__(self):
yaml = ruamel.yaml.YAML()
with open("pluget_config.yaml", "r") as config_file:
with open("pluGET_config.yaml", "r") as config_file:
data = yaml.load(config_file)
self.connection = data["Connection"]
self.path_to_plugin_folder = Path(data["Local"]["PathToPluginFolder"])
@ -35,16 +35,16 @@ class config_value():
def check_config() -> None:
"""
Check if there is a pluget_config.yml file in the same folder as pluget.py and if not create a new config
Check if there is a pluGET_config.yml file in the same folder as pluget.py and if not create a new config
and exit the programm
"""
if not os.path.isfile("pluget_config.yaml"):
if not os.path.isfile("pluGET_config.yaml"):
create_config()
def create_config() -> None:
"""
Creates the yaml config in the current directory with the filename pluget_config.yml
Creates the yaml config in the current directory with the filename pluGET_config.yml
"""
# this is the whole yaml code because of weird formating indention is not possible
configuration = """\
@ -78,11 +78,10 @@ def create_config() -> None:
# load ruamel.yaml to get the # commands right in the yaml code
yaml = ruamel.yaml.YAML()
code = yaml.load(configuration)
print(code['Local']['SeperateDownloadPath'])
with open("pluget_config.yaml", "w") as config_file:
with open("pluGET_config.yaml", "w") as config_file:
yaml.dump(code, config_file)
config_file_path = os.path.abspath("pluget_config.yaml")
config_file_path = os.path.abspath("pluGET_config.yaml")
print(f"Path of config file: {config_file_path}")
print("Config created. Edit config before executing again!")
input("Press any key + enter to exit...")

View File

@ -19,7 +19,12 @@ def clear_console() -> None:
"""
os.system('cls' if os.name=='nt' else 'clear')
def print_logo() -> None:
"""
Prints the logo of pluGET and the link to the github repo
"""
# use rich console
console = Console()
# line 1
console.print()
@ -56,18 +61,66 @@ def print_logo() -> None:
console.print("██", style="bright_magenta", end='')
console.print("╔══╝", style="bright_yellow")
# line 4
console.print(" ██████╔╝██║ ██║ ██║██║ ███╗█████╗ ██║ ")
console.print(" ██████", style="bright_magenta", end='')
console.print("╔╝", style="bright_yellow", end='')
console.print("██", style="bright_magenta", end='')
console.print("", style="bright_yellow", end='')
console.print("██", style="bright_magenta", end='')
console.print("", style="bright_yellow", end='')
console.print("██", style="bright_magenta", end='')
console.print("", style="bright_yellow", end='')
console.print("██", style="bright_magenta", end='')
console.print("", style="bright_yellow", end='')
console.print("███", style="bright_magenta", end='')
console.print("", style="bright_yellow", end='')
console.print("█████", style="bright_magenta", end='')
console.print("", style="bright_yellow", end='')
console.print("██", style="bright_magenta", end='')
console.print("", style="bright_yellow")
# line 5
console.print(" ██╔═══╝ ██║ ██║ ██║██║ ██║██╔══╝ ██║ ")
console.print(" ██", style="bright_magenta", end='')
console.print("╔═══╝ ", style="bright_yellow", end='')
console.print("██", style="bright_magenta", end='')
console.print("", style="bright_yellow", end='')
console.print("██", style="bright_magenta", end='')
console.print("", style="bright_yellow", end='')
console.print("██", style="bright_magenta", end='')
console.print("", style="bright_yellow", end='')
console.print("██", style="bright_magenta", end='')
console.print("", style="bright_yellow", end='')
console.print("██", style="bright_magenta", end='')
console.print("", style="bright_yellow", end='')
console.print("██", style="bright_magenta", end='')
console.print("╔══╝ ", style="bright_yellow", end='')
console.print("██", style="bright_magenta", end='')
console.print("", style="bright_yellow")
# line 6
console.print(" ██║ ███████╗╚██████╔╝╚██████╔╝███████╗ ██║ ")
console.print(" ██", style="bright_magenta", end='')
console.print("", style="bright_yellow", end='')
console.print("███████", style="bright_magenta", end='')
console.print("╗╚", style="bright_yellow", end='')
console.print("██████", style="bright_magenta", end='')
console.print("╔╝╚", style="bright_yellow", end='')
console.print("██████", style="bright_magenta", end='')
console.print("╔╝", style="bright_yellow", end='')
console.print("███████", style="bright_magenta", end='')
console.print("", style="bright_yellow", end='')
console.print("██", style="bright_magenta", end='')
console.print("", style="bright_yellow")
# line 7
console.print(" ╚═╝ ╚══════╝ ╚═════╝ ╚═════╝ ╚══════╝ ╚═╝ ", style="bright_yellow")
console.print(" ┌────────────────────────────────────┐", style="bright_black")
#print(" │ [" + 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)
# line 8
console.print()
# line 9
console.print(" ┌────────────────────────────────────┐", style="bright_black")
# line 10
console.print(" │ [", style="bright_black", end='')
console.print("By Neocky", style="bright_magenta", end='')
console.print("] │ ", style="bright_black")
# line 11
console.print("", style="bright_black", end='')
console.print("https://github.com/Neocky/pluGET", style="link https://github.com/Neocky/pluGET", end='')
console.print("", style="bright_black")
# line 12
console.print(" └────────────────────────────────────┘", style="bright_black")
console.print(" ───────────────────────────────────────────────────")