[GRASS-SVN] r67557 - grass-addons/grass7/gui/wxpython/wx.mwprecip
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Jan 11 07:44:52 PST 2016
Author: krejcmat
Date: 2016-01-11 07:44:52 -0800 (Mon, 11 Jan 2016)
New Revision: 67557
Modified:
grass-addons/grass7/gui/wxpython/wx.mwprecip/g.gui.mwprecip.py
grass-addons/grass7/gui/wxpython/wx.mwprecip/mw3.py
Log:
addons wx.mwprecip: change folder for storing logs
Modified: grass-addons/grass7/gui/wxpython/wx.mwprecip/g.gui.mwprecip.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.mwprecip/g.gui.mwprecip.py 2016-01-11 15:12:42 UTC (rev 67556)
+++ grass-addons/grass7/gui/wxpython/wx.mwprecip/g.gui.mwprecip.py 2016-01-11 15:44:52 UTC (rev 67557)
@@ -550,25 +550,21 @@
self.SetSizerAndFit(mainSizer)
-
class MWMainFrame(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title,style=wx.DEFAULT_FRAME_STYLE )
-
+ self.loggerPath=None
+ self.worker = None
self.logger=None
context=StaticContext()
self.workPath = context.getTmpPath()
self.initWorkingFoldrs()
- self.initLogger()
- self.initWorkingFoldrs()
self.settings = {}
self.settingsLst = []
self.mainSizer = wx.BoxSizer(wx.VERTICAL)
self.panelSizer = wx.BoxSizer(wx.VERTICAL)
self.mainPanel = wx.Panel(self,id=wx.ID_ANY)
-
- self.worker = None
menubar = wx.MenuBar()
settMenu = wx.Menu()
databaseItem = settMenu.Append(wx.ID_ANY, 'Database', 'Set database')
@@ -627,12 +623,12 @@
self.findProject()
self.layout()
- def initLogger(self):
- logging.basicConfig(filename=os.path.join(self.workPath,'mwprecip.log'),
- level=logging.INFO,
- format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
- datefmt='%m-%d %H:%M',
- filemode='w')
+ def initLogger(self,path):
+ logging.basicConfig(filename=path,
+ level=logging.INFO,
+ format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
+ datefmt='%m-%d %H:%M',
+ filemode='w')
console = logging.StreamHandler()
@@ -727,13 +723,18 @@
pass
self.settings['workSchema'] = self.profilSelection.GetValue()
-
if self.schema.GetValue() is not None:
self.settings['workSchema'] = self.schema.GetValue()
#print self.settings
if toFile:
tmpPath = os.path.join(self.workPath, 'save', self.settings['workSchema'])
+ profilePath=os.path.join(self.workPath,"logs")
+ if not os.path.exists(profilePath):
+ os.mkdir(profilePath)
+ self.loggerPath = os.path.join(profilePath,self.settings['workSchema']+".logg")
+ self.initLogger(self.loggerPath)
saveDict(tmpPath, self.settings)
+
self.findProject()
def initWorkingFoldrs(self):
@@ -741,7 +742,6 @@
if not os.path.exists(savePath):
os.makedirs(savePath)
-
def findProject(self):
try:
projectDir = os.path.join(self.workPath, "save")
@@ -872,7 +872,7 @@
def _onExport(self, evt=None):
path = OnSaveAs(self)
self.OnSaveSettings(toFile=False)
- if not self.exportDMgr.chkprecip.GetValue():
+ if not self.exportDMgr.chkprecip.GetValue(): #if export only data from sql without computing
attrTmp1 = ['link.linkid']
attrTmp2 = []
attrTmp3 = []
@@ -917,8 +917,6 @@
lines = ''
for r in res:
lines += str(r)[1:][:-1].replace('datetime.datetime', '').replace("'", "") + '\n'
- #print conn.pathworkSchemaDir
- #path=os.path.join(conn.pathworkSchemaDir, "export")
io0 = open(path, "w+")
io0.writelines(lines)
io0.close()
@@ -929,7 +927,6 @@
if YesNo(self, 'Export data only?'):
exportData['dataOnly'] = True
self.settings['dataExport'] = exportData
-
# if rain gauges
if self.dataMgrMW.inpRainGauge.GetPath() is not None:
self.settings['IDtype'] = 'gaugeid'
@@ -978,7 +975,6 @@
self.worker = Gui2Model(self, self.settings,self.workPath)
if self.worker.checkConn():
-
if not self.worker.initConnection():
return
self.worker.initVectorGrass()
@@ -1036,7 +1032,6 @@
def initConnection(self, info=False):
conninfo = self.conninfo
-
if 'workSchema' in self.settings:
conninfo['workSchema'] = self.settings['workSchema']
if 'schema' in self.settings:
Modified: grass-addons/grass7/gui/wxpython/wx.mwprecip/mw3.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.mwprecip/mw3.py 2016-01-11 15:12:42 UTC (rev 67556)
+++ grass-addons/grass7/gui/wxpython/wx.mwprecip/mw3.py 2016-01-11 15:44:52 UTC (rev 67557)
@@ -1384,7 +1384,7 @@
self.linkVecMapName = linkVecMapName
self.linkPointsVecName = linkPointsVecName
- self.pathworkSchemaDir = os.path.join(workPath,'profiles', "tmp_%s" % self.schema)
+ self.pathworkSchemaDir = os.path.join(workPath,'profiles', "%s" % self.schema)
self.pyConnection()
self.grassConnectionRemote()
More information about the grass-commit
mailing list