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 tmpAppPath = False
modPath = False modPath = False
originalModPath = False originalModPath = False
api = True
#Exception Handler #Exception Handler
def openFileWithStandardApp(path): def openFileWithStandardApp(path):
@ -276,6 +277,7 @@ def walklevel(some_dir, level=1):
del dirs[:] del dirs[:]
def title(string): def title(string):
if api == True: return
if os.name == "nt": if os.name == "nt":
os.system("title " +string) os.system("title " +string)
else: else:
@ -409,7 +411,8 @@ def setupVariables():
modPath = os.path.join(appPath + " - umlMods") modPath = os.path.join(appPath + " - umlMods")
originalModPath = modPath originalModPath = modPath
#Init def init():
api = False
title("Fier's Universal Modloader - " +uml.versionString) title("Fier's Universal Modloader - " +uml.versionString)
setupVariables() setupVariables()
title("Fier's Universal Modloader - " +uml.versionString+ " : " +appName) title("Fier's Universal Modloader - " +uml.versionString+ " : " +appName)
@ -419,3 +422,6 @@ checkUp()
while True: while True:
mainMenu() mainMenu()
if __name__ == "__main__":
init()