Пример #1
0
 def __init__(self,appID):
     self.__os=os.name
     self.__home=os.getenv('HOME')
     self.__gisPath=os.path.dirname(__file__)
     
     #pGIS configuration
     self.__appId=appID
     gisConf=configParser()
     gisConf.read('%s/config/pGIS_conf.ini' % (self.__gisPath))
     self.__appType=gisConf.get('app','app_type')
     self.__appRoot='%s%s' % (self.__home,gisConf.get(self.__appId,'app_root'))
     self.__appConf='%s%s' % (self.__appRoot,gisConf.get(self.__appId,'app_conf'))
     
     #pGIS application
     appConf=configParser()
     appConf.read(self.__appConf)
     self.__appConfObj=appConf
     self.__hasEmail=appConf.get(self.__appType,'email')
     self.__hasGrass=appConf.get(self.__appType,'grass')
     self.__hasArc=appConf.get(self.__appType,'arc')
     self.__appData=appConf.items('data')
     self.__appDataDict=self.__createAppData()
     self.__appAppRoot='%s%s' % (self.__home,self.__appDataDict['app_root'])
     self.__projRoot='%s%s' % (self.__home,self.__appDataDict['proj_root'])
     self.__gisDir='%s%s' % (self.__home,self.__appDataDict['gis_data'])
     self.__rastDir='%s%s' % (self.__home,self.__appDataDict['rast_data'])
     self.__vectDir='%s%s' % (self.__home,self.__appDataDict['vect_data'])
     self.__zonalDir='%s%s' % (self.__home,self.__appDataDict['zonal_data'])
     self.__csvDir='%s%s' % (self.__home,self.__appDataDict['csv_data'])
     self.__tblDir='%s%s' % (self.__home,self.__appDataDict['tbl_data'])
     self.__dataSrc=self.__appDataDict['data_src']
     self.__outDir='%s%s' % (self.__home,self.__appDataDict['out_dir'])
     
     
     if self.__hasGrass:
         self.__grassApp=self.__createGrassApp()
     if self.__hasArc:
         self.__arcApp=self.__createArcApp()
     if self.__hasEmail:
         self.emailApp=self.__createEmailApp()
Пример #2
0
# ######################################
#       ------ Main --------
# ######################################


# ######################################
#       ------ Unit Testing --------
# ######################################
if __name__=='__main__':
       def debug(msg):
              print msg

       start_main="Start main (%s)" % (__file__)
       end_main="End main (%s)" % (__file__)

       debug(start_main)
       #-- App Code start --#
#       import os
#       import grass.script as grass
       from pprint import pprint as pp
       from ConfigParser import ConfigParser as configParser
       
       grassConf=configParser()
       grassConf.read(r'C:\MyDocs\projects\eclipse_wkspc\ncres_app\src\app.ini')
       grassSect=grassConf.items('pGRASS')
       
       rast=gRast()
       pp(rast)
       #-- App Code end --#
       debug(end_main)
Пример #3
0

# ######################################
#       ------ Unit Testing --------
# ######################################
if __name__=='__main__':
       def debug(msg):
              print msg

       start_main="Start main (%s)" % (__file__)
       end_main="End main (%s)" % (__file__)

       debug(start_main)
       #-- App Code start --#
       
       from pprint import pprint as pp
       import sys
       
       from ConfigParser import ConfigParser as configParser
       
       arcConf=configParser()
       arcConf.read('C:/MyDocs/projects/eclipse_wkspc/pGIS_Test/src/app.ini')
       arcSect=arcConf.items('pARC')
       arcApp=arcApp(arcSect)
       arcGP=arcApp.getGP
       
#       pp(arcApp.__home)
#       pp(sys.path)
       #-- App Code end --#
       debug(end_main)