[GRASS-SVN] r47541 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Aug 10 15:48:32 EDT 2011


Author: mmetz
Date: 2011-08-10 12:48:31 -0700 (Wed, 10 Aug 2011)
New Revision: 47541

Modified:
   grass/trunk/gui/wxpython/gui_modules/menuform.py
Log:
wxGUI file selector: distinguish between file to open and file to save

Modified: grass/trunk/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/menuform.py	2011-08-10 19:21:08 UTC (rev 47540)
+++ grass/trunk/gui/wxpython/gui_modules/menuform.py	2011-08-10 19:48:31 UTC (rev 47541)
@@ -1335,12 +1335,16 @@
                         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 @@
                     # 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,



More information about the grass-commit mailing list