/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/Model/resource.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/Model/resource.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1161 by jonathan, Thu Jun 12 12:41:01 2003 UTC revision 1230 by jonathan, Wed Jun 18 14:46:43 2003 UTC
# Line 21  from xml.sax import SAXParseException Line 21  from xml.sax import SAXParseException
21  projdir = \  projdir = \
22          os.path.join(Thuban.__path__[0], os.pardir, "Resources", "Projections")          os.path.join(Thuban.__path__[0], os.pardir, "Resources", "Projections")
23    
 usrdir  = get_application_dir()  
24    
25  PROJ_EXT = ".proj"  PROJ_EXT = ".proj"
26    
27  has_gdal_support = lambda: False  has_gdal_support = lambda: False
28  try:  try:
29        # first try to see if our extension module is there. if it
30        # wasn't even compiled, we obviously don't have gdal support.
31        import gdalwarp
32    
33        # now try to import the python extension. if this doesn't
34        # exist then we can't do anything.
35      import gdal      import gdal
36    
37      """Return True if the gdal library is available."""      """Return True if the gdal library is available."""
38      has_gdal_support = lambda: True      has_gdal_support = lambda: True
39  except ImportError:  except ImportError:
# Line 68  def get_proj_files(dir): Line 74  def get_proj_files(dir):
74          for file in filter(lambda s: s.endswith(PROJ_EXT), dirlist):          for file in filter(lambda s: s.endswith(PROJ_EXT), dirlist):
75              try:              try:
76                  filename = os.path.join(dir, file)                  filename = os.path.join(dir, file)
77                  list.append(ReadProjFile(filename))                  list.append(read_proj_file(filename))
78              except (OSError, IOError, SAXParseException):              except (OSError, IOError, SAXParseException):
79                  pass # just move onto the next file                  pass # just move onto the next file
80    
# Line 83  def get_system_proj_files(): Line 89  def get_system_proj_files():
89      """      """
90      filename = os.path.join(projdir, "defaults.proj")      filename = os.path.join(projdir, "defaults.proj")
91      try:      try:
92          return [ReadProjFile(filename)]          return [read_proj_file(filename)]
93      except (OSError, IOError, SAXParseException):      except (OSError, IOError, SAXParseException):
94          return [ProjFile(filename)]          return [ProjFile(filename)]
95    
# Line 94  def get_user_proj_files(): Line 100  def get_user_proj_files():
100      empty projection file set to store data in the default file.      empty projection file set to store data in the default file.
101      """      """
102    
103        usrdir  = get_application_dir()
104      filename = os.path.join(usrdir, "user.proj")      filename = os.path.join(usrdir, "user.proj")
105      try:      try:
106          return [ReadProjFile(filename)]          return [read_proj_file(filename)]
107      except (OSError, IOError, SAXParseException):      except (OSError, IOError, SAXParseException):
108          return [ProjFile(filename)]          return [ProjFile(filename)]
109    

Legend:
Removed from v.1161  
changed lines
  Added in v.1230

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26