[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] Fwd:  database notification
From:       Paolo De Stefani <paolo () paolodestefani ! it>
Date:       2015-07-21 10:23:09
Message-ID: 519a3eb2821d28f06ca7d24a54f322e9 () paolodestefani ! it
[Download RAW message or body]

Thank you Phil

After some attempts i found that this works:

db.driver().notification['QString', 'QSqlDriver::NotificationSource', 
'QVariant'].connect(notify_handle)

and this too:

db.driver().notification[str, 'QSqlDriver::NotificationSource', 
'QVariant'].connect(notify_handle)

maybe this is usefull for other people troubling with similar problems

Paolo De Stefani

Il 21/07/2015 09:46 Phil Thompson ha scritto:
> On 21/07/2015 8:26 am, Paolo De Stefani wrote:
>> Is there anybody that can help me ?
>> 
>> -------- Messaggio originale --------
>> Oggetto: [PyQt] database notification
>> Data: 20/07/2015 12:20
>> Mittente: Paolo De Stefani <paolo@paolodestefani.it>
>> Destinatario: PyQt@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)
> 
> ...which is not the signature of the signal.
> 
>> 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.
> 
> Just select the correct signal using indexing and connect to an
> undecorated slot.
> 
> Phil
> _______________________________________________
> PyQt mailing list    PyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic