/[escript]/trunk/pyvisi/py_src/datacollector.py
ViewVC logotype

Diff of /trunk/pyvisi/py_src/datacollector.py

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

revision 1809 by ksteube, Thu Sep 25 06:43:44 2008 UTC revision 2009 by phornby, Mon Nov 10 10:01:50 2008 UTC
# Line 71  class DataCollector: Line 71  class DataCollector:
71          self.__set_scalar = False          self.__set_scalar = False
72          self.__set_vector= False          self.__set_vector= False
73          self.__set_tensor= False          self.__set_tensor= False
74            self.__tmp_fd = None
75            self.__tmp_file = None
76    
77    
78          if(source == Source.XML): # Source is an XML file.          if(source == Source.XML): # Source is an XML file.
79              self.__vtk_xml_reader = vtk.vtkXMLUnstructuredGridReader()              self.__vtk_xml_reader = vtk.vtkXMLUnstructuredGridReader()
# Line 78  class DataCollector: Line 81  class DataCollector:
81          elif (self.__source == Source.ESCRIPT):          elif (self.__source == Source.ESCRIPT):
82              self.__vtk_xml_reader = vtk.vtkXMLUnstructuredGridReader()              self.__vtk_xml_reader = vtk.vtkXMLUnstructuredGridReader()
83              # Create a temporary .xml file and retrieve its path.              # Create a temporary .xml file and retrieve its path.
84              self.__tmp_file = tempfile.mkstemp(suffix=".xml")[1]              # Should raise IOError on failure, in wich case
85                # __tmp_fd will remain None.
86                fd_and_name = tempfile.mkstemp(suffix=".xml")
87                self.__tmp_fd = fd_and_name[0]
88                self.__tmp_file = fd_and_name[1]
89    
90      def __del__(self):      def __del__(self):
91          """          """
92          Perform some clean up of the temporary file.          Perform some clean up of ths assumese temporary file.
93          """          """
94            # remove this test and rely upon the existance of an open
95          if (self.__source == Source.ESCRIPT):          # __tmp_file to decide upon closing and unlinking.
96              if os.access(self.__tmp_file,os.F_OK): os.unlink(self.__tmp_file)          # if (self.__source == Source.ESCRIPT):
97            if self.__tmp_fd != None :
98                os.close(self.__tmp_fd)
99                os.unlink(self.__tmp_file)
100    
101      def setFileName(self, file_name):      def setFileName(self, file_name):
102          """          """

Legend:
Removed from v.1809  
changed lines
  Added in v.2009

  ViewVC Help
Powered by ViewVC 1.1.26