hoffstadt / hoffstadt/DearPyGui

`file_dialog` shows files in reverse alphabetical order by default

Open
#1,494 6 comments 0 reactions 0 assignees View on GitHub
priority: medium type: improvement
Dominant language
C++
Stars
15.6k
Forks
783
PR merge metrics
No merged PRs in 30d

Description

## Version of Dear PyGui

DPG Version: 1.1.3
OS: macOS-10.15.7-x86_64-i386-64bit

## My Issue/Question

By default, the file_dialog should present the files in descending order alphabetically. For some reason it shows them in reverse order. It's a bit unexpected for users.

## Screenshots/Video
![file_picker_bug](https://user-images.githubusercontent.com/1454335/146792119-0a70e83f-6c52-4294-884c-8c496b7e32d7.jpg)

## Standalone, minimal, complete and verifiable example

```python
import dearpygui.dearpygui as dpg

import dearpygui

import platform
print(f"DPG Version: {dearpygui.__version__}")
print(f"OS: {platform.platform()}")

dpg.create_context()

def make_files():
files = [
'a.txt', # These should be red but appear white
'b.txt',
'a.md',
'b.md',
'a.rtf',
'a.py'
'b.py',
'a.h',
'b.h',
'a.xyz',
'b.xyz',
'c.xyz',

]
for fname in files:
with open(fname, 'w') as f:
pass

def callback(sender, app_data, user_data):
print("Sender: ", sender)
print("App Data: ", app_data)

with dpg.file_dialog(directory_selector=False, show=False, callback=callback, id="file_dialog_id"): # BUG? Files shown in reverse order by default.
dpg.add_file_extension(".*", color=(255,255,0,255)) # BUG? default color does not appear to work, appear white
dpg.add_file_extension("", color=(150, 255, 150, 128))
dpg.add_file_extension("Text Files (*.txt *.md *.rtf){.txt,.md,.rtf}", color=(255, 0, 0, 255)) # BUG? red color does not apply to these, appear white
dpg.add_file_extension(".h", color=(255, 0, 255, 255), custom_text="[header]")
dpg.add_file_extension(".py", color=(0, 255, 0, 255), custom_text="[Python]")

with dpg.window(label="Tutorial", width=800, height=300):
dpg.add_button(label="Makes Sample Files", callback=make_files)
dpg.add_button(label="File Selector", callback=lambda: dpg.show_item("file_dialog_id"))

dpg.create_viewport(title='Custom Title', width=800, height=600)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.