Added start blocke on no database connection available
This commit is contained in:
8
main.py
8
main.py
@@ -28,6 +28,7 @@ from lib.DB.ContactModel import ContactModel
|
||||
# type=""
|
||||
|
||||
bad_config = False
|
||||
db_con = False
|
||||
address_model = None
|
||||
business_model = None
|
||||
business_type = None
|
||||
@@ -35,14 +36,14 @@ contact_model = None
|
||||
user = None
|
||||
|
||||
def initializeProgram():
|
||||
# print(f"In {__file__} file, initializeProgram()")
|
||||
#print(f"In {__file__} file, initializeProgram()")
|
||||
global address_model, bad_config, business_model, user, business_type, contact_model
|
||||
if not bad_config:
|
||||
dbconf = config.getConfig()['database']
|
||||
DbManager(dbconf)
|
||||
bad_config = False
|
||||
business_model = BusinessModel()
|
||||
user = UserManager()
|
||||
business_model = BusinessModel()
|
||||
address_model = AddressModel()
|
||||
business_type = BTypeModel()
|
||||
contact_model = ContactModel()
|
||||
@@ -78,9 +79,12 @@ if __name__ == "__main__":
|
||||
config.configurationReady.connect(initializeProgram)
|
||||
else:
|
||||
initializeProgram()
|
||||
if DbManager().getConnection():
|
||||
db_con = True
|
||||
|
||||
|
||||
engine.rootContext().setContextProperty("bad_config", bad_config) # print(f"Fehler: {i}")
|
||||
engine.rootContext().setContextProperty("db_con", db_con)
|
||||
engine.rootContext().setContextProperty("config", config)
|
||||
|
||||
engine.load(qml_file)
|
||||
|
||||
Reference in New Issue
Block a user