[GRASS-SVN] r65721 - grass/trunk/gui/wxpython/animation

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jul 20 12:03:50 PDT 2015


Author: annakrat
Date: 2015-07-20 12:03:50 -0700 (Mon, 20 Jul 2015)
New Revision: 65721

Modified:
   grass/trunk/gui/wxpython/animation/controller.py
   grass/trunk/gui/wxpython/animation/dialogs.py
Log:
wxGUI/animation: select number of processes in preferences

Modified: grass/trunk/gui/wxpython/animation/controller.py
===================================================================
--- grass/trunk/gui/wxpython/animation/controller.py	2015-07-20 18:59:13 UTC (rev 65720)
+++ grass/trunk/gui/wxpython/animation/controller.py	2015-07-20 19:03:50 UTC (rev 65721)
@@ -371,7 +371,8 @@
                 self._load3DData(animData)
             self._loadLegend(animData)
         color = UserSettings.Get(group='animation', key='bgcolor', subkey='color')
-        self.bitmapProvider.Load(nprocs=getCpuCount(), bgcolor=color)
+        cpus = UserSettings.Get(group='animation', key='nprocs', subkey='value')
+        self.bitmapProvider.Load(nprocs=cpus, bgcolor=color)
         # clear pools
         self.bitmapPool.Clear()
         self.mapFilesPool.Clear()
@@ -449,7 +450,8 @@
         self.EndAnimation()
 
         color = UserSettings.Get(group='animation', key='bgcolor', subkey='color')
-        self.bitmapProvider.Load(nprocs=getCpuCount(), bgcolor=color, force=True)
+        cpus = UserSettings.Get(group='animation', key='nprocs', subkey='value')
+        self.bitmapProvider.Load(nprocs=cpus, bgcolor=color, force=True)
 
         self.EndAnimation()
 

Modified: grass/trunk/gui/wxpython/animation/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/animation/dialogs.py	2015-07-20 18:59:13 UTC (rev 65720)
+++ grass/trunk/gui/wxpython/animation/dialogs.py	2015-07-20 19:03:50 UTC (rev 65721)
@@ -37,7 +37,7 @@
 from gui_core.gselect import Select
 from gui_core.widgets import FloatValidator
 
-from animation.utils import TemporalMode, getRegisteredMaps, getNameAndLayer
+from animation.utils import TemporalMode, getRegisteredMaps, getNameAndLayer, getCpuCount
 from animation.data import AnimationData, AnimLayer
 from animation.toolbars import AnimSimpleLmgrToolbar, SIMPLE_LMGR_STDS
 from gui_core.simplelmgr import SimpleLayerManager, \
@@ -1505,6 +1505,20 @@
 
         gridSizer.Add(item=color, pos=(row, 1), flag=wx.ALIGN_RIGHT)
 
+        row += 1
+        gridSizer.Add(item=wx.StaticText(parent=panel,
+                                         label=_("Number of parallel processes:")),
+                      flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, pos=(row, 0))
+        # when running for the first time, set nprocs based on the number of processes
+        if UserSettings.Get(group='animation', key='nprocs', subkey='value') == -1:
+            UserSettings.Set(group='animation', key='nprocs', subkey='value', value=getCpuCount())
+        nprocs = wx.SpinCtrl(parent=panel,
+                             initial=UserSettings.Get(group='animation', key='nprocs', subkey='value'))
+        nprocs.SetName('GetValue')
+        self.winId['animation:nprocs:value'] = nprocs.GetId()
+
+        gridSizer.Add(item=nprocs, pos=(row, 1), flag=wx.ALIGN_RIGHT)
+
         gridSizer.AddGrowableCol(1)
         sizer.Add(item=gridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=3)
         border.Add(item=sizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=3)



More information about the grass-commit mailing list