enthought / enthought/traitsui

FileEditor / DirectoryEditor ignores initial path

Open
#1,429 2 comments 0 reactions 0 assignees View on GitHub
component: core type: bug
Dominant language
Python
Stars
306
Forks
99
PR merge metrics
No merged PRs in 30d

Description

When using Traitsui through the minimal example below, pressing the folder chooser button opens up the directory from where the script was launched, not that set on the Directory trait and shown in the GUI before pressing the folder choosing button. It is expected that pressing the folder chooser button will start at the path shown in the GUI.

Notes:

- It works fine on Macos / Linux
- It starts to work as expected once a directory is chosen in the GUI
- I have tried many paths and setting the path differently to no avail
- I have tried a variety of versions of pyface, pyqt5, and traitsui to no avail
- I am using the older python v3.5.4 because it was the only version that I could get all the enthought and QT dependencies installed and working.

![image](https://user-images.githubusercontent.com/11276774/100784244-c0219e00-33c3-11eb-8a5b-ed3bb33b77ca.png)

Minimal example:
```
from os.path import expanduser
from traits.api import HasTraits, File, Unicode, Directory
from traitsui.api import DirectoryEditor, Item, View

class Foo(HasTraits):
f = Directory()
view = View(Item('f', editor=DirectoryEditor(), show_label=False),resizable=True)
foo = Foo()
foo.f = expanduser("~")
foo.configure_traits(view=view)
```
Relevant version information:
OS: Windows 10 Home version 1903
Python Version: Python 3.5.4
Output of PIP List:
```
$ pip list
Package Version Location
------------------- -------------------------------------------------- -----------------------------
appdirs 1.4.4
certifi 2020.6.20
chaco 4.8.0
chardet 3.0.4
colorama 0.4.3
configparser 4.0.2
construct 2.9.33
distlib 0.3.1
enable 4.8.1
enum34 1.1.6
filelock 3.0.12
fonttools 3.44.0
future 0.17.1
futures 3.1.1
idna 2.7
importlib-metadata 1.7.0
importlib-resources 3.0.0
libsettings 0.1.12
monotonic 1.5
numpy 1.18.5
packaging 20.4
pandas 0.25.3
pep8 1.7.0
Pillow 7.2.0
pip 20.1.1
pluggy 0.13.1
pretty-html-table 0.9.dev0
py 1.9.0
pyface 7.1.0
pyftdi 0.13.4
Pygments 2.2.0
pylibftdi 0.16.1.2
pyparsing 2.2.0
pypiwin32 219
PyQt5 5.15.2
PyQt5-sip 12.8.1
pyserial 3.4
python-dateutil 2.8.1
pytz 2020.1
pyusb 1.0.2
requests 2.20.1
ruamel.yaml 0.15.87
setuptools 41.0.1
setuptools-scm 3.3.3
sip 4.19.8
six 1.15.0
toml 0.10.1
tox 3.16.1
traits 6.1.1
traitsui 7.1.0
urllib3 1.24.3
virtualenv 20.0.26
wheel 0.34.2
zipp 1.2.0
```

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.