Closed dpinte closed 1 year ago
The bug seems to be an issue due to the traits validation for https://github.com/enthought/envisage/blob/main/envisage/ui/workbench/default_action_set.py#L28 .
The traits validation seemed to be the culprit. Testing with traits 6.3.2
works fine. The issue starts with 6.4.1
or the combination of other ETS dependencies coming with that version
~The trait error here is misleading. The problem is that the groups
trait of a Menu
is a read-only property:
https://github.com/enthought/pyface/blob/608e153cb0f067223de82df608f8067f1d94a6a2/pyface/action/action_manager.py#L47-L48
Instead groups
are intended to be passed through as *args
to the Menu()
.~
~So the code here: https://github.com/enthought/envisage/blob/ebca726572a4ec565c82cc4091ec1f2d3c96a76c/envisage/ui/workbench/default_action_set.py#L25-L29 should instead look like:~
Menu(
"OpenGroup", "SaveGroup", "ImportGroup", "ExitGroup"
name="&File",
path="MenuBar",
),
~and so on for the other menus.~
~If this code worked in the past, it was purely by accident!~
Edit:
Sorry, this is a different Menu
object, from here: https://github.com/enthought/envisage/blob/ebca726572a4ec565c82cc4091ec1f2d3c96a76c/envisage/ui/action/menu.py#L50
The change in traits which is responsible is this one: https://github.com/enthought/traits/pull/1625 (see https://github.com/enthought/traits/issues/1619 for the issue it fixed).
I'm not quite sure how it worked previously, as traits typically don't validate default values, so I'm not sure if it is a bug or not. In any case, a work around is to use Group("OpenGroup")
and so forth.
I tried your workaround and the syntax that works is Group(id="OpenGroup")
and this fixes the issue. Should I send a PR to envisage for this?
I just submitted a PR to envisage that addresses this. https://github.com/enthought/envisage/pull/485
I am still having an issue. Downgrading traits to 6.3.1 or applying the fix in https://github.com/enthought/traits/issues/1619 gives another error:
mayavi2
QSocketNotifier: Can only be used with threads started with QThread
multiple 'tvtk.toolkits' plugins found for toolkit 'qt4': tvtk.pyface.ui.qt4.init, tvtk.pyface.ui.qt4.init
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 3 (X_GetWindowAttributes)
Resource id in failed request: 0x5
Serial number of failed request: 7
Current serial number in output stream: 8
Anyway I am not sure where to apply the fix Group(id="OpenGroup")
Any help?