Browse Source

wxGUI/forms: better check for allowed file extension (add always `*.*` mask)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@54237 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 12 years ago
parent
commit
9139a2b44f
1 changed files with 5 additions and 2 deletions
  1. 5 2
      gui/wxpython/gui_core/forms.py

+ 5 - 2
gui/wxpython/gui_core/forms.py

@@ -1366,11 +1366,14 @@ class CmdPanel(wx.Panel):
                     else:
                         fmode = wx.OPEN
                     # check wildcard
-                    fExt = os.path.splitext(p.get('key_desc', ['*.*'])[0])[1]
+                    try:
+                        fExt = os.path.splitext(p.get('key_desc', ['*.*'])[0])[1]
+                    except:
+                        fExt = None
                     if not fExt:
                         fMask = '*.*'
                     else:
-                        fMask = '*' + fExt
+                        fMask = '%s files (*%s)|*%s|Files (*.*)|*.*' % (fExt[1:].upper(), fExt, fExt)
                     fbb = filebrowse.FileBrowseButton(parent = which_panel, id = wx.ID_ANY, fileMask = fMask,
                                                       size = globalvar.DIALOG_GSELECT_SIZE, labelText = '',
                                                       dialogTitle = _('Choose %s') % \