[GRASS-SVN] r58801 - grass/trunk/gui/wxpython/nviz

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jan 29 09:56:29 PST 2014


Author: annakrat
Date: 2014-01-29 09:56:29 -0800 (Wed, 29 Jan 2014)
New Revision: 58801

Modified:
   grass/trunk/gui/wxpython/nviz/animation.py
Log:
wxGUI/nviz: fix output format in simple animation

Modified: grass/trunk/gui/wxpython/nviz/animation.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/animation.py	2014-01-29 16:54:23 UTC (rev 58800)
+++ grass/trunk/gui/wxpython/nviz/animation.py	2014-01-29 17:56:29 UTC (rev 58801)
@@ -48,7 +48,7 @@
         self.mapWindow = mapWindow
         self.actions = {'record': self.Record,
                         'play': self.Play}
-        self.formats = ['ppm', 'tif']   # currently supported formats
+        self.formats = ['tif', 'ppm']   # currently supported formats
         self.mode = 'record'            # current mode (record, play, save)
         self.paused = False             # recording/replaying paused
         self.currentFrame = 0           # index of current frame
@@ -180,12 +180,24 @@
         w, h = self.mapWindow.GetClientSizeTuple()
         toolWin = self.mapWindow.GetToolWin()
         
+        formatter = ':04.0f'
+        n = len(self.animationList)
+        if n < 10:
+            formatter = ':01.0f'
+        elif n < 100:
+            formatter = ':02.0f'
+        elif n < 1000:
+            formatter = ':03.0f'
+
         self.currentFrame = 0
         self.mode = 'save'
         for params in self.animationList:
             if not self.stopSaving:
                 self.UpdateView(params)
-                filename = prefix + "_" + str(self.currentFrame) + '.' + self.formats[format]
+                number = ('{frame' + formatter +'}').format(frame=self.currentFrame)
+                filename = "{prefix}_{number}.{ext}".format(prefix=prefix,
+                                                            number=number,
+                                                            ext=self.formats[format])
                 filepath = os.path.join(path, filename)
                 self.mapWindow.SaveToFile(FileName = filepath, FileType = self.formats[format],
                                                   width = w, height = h)



More information about the grass-commit mailing list