Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

format_func may be unexpected by some editors #898

Closed
kitchoi opened this issue Jun 12, 2020 · 1 comment · Fixed by #900
Closed

format_func may be unexpected by some editors #898

kitchoi opened this issue Jun 12, 2020 · 1 comment · Fixed by #900
Assignees
Milestone

Comments

@kitchoi
Copy link
Contributor

kitchoi commented Jun 12, 2020

Currently the RangeEditor_demo.py fails to launch, with the following error:

Traceback (most recent call last):
  File "examples/demo/Standard_Editors/RangeEditor_demo.py", line 97, in <module>
    demo.configure_traits()
  File "/Users/kchoi/.edm/envs/traitsui-test-3.6-pyqt/lib/python3.6/site-packages/traits/has_traits.py", line 2088, in configure_traits
    args,
  File "/Users/kchoi/Work/ETS/traitsui/traitsui/qt4/toolkit.py", line 232, in view_application
    context, view, kind, handler, id, scrollable, args
  File "/Users/kchoi/Work/ETS/traitsui/traitsui/qt4/view_application.py", line 84, in view_application
    context, view, kind, handler, id, scrollable, args
  File "/Users/kchoi/Work/ETS/traitsui/traitsui/qt4/view_application.py", line 126, in __init__
    args=self.args,
  File "/Users/kchoi/Work/ETS/traitsui/traitsui/view.py", line 462, in ui
    ui.ui(parent, kind)
  File "/Users/kchoi/Work/ETS/traitsui/traitsui/ui.py", line 246, in ui
    self.rebuild(self, parent)
  File "/Users/kchoi/Work/ETS/traitsui/traitsui/qt4/toolkit.py", line 162, in ui_live
    ui_live.ui_live(ui, parent)
  File "/Users/kchoi/Work/ETS/traitsui/traitsui/qt4/ui_live.py", line 43, in ui_live
    _ui_dialog(ui, parent, BaseDialog.NONMODAL)
  File "/Users/kchoi/Work/ETS/traitsui/traitsui/qt4/ui_live.py", line 65, in _ui_dialog
    BaseDialog.display_ui(ui, parent, style)
  File "/Users/kchoi/Work/ETS/traitsui/traitsui/qt4/ui_base.py", line 284, in display_ui
    ui.owner.init(ui, parent, style)
  File "/Users/kchoi/Work/ETS/traitsui/traitsui/qt4/ui_live.py", line 225, in init
    self.add_contents(panel(ui), bbox)
  File "/Users/kchoi/Work/ETS/traitsui/traitsui/qt4/ui_panel.py", line 262, in panel
    _fill_panel(panel, content, ui)
  File "/Users/kchoi/Work/ETS/traitsui/traitsui/qt4/ui_panel.py", line 295, in _fill_panel
    gp = _GroupPanel(item, ui, suppress_label=True)
  File "/Users/kchoi/Work/ETS/traitsui/traitsui/qt4/ui_panel.py", line 601, in __init__
    layout = self._add_items(content, inner)
  File "/Users/kchoi/Work/ETS/traitsui/traitsui/qt4/ui_panel.py", line 854, in _add_items
    ui, object, name, item.tooltip, None
  File "/Users/kchoi/Work/ETS/traitsui/traitsui/editors/range_editor.py", line 305, in custom_editor
    ui, object, name, description, parent
  File "/Users/kchoi/Work/ETS/traitsui/traitsui/editor_factory.py", line 155, in custom_editor
    invalid_trait_name=self.invalid,
TypeError: CustomEnumEditor() got an unexpected keyword argument 'format_func'

Looks related to #859

The example seems to work fine with v7.0.0.

@kitchoi kitchoi added this to the Release 7.0.1 milestone Jun 12, 2020
@ievacerny
Copy link
Contributor

Ah, that's because CustomEnumEditor in both implementations of range_editor.py is a function and not a class inheriting from Editor. SimpleEnumEditor in range_editor.py should have the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants