Added Main Menu & Login Menu
This commit is contained in:
87
CLI/Init.py
87
CLI/Init.py
@@ -10,11 +10,29 @@ class Config():
|
|||||||
AccountID = "NA"
|
AccountID = "NA"
|
||||||
version = 01.02
|
version = 01.02
|
||||||
|
|
||||||
|
class Server():
|
||||||
|
isReachable = False
|
||||||
|
Icon = "🌐"
|
||||||
|
if isReachable:
|
||||||
|
Icon = "🌐"
|
||||||
|
else:
|
||||||
|
Icon = "⛔"
|
||||||
|
|
||||||
|
|
||||||
#declare files
|
#declare files
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
configPath = Path("Config.ini")
|
configPath = Path("Config.ini")
|
||||||
|
|
||||||
|
class Display():
|
||||||
|
def Clear():
|
||||||
|
os.system('cls' if os.name == 'nt' else 'clear')
|
||||||
|
|
||||||
|
def showIntroText():
|
||||||
|
print("Tiropit Launcher CLI - Release Branch")
|
||||||
|
print(f"[TCLI]=============[Select option]==============[{Config.version}]")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def WarnMissingConfig(ConfigError):
|
def WarnMissingConfig(ConfigError):
|
||||||
print(f"[⚠️ WARNING ⚠️] - Your config file is corrupt , something that has to do with {ConfigError}")
|
print(f"[⚠️ WARNING ⚠️] - Your config file is corrupt , something that has to do with {ConfigError}")
|
||||||
print("Program will exit before it crashes :)")
|
print("Program will exit before it crashes :)")
|
||||||
@@ -35,6 +53,43 @@ def makeConfig():
|
|||||||
config.write(configfile)
|
config.write(configfile)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def TiropitLogin():
|
||||||
|
class menuData():
|
||||||
|
def menuInstructions():
|
||||||
|
Display.Clear()
|
||||||
|
showIntroText()
|
||||||
|
print("|[About: Login Instructions] |")
|
||||||
|
print("|1. Enter your username & password |")
|
||||||
|
print("|2. Enter your pin (if you have) |")
|
||||||
|
print("|3. Save Login key (autologin) |")
|
||||||
|
print("|[e] Exit [Any] Login > |")
|
||||||
|
print("======================================================")
|
||||||
|
def menuUsername():
|
||||||
|
Display.Clear()
|
||||||
|
showIntroText()
|
||||||
|
print(f"|[LogIn: Login page] [{Server.Icon}]|")
|
||||||
|
print("| Enter your username |")
|
||||||
|
print("| |")
|
||||||
|
print("| |")
|
||||||
|
print("| |")
|
||||||
|
print("======================================================")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
menuData.menuInstructions()
|
||||||
|
option = input(">> ")
|
||||||
|
match option:
|
||||||
|
case "e":
|
||||||
|
showMenu(1)
|
||||||
|
return 0
|
||||||
|
case _:
|
||||||
|
menuData.menuUsername()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def loadConfig():
|
def loadConfig():
|
||||||
try:
|
try:
|
||||||
config.read(configPath)
|
config.read(configPath)
|
||||||
@@ -53,12 +108,35 @@ def checkConfig():
|
|||||||
print("The file Config does not exist. - Creating")
|
print("The file Config does not exist. - Creating")
|
||||||
makeConfig()
|
makeConfig()
|
||||||
|
|
||||||
|
def showMenu(menuID):
|
||||||
|
Display.Clear()
|
||||||
|
showIntroText()
|
||||||
|
match menuID:
|
||||||
|
case 1:
|
||||||
|
|
||||||
|
print("|[Main menu] |")
|
||||||
|
print("|[1] Log in to tiropit | [2] Reset Data & Config |")
|
||||||
|
print("|[3] Send / Get Request| [4] My Profile |")
|
||||||
|
print("| |")
|
||||||
|
print("|[e] Exit |")
|
||||||
|
print("======================================================")
|
||||||
|
option = input(">> ")
|
||||||
|
if option == "": showMenu(1)
|
||||||
|
|
||||||
|
|
||||||
|
print(option)
|
||||||
|
match option:
|
||||||
|
case "1":
|
||||||
|
TiropitLogin()
|
||||||
|
case _:
|
||||||
|
showMenu(1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def showIntroText():
|
|
||||||
print("Tiropit Launcher CLI - Release Branch")
|
|
||||||
print(f"[TCLI]===========================[{Config.version}]")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -68,5 +146,4 @@ def showIntroText():
|
|||||||
#Begin
|
#Begin
|
||||||
|
|
||||||
checkConfig()
|
checkConfig()
|
||||||
|
showMenu(1)
|
||||||
showIntroText()
|
|
||||||
|
|||||||
Reference in New Issue
Block a user