/[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 907 by bh, Fri May 16 15:01:04 2003 UTC revision 1019 by jan, Fri May 23 12:56:34 2003 UTC
# Line 12  Classes for handling tables of data. Line 12  Classes for handling tables of data.
12    
13  __version__ = "$Revision$"  __version__ = "$Revision$"
14    
15    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 107  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 129  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 218  class DBFTable(OldTableInterfaceMixin): Line 223  class DBFTable(OldTableInterfaceMixin):
223          values.sort()          values.sort()
224          return values          return values
225    
226        def Dependencies(self):
227            """Return an empty sequence. The DBFTable doesn't depend on anything"""
228            return ()
229    
230      # DBF specific interface parts.      # DBF specific interface parts.
231    
# Line 246  class DBFTable(OldTableInterfaceMixin): Line 254  class DBFTable(OldTableInterfaceMixin):
254          self.dbf.write_record(record, values)          self.dbf.write_record(record, values)
255          self.dbf.commit()          self.dbf.commit()
256    
257        def FileName(self):
258            """Return the filename the DBFTable was instantiated with"""
259            return self.filename
260    
261    
262  class MemoryColumn:  class MemoryColumn:
# Line 255  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 267  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 344  class MemoryTable(OldTableInterfaceMixin Line 357  class MemoryTable(OldTableInterfaceMixin
357          values.sort()          values.sort()
358          return values          return values
359    
360        def Dependencies(self):
361            """Return an empty sequence. The MemoryTable doesn't depend on anything
362            """
363            return ()
364    
365      def write_record(self, record, values):      def write_record(self, record, values):
366          # TODO: Check for correct lenght and perhaps also          # TODO: Check for correct lenght and perhaps also

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26