From 01c926bf679b3f54ba421c98becbfb57e6f44dc0 Mon Sep 17 00:00:00 2001 From: Fierelier Date: Sun, 2 Jun 2019 16:31:56 +0200 Subject: [PATCH] Quick and dirty API support, sort of UML will be rewritten soon, however, I still wanted to add simplistic API support. - Initialization moved into its own function - Title does not get set if api == True - Program only gets initialized if __name__ equals "__main__", so it can be used as an API --- UniversalModloader.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/UniversalModloader.py b/UniversalModloader.py index b1899cc..280c142 100644 --- a/UniversalModloader.py +++ b/UniversalModloader.py @@ -30,6 +30,7 @@ originalAppPath = False tmpAppPath = False modPath = False originalModPath = False +api = True #Exception Handler def openFileWithStandardApp(path): @@ -276,6 +277,7 @@ def walklevel(some_dir, level=1): del dirs[:] def title(string): + if api == True: return if os.name == "nt": os.system("title " +string) else: @@ -409,13 +411,17 @@ def setupVariables(): modPath = os.path.join(appPath + " - umlMods") originalModPath = modPath -#Init -title("Fier's Universal Modloader - " +uml.versionString) -setupVariables() -title("Fier's Universal Modloader - " +uml.versionString+ " : " +appName) +def init(): + api = False + title("Fier's Universal Modloader - " +uml.versionString) + setupVariables() + title("Fier's Universal Modloader - " +uml.versionString+ " : " +appName) -cleanUp() -checkUp() + cleanUp() + checkUp() -while True: - mainMenu() \ No newline at end of file + while True: + mainMenu() + +if __name__ == "__main__": + init() \ No newline at end of file