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
This commit is contained in:
Fierelier 2019-06-02 16:31:56 +02:00
parent 2369d5acec
commit 01c926bf67

View File

@ -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()
while True:
mainMenu()
if __name__ == "__main__":
init()