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

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Oct 12 02:03:58 PDT 2015


Author: krejcmat
Date: 2015-10-12 02:03:58 -0700 (Mon, 12 Oct 2015)
New Revision: 66475

Modified:
   grass-addons/grass7/gui/wxpython/wx.mwprecip/mw3.py
Log:
wx.mwprecip addons: fix status handling- self.status.get('msg')

Modified: grass-addons/grass7/gui/wxpython/wx.mwprecip/mw3.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.mwprecip/mw3.py	2015-10-12 08:13:57 UTC (rev 66474)
+++ grass-addons/grass7/gui/wxpython/wx.mwprecip/mw3.py	2015-10-12 09:03:58 UTC (rev 66475)
@@ -322,11 +322,6 @@
         self.type = type
         self.statFce = statFce
 
-
-
-
-
-
 class TimeWindows():
     def __init__(self, database, IDtype, sumStep, startTime=None,
                  endTime=None, linksIgnored=False, linksOnly=False, links=None, linksMap=None):
@@ -345,6 +340,10 @@
         self.linksIgnored = linksIgnored  # if true: remove self.link else:
         self.linksOnly = linksOnly  # compute only links
 
+        self.status = {}
+        self.status['bool'] = False
+        self.status['msg'] = 'Done'
+
         self.viewDB = None
         self.intervalStr = None
         self.timestamp_max = None
@@ -370,8 +369,6 @@
             self.removeLinksIgnore()
         elif self.linksOnly:
             self.removeLinksOthers()
-
-
         self.crateTimeWin()
 
     def sumValues(self):
@@ -535,7 +532,6 @@
             self.timeWin.createWin()
             self.status['bool'] = True
 
-
     def GetStatus(self):
         return self.status.get('bool'), self.status.get('msg')
 
@@ -587,10 +583,8 @@
             # io1.write('mode|' + str(baseline.aw))
             # io1.close
 
-
         def computeBaselineFromTime():
 
-
             def chckTimeValidity(tIn):
                 # print tIn
                 tIn = str(tIn).replace("\n", "")
@@ -625,7 +619,6 @@
             ######## AVG #########
             if baseline.statFce == 'avg':
 
-
                 if baseline.type == 'noDryWin':
                     if baseline.statFce == 'avg':
                         sql = "SELECT linkid, avg(a) FROM %s.record \
@@ -841,8 +834,6 @@
                 resu = resu[0][0]
                 tmp.append(str(linkid) + ',' + str(resu) + '\n')
 
-
-
             io0 = open(os.path.join(database.pathworkSchemaDir, "baseline"), 'w+')
             io0.writelines(tmp)
             io0.close()
@@ -906,6 +897,7 @@
                 return True
             else:
                 return False
+
     def logMsg(self, msg,err=False):
         if self.status.get('msg') == 'Done':
             self.status['msg'] = ''
@@ -1389,10 +1381,7 @@
         #self.pathworkSchemaDir = os.path.join(tempfile.gettempdir(), "tmp_%s" % self.schema)
 
         self.pyConnection()
-        #if self.host:
         self.grassConnectionRemote()
-        #else:
-        #self.grassConnection()
         self.grassTemporalConnection('postgres')
         #self.firstPreparation()
         #self.prepareDB()
@@ -1486,7 +1475,6 @@
         if grass.run_command('db.connect', driver="pg", database=self.dbName,overwrite=True) != 0:
              grass.warning("Unable to connect to the database by grass driver.")
 
-
     def pyConnection(self):
         try:
             conninfo = {'dbname': self.dbName}
@@ -1523,8 +1511,6 @@
             #sql = "ALTER TABLE record DROP COLUMN frequency;"
             #self.connection.executeSql(sql, False, True)
 
-            # TODO
-
             grass.message("Add function for computing distance ")
             '''
             sql=r"CREATE OR REPLACE FUNCTION get_earth_distance1
@@ -1602,7 +1588,6 @@
             if not os.path.isdir(self.pathworkSchemaDir):
                 raise
 
-
 '''
 def main():
     db = Database(name='tyden')



More information about the grass-commit mailing list