[PyQt] QObject confusion

Arve Knudsen arve.knudsen at gmail.com
Mon Jul 23 17:03:48 BST 2007


Hello Jason

First of all, is Activation.http a QObject? I think what you want to do is:

QObject.connect(self.http, SIGNAL('done(bool)'), self.loginResponseCvd)

QObject.connect is a static class method, so there's no point in calling it
on an Activation instance. When it comes to emit however, it should be
treated as an instance method (self.emit).

Arve

On 7/23/07, Jason Hihn <jason at eyemaginations.com> wrote:
>
>  In the class below (where I use … for brevity) when I have the Activation
> class not as a QObject but as a plain python class, the loginReponseRcvd()
> gets called. As soon as I make it a QObject (so I can emit) it stops
> working. The commented out line I tried and it told me that the underlining
> C++ object was deleted…
>
>
>
> Can anyone offer a suggestion?
>
> Thanks!
>
>
>
>
>
>
>
> class Activation(QObject):
>
>>
>             def login (self, username, password):
>
>>
>                         #self.connect(self.http, SIGNAL('done(bool)'),
> self, SLOT('loginReponseRcvd(bool)'))
>
>                         self.connect(self.http, SIGNAL('done(bool)'),
> self.loginReponseRcvd)
>
>
>
>                         self.http.get(getdata)
>
>                         print 'login'
>
>
>
>             def loginReponseRcvd(self, error):
>
>                         print 'loginReponseRcvd: ', error
>
>                         if error:
>
>                                     print str(self.http.errorString())
>
>                         else:
>
>                                     data=str(self.http.readAll())
>
>                                     print 'data:', data
>
>                                     QObject.emit(self,
> SIGNAL('loggedIn(bool)'), data=='1')
>
>                         QApplication.exit(0)
>
>
>
> ---
>
> Regards,
>
> Jason Hihn
>
> Director of Software Engineering
> Eyemaginations, Inc.
>
> 600 Washington Ave, Suite #100
> Towson, MD 21204
> Domestic: 877.321.5481 ext. 8617
> International: 410.321.5481 ext. 8617
> Fax: 410.616.8657
> jason at eyemaginations.com
> www.eyemaginations.com
> www.3d-eye.com
>
> =================================================
> The information transmitted within this email document or fax is intended
> only for
>
> the person(s) or entity to which it is specifically addressed and may
> contain
>
> confidential and/or privileged material of Eyemaginations. Any
> re-creation, review,
>
> distribution, retransmission, dissemination or other use of, or taking of
> any action
>
> in reliance upon, this information by persons or entities other than the
> intended
>
> parties is completely prohibited. If you have received this email in
> error, please
>
> contact the sender or author and permanently delete and destroy the email
> from
>
> any computer which houses its contents.
>
> =================================================
>
>
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070723/e80877cb/attachment.html


More information about the PyQt mailing list