Add connect_timout to DBManager connection and accelerate program start
on connection timeout
This commit is contained in:
21
main.py
21
main.py
@@ -1,4 +1,4 @@
|
||||
# This Python file uses the following encoding: utf-8
|
||||
# # !/home/linuxero/proj/tero/pyqcrm/.qtcreator/venv-3.13.0/bin/python3
|
||||
import sys
|
||||
import logging
|
||||
from PySide6.QtGui import QGuiApplication
|
||||
@@ -37,18 +37,19 @@ user = None
|
||||
|
||||
def initializeProgram():
|
||||
#print(f"In {__file__} file, initializeProgram()")
|
||||
global address_model, bad_config, business_model, user, business_type, contact_model
|
||||
global address_model, bad_config, business_model, user, business_type, contact_model, db_con
|
||||
if not bad_config:
|
||||
dbconf = config.getConfig()['database']
|
||||
DbManager(dbconf)
|
||||
if DbManager().getConnection():
|
||||
db_con = True
|
||||
user = UserManager()
|
||||
business_model = BusinessModel()
|
||||
address_model = AddressModel()
|
||||
business_type = BTypeModel()
|
||||
contact_model = ContactModel()
|
||||
publishContext()
|
||||
bad_config = False
|
||||
user = UserManager()
|
||||
business_model = BusinessModel()
|
||||
address_model = AddressModel()
|
||||
business_type = BTypeModel()
|
||||
contact_model = ContactModel()
|
||||
|
||||
publishContext()
|
||||
|
||||
def publishContext():
|
||||
# print(f"In {__file__} file, publishContext()")
|
||||
@@ -79,8 +80,6 @@ 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}")
|
||||
|
||||
Reference in New Issue
Block a user