Clean-up and rename variables

This commit is contained in:
2024-12-10 21:46:33 +01:00
parent 8830e277ec
commit 7c61b2a532
8 changed files with 25 additions and 32 deletions

24
main.py
View File

@@ -26,38 +26,36 @@ from lib.DB.ContactModel import ContactModel
# password=""
# name=""
# type=""
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG)
bad_config = False
am = None
bm = None
btm = None
address_model = None
business_model = None
business_type = None
contact_model = None
user = None
def initializeProgram():
# print(f"In {__file__} file, initializeProgram()")
global am, bad_config, bm, user, btm, contact_model
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
bm = BusinessModel()
business_model = BusinessModel()
user = UserManager()
am = AddressModel()
btm = BTypeModel()
address_model = AddressModel()
business_type = BTypeModel()
contact_model = ContactModel()
publishContext()
def publishContext():
# print(f"In {__file__} file, publishContext()")
global engine, am, bad_config, bm, user, btm, contact_model
global engine, address_model, bad_config, business_model, user, business_type, contact_model
engine.rootContext().setContextProperty("loggedin_user", user)
engine.rootContext().setContextProperty("bm", bm)
engine.rootContext().setContextProperty("am", am)
engine.rootContext().setContextProperty("btm", btm)
engine.rootContext().setContextProperty("business_model", business_model)
engine.rootContext().setContextProperty("address_model", address_model)
engine.rootContext().setContextProperty("business_type", business_type)
engine.rootContext().setContextProperty("contact_model", contact_model)
if __name__ == "__main__":