enthought / enthought/traitsui

Adding a new node via QT TreeEditor fails under specific circumstances

Open
#665 2 comments 0 reactions 0 assignees View on GitHub
toolkit: Qt
Dominant language
Python
Stars
306
Forks
99
PR merge metrics
No merged PRs in 30d

Description

When trying to add a new element to an empty TreeNode with auto_open = False the application will crash with the following Python error message
`Traceback (most recent call last):
File "C:\Apps\Continuum\anaconda2\envs\py37AutoSum\lib\site-packages\traitsui\qt4\tree_editor.py", line 1042, in _on_tree_sel_changed
expanded, node, sel_object = self._get_node_data(nid)
File "C:\Apps\Continuum\anaconda2\envs\py37AutoSum\lib\site-packages\traitsui\qt4\tree_editor.py", line 893, in _get_node_data
return nid._py_data
AttributeError: 'QTreeWidgetItem' object has no attribute '_py_data'`

**Steps to reproduce:**
- Environment: Python 3.7.3, qt 5.9.7, TraitsUI 6.1.3 and Traits 5.1.2
- Run the file attached below which is based on the `tree_editor.py` example.
- Right click on _Marketing_ and select _New_ and click on _Employee_. The application will then crash with the error message shown above

[InsertNodeTreeEditorBug.txt](https://github.com/enthought/traitsui/files/3665862/InsertNodeTreeEditorBug.txt)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.