[GRASS-SVN] r67639 - grass-addons/grass7/gui/wxpython/wx.mwprecip

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jan 23 07:49:49 PST 2016


Author: krejcmat
Date: 2016-01-23 07:49:49 -0800 (Sat, 23 Jan 2016)
New Revision: 67639

Modified:
   grass-addons/grass7/gui/wxpython/wx.mwprecip/mw_util.py
Log:
addons g.gui.mwprecip: add progress bar

Modified: grass-addons/grass7/gui/wxpython/wx.mwprecip/mw_util.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.mwprecip/mw_util.py	2016-01-23 14:45:40 UTC (rev 67638)
+++ grass-addons/grass7/gui/wxpython/wx.mwprecip/mw_util.py	2016-01-23 15:49:49 UTC (rev 67639)
@@ -426,17 +426,19 @@
 
 
 class MeasureTime():
-    def __init__(self):
+    def __init__(self,total_count_step=14):
         self.startLast=None
+        self.total_count_step=total_count_step
         self.end=None
         self.start=None
         self.logger = logging.getLogger('mwprecip.MeasureTime')
+        self.set_counter=0
 
-    def timeMsg(self,msg,end=False):
+    def timeMsg(self,msg,end=False,step=1):
+        self.set_counter += 1
         if self.start is None:
             self.start = time.time()
             self.startLast= self.start
-            #grass.message("Measuring time - start: %s "%self.start)
             self.logger.info("Measuring time - START: %s "%str(datetime.now()))
         else:
             self.end = time.time()
@@ -444,16 +446,14 @@
             elapsedLast=self.end-self.startLast
             self.startLast=self.end
 
-            #grass.message("Elapsed time from start < %s > : %s"%(msg,elapsed))
-            #grass.message("Elapsed time for last part < %s > : %s"%(msg,elapsedLast))
+            grass.percent(self.set_counter,self.total_count_step,1)
+            self.logger.info("counter num < %s >"%(self.set_counter))
 
             self.logger.info("TOTAL TIME < %s > : %s"%(msg,elapsedTotal))
             self.logger.info("LAST PART TIME< %s > : %s"%(msg,elapsedLast))
 
             if end:
-                #grass.message("Total time: %s"%(elapsed))
-                #grass.message("Measuring time - end: %s "%self.end)
-
+                grass.percent(self.total_count_step,self.total_count_step,1)
                 self.logger.info("TOTAL TIME e: %s"%(elapsedTotal))
                 self.logger.info("Measuring time - END: %s "%str(datetime.now()))
 



More information about the grass-commit mailing list