hoffstadt / hoffstadt/DearPyGui
Inaccessible file extension in some cases
- Dominant language
- C++
- Stars
- 15.6k
- Forks
- 783
- PR merge metrics
- No merged PRs in 30d
Description
## Version of Dear PyGui
Version: 1.9.1
Operating System: Ubuntu 20.04
## My Issue/Question
When using a file dialog, in a specific list of steps taken by the user, it is possible that the file dialog's `app_data` will not contain the filename's extension.
## To Reproduce
Steps to reproduce the behavior:
1. Code:
1. Create a file dialog. In its callback, print `app_data`. (in this case, `file_count=1, directory_selector=False`). Give it a list of possible extensions, in this example: `'.*'`.
2. Create a button that shows this file dialog.
2. As a user:
1. Click on the button and select one file, click ok.
app_data = {'file_path_name': 'my_path/my_file.*', 'file_name': 'my_file.*',
'current_path': 'my_path', 'current_filter': '.*',
'selections': {'my_file.docx': 'my_path/my_file.docx'}}
(We can find the extension in 'selections').
3. You change your mind and decide to save your results in a new file rather than choosing an existing file: Click on the button, and in the bottom space, enter manually the following filename: 'my_new_file.txt'.
app_data = {'file_path_name': 'my_path/my_new_file.*', 'file_name': 'my_new_file.*',
'current_path': 'my_path', 'current_filter': '.*',
'selections': {'my_file.docx': 'my_path/my_file.docx'}}
We can see that the extention of my_new_file (.txt) is not visible anywhere in app_data. 'selections' still contains the previous choice.
## Expected behavior
Choice 1: 'selections' becomes updated when you enter a filename manually (please note that it is also not updated if you select nothing and click ok).
Choice 2: app_data['file_path_name'] should contain the whole filename, with correct extension.
## Standalone, minimal, complete and verifiable example
--> You can use the code shown in the tutorial, under "File Extensions"
https://dearpygui.readthedocs.io/en/latest/documentation/file-directory-selector.html
Thank you!
Contributor guide
Assessment
This issue has not been assessed yet.