Menu

#110 Problem with taurusgui in debian if taurus console module is installed

Jan15
resolved
bug
2015-03-30
2014-09-30
No

Hello,
I add here the relevant e-mails about the problem:

  • From Teresa (25-09-14):

    I have a problem working with taurusgui in Debian computers.

taurusgui macrogui

works without problems, but if I use the example example01 I get
the error:

Traceback (most recent call last):
File "/usr/bin/taurusgui", line 27, in <module>
main()
File "/usr/lib/python2.7/dist-packages/taurus/qt/qtgui/taurusgui/taurusgui.py", line 1369, in main
gui = TaurusGui(None, confname=confname, configRecursionDepth=configRecursionDepth)
File "/usr/lib/python2.7/dist-packages/taurus/qt/qtgui/taurusgui/taurusgui.py", line 298, in init
self.loadConfiguration(confname)
File "/usr/lib/python2.7/dist-packages/taurus/qt/qtgui/taurusgui/taurusgui.py", line 924, in loadConfiguration
self.createConsole(CONSOLE)
File "/usr/lib/python2.7/dist-packages/taurus/qt/qtgui/taurusgui/taurusgui.py", line 684, in createConsole
console = TaurusConsole(kernels=kernels)
File "/usr/lib/python2.7/dist-packages/taurus/qt/qtgui/console/taurusconsole.py", line 47, in init
self._window = window = TaurusConsoleFactory().new_window(kernels=kernels)
File "/usr/lib/python2.7/dist-packages/taurus/qt/qtgui/console/taurusconsolefactory.py", line 121, in new_window
window.register_kernel_extension(extension)
File "/usr/lib/python2.7/dist-packages/taurus/qt/qtgui/console/taurusconsolewindow.py", line 92, in register_kernel_extension
action = Qt.QAction(extension.Label, self, triggered=f)
TypeError: arguments did not match any overloaded call:
QAction(QObject): argument 1 has unexpected type 'str'
QAction(QString, QObject): argument 2 has unexpected type 'TaurusConsoleWindow'
QAction(QIcon, QString, QObject): argument 1 has unexpected type 'str'

The same happens with any new gui that I create with:

taurusgui --new-gui

if I do NOT enable the Sardana Communication.

Looking at the generated config.xml file I found out that the line:

<MACROSERVER_NAME>my/macroserver/device</MACROSERVER_NAME>

has always to be there, in any other case I get the error shown
above.
In our computers with Scientific Linux everything is fine, this
problem does not exist.
Somebody working in debian tried it and it works?.

  • 25-09-14

If taurus.qt.qtgui.console is not installed the problem is not there

  • From Teresa (29-09-14)

I found which is the difference between calling
taurusgui with the macrogui configuration and calling it with
any other configuration not defining a MACROSERVER_NAME.
In the first case the import:

try:
from IPython.qt.console.mainwindow import MainWindow
except ImportError:
from IPython.frontend.qt.console.mainwindow import MainWindow

that is needed because TaurusConsoleWindow derives from MainWindow,
gets MainWindow as type:

PyQt4.QtCore.pyqtWrapperType

but in the second case it is taken as:

Shiboken.ObjectType

With this second type the call to:

QAction(QString, QObject)

gives an error because Shiboken.ObjectType is not a QObject:

TypeError: arguments did not match any overloaded call:
QAction(QObject): argument 1 has unexpected type 'str'
QAction(QString, QObject): argument 2 has unexpected type 'TaurusConsoleWindow'
QAction(QIcon, QString, QObject): argument 1 has unexpected type 'str'

The reason why one or the other type is returned comes from the file:

IPython/external/qt/py.qt

In the first case PyQt4 is imported, but in the second case it is PySide. If you look at the file you can see the conditions there.
In our case QT_API is not defined and PySide version is 1.1, so
PySide is taken.
When taurusgui macrogui is called the call to

    from taurus.qt.qtgui.taurusgui import MacroBroker
    self.__macroBroker = MacroBroker(self)

that is done in case

MACROSERVER_NAME is not None

in the loadConfiguration funcion of the class TaurusGui makes
that the import of PyQt4 instead of the one of PySide is done.

If I define QT_API as pyqt the problem is solved, because in
that case it will be always used PyQt4 instead of PySide.

  • Solution from Carlos (30-09-14)

From what I see we need to match the qt selector from IPython.external
with the qt selector from taurus.external.qt

One can do that adding to the initialize() function of
taurus/external/qt/init.py, just before the "return qt":

QT_API = os.environ.get('QT_API')
if QT_API is None:
global QT_NAME
if
QT_NAME == 'PySide':
QT_API = 'pyside'
else:
QT_API = 'pyqt'
os.environ['QT_API'] = QT_API

and make an:

import os

in the file.

In this way, we would force IPython to use the same API as taurus
without forcing the user to set the QT_APY environment variable
manually.

Discussion

  • Teresa Nunez

    Teresa Nunez - 2014-09-30

    A patch for solving the problem will be send to the list.

     
  • Teresa Nunez

    Teresa Nunez - 2014-09-30
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -51,11 +51,11 @@
      problem does not exist.
     Somebody working in debian tried it and it works?.
    
    -** 25-09-14
    +* 25-09-14
    
     If taurus.qt.qtgui.console is not installed the problem is not there
    
    -** From Teresa (29-09-14)
    +* From Teresa (29-09-14)
    
     I found which is the difference between calling
     taurusgui with the macrogui configuration and calling it with
    @@ -110,7 +110,7 @@
      If I define QT_API as pyqt the problem is solved, because in
      that case it will be always used PyQt4 instead of PySide.
    
    -** Solution from Carlos (30-09-14)
    +* Solution from Carlos (30-09-14)
    
     From what I see we need to match the qt selector from IPython.external 
     with the qt selector from taurus.external.qt
    
     
  • Teresa Nunez

    Teresa Nunez - 2014-09-30
    • status: waiting --> resolved
     
  • Tiago Coutinho

    Tiago Coutinho - 2015-03-30

    Ticket moved from /p/sardana/tickets/252/

    Can't be converted:

    • _category: taurus-qt
     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.