Open max3-2 opened 2 years ago
Let me follow up here: Deletion of elements is not possible too. A window pops up and disappears so quickly I cant make out what it says. I think I traced it back a bit:
self._data
in is modified in class SimpleEditor(Editor)
of tree_editor.py
in ll952 _on_context_menu
which is called on each right click.
self_datais set valid and then just at the end of the method it is set to
None` which happens before performing an action, leading to the error above.
If I remove self_data
from the statement beginning line 1007 it seems to work again, albeit the deletion of elements. Don't see any other issues in a very quick test
Any ideas on this?
Thanks for the report. Unfortunately I can't currently replicate the behaviour in pure TraitsUI (on Mac, with PyQt 5.14.2).
Indeed, self._data
should not be None
when the method is called.
However the lines in 1007 onwards shouldn't be called until after all menu interactions are done: I think that the exec_
on 1004 should be blocking; and I don't think there is any threading or asynchronous stuff going on.
The standard execution flow should be something like:
exec_ -> ...user interaction selects menu item... -> _qt4_on_triggered -> perform -> do_undoable -> _perform
with no opportunity to resume execution after the exec_
until _perform
is done. So I'm not entirely sure how we're getting to this state. Adding a few print statements or logging calls may help you confirm
Can you install TraitsUI from the main branch and see if it still occurs? Also, can you try with a different version of PyQt5 or PySide2, as it is possible that this is hitting some bug at that level.
Also it is possible that Mayavi is doing something nonstandard in its tree view widget which may override this analysis.
I added some prints around the reset and as soon as I interact, both are called on appearance of the menu. This is, however logical since at the other issue @prabhuramachandran came through and explained that my event loop was not running. So this obviously stops exec_()
from blocking and the error occurs. So from traitsui
I guess this is a no error.
Thanks for the quick help though!
Oh and btw:
I can't currently replicate the behaviour in pure TraitsUI
Can you produce a MWE just to test TraitsUI?
Hi,
let me link this from mayavi, I did not get any answer there and I feel this might be related: https://github.com/enthought/mayavi/issues/1127
In short, using mayavi works (examples, custom scripts) but when accessing the tree to change any property, the following occurs and crashes the current window:
Any help to pinpoint me for a fix? Seems to be that
self._data is None
which is not supposed to happen...?