RE: ruby with root + qt

From: Fine, Valeri <fine_at_bnl.gov>
Date: Thu, 23 Jul 2009 18:59:28 -0400


Hello Robert,

I've paid attention to the description you had provided

> > > > Versions:
> > > > Root v5.20/00
> > > > Ruby ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
> > > > opensuse 11.1 with kde 4.2.4 and ruby-kde4 4.2.4

Was your ROOT 5.20/00 built with Qt-layer "enabled"? If "yes", then which Qt version was used? The presence of the "kde 4.2.4" doesn't mean the Qt 4.x was in use to build ROOT.

I think, the best way to reduce the guess job is to re-build the Qt-layer against your current ROOT version the way the page http://root.bnl.gov/QtRoot/How2Install4Unix.html describes.

Best regards, Valeri

>
> Hello Robert,
>
> > Maybe I find some time on the weekend to read something about the
qt-
> layer
> > configs.
>
> Please, read. This is the first think to do.
> The text to read is one page long.
> Please spend another weekend using "search engine" to look up
> "Qt4 + QtRoot +ROOT" topics.
>
> Then (I am sorry, I have to repeat)
>
> > Anyway, before going further with the guess job please clarify:
> >
> > 1. What your ROOT version is
> > 2. What your Qt version is
> > 3. Does you activate QtROOT layer via ROOT resource file
> >
> > see: "Qt-layer Configuration"
> > ftp://root.cern.ch/root/doc/26ROOTandQt.pdf
> > p.424
> > ?
> > 4. Does the patched version of "qtexample.py" works for you?
>
> In the other words, please, provide us the step-by-step instruction to
> reproduce your issue.
>
> By the way, does PyQt4 interactive examples work for you (with NO
> ROOT/QtRoot)?
>
> 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: Riemann, Robert [mailto:robert.riemann_at_physik.hu-berlin.de]
> > Sent: Thursday, July 23, 2009 2:34 PM
> > To: Fine, Valeri
> > Cc: roottalk_at_root.cern.ch; Zoltan.Mathe_at_ucdconnect.ie
> > Subject: Re: [ROOT] ruby with root + qt
> >
> > I tested the new pyroot example, but the program aborted with the
> > following
> > message:
> >
> >
> > > python qt3example.py
> > Traceback (most recent call last):
> > File "qt3example.py", line 47, in <module>
> > terminator = ROOT.TQtRootSlot.CintSlot()
> > File "lib/ROOT.py", line 345, in __getattr1
> > return getattr( self, name )
> > File "lib/ROOT.py", line 367, in __getattr2
> > attr = _root.LookupRootEntity( name )
> > AttributeError: TQtRootSlot
> >
> > I published qt3example.py on a code-snippet-wiki
> > (editable without login):
> > http://refactory.org/s/using_root_with_python_and_qt4/view/1
> >
> > Maybe I find some time on the weekend to read something about the
qt-
> layer
> > configs.
> >
> > Greets Robert
> >
> >
> > Am Donnerstag, 23. Juli 2009 19:44:55 schrieb Fine, Valeri:
> > > Hello Robert,
> > >
> > > I have neither Python nor PyQt installed to debug PyROOT related
> issue.
> > >
> > > > I tried to translate the python+qt example from the userguide to
> ruby.
> > > >
> > > >> I had to add one modification (line 17, actually in comments)
to
> get
> > >
> > > it
> > >
> > > > working, but the program doesn't behave as well as the python-
> version.
> > >
> > > From the first glance the example:
> > > ftp://root.cern.ch/root/doc/19PythonRuby.pdf is for Qt3.
> > >
> > > That was fixed by Zoltan Mathe (See his E-mail below)
> > >
> > > >> -----Original Message-----
> > > >> From: Zoltan MATHE [mailto:Zoltan.Mathe_at_ucdconnect.ie]
> > > >> Sent: Wednesday, June 10, 2009 7:50 AM
> > > >> To: Fine, Valeri
> > > >> Cc: WLavrijsen_at_lbl.gov; Rene Brun
> > > >> Subject: Re: [Fwd: root and qt problem]
> > > >>
> > > >> Hello, :)
> > > >> I changed the qtexample.py, because it is implemented qt3. I
> attached
> > > >>
> > > >> the file. But it still dosn't work.
> > >
> > > ....
> > >
> > > I've submitted his patch to CERN.
> > >
> > > Index: qtexample.py
> > >



