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.logger = logging.getLogger() self.__key = ConfigLoader().getKey() print(f"*** File: {__file__}, __init__()") self.__data = self.__getData() def getContacts(self): print(f"*** File: {__file__}, getContacts()") logging.debug("No debug message") return self.__data def __getData(self): print(f"*** File: {__file__}, __getData()") ContactDAO().getContacts() @Slot(dict) def addContact(self, contact): print(len(self.__key)) print(self.__key) i = ContactDAO().addContact(self.__key, contact) self.contactIdReady.emit(i)