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

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

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

revision 1018 by bh, Thu May 22 19:29:39 2003 UTC revision 1019 by jan, Fri May 23 12:56:34 2003 UTC
# Line 16  import os Line 16  import os
16  import inspect  import inspect
17  import warnings  import warnings
18    
19    from base import TitledObject
20    
21  import dbflib  import dbflib
22    
23  # the field types supported by a Table instance.  # the field types supported by a Table instance.
# Line 108  class DBFColumn: Line 110  class DBFColumn:
110          self.index = index          self.index = index
111    
112    
113  class DBFTable(OldTableInterfaceMixin):  class DBFTable(TitledObject, OldTableInterfaceMixin):
114    
115      """      """
116      Table interface for the data in a DBF file      Table interface for the data in a DBF file
# Line 130  class DBFTable(OldTableInterfaceMixin): Line 132  class DBFTable(OldTableInterfaceMixin):
132    
133      def __init__(self, filename):      def __init__(self, filename):
134          self.filename = filename          self.filename = filename
135            title = os.path.basename(self.filename)
136            TitledObject.__init__(self, title)
137          self.dbf = dbflib.DBFFile(filename)          self.dbf = dbflib.DBFFile(filename)
138    
139          # If true, self.dbf is open for writing.          # If true, self.dbf is open for writing.
# Line 147  class DBFTable(OldTableInterfaceMixin): Line 151  class DBFTable(OldTableInterfaceMixin):
151              self.column_map[name] = col              self.column_map[name] = col
152              self.column_map[index] = col              self.column_map[index] = col
153    
     def Title(self):  
         """Return the title of the table.  
   
         The title is simply the basename of the filename  
         """  
         return os.path.basename(self.filename)  
   
154      def NumRows(self):      def NumRows(self):
155          """Return the number of rows in the table"""          """Return the number of rows in the table"""
156          return self.dbf.record_count()          return self.dbf.record_count()
# Line 269  class MemoryColumn: Line 266  class MemoryColumn:
266          self.type = type          self.type = type
267          self.index = index          self.index = index
268    
269  class MemoryTable(OldTableInterfaceMixin):  class MemoryTable(TitledObject, OldTableInterfaceMixin):
270    
271      """Very simple table implementation that operates on a list of tuples"""      """Very simple table implementation that operates on a list of tuples"""
272    
# Line 281  class MemoryTable(OldTableInterfaceMixin Line 278  class MemoryTable(OldTableInterfaceMixin
278          data -- List of tuples, one for each row of data          data -- List of tuples, one for each row of data
279          """          """
280          self.data = data          self.data = data
281            title = 'MemoryTable'
282            TitledObject.__init__(self, title)
283    
284          # Create the column information objects          # Create the column information objects
285          self.columns = []          self.columns = []
# Line 292  class MemoryTable(OldTableInterfaceMixin Line 291  class MemoryTable(OldTableInterfaceMixin
291              self.column_map[name] = col              self.column_map[name] = col
292              self.column_map[index] = col              self.column_map[index] = col
293    
     def Title(self):  
         """Return 'MemoryTable'  
   
         Override in derived classes to have a more meaningful title.  
         """  
         return "MemoryTable"  
   
294      def NumColumns(self):      def NumColumns(self):
295          """Return the number of columns in the table"""          """Return the number of columns in the table"""
296          return len(self.columns)          return len(self.columns)

Legend:
Removed from v.1018  
changed lines
  Added in v.1019

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26