RE: [Qt-root-l] RE: PyQt and PyROOT

From: Fine, Valeri <fine_at_bnl.gov>
Date: Tue, 16 Jan 2007 17:44:31 -0500


Hello Luca,

>From the first glance the main trouble to run GUI (it doesn't matter
which one Root or Qt at this point) application from PyROOT comes from the PyROOT code:

    # root thread, if needed, to prevent GUIs from starving, as needed

      if not self.keeppolling and not _root.gROOT.IsBatch():
         import threading
         self.__dict__[ 'keeppolling' ] = 1
         self.__dict__[ 'thread' ] = \
            threading.Thread( None, _processRootEvents, None, ( self, )
)
         self.thread.setDaemon( 1 )
         self.thread.start()


Therefore, can you check whether PyROOT is capable to run the standard ROOT "guitest.cxx" example with no crash? Sorry, I had no time to check this myself.

Can you

  1. comment out the line of $ROOTSYS/pyroot/ROOT.py:

       self.thread.start()

2. Start your main with the line

   print ROOT.gApplication

3. add the line

       ROOT.gApplication.Run()

     as the very last line of your main

4. Re-run your script.

I.e. do something like this:

if __name__ == '__main__':

    print ROOT.gApplication
    application = qt.qApp
    qt.QObject.connect(application,. . . )     w = MainWindow()

    w.show()
    w.resize(350, 350)
    w.show()

    ROOT.gApplication.Run()

Thank you,

Best Regards

                         Valeri Fine


Brookhaven National Laboratory
Upton, NY 11973, USA
Phone: +1 631 344 7806
Fax: +1 631 344 4206
E-mail: fine_at_bnl.gov

> -----Original Message-----
> From: qt-root-l-bounces_at_lists.bnl.gov [mailto:qt-root-l-
> bounces_at_lists.bnl.gov] On Behalf Of Qt-Root integration project
> Sent: Tuesday, January 16, 2007 10:28 AM
> To: Luca Baldini; qt-root-l_at_lists.bnl.gov
> Cc: WLavrijsen_at_lbl.gov; Johan Bregeon; ROOT Talk
> Subject: Re: [Qt-root-l] [ROOT] RE: PyQt and PyROOT
>
> Hi Luca, Thank you very much for your update.
>
> I'll investigate how PyROOT manages the ROOT event loop today to
provide
> you the further assistance.
>
> Mean time I need to know whether you did customize your
> $ROOTSYS/etc/system.rootrc or provide your custom ".rootrc" somewhere.
Can
> you send me these files? May be we should discuss the QtRoot issue via
> http://lists.bnl.gov/mailman/listinfo/qt-root-l
> <http://lists.bnl.gov/mailman/listinfo/qt-root-l> to avoid the
ROOTTALK
> pollution.
>
> I had explained the nature of the warnings:
>
> > Warning in <TClass::TClass>: no dictionary for class Qt is available
> > Warning in <TClass::TClass>: no dictionary for class QPaintDevice is
>
> and proposed the "way" to eliminate it. We need a Python's guru advice
to
> avoid "qtcint" shared library usage. Please, let me know whether I
should
> elaborate further.
>
> Have a nice day, Valeri
>
>
> ________________________________
>
> From: Luca Baldini [mailto:luca.baldini_at_pi.infn.it]
> Sent: Tue 1/16/2007 9:53 AM
> To: Fine, Valeri
> Cc: Luca Baldini; Johan Bregeon; WLavrijsen_at_lbl.gov; ROOT Talk
> Subject: Re: [ROOT] RE: PyQt and PyROOT
>
>
>
> Hi all,
> adding some more entropy...
> If we modify our "main" like this:
>
> if __name__ == '__main__':
> qt.QObject.connect(qt.qApp, qt.SIGNAL("lastWindowClosed()"),
qt.qApp,
> qt.SLOT("quit()"))
> w = MainWindow()
> w.resize(350, 350)
> w.show()
> qt.qApp.exec_loop()
>
> i.e. adding the qt.qApp stuff, the windows behaves like we expect...
> sometimes! Often it hangs up without
> the histogram inside, but once in a while it looks ok and we're able
to
> get the shell back by closing the window.
> Also note that we made a fresh ROOT installation with the qtFullRoot
> package, as suggested by Valeri.
> We don't have any error, anymore; just a couple of warnings:
>
> [online_at_pcglast23 test]$ ./pyqtroot.py
> ** $Id: TGQt.cxx,v 1.146 2007/01/15 07:30:32 fine Exp $ this=0x89fb928
> Warning in <TClass::TClass>: no dictionary for class Qt is available
> Warning in <TClass::TClass>: no dictionary for class QPaintDevice is
> available
>
> Thanks a lot for your patience, hope that helps.
>
> P.S. We also tried the ROOT.gApplication.Run(), and that does not
help.
> Note that by putting in the "main":
>
> if __name__ == '__main__':
> w = MainWindow()
> w.resize(350, 350)
> w.show()
> print qt.qApp
> print ROOT.gApplication
>
> what we get is:
>
> [online_at_pcglast23 test]$ ./pyqtroot.py
> ** $Id: TGQt.cxx,v 1.146 2007/01/15 07:30:32 fine Exp $ this=0x93078e8
> Warning in <TClass::TClass>: no dictionary for class Qt is available
> Warning in <TClass::TClass>: no dictionary for class QPaintDevice is
> available
> <qt.QApplication object at 0xb7ed302c>
> <ROOT.TApplication* object ("PyROOT::TPyROOTApplication") at
0x16d7f90>
>
> meaning that both qt.qApp and ROOT.gApplication seem to exist, at that
> point.
> I guess I'm confused, now.
>
> Cheers,
> Johan, Luca
>
>
> _______________________________________________
> Qt-Root-l mailing list
> Qt-Root-l_at_lists.bnl.gov
> http://lists.bnl.gov/mailman/listinfo/qt-root-l
Received on Tue Jan 16 2007 - 23:44:58 CET

This archive was generated by hypermail 2.2.0 : Wed Jan 17 2007 - 05:50:00 CET