Fixing qml connection to save business with a new contact - some

database modifications
This commit is contained in:
2024-12-14 15:32:10 +01:00
parent 59e5fadd26
commit 559ad1b882
7 changed files with 54 additions and 22 deletions

View File

@@ -1,27 +1,30 @@
from PySide6.QtCore import QAbstractTableModel, QModelIndex, Qt, Slot, QObject, Signal
from .ContactDAO import ContactDAO
from ..ConfigLoader import ConfigLoader
import logging
class ContactModel(QObject):
contactIdReady = Signal(int)
def __init__(self):
super().__init__()
self.__conf = ConfigLoader().getConfig()
self.__key = self.__conf['pyqcrm']['ENCRYPTION_KEY']
#self.logger = logging.getLogger()
print(f"*** File: {__file__}, __init__()")
# print(f"*** File: {__file__}, __init__()")
self.__data = self.__getData()
def getContacts(self):
print(f"*** File: {__file__}, getContacts()")
# print(f"*** File: {__file__}, getContacts()")
logging.debug("No debug message")
return self.__data
def __getData(self):
print(f"*** File: {__file__}, __getData()")
# print(f"*** File: {__file__}, __getData()")
ContactDAO().getContacts()
@Slot(dict)
def addContact(self, contact):
i = ContactDAO().addContact(contact)
i = ContactDAO().addContact(contact, self.__key)
self.contactIdReady.emit(i)