/[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 981 by bh, Wed May 7 15:11:12 2003 UTC revision 982 by bh, Thu May 22 12:02:15 2003 UTC
# Line 23  from base import TitledObject, Modifiabl Line 23  from base import TitledObject, Modifiabl
23  from map import Map  from map import Map
24  from data import ShapefileStore  from data import ShapefileStore
25    
26  from transientdb import TransientDatabase  from transientdb import TransientDatabase, AutoTransientTable
27    
28  class AutoRemoveFile:  class AutoRemoveFile:
29    
# Line 194  class Session(TitledObject, Modifiable): Line 194  class Session(TitledObject, Modifiable):
194                                    if store is not weakref]                                    if store is not weakref]
195    
196      def Tables(self):      def Tables(self):
197          """Return a list of all table objects open in the session"""          """Return a list of all table objects open in the session
198          # Tables are only available from shapestores at the moment, so  
199          # we just take them from there          The list includes all tables that are indirectly opened through
200          return [store.Table() for store in self.ShapeStores()]          shape stores and the tables that have been opened explicitly.
201            """
202            return self.tables + [store.Table() for store in self.ShapeStores()]
203    
204        def AddTable(self, table):
205            """Add the table to the session
206    
207            All tables associated with the session that are not implicitly
208            created by the OpenShapefile method (and maybe other Open*
209            methods in the future) have to be passed to this method to make
210            sure the session knows about it. The session keeps a reference
211            to the table. Only tables managed by the session in this way
212            should be used for layers contained in one of the session's
213            maps.
214    
215            The table parameter may be any object implementing the table
216            interface. If it's not already one of the transient tables
217            instantiate an AutoTransientTable with it and use that instead
218            of the original table (note that the AutoTransientTable keeps a
219            reference to the original table).
220    
221            Return the table object actually used by the session.
222            """
223            if not hasattr(table, "transient_table"):
224                transient_table = AutoTransientTable(self.TransientDB(), table)
225            else:
226                transient_table = table
227            self.tables.append(transient_table)
228            return transient_table
229    
230      def temp_directory(self):      def temp_directory(self):
231          """          """

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26