Fixed first start configuration load and add city model in add customer
This commit is contained in:
34
main.py
34
main.py
@@ -26,6 +26,26 @@ from lib.DB.AddressModel import AddressModel
|
||||
# name=""
|
||||
# type=""
|
||||
|
||||
am = None
|
||||
bm = None
|
||||
user = None
|
||||
|
||||
def initializeProgram():
|
||||
global am, bad_config, bm, user
|
||||
dbconf = config.getConfig()['database']
|
||||
DbManager(dbconf)
|
||||
bad_config = False
|
||||
bm = BusinessModel()
|
||||
user = UserManager()
|
||||
am = AddressModel()
|
||||
|
||||
publishContext()
|
||||
|
||||
def publishContext():
|
||||
global engine
|
||||
engine.rootContext().setContextProperty("loggedin_user", user)
|
||||
engine.rootContext().setContextProperty("bm", bm)
|
||||
engine.rootContext().setContextProperty("am", am)
|
||||
|
||||
if __name__ == "__main__":
|
||||
#QResource.registerResource("rc_qml.py")
|
||||
@@ -50,21 +70,13 @@ if __name__ == "__main__":
|
||||
|
||||
if not config.getConfig():
|
||||
bad_config = True
|
||||
bm = False
|
||||
config.configurationReady.connect(initializeProgram)
|
||||
|
||||
else:
|
||||
dbconf = config.getConfig()['database']
|
||||
DbManager(dbconf)
|
||||
bm = BusinessModel()
|
||||
user = UserManager()
|
||||
am = AddressModel()
|
||||
initializeProgram()
|
||||
|
||||
#print(con is con2)
|
||||
|
||||
engine.rootContext().setContextProperty("bm", bm)
|
||||
engine.rootContext().setContextProperty("am", am)
|
||||
engine.rootContext().setContextProperty("bad_config", bad_config) # print(f"Fehler: {i}")
|
||||
engine.rootContext().setContextProperty("config", config)
|
||||
engine.rootContext().setContextProperty("loggedin_user", user)
|
||||
engine.load(qml_file)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user