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

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

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

revision 982 by bh, Thu May 22 12:02:15 2003 UTC revision 1036 by bh, Mon May 26 17:30:29 2003 UTC
# Line 22  from Thuban import _ Line 22  from Thuban import _
22  from base import TitledObject, Modifiable  from base import TitledObject, Modifiable
23  from map import Map  from map import Map
24  from data import ShapefileStore  from data import ShapefileStore
25    from table import DBFTable
26    
27  from transientdb import TransientDatabase, AutoTransientTable  from transientdb import TransientDatabase, AutoTransientTable
28    
# Line 227  class Session(TitledObject, Modifiable): Line 228  class Session(TitledObject, Modifiable):
228          self.tables.append(transient_table)          self.tables.append(transient_table)
229          return transient_table          return transient_table
230    
231        def RemoveTable(self, table):
232            """Remove the table from the session.
233    
234            The table object must be a table object previously returned by
235            the AddTable method. If the table is not part of the session
236            raise a ValueError.
237            """
238            tables = [t for t in self.tables if t is not table]
239            if len(tables) == len(self.tables):
240                raise ValueError
241            self.tables = tables
242    
243        def OpenTableFile(self, filename):
244            """Open the table file filename and return the table object.
245    
246            The filename argument must be the name of a DBF file.
247            """
248            return self.AddTable(DBFTable(filename))
249    
250      def temp_directory(self):      def temp_directory(self):
251          """          """
252          Return the name of the directory for session specific temporary files          Return the name of the directory for session specific temporary files
# Line 246  class Session(TitledObject, Modifiable): Line 266  class Session(TitledObject, Modifiable):
266          self._add_shapestore(store)          self._add_shapestore(store)
267          return store          return store
268    
269        def AddShapeStore(self, shapestore):
270            """Add the shapestore to the session.
271    
272            The session only holds a weak reference to the shapestore, so it
273            will automatically be removed from the session when the last
274            reference goes away.
275            """
276            self._add_shapestore(shapestore)
277            return shapestore
278    
279      def TransientDB(self):      def TransientDB(self):
280          if self.transient_db is None:          if self.transient_db is None:
281              filename = os.path.join(self.temp_directory(), "transientdb")              filename = os.path.join(self.temp_directory(), "transientdb")

Legend:
Removed from v.982  
changed lines
  Added in v.1036

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26