Open vallsv opened 4 years ago
At a popup close, i set the model to ""
.
taurusbase.py:filterEvent
receive a bunch of events, and when the source /state
with the value None
are received, the code raises this exception.
Maybe that's again something about relative model.
I tried to reproduce the problem, i did once, but now the test deadlock when i call setModel
. I guess i forget an obvious thing. In case you have an idea.
BTW if you agree to patch _stateObj
with None state, i can provide a patch. That's an easier way for me, cause i did not found a way to fix it on my side.
from taurus.qt.qtgui.application import TaurusApplication
from taurus.qt.qtgui.display.tauruslabel import TaurusLabel
from taurus.qt.qtgui.container import TaurusWidget
from PyQt5 import Qt
import logging
app = TaurusApplication([])
class Popup(Qt.QWidget):
def __init__(self, parent=None):
Qt.QWidget.__init__(self, parent=parent)
self.setWindowFlags(Qt.Qt.Popup)
self.setAttribute(Qt.Qt.WA_DeleteOnClose)
w = TaurusWidget(self)
l1 = Qt.QVBoxLayout(self)
l1.addWidget(w)
l = TaurusLabel(self)
l.setModel("/State")
l.setBgRole("state")
l.setUseParentModel(True)
l2 = Qt.QVBoxLayout(w)
l2.addWidget(l)
self.w = w
def closeEvent(self, event):
print("closeEvent")
try:
self.w.setModel("")
pass
except:
logging.error("Arg", exc_info=True)
print("Never reached")
Qt.QWidget.closeEvent(self, event)
win = Qt.QMainWindow()
button = Qt.QPushButton()
win.setCentralWidget(button)
def clicked():
print("clicked")
popup = Popup(button)
popup.w.setModel("sys/tg_test/1")
p = Qt.QPoint(0, button.height())
p = button.mapToGlobal(p)
popup.move(p)
popup.show()
button.clicked.connect(clicked)
win.show()
app.exec_()
I maybe fixed the problem on my side.
Calling _detach
instead of setModel(None)
. Do you think it can be enough? In this case it's fine for me, the issue can be closed.
The widget is supposed to be destroyed just after, but without that i guess it was persisting in the background.
Calling _detach instead of setModel(None). Do you think it can be enough?
Calling setModel(None)
should work. If it does not, but _detach
does, I would say that it is a bug in taurus. Maybe the deadlock is related to https://github.com/tango-controls/pytango/issues/292, https://github.com/tango-controls/cppTango/issues/686 ?
BTW if you agree to patch _stateObj with None state, i can provide a patch
Of course. Please submit it!
Hi again,
I also receive this weird traceback from a TaurusLabel. I still have to figure out if the problem is on my side or on yours.
But looking at the code,
_stateObj
could be None, so my problem could be fixed on your side?It happens at the creation or the destruction of something.