[PyQt] QProcess issues

Detlev Offenbach detlev at die-offenbachs.de
Mon Sep 15 18:55:48 BST 2008


On Montag, 15. September 2008, Oguz Yarimtepe wrote:
> Hi,
>
> On Sat, 2008-09-13 at 15:54 +0200, Detlev Offenbach wrote:
> > You probably want to execute the processes sequentially, i.e. start
> > the next
> > when the previous one has finished. In order to do that you should use
> > code
> > like this in your startProcess method after self.process.start().
> >
> > if ok:
> >   finished = self.process.waitForFinished()
>
> Thanx for the example but i am using qt3. I didn`t see any
> waitForFinished() method at the reference manual. Any equivalent of it
> at qt3?
>

In eric3 I used code like the one below.

	    timeoutTimer = QTime()
            if timeout:
                timeoutTimer.start()
            while proc.isRunning():
                qApp.processEvents()
                QThread.msleep(10)
                qApp.processEvents()
                if timeout and timeoutTimer.elapsed() >= timeout:
                    try:
                        proc.tryTerminate()
                        QTimer.singleShot(2000, proc, SLOT('kill()'))
                    except:
                        pass
                    self.__syncProc = None
                    return 1
            return proc.normalExit()


Regards,
Detlev
-- 
Detlev Offenbach
detlev at die-offenbachs.de


More information about the PyQt mailing list