> > > --- qtexample.py (revision 29535)
> > > +++ qtexample.py (working copy)
> > > @@ -1,26 +1,29 @@
> > > import sys
> > > -import qt
> > >
> > > +from PyQt4.QtGui import *
> > > +from PyQt4.QtCore import *
> > > +
> > > +
> > > import ROOT
> > > import sip
> > >
> > > -class window(qt.QMainWindow):
> > > +class window(QMainWindow):
> > > def __init__(self):
> > > # Init the main window.
> > > - qt.QMainWindow.__init__(self)
> > > + QMainWindow.__init__(self)
> > > self.resize(350, 350)
> > >
> > > # Create the central widget.
> > > - self.CentralWidget = qt.QWidget(self)
> > > + self.CentralWidget = QWidget(self)
> > > self.setCentralWidget(self.CentralWidget)
> > > - self.Layout = qt.QGridLayout(self.CentralWidget)
> > > + self.Layout = QGridLayout(self.CentralWidget)
> > >
> > > # Create a button.
> > > - self.QuitButton = qt.QPushButton(self.centralWidget())
> > > + self.QuitButton = QPushButton(self.centralWidget())
> > > self.QuitButton.setText('Quit')
> > > self.Layout.addWidget(self.QuitButton, 1, 0)
> > > # Connect the button.
> > > - qt.QObject.connect(self.QuitButton,
qt.SIGNAL('clicked()'),
> > > self.quit)
> > > + QObject.connect(self.QuitButton, SIGNAL('clicked()'),
> > > self.quit)
> > >
> > > # Create a root histogram.
> > > self.hist = ROOT.TH1F("pipo","pipo", 100, 0, 100)
> > > @@ -31,7 +34,7 @@
> > >
> > > # Place the TQtWidget in the main grid layout and draw the
> > > histogram.
> > >
> > > -
> > >

>
self.Layout.addWidget(sip.wrapinstance(ROOT.AddressOf(self.Canvas)[0],qt
> > > .QWidget), 0, 0)
> > > +
> > >

>
self.Layout.addWidget(sip.wrapinstance(ROOT.AddressOf(self.Canvas)[0],QW
> > > idget), 0, 0)
> > > self.hist.Draw()
> > >
> > > def quit(self):
> > > @@ -40,11 +43,12 @@
> > >
> > >
> > > if __name__ == '__main__':
> > > - application = qt.qApp
> > > + application = qApp
> > > terminator = ROOT.TQtRootSlot.CintSlot()
> > > - termAddress =
> > > sip.wrapinstance(ROOT.AddressOf(terminator)[0],qt.QObject)
> > > - qt.QObject.connect(application,
> > > qt.SIGNAL("lastWindowClosed()"),termAddress
,qt.SLOT("Terminate()"))
> > > + termAddress =
> > > sip.wrapinstance(ROOT.AddressOf(terminator)[0],QObject)
> > > + QObject.connect(application,
> > > SIGNAL("lastWindowClosed()"),termAddress ,SLOT("Terminate()"))
> > > w = window()
> > > w.show()
> > > ROOT.gApplication.Run(1)
> > > print 'Bye forever!'
> > > +
> > >
> > > > Closing the TBrowser and restarting with another
> > > > click on the button doesn't work.
> > > > In some cases windows freeze. Without the
> > > > fork-command the qt-window freezes.
> > >
> > > From the first glance, your application lacks of the "event loop"
by
> > > some reason.
> > >
> > > > Maybe it's a bug. Does anyone have a better idea how to make it
with
> > >
> > > ruby?
> > >
> > > I am not aware about any attempt to use QtRoot with ruby.
> > >
> > > Anyway, before going further with the guess job please clarify:
> > >
> > > 1. What your ROOT version is
> > > 2. What your Qt version is
> > > 3. Does you activate QtROOT layer via ROOT resource file
> > >
> > > see: "Qt-layer Configuration"
> > > ftp://root.cern.ch/root/doc/26ROOTandQt.pdf
> > > p.424
> > > ?
> > > 4. Does the patched version of "qtexample.py" works for you?
> > >
> > > Thank you, Valeri
> > >
> > >
> > >
> > > -
> > >
> > > > Greets Robert
> > > >
> > > > Versions:
> > > > Root v5.20/00
> > > > Ruby ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
> > > > opensuse 11.1 with kde 4.2.4 and ruby-kde4 4.2.4
> > > >
> > > > Code with highlighting on pastie.org: http://pastie.org/548613
> > > > Code without highlighting here:
> > > >
> > > > #!/usr/bin/env ruby
> > > > $KCODE = 'u' # use utf8 encoding of this file
> > > >
> > > > require 'Qt4'
> > > > require 'libRuby'
> > > >
> > > > class CustomWidget < Qt::PushButton
> > > >
> > > > slots :browse
> > > >
> > > > def initialize( label )
> > > > super( label )
> > > > end
> > > >
> > > > def browse
> > > > tb = TBrowser.new
> > > > # fork do gApplication.Run end
> > > > end
> > > >
> > > > end
> > > >
> > > > a = Qt::Application.new(ARGV) # create an application object
> > > > w = CustomWidget.new( 'Start TBrowser' ) # create an instance of
our
> > >
> > > self-
> > >
> > > > made
> > > > CustomWidget
> > > > Qt::Object.connect( w, SIGNAL( :clicked ), w, SLOT( :browse ) )
> > > > w.show # show our widget
> > > > a.exec # run the application
Received on Fri Jul 24 2009 - 00:59:40 CEST

This archive was generated by hypermail 2.2.0 : Fri Jul 24 2009 - 17:50:02 CEST