[PyQt] Fwd: database notification

Paolo De Stefani paolo at paolodestefani.it
Tue Jul 21 08:26:11 BST 2015


Is there anybody that can help me ?

-------- Messaggio originale --------
Oggetto: [PyQt] database notification
Data: 20/07/2015 12:20
Mittente: Paolo De Stefani <paolo at paolodestefani.it>
Destinatario: PyQt at riverbankcomputing.com

I'm try to manage database notifications from pyqt. From the Qt docs 
there are 2 signals:

void	notification(const QString & name)
void	notification(const QString & name, QSqlDriver::NotificationSource 
source, const QVariant & payload)

the second one can catch the payload and is the signal i want to connect 
to a python slot

 From the PyQt docs i see that "The pyqtSlot() decorator can be used to 
specify which of the signals should be connected to the slot."

So this is the code i use:

     db.driver().subscribeToNotification(CHANNEL)
     db.driver().notification.connect(notify_handle)

@pyqtSlot(str, int, str)
def notify_handle(text1, num='Nothing', text2='Nothing'):
     print("TXT1", text1, "NUM", num, "TEXT2", text2)

I test the code and i can catch the signal BUT looks like i'm using the 
first form of the signal not the second so i can not get the payload.

What's wrong in my code ?

Paolo De Stefani

_______________________________________________
PyQt mailing list    PyQt at riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


More information about the PyQt mailing list