ScatterInspectorOverlay incompatible with enable v5.3.0
actcheng opened this issue · comments
The following error occurred when running the scatter inspector demo with chaco (v5.0.0) and enable (v5.3.0):
Traceback (most recent call last):
File "scatter_inspector_overlay.py", line 91, in <module>
demo.configure_traits()
File "/Users/acheng/.edm/envs/test-enable/lib/python3.6/site-packages/traits/has_traits.py", line 2181, in configure_traits
args,
File "/Users/acheng/.edm/envs/test-enable/lib/python3.6/site-packages/traitsui/qt4/toolkit.py", line 238, in view_application
context, view, kind, handler, id, scrollable, args
File "/Users/acheng/.edm/envs/test-enable/lib/python3.6/site-packages/traitsui/qt4/view_application.py", line 93, in view_application
context, view, kind, handler, id, scrollable, args
File "/Users/acheng/.edm/envs/test-enable/lib/python3.6/site-packages/traitsui/qt4/view_application.py", line 133, in __init__
args=self.args,
File "/Users/acheng/.edm/envs/test-enable/lib/python3.6/site-packages/traitsui/view.py", line 450, in ui
ui.ui(parent, kind)
File "/Users/acheng/.edm/envs/test-enable/lib/python3.6/site-packages/traitsui/ui.py", line 234, in ui
self.rebuild(self, parent)
File "/Users/acheng/.edm/envs/test-enable/lib/python3.6/site-packages/traitsui/qt4/toolkit.py", line 168, in ui_live
ui_live.ui_live(ui, parent)
File "/Users/acheng/.edm/envs/test-enable/lib/python3.6/site-packages/traitsui/qt4/ui_live.py", line 52, in ui_live
_ui_dialog(ui, parent, BaseDialog.NONMODAL)
File "/Users/acheng/.edm/envs/test-enable/lib/python3.6/site-packages/traitsui/qt4/ui_live.py", line 72, in _ui_dialog
BaseDialog.display_ui(ui, parent, style)
File "/Users/acheng/.edm/envs/test-enable/lib/python3.6/site-packages/traitsui/qt4/ui_base.py", line 292, in display_ui
ui.owner.init(ui, parent, style)
File "/Users/acheng/.edm/envs/test-enable/lib/python3.6/site-packages/traitsui/qt4/ui_live.py", line 231, in init
self.add_contents(panel(ui), bbox)
File "/Users/acheng/.edm/envs/test-enable/lib/python3.6/site-packages/traitsui/qt4/ui_panel.py", line 270, in panel
panel = _GroupPanel(content[0], ui).control
File "/Users/acheng/.edm/envs/test-enable/lib/python3.6/site-packages/traitsui/qt4/ui_panel.py", line 620, in __init__
layout = self._add_items(content, inner)
File "/Users/acheng/.edm/envs/test-enable/lib/python3.6/site-packages/traitsui/qt4/ui_panel.py", line 855, in _add_items
ui, object, name, item.tooltip, None
File "/Users/acheng/.edm/envs/test-enable/lib/python3.6/site-packages/traitsui/editor_factory.py", line 123, in simple_editor
description=description,
File "/Users/acheng/.edm/envs/test-enable/lib/python3.6/site-packages/traitsui/editor.py", line 539, in __init__
self.old_value = getattr(self.object, self.name)
File "scatter_inspector_overlay.py", line 86, in _plot_default
return _create_plot_component()
File "scatter_inspector_overlay.py", line 51, in _create_plot_component
selection_line_width=3,
File "/Users/acheng/.edm/envs/test-enable/lib/python3.6/site-packages/chaco/abstract_overlay.py", line 46, in __init__
super().__init__(*args, **kw)
File "/Users/acheng/.edm/envs/test-enable/lib/python3.6/site-packages/enable/component.py", line 380, in __init__
super().__init__(**traits)
File "/Users/acheng/.edm/envs/test-enable/lib/python3.6/site-packages/traits/trait_handlers.py", line 902, in _post_setattr
post_setattr(object, name, value)
File "/Users/acheng/.edm/envs/test-enable/lib/python3.6/site-packages/enable/trait_defs/rgba_color_trait.py", line 143, in post_setattr
setattr(object, name + '_', self.mapped_value(value))
File "/Users/acheng/.edm/envs/test-enable/lib/python3.6/site-packages/enable/trait_defs/rgba_color_trait.py", line 139, in mapped_value
return convert_to_color_tuple(value)
File "/Users/acheng/.edm/envs/test-enable/lib/python3.6/site-packages/enable/trait_defs/rgba_color_trait.py", line 87, in convert_to_color_tuple
value = PyfaceColor.from_toolkit(value)
File "/Users/acheng/.edm/envs/test-enable/lib/python3.6/site-packages/pyface/color.py", line 142, in from_toolkit
rgba = toolkit_color_to_rgba(toolkit_color)
File "/Users/acheng/.edm/envs/test-enable/lib/python3.6/site-packages/pyface/ui/qt4/color.py", line 35, in toolkit_color_to_rgba
qcolor.red(),
AttributeError: 'NoneType' object has no attribute 'red'
The script can be run without error with chaco (v5.0.0) + enable (v5.2.3), or when the ScatterInspectorOverlay
is disabled.
OS, Python version: MacOS, Python 3.6
Thanks for the report. We made a number of changes to the implementation of the Enable color traits in the most recent release, and although the Chaco tests passed with the new version it looks like there may be some issues remaining. In particular it is curious to me that the color seems to be resolving through Pyface and Qt, which seems odd.
The issue appears to be with these trait definitions which are very outdated:
chaco/chaco/overlays/scatter_inspector_overlay.py
Lines 34 to 47 in cbf53e7
I think this will require a new release of Chaco where these old-style trait definitions are removed.
To be more concrete, all of the Trait(None, None, ...)
here just need to be replaced with something like Union(None, ...)
.