Phoenix icon indicating copy to clipboard operation
Phoenix copied to clipboard

Save-file dialog doesn't show complete file list view if `defaultFile` contains wildcards.

Open komoto48g opened this issue 3 years ago • 1 comments

Operating system: Windows 10 wxPython version & source: wxPython 4.2.0 (pypi) Python version & source: 3.10.4

Description of the problem: The file list view of wx.FileDialog is incomplete if the argument defaultFile contains ~~OS invalid characters such as~~ wildcard *.

Code Example (click to expand)
import wx

def saveas(self, name):
    with wx.FileDialog(self, "Save buffer as",
            defaultFile=name,
            style=wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT) as dlg:
        if dlg.ShowModal() != wx.ID_OK:
            return

if __name__ == "__main__":
    app = wx.App()
    saveas(None, name="*scratch*") # [ NG ] OS-invalid name => Actual outcome
    ## saveas(None, name="_scratch_") # [ OK ] valid name => Expected outcome

Actual outcome: Although the file list shows 4 files, there are actually more than 10 files in this directory. issue-save-dialog-1

Expected outcome: issue-save-dialog-2

komoto48g avatar Aug 21 '22 17:08 komoto48g

I noticed that presetting defaultFile acts as Unix shell-style wildcards. However, even if I change [File name:] text, the filename filter still works and the file list view remains incomplete. I wonder if this is a specification?

komoto48g avatar Aug 22 '22 03:08 komoto48g