<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Florian,<div><br></div><div>Thanks.</div><div><br></div><div>Yes, I have put pyqtSignal() in my code.</div><div><br></div><div><div style="margin: 0px; font-size: 11px; font-family: Monaco;">Here's the old style</div><div style="margin: 0px; font-size: 11px; font-family: Monaco;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Monaco;"><div style="margin: 0px; min-height: 15px;"><span style="color: rgb(4, 51, 255);">class</span> DatabaseProxy(Proxy, QObject):</div><div style="margin: 0px;"> databaseChanged = pyqtSignal(object)</div><div style="margin: 0px;"> </div><div style="margin: 0px;"><span style="color: rgb(4, 51, 255);"> def</span> __init__(self, url):</div><div style="margin: 0px; color: rgb(203, 203, 203);"><span style="color: rgb(0, 0, 0);"> </span># Call <span style="text-decoration: underline;">superclasses</span></div><div style="margin: 0px;"> Proxy.__init__(</div><div style="margin: 0px;"> self, self.NAME, DatabaseAdapter(url))</div><div style="margin: 0px;"> QtCore.QObject.__init__(self)</div><div style="margin: 0px; min-height: 15px;"><br></div><div style="margin: 0px; color: rgb(203, 203, 203);"><span style="color: rgb(0, 0, 0);"> </span># Public attributes</div><div style="margin: 0px;"> self.session = <span style="color: rgb(4, 51, 255);">None</span> </div><div style="margin: 0px;"><div style="margin: 0px;"> <span style="color: #0433ff">def</span> onRegister(self):</div><div style="margin: 0px;"> <span style="color: #00b400">"""</span></div><div style="margin: 0px; color: rgb(0, 180, 0);"> Create a new database session</div><div style="margin: 0px; color: rgb(0, 180, 0);"> """</div><div style="margin: 0px; color: rgb(203, 203, 203);"><span style="color: #000000"> </span># Create session</div><div style="margin: 0px;"> self.session = self.new_event_session()</div></div></div><div style="margin: 0px; font-size: 11px; font-family: Monaco;"> self.connect(</div><div style="margin: 0px; font-size: 11px; font-family: Monaco;"> QtCore.QCoreApplication.instance(),</div><div style="margin: 0px; font-size: 11px; font-family: Monaco;"> QtCore.SIGNAL(b"databaseChanged(PyQt_PyObject)"),</div><div style="margin: 0px; font-size: 11px; font-family: Monaco;"> self.on_database_updated_signal,</div><div style="margin: 0px; font-size: 11px; font-family: Monaco;"> Qt.QueuedConnection</div><div style="margin: 0px; font-size: 11px; font-family: Monaco;"> )</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; color: rgb(203, 203, 203);"><br></div><p style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px;"><br></p><p style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px;"><br></p><p style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px;">Here's the new style:-</p><p style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px;"><br></p><p style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px;"><br></p><p style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px;"><span style="color: rgb(4, 51, 255);">class</span> DatabaseProxy(Proxy, QObject):</p><div style="margin: 0px; font-size: 11px; font-family: Monaco;"> databaseChanged = pyqtSignal(object) </div><div style="margin: 0px; font-size: 11px; font-family: Monaco;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Monaco;"><span style="color: #0433ff"> def</span> __init__(self, url):</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; color: rgb(203, 203, 203);"><span style="color: #000000"> </span># Call <span style="text-decoration: underline">superclasses</span></div><div style="margin: 0px; font-size: 11px; font-family: Monaco;"> Proxy.__init__(</div><div style="margin: 0px; font-size: 11px; font-family: Monaco;"> self, self.NAME, DatabaseAdapter(url))</div><div style="margin: 0px; font-size: 11px; font-family: Monaco;"> QtCore.QObject.__init__(self)</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; color: rgb(203, 203, 203);"><span style="color: #000000"> </span># Public attributes</div><div style="margin: 0px; font-size: 11px; font-family: Monaco;"> self.session = <span style="color: rgb(4, 51, 255);">None</span> </div><div style="margin: 0px; font-size: 11px; font-family: Monaco;"><span style="color: rgb(4, 51, 255);"> </span></div><div style="margin: 0px; font-size: 11px; font-family: Monaco;"><span style="color: rgb(4, 51, 255);"> def</span> onRegister(self):</div><div style="margin: 0px; font-size: 11px; font-family: Monaco;"> <span style="color: #00b400">"""</span></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; color: rgb(0, 180, 0);"> Create a new database session</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; color: rgb(0, 180, 0);"> """</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; color: rgb(203, 203, 203);"><span style="color: #000000"> </span># Create session</div><div style="margin: 0px; font-size: 11px; font-family: Monaco;"> self.session = self.new_event_session() </div><div style="margin: 0px; font-size: 11px; font-family: Monaco;"> self.databaseChanged.connect(</div><div style="margin: 0px; font-size: 11px; font-family: Monaco;"> self.on_database_updated_signal,</div><div style="margin: 0px; font-size: 11px; font-family: Monaco;"> Qt.QueuedConnection)</div></div><div><br></div><div><br></div><div><br></div><div><br></div><div>The only thing I'm trying to work out is what happened to <span style="font-family: Monaco; font-size: 11px;">QtCore.QCoreApplication.instance() in the new style?</span></div><div><span style="font-family: Monaco; font-size: 11px;">Do i need to bring it back into play somehow? I'm just trying to understand the old style in this instance so I can ensure that I port from 4 to 5 cleanly without breaking functionality.</span></div><div><span style="font-family: Monaco; font-size: 11px;"><br></span></div><div><span style="font-family: Monaco; font-size: 11px;"><br></span></div><div>Now i've changed the signal to the new style it not longer errors in the eclipse runner/debugger. </div><div><br></div><div><br></div><div>Rob</div><div><br></div><div><br></div><div><br></div><div><br><div><div>On 28 May 2015, at 13:15, Florian Bruhin <<a href="mailto:me@the-compiler.org">me@the-compiler.org</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><blockquote type="cite">It looks as if you are trying to have your signal not just exist but pass a<br>parameter? The syntax for that in pyQtSignal is a bit obscure and I'm not<br>comfortable with it so maybe somebody else can write about that.<br></blockquote><br>It's quite simple, IMHO (at least as you don't need overloaded<br>signals):<br><br> class myWidget( QWidget ):<br> databaseChanged = pyqtSignal(str)<br><br> [...]<br><br> # self.react_to_db is a callable taking one argument.<br> self.databaseChanged.connect( self.react_to_db )<br><br> [...]<br><br> if database_has_changed :<br> # database_name has to be a string<br> self.databaseChanged.emit(database_name)<br><br>(also, note that it's pyqtSignal, not pyQtSignal)<br><br>Florian<br><br>-- <br><a href="http://www.the-compiler.org">http://www.the-compiler.org</a> | <a href="mailto:me@the-compiler.org">me@the-compiler.org</a> (Mail/XMPP)<br> GPG: 916E B0C8 FD55 A072 | <a href="http://the-compiler.org/pubkey.asc">http://the-compiler.org/pubkey.asc</a><br> I love long mails! | <a href="http://email.is-not-s.ms/">http://email.is-not-s.ms/</a><br>_______________________________________________<br>PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br><a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a></blockquote></div><br></div></body></html>