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

List:       pykde
Subject:    Re: [PyQt] multiple dialog boxes simultaneously
From:       Doug Bell <dougb () bellz ! org>
Date:       2007-11-30 11:17:29
Message-ID: 20071130111728.GA21587 () honey ! rootshell ! be
[Download RAW message or body]

Pradnyesh Sawant wrote:
> Hello,
> I have 2 new doubts, related to the same problem. As suggested by Oleg, I'm
> now going on creating new dialogs as I require. I'll first give an overview
> of the code:
> 
> ***************************************************************************
> from time import ctime, time, sleep
> import sys
> from PyQt4 import QtGui, QtCore
> 
> class Jrnl(QtGui.QDialog):
>     def __init__(self, parent = None):
>         QtGui.QDialog.__init__(self, parent)
> 
>         self.createFe()
>         self.showFe()
>     def createFe(self):
>         # create widgets and add them to layout
>     def showFe(self):
>         tmr = QtCore.QTimer(self)
>         tmr.setSingleShot(True)
>         self.connect(tmr, QtCore.SIGNAL("timeout()"), self.newDialog)
>         tmr.start(1000)
>         # sleep(1)
>         # self.newDialog()
>     def newDialog(self):
>         self.show()
>         jrnl = Journal()
> if __name__ == "__main__":
>     app = QtGui.QApplication(sys.argv)
>     jrnl = Journal()
>     sys.exit(jrnl.exec_())
> ***************************************************************************
> So, basically, what I'm trying to do is as soon as one jrnl instance shows
> itself, it creates a new instance (of Journal class). It works fine with
> the sleep(1) statement (the statements which are commented in the showFe
> method), but hangs the dialog (i can't do anything to/with it). However,
> the QTimer thing does not seem to work at all :(

Since you aren't keeping a refernce to QTimer or giving it an explicit Qt
parent, it's probably getting garbage collected.  Try replacing tmr with
self.tmr.

> The other doubt is that only the last created dialog box can have focus.
> How do I make it possible to give all dialog boxes the focus?

That doesn't make sense to me.  Focus means that keyboard entries will go to
the focused widget.  Do you want the same keyboard input to go to all of the
dialogs?  That's non-standard, and would probably take a fair amount of code to
work around the normal behavior.

Doug.
_______________________________________________
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