[PyQt] Help with Login Dialog / QThread issues
Nick Gaens
mail at nickgaens.com
Mon Aug 8 16:10:42 BST 2011
I've quickly created this for you, hope it helps a bit.
Note: it's not working 100%, since the main event loop isn't terminated
after the dialog is closed.
On Mon, Aug 8, 2011 at 16:58, Baz Walter <bazwal at ftml.net> wrote:
> On 08/08/11 14:58, Eric Frederich wrote:
>
>> I'm just a little confused on what connections to make.
>> I'm sure I could get something working but I'd be going about it the wrong
>> way.
>>
>> Forget my original post.
>>
>> This is what I want.
>> I want a login dialog with username, password and group.
>> I want that dialog to stay up until the login is successful or user hits
>> cancel.
>> I have a QThread subclass for logging in.
>> It emits either "success" or "fail", and with fail it provides some
>> text feedback.
>> When the login thread starts a progress bar should start animating.
>>
>> This is where I am completely lost as far as connections go.
>> The QDialogButtonBox has accepted, rejected.
>> The QDialog has accepted, rejected.
>> My login thread has success, and fail.
>> There are clicked() signals as well.
>>
>> Its not complicated, but I'm new to Qt and PyQt.
>> I think I need someone to spell it out for me.
>>
>
> okay. in designer, open up View -> Signal/Slot Editor, remove the
> buttonBox.accepted() connection, and then re-compile.
>
> next, in your LoginDialog class, rename your accept method to, say,
> handleAccepted, and connect it to the accepted() signal of the buttonBox:
>
> self.buttonBox.accepted.**connect(self.handleAccepted)
>
> finally, in handleAccepted, replace the thread connection with:
>
> self.lt.finished.connect(self.**accept)
>
> (obviously, i haven't tested this at all, but hopefully it will give you
> the general idea).
>
>
> ______________________________**_________________
> PyQt mailing list PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.**com/mailman/listinfo/pyqt<http://www.riverbankcomputing.com/mailman/listinfo/pyqt>
>
--
Nick Gaens
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110808/7cf5821a/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LoginDialog.py
Type: application/octet-stream
Size: 795 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110808/7cf5821a/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.py
Type: application/octet-stream
Size: 413 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110808/7cf5821a/attachment-0003.obj>
More information about the PyQt
mailing list