From 1e3c6bd8db4f08c7437d3ea579e6d6705618c85a Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sun, 4 Feb 2024 17:13:11 -0300 Subject: Minor fixes --- __main__.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/__main__.py b/__main__.py index 8525f4a..813859f 100755 --- a/__main__.py +++ b/__main__.py @@ -10,7 +10,7 @@ ##################################### import requests, json, traceback, subprocess, sys, time, os, uuid, base64 -#import hmac, struct # < - TODO: Necessary for TOTP-remember support +import threading #hmac, struct # < - TODO: Necessary for TOTP-remember support import tkinter as tk from tkinter.messagebox import showerror, askyesno from functools import partial @@ -120,9 +120,9 @@ def san(cmd): def now(): return int(time.time()) -## Update preferences -if not "local" in list(pref.keys()): - pref["local"] = True +## Update preferences (only after release) +#if not "local" in list(pref.keys()): +# pref["local"] = True ## Does nothing, validation purposes only def nullp(arg): @@ -154,6 +154,7 @@ def validate_server(srv): return ok +## Update server list def update_serverlist(hosti): global serverlist, host try: @@ -177,6 +178,7 @@ def update_serverlist(hosti): traceback.print_exc() return False +## Launch a specific world with its appropriate client def launch_game(idx): ## Get/Set basic data HOST=serverlist[idx]["Host"] @@ -215,12 +217,14 @@ def launch_game(idx): ## Using system-wide versus local path if pref["local"]: CMD=os.getcwd()+"/manaplus/" + CMD=CMD.replace(" ", "\\ ") + CWD=CMD[:-1] ## TODO: Handle server type and client if not sys.platform.startswith('win'): if pref["plus"]: CMD+="manaplus" - elif pref["mana"]: + elif pref["mana"] and "tmwa" in serverlist[idx]["Type"]: CMD+="mana" else: CMD+="ManaVerse" @@ -235,12 +239,13 @@ def launch_game(idx): ## Build the server options OPT="-s %s -y %s -p %s -S" % (HOST, serverlist[idx]["Type"], PORT) + print("%s %s" % (CMD, OPT)) ## Local or System-Wide Config folders if pref["local"]: if not sys.platform.startswith('win'): - OPT+=" -C %s/Config -L %s/Local" % (os.getcwd()+"/manaplus", os.getcwd()+"/manaplus") + OPT+=" -C %s/Config -L %s/Local" % (CWD, CWD) else: - OPT+=" -C %s\\Config -L %s\\Local" % (os.getcwd()+"\\manaplus", os.getcwd()+"\\manaplus") + OPT+=" -C %s\\Config -L %s\\Local" % (CWD.replace('/','\\'), CWD.replace('/','\\')) pass ## Execute the app @@ -344,7 +349,7 @@ def login(): _savePref() ## Change the display - print("Connected to vault!") + print("Connected to vault! vaultId = %d" % vaultId) canva.destroy() ## TODO: Do not jump to world selection if it is a new account world_select() -- cgit v1.2.3-70-g09d2