TaurusJDrawSynopticsView crash with some jdraw files :

Trying to display a jdraw file in a Taurus Application with TaurusJDrawSynopticsView, depending on the file (the best issues, the random ones :) ) , when executing .setModel('path_to_djraw_file') application crashes:

code

import sys
from taurus.external.qt import Qt
from taurus.qt.qtgui.panel import TaurusForm
from taurus.qt.qtgui.application import TaurusApplication
from taurus.qt.qtgui.graphic import TaurusJDrawSynopticsView

app = TaurusApplication(sys.argv, cmd_line_parser=None)


jdraw = TaurusJDrawSynopticsView()
jdraw.setModel('/home/vergaral/tmp/jdrawTest.jdw')

jdraw2 = TaurusJDrawSynopticsView()
jdraw2.setModel('/home/vergaral/tmp/cryo-template.jdw')

jdraw.show()
jdraw2.show() 

sys.exit(app.exec_())

if the jdraw2.setModel('/home/vergaral/tmp/cryo-template.jdw') line is commented, then the jdrawTest.jdw file is correctly displayed. Please find below the two jdraw files.

stack trace

python jdrawTest.py 
MainThread     INFO     2025-08-18 13:53:51,762 TaurusRootLogger: Using PyQt5 (v5.15.11 with Qt 5.15.15 and Python 3.13.3)
MainThread     INFO     2025-08-18 13:53:51,820 TaurusRootLogger: Plugin "taurus_pyqtgraph" lazy-loaded as "taurus.qt.qtgui.tpg"
MainThread     WARNING  2025-08-18 13:53:51,859 TaurusRootLogger: Qtqt.qpa.plugin None.None[0]: Could not find the Qt platform plugin "wayland" in ""
MainThread     WARNING  2025-08-18 13:53:51,983 TaurusJDrawGraphicsFactory: Error fetching object
MainThread     INFO     2025-08-18 13:53:51,983 TaurusJDrawGraphicsFactory: Details:
Traceback (most recent call last):
  File "/home/vergaral/git/taurus/lib/taurus/qt/qtgui/graphic/jdraw/jdraw.py", line 138, in getObj
    obj = method(params)
  File "/home/vergaral/git/taurus/lib/taurus/qt/qtgui/graphic/jdraw/jdraw.py", line 283, in getSwingObjectObj
    item = self.getGraphicsItem("SwingObject", params)
  File "/home/vergaral/git/taurus/lib/taurus/qt/qtgui/graphic/taurusgraphic.py", line 1803, in getGraphicsItem
    self.set_common_params(item, params)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "/home/vergaral/git/taurus/lib/taurus/qt/qtgui/graphic/jdraw/jdraw.py", line 363, in set_common_params
    item.setModel(name)
    ~~~~~~~~~~~~~^^^^^^
  File "/home/vergaral/git/taurus/lib/taurus/qt/qtgui/graphic/taurusgraphic.py", line 1280, in setModel
    if issubclass(Manager().findObjectClass(self._name), TaurusDevice):
       ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: issubclass() arg 1 must be a class
MainThread     WARNING  2025-08-18 13:53:51,984 JDraw Parser: Failed to parse /home/vergaral/tmp/cryo-template.jdw
MainThread     WARNING  2025-08-18 13:53:51,984 TaurusJDrawSynopticsView: TaurusJDrawSynopticsView.setModel(/home/vergaral/tmp/cryo-template.jdw): Unable to parse /home/vergaral/tmp/cryo-template.jdw!!!
Traceback (most recent call last):
  File "/home/vergaral/git/taurus-test/jdrawTest.py", line 14, in <module>
    jdraw2.setModel('/home/vergaral/tmp/cryo-template.jdw')
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vergaral/git/taurus/lib/taurus/qt/qtgui/graphic/jdraw/jdraw_view.py", line 489, in setModel
    self.scene().graphicItemSelected.connect(
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'graphicItemSelected'

This is just a first draft for the the bug: I'll try to get more in deep in the issue and identify why some jdraw files are correctly displayed and other aren't.

Edited by Natxo Vergara