Browse Source

wxGUI file selector: distinguish between file to open and file to save

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@47541 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 13 years ago
parent
commit
65c9f0e93d
1 changed files with 6 additions and 2 deletions
  1. 6 2
      gui/wxpython/gui_modules/menuform.py

+ 6 - 2
gui/wxpython/gui_modules/menuform.py

@@ -1335,12 +1335,16 @@ class cmdPanel(wx.Panel):
                         p['wxId'].append(None)
                 # file selector
                 elif p.get('prompt','') !=  'color' and p.get('element', '') ==  'file':
+                    if p.get('age', 'new') == 'new':
+                        fmode = wx.SAVE
+                    else:
+                        fmode = wx.OPEN
                     fbb = filebrowse.FileBrowseButton(parent = which_panel, id = wx.ID_ANY, fileMask = '*',
                                                       size = globalvar.DIALOG_GSELECT_SIZE, labelText = '',
                                                       dialogTitle = _('Choose %s') % \
                                                           p.get('description',_('File')),
                                                       buttonText = _('Browse'),
-                                                      startDirectory = os.getcwd(), fileMode = 0,
+                                                      startDirectory = os.getcwd(), fileMode = fmode,
                                                       changeCallback = self.OnSetValue)
                     value = self._getValue(p)
                     if value:
@@ -1352,7 +1356,7 @@ class cmdPanel(wx.Panel):
                     # a textctl and a button;
                     # we have to target the button here
                     p['wxId'] = [ fbb.GetChildren()[1].GetId() ]
-                    if p.get('age', 'new') ==  'old' and \
+                    if p.get('age', 'new') == 'old' and \
                             UserSettings.Get(group = 'cmd', key = 'interactiveInput', subkey = 'enabled'):
                         # widget for interactive input
                         ifbb = wx.TextCtrl(parent = which_panel, id = wx.ID_ANY,