Fummeljob hierum darum
This commit is contained in:
13
main.py
13
main.py
@@ -1,4 +1,5 @@
|
||||
# # !/home/linuxero/proj/tero/pyqcrm/.qtcreator/venv-3.13.1/bin/python3
|
||||
import os
|
||||
import sys
|
||||
import logging
|
||||
from PySide6.QtGui import QGuiApplication
|
||||
@@ -13,9 +14,10 @@ from lib.DB.UserManager import UserManager
|
||||
from lib.DB.AddressModel import AddressModel
|
||||
from lib.DB.BTypeModel import BTypeModel
|
||||
from lib.DB.ContactModel import ContactModel
|
||||
from lib.Printers import Printers
|
||||
|
||||
|
||||
|
||||
os.environ['QML_XHR_ALLOW_FILE_READ'] = '1'
|
||||
|
||||
# [pyqcrm]
|
||||
# program-name=""
|
||||
@@ -35,14 +37,16 @@ address_model = None
|
||||
business_model = None
|
||||
business_type = None
|
||||
contact_model = None
|
||||
printers = None
|
||||
user = None
|
||||
|
||||
def initializeProgram():
|
||||
#print(f"In {__file__} file, initializeProgram()")
|
||||
global address_model, bad_config, business_model, user, business_type, contact_model, db_con
|
||||
global address_model, bad_config, business_model, user, business_type, contact_model, db_con, printers
|
||||
if not bad_config:
|
||||
dbconf = config.getConfig()['database']
|
||||
DbManager(dbconf)
|
||||
printers = Printers()
|
||||
if DbManager().getConnection():
|
||||
db_con = True
|
||||
user = UserManager()
|
||||
@@ -55,7 +59,7 @@ def initializeProgram():
|
||||
|
||||
def publishContext():
|
||||
# print(f"In {__file__} file, publishContext()")
|
||||
global engine, address_model, bad_config, business_model, user, business_type, contact_model
|
||||
global engine, address_model, bad_config, business_model, user, business_type, contact_model, printers
|
||||
engine.rootContext().setContextProperty("loggedin_user", user)
|
||||
engine.rootContext().setContextProperty("business_model", business_model)
|
||||
engine.rootContext().setContextProperty("address_model", address_model)
|
||||
@@ -76,14 +80,13 @@ if __name__ == "__main__":
|
||||
|
||||
config = ConfigLoader()
|
||||
|
||||
|
||||
if not config.getConfig():
|
||||
bad_config = True
|
||||
config.configurationReady.connect(initializeProgram)
|
||||
else:
|
||||
initializeProgram()
|
||||
|
||||
|
||||
engine.rootContext().setContextProperty("sys_printers", printers)
|
||||
engine.rootContext().setContextProperty("bad_config", bad_config) # print(f"Fehler: {i}")
|
||||
engine.rootContext().setContextProperty("db_con", db_con)
|
||||
engine.rootContext().setContextProperty("config", config)
|
||||
|
||||
Reference in New Issue
Block a user