[GRASS-SVN] r58666 - grass/trunk/gui/wxpython/gmodeler
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jan 10 07:26:56 PST 2014
Author: martinl
Date: 2014-01-10 07:26:56 -0800 (Fri, 10 Jan 2014)
New Revision: 58666
Modified:
grass/trunk/gui/wxpython/gmodeler/frame.py
grass/trunk/gui/wxpython/gmodeler/model.py
Log:
wxGUI/modeler: define default name for exported Python script
Modified: grass/trunk/gui/wxpython/gmodeler/frame.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/frame.py 2014-01-10 15:03:50 UTC (rev 58665)
+++ grass/trunk/gui/wxpython/gmodeler/frame.py 2014-01-10 15:26:56 UTC (rev 58666)
@@ -371,6 +371,17 @@
self.modelChanged = False
self.SetTitle(self.baseTitle)
+ def GetModelFile(self, ext=True):
+ """!Get model file
+
+ @param ext False to avoid extension
+ """
+ if not self.modelFile:
+ return ''
+ if ext:
+ return self.modelFile
+ return os.path.splitext(self.modelFile)[0]
+
def OnModelOpen(self, event):
"""!Load model from file"""
filename = ''
@@ -1720,6 +1731,7 @@
filename = ''
dlg = wx.FileDialog(parent = self,
message = _("Choose file to save"),
+ defaultFile = self.parent.GetModelFile(ext=False) + '.py',
defaultDir = os.getcwd(),
wildcard = _("Python script (*.py)|*.py"),
style = wx.FD_SAVE)
Modified: grass/trunk/gui/wxpython/gmodeler/model.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/model.py 2014-01-10 15:03:50 UTC (rev 58665)
+++ grass/trunk/gui/wxpython/gmodeler/model.py 2014-01-10 15:26:56 UTC (rev 58666)
@@ -2373,6 +2373,7 @@
for action in condItems['else']:
self._writePythonItem(action, ignoreBlock = False)
self.indent += 4
+ self.fd.write('\n')
if isinstance(item, ModelComment):
self._writePythonComment(item)
More information about the grass-commit
mailing list