enthought / enthought/traitsui
reload_name trait does not work with Qt FileEditor
- Dominant language
- Python
- Stars
- 306
- Forks
- 99
- PR merge metrics
- No merged PRs in 30d
Description
When using a `FileEditor` with a `'custom'` style, the trait assigned to the `reload_name` attribute throws an exception when that event is triggered.
See below:
```python
class Foo(HasTraits):
file = File
refresh = Button('Refresh')
def default_traits_view(self):
return View(
Item('file',
editor=FileEditor(reload_name='refresh'),
style='custom',
show_label=False),
Item('refresh',
show_label=False)
)
Foo().configure_traits()
```
Pressing "Refresh" causes this exception:
```
Exception occurred in traits notification handler.
Please check the log file for details.
Exception occurred in traits notification handler for object: ,trait: reload, old value: , new value: 0
Traceback (most recent call last):
File "/Users/mreay/.edm/envs/.../lib/python3.6/site-packages/traits/trait_notifiers.py", line 340, in __call__
self.handler( *args )
File "/Users/mreay/.edm/envs/.../lib/python3.6/site-packages/traitsui/qt4/file_editor.py", line 245, in _reload_changed
self._model.refresh()
AttributeError: 'QFileSystemModel' object has no attribute 'refresh'
```
On macOS, the `QFileSystemModel` does not need a manual refresh, this happens automatically. On Windows, this does not work.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.