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

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

Parent Directory Parent Directory | Revision Log Revision Log


Sticky Revision:
(Current path doesn't exist after revision 2835)

Revision 2734 - (view) (annotate) - [select for diffs]
Modified Thu Mar 1 12:42:59 2007 UTC (18 years ago) by bramz
File length: 15639 byte(s)
Diff to previous 2102
made a copy

Revision 2102 - (view) (annotate) - [select for diffs]
Modified Thu Mar 11 21:04:30 2004 UTC (20 years, 11 months ago) by bh
Original Path: trunk/thuban/Thuban/Model/session.py
File length: 15639 byte(s)
Diff to previous 1607
* Thuban/UI/dbdialog.py (ChooseDBTableDialog.__init__): Rework how
the dialog is constructed. Add combo boxes to select id and
geometry column.  Rename some instance variables.
(ChooseDBTableDialog.GetTable): Return id and geometry column
names
(ChooseDBTableDialog.OnTableSelect): New. Event handler for
selections in the table list

* Thuban/UI/mainwindow.py (MainWindow.AddDBLayer): Use id_column
and geometry_column

* Thuban/Model/session.py (Session.OpenDBShapeStore): Add the new
parameters for id_column and geometry column of PostGISShapeStore
here as well.

* Thuban/Model/postgisdb.py (type_map): Add ROWID psycog type.
(_raw_type_map): New. Map raw PostgreSQL type ints to thuban types
(PostGISConnection.GeometryTables): Use a better query to
determine which relations in the database might be usable for
shapestores.  Now supports views as well but is more PostgreSQL
specific
(PostGISConnection.table_columns): New. Somewhat experimental
method to let the db dialogs provide lists of columns to users so
that they can select id and geometry columns.
(PostGISTable.__init__): The default value of the id_column
parameter is now None it still means "gid" effectively, though.
(PostGISTable.IDColumn): New introspection method to return a
column object for the id column
(PostGISShapeStore.GeometryColumn): New introspection method to
return a column object for the geometry column

* test/test_postgis_db.py
(TestPostGISConnection.test_gis_tables_non_empty):
Removed. Subsumed by the new:
(TestPostGISConnection.test_gis_tables_with_views_and_tables):
New. Tes the GeometryTables and table_columns methods with actual
tables and views.
(PointTests.test_id_column, PointTests.test_geometry_column):
New. tests for the new methods.
(TestPostGISShapestorePoint.setUp)
(TestPostGISShapestorePointSRID.setUp)
(TestPostGISShapestorePointExplicitGIDColumn.setUp): Fill the
instance variables needed by the new tests


Revision 1607 - (view) (annotate) - [select for diffs]
Modified Tue Aug 19 12:50:35 2003 UTC (21 years, 6 months ago) by bh
Original Path: trunk/thuban/Thuban/Model/session.py
File length: 15420 byte(s)
Diff to previous 1282
Add the db connection management to the session.

* Thuban/Model/session.py (Session.__init__): New instance
variable db_connections
(Session.AddDBConnection, Session.DBConnections)
(Session.HasDBConnections, Session.CanRemoveDBConnection)
(Session.RemoveDBConnection): New methods to manage and query the
db connections managed by the session
(Session.OpenDBShapeStore): New method to open a shapestore from a
db connection

* Thuban/Model/messages.py (DBCONN_REMOVED, DBCONN_ADDED): New
messages for the db connection handling in the session

* test/test_postgis_session.py: New. test cases for the session's
db connection handling with postgis connections


Revision 1282 - (view) (annotate) - [select for diffs]
Modified Mon Jun 23 09:47:18 2003 UTC (21 years, 8 months ago) by bh
Original Path: trunk/thuban/Thuban/Model/session.py
File length: 13096 byte(s)
Diff to previous 1268
Bug fix for RT #1961:

* Thuban/Model/load.py (SessionLoader.start_derivedshapesource):
Register DerivedShapestores with the session

* Thuban/Model/session.py (Session.Tables): Make sure each table
is only listed once.

* test/test_load.py (TestJoinedTable.test): Add check_format call.
Update file contents to match the one written out.


Revision 1268 - (view) (annotate) - [select for diffs]
Modified Fri Jun 20 16:10:12 2003 UTC (21 years, 8 months ago) by bh
Original Path: trunk/thuban/Thuban/Model/session.py
File length: 12882 byte(s)
Diff to previous 1124
* Resources/XML/thuban-0.8.dtd: New DTD for the new file format
version.

* Thuban/Model/save.py (sort_data_stores): New. Make topological
sort of the data sources so they can be written with sources that
data sources that depend on other data sources come after the
sources they depend on.
(SessionSaver.__init__): Add idmap instance variable to map from
objects to the ids used in the file.
(SessionSaver.get_id, SessionSaver.define_id)
(SessionSaver.has_id): New. Methods to manage the idmap
(SessionSaver.write): Use thuban-0.8.dtd
(SessionSaver.write_session): Add a namespace on the session and
write out the data sources before the maps.
(SessionSaver.write_data_containers): New. Write the data
containers.
(SessionSaver.write_layer): Layer elements now refer to a
shapestore and don't contain filenames anymore.

* Thuban/Model/load.py (LoadError): Exception class to raise when
errors in the files are discovered
(SessionLoader.__init__): Define dispatchers for elements with a
thuban-0.8 namespace too.
(SessionLoader.check_attrs): New helper method to check and
convert attributes
(AttrDesc): New. Helper class for SessionLoader.check_attrs
(SessionLoader.start_fileshapesource)
(SessionLoader.start_derivedshapesource)
(SessionLoader.start_filetable, SessionLoader.start_jointable):
Handlers for the new elements in the new fileformat
(SessionLoader.start_layer): Handle the shapestore attribute in
addition to filename.
(SessionLoader.start_table, SessionLoader.end_table): Removed.
They were never used in the old formats and aren't needed for the
new.

* Thuban/Model/session.py (Session.DataContainers): New method to
return all "data containers", i.e. shapestores and tables

* test/xmlsupport.py (SaxEventLister.__init__)
(SaxEventLister.startElementNS, sax_eventlist): Add support to
normalize IDs.

* test/test_xmlsupport.py
(TestEventList.test_even_list_id_normalization): New test case for
id normalization

* test/test_load.py (LoadSessionTest.check_format): Use ID
normalization
(LoadSessionTest.thubanids, LoadSessionTest.thubanidrefs): New
class atrributes used for ID normalization
(TestSingleLayer, TestLayerVisibility, TestLabels.test)
(TestLayerProjection.test, TestRasterLayer.test): Adapt to new
file format
(TestJoinedTable): New test for loading sessions with joined
tables.
(TestLoadError): New. Test whether missing required attributes
cause a LoadError.

* test/test_save.py (SaveSessionTest.thubanids)
(SaveSessionTest.thubanidrefs): New class attributes for ID
normalization in .thuban files.
(SaveSessionTest.compare_xml): Use id-normalization.
(SaveSessionTest.testEmptySession)
(SaveSessionTest.testLayerProjection)
(SaveSessionTest.testRasterLayer)
(SaveSessionTest.testClassifiedLayer): Adapt to new file format.
(SaveSessionTest.testLayerProjection): The filename used was the
same as for testSingleLayer. Use a different one.
(SaveSessionTest.test_dbf_table)
(SaveSessionTest.test_joined_table): New test cases for saving the
new data sources structures.
(TestStoreSort, MockDataStore): Classes to test the sorting of the
data stores for writing.


Revision 1124 - (view) (annotate) - [select for diffs]
Modified Mon Jun 2 14:14:25 2003 UTC (21 years, 9 months ago) by bh
Original Path: trunk/thuban/Thuban/Model/session.py
File length: 12733 byte(s)
Diff to previous 1068
(Session.AddTable): call self.changed to
set the modified flag


Revision 1068 - (view) (annotate) - [select for diffs]
Modified Tue May 27 15:02:37 2003 UTC (21 years, 9 months ago) by bh
Original Path: trunk/thuban/Thuban/Model/session.py
File length: 12710 byte(s)
Diff to previous 1036
* Thuban/Model/messages.py (TABLE_REMOVED): New message.

* Thuban/Model/session.py (Session.UnreferencedTables): New method
to return tables that are not referenced by other tables or shape
stores and can be removed.
(Session.RemoveTable): Issue a TABLE_REMOVED message after
removing the table

* Thuban/UI/mainwindow.py: Remove unused imports
(MainWindow.TableClose): Implement.

* Thuban/UI/tableview.py (TableFrame.__init__): Subscribe to some
messages so that the frame will be automatically closed when a new
session is opened or the table is removed.
(TableFrame.OnClose): Unsubscribe the Subscriptions made in
__init__
(TableFrame.close_on_session_replaced)
(TableFrame.close_on_table_removed): New. Subscribers that close
the window

* test/test_session.py (TestSessionMessages.test_remove_table)
(TestSessionSimple.test_remove_table): Move the test to
TestSessionSimple and add test for the TABLE_REMOVED message
(TestSessionBase.setUp): Also subscribe to TABLE_REMOVED
(TestSessionSimple.test_unreferenced_tables) New. Test for the
UnreferencedTables method.
(UnreferencedTablesTests): New. Class with some more sophisticated
tests for UnreferencedTables.


Revision 1036 - (view) (annotate) - [select for diffs]
Modified Mon May 26 17:30:29 2003 UTC (21 years, 9 months ago) by bh
Original Path: trunk/thuban/Thuban/Model/session.py
File length: 12098 byte(s)
Diff to previous 1016
(Session.OpenTableFile): New. Open a dbf
file and add the table to the tables managed by the session


Revision 1016 - (view) (annotate) - [select for diffs]
Modified Fri May 23 11:05:59 2003 UTC (21 years, 9 months ago) by bh
Original Path: trunk/thuban/Thuban/Model/session.py
File length: 11838 byte(s)
Diff to previous 987
* Thuban/Model/session.py (Session.AddShapeStore): Define
AddShapeStore analogously to AddTable.

* test/test_session.py (TestSessionSimple.test_add_shapestore):
New. Test for AddShapeStore


Revision 987 - (view) (annotate) - [select for diffs]
Modified Thu May 22 16:46:14 2003 UTC (21 years, 9 months ago) by bh
Original Path: trunk/thuban/Thuban/Model/session.py
File length: 11499 byte(s)
Diff to previous 982
* Thuban/Model/session.py (Session.RemoveTable): New method to
remove tables

* test/test_session.py (TestSessionSimple.test_remove_table): New.
Test for RemoveTable


Revision 982 - (view) (annotate) - [select for diffs]
Modified Thu May 22 12:02:15 2003 UTC (21 years, 9 months ago) by bh
Original Path: trunk/thuban/Thuban/Model/session.py
File length: 11075 byte(s)
Diff to previous 851
* Thuban/Model/session.py (Session.AddTable): New method to
register tables with the session.
(Session.Tables): Return the tables registered with AddTable too.

* test/test_session.py (TestSessionSimple.test_add_table): New.
Test case for the AddTable method


Revision 851 - (view) (annotate) - [select for diffs]
Modified Wed May 7 15:11:12 2003 UTC (21 years, 10 months ago) by bh
Original Path: trunk/thuban/Thuban/Model/session.py
File length: 9846 byte(s)
Diff to previous 778
* Thuban/Model/session.py (Session.__init__): New instance
variable shapestores to hold a list of all open shapestore objects
(Session.ShapeStores): New. Accessor method for the shapestores
list.
(Session._add_shapestore, Session._clean_weak_store_refs): New.
Internal methods to maintain the shapestores list.
(Session.Tables): New. Return all tables open in the session.
(Session.OpenShapefile): Insert the new ShapeStore into the
shapestores list.

* test/test_session.py (TestSessionSimple.test_initial_state): Add
tests for ShapeStores and Tables
(TestSessionWithContent.test_shape_stores)
(TestSessionWithContent.test_tables): New. Test cases for
ShapeStores and Tables


Revision 778 - (view) (annotate) - [select for diffs]
Modified Tue Apr 29 14:54:17 2003 UTC (21 years, 10 months ago) by bh
Original Path: trunk/thuban/Thuban/Model/session.py
File length: 8862 byte(s)
Diff to previous 765
(Session.Destroy): Explicitly close the
transient DB if it exists to make sure it doesn't leave a journal
file in the temp directory.


Revision 765 - (view) (annotate) - [select for diffs]
Modified Tue Apr 29 12:42:14 2003 UTC (21 years, 10 months ago) by bh
Original Path: trunk/thuban/Thuban/Model/session.py
File length: 8661 byte(s)
Diff to previous 723
Next step of table implementation. Introduce a transient database
using SQLite that some of the data is copied to on demand. This
allows us to do joins and other operations that require an index
for good performance with reasonable efficiency. Thuban now needs
SQLite 2.8.0 and pysqlite 0.4.1. Older versions may work but I
haven't tested that.

* Thuban/Model/transientdb.py: New. Transient database
implementation.

* test/test_transientdb.py: New. Tests for the transient DB
classes.

* Thuban/Model/session.py (AutoRemoveFile, AutoRemoveDir): New
classes to help automatically remove temporary files and
directories.
(Session.__init__): New instance variables temp_dir for the
temporary directory and transient_db for the SQLite database
(Session.temp_directory): New. Create a temporary directory if not
yet done and return its name. Use AutoRemoveDir to have it
automatically deleted
(Session.TransientDB): Instantiate the transient database if not
done yet and return it.

* Thuban/Model/data.py (ShapefileStore.__init__): Use an
AutoTransientTable so that data is copied to the transient DB on
demand.
(SimpleStore): New class that simply combines a table and a
shapefile

* Thuban/Model/table.py (Table, DBFTable): Rename Table into
DBFTable and update its doc-string to reflect the fact that this
is only the table interface to a DBF file. Table is now an alias
for DBFTable for temporary backwards compatibility.

* Thuban/UI/application.py (ThubanApplication.OnExit): Make sure
the last reference to the session goes away so that the temporary
files are removed properly.

* test/test_load.py (LoadSessionTest.tearDown): Remove the
reference to the session to make sure the temporary files are
removed.


Revision 723 - (view) (annotate) - [select for diffs]
Modified Thu Apr 24 15:31:53 2003 UTC (21 years, 10 months ago) by bh
Original Path: trunk/thuban/Thuban/Model/session.py
File length: 5911 byte(s)
Diff to previous 582
First step towards table management. Introduce a simple data
abstraction so that we replace the data a layer uses more easily
in the next step.

* Thuban/Model/data.py: New file with a simple data abstraction
that bundles shapefile and dbffile into one object.

* Thuban/Model/session.py (Session.OpenShapefile): New method to
open shapefiles and return a shape store object

* Thuban/Model/layer.py (Layer.__init__): Pass the data as a store
object instead of a shapefile filename. This introduces a new
instance variable store holding the datastore. For intermediate
backwards compatibility keep the old instance variables.
(open_shapefile): Removed. No longer needed with the shape store.
(Layer.SetShapeStore, Layer.ShapeStore): New methods to set and
get the shape store used by a layer.
(Layer.Destroy): No need to explicitly destroy the shapefile or
table anymore.

* Thuban/UI/mainwindow.py (MainWindow.AddLayer)
(MainWindow.AddLayer): Use the session's OpenShapefile method to
open shapefiles

* Thuban/Model/load.py (ProcessSession.start_layer): Use the
session's OpenShapefile method to open shapefiles

* test/test_classification.py
(TestClassification.test_classification): Use the session's
OpenShapefile method to open shapefiles and build the filename in
a more platform independed way

* test/test_layer.py (TestLayer.setUp, TestLayer.tearDown):
Implement to have a session to use in the tests
(TestLayer.test_arc_layer, TestLayer.test_polygon_layer)
(TestLayer.test_point_layer, TestLayer.test_empty_layer): Use the
session's OpenShapefile method to open shapefiles
(TestLayerLegend.setUp): Instantiate a session so that we can use
it to open shapefiles.
(TestLayerLegend.tearDown): Make sure that all references to
layers and session are removed otherwise we may get a resource
leak

* test/test_map.py (TestMapAddLayer.test_add_layer)
(TestMapWithContents.setUp): Instantiate a session so that we can
use it to open shapefiles.
(TestMapWithContents.tearDown): Make sure that all references to
layers, maps and sessions are removed otherwise we may get a
resource leak
("__main__"): use support.run_tests() so that more info about
uncollected garbage is printed

* test/test_save.py (SaveSessionTest.testSingleLayer): Use the
session's OpenShapefile method to open shapefiles
("__main__"): use support.run_tests() so that more info about
uncollected garbage is printed

* test/test_selection.py (TestSelection.tearDown): Make sure that
all references to the session and the selection are removed
otherwise we may get a resource leak
(TestSelection.get_layer): Instantiate a session so that we can
use it to open shapefiles.
("__main__"): use support.run_tests() so that more info about
uncollected garbage is printed

* test/test_session.py (TestSessionBase.tearDown)
(TestSessionWithContent.tearDown): Make sure that all references
to the session and layers are removed otherwise we may get a
resource leak
(TestSessionWithContent.setUp): Use the session's OpenShapefile
method to open shapefiles


Revision 582 - (view) (annotate) - [select for diffs]
Modified Tue Apr 1 10:22:01 2003 UTC (21 years, 11 months ago) by jonathan
Original Path: trunk/thuban/Thuban/Model/session.py
File length: 5755 byte(s)
Diff to previous 548
Use LAYER_CHANGED instead of LAYER_LEGEND_CHANGED.


Revision 548 - (view) (annotate) - [select for diffs]
Modified Thu Mar 20 09:44:49 2003 UTC (21 years, 11 months ago) by jonathan
Original Path: trunk/thuban/Thuban/Model/session.py
File length: 5769 byte(s)
Diff to previous 374
Rename and use new messages.


Revision 374 - (view) (annotate) - [select for diffs]
Modified Mon Jan 27 14:20:02 2003 UTC (22 years, 1 month ago) by jan
Original Path: trunk/thuban/Thuban/Model/session.py
File length: 5757 byte(s)
Diff to previous 318
Replace user string by _() for i18n.


Revision 318 - (view) (annotate) - [select for diffs]
Modified Fri Sep 13 14:21:12 2002 UTC (22 years, 5 months ago) by bh
Original Path: trunk/thuban/Thuban/Model/session.py
File length: 5714 byte(s)
Diff to previous 250
(Session.forwarded_channels): Forward
the CHANGED channel too.


Revision 250 - (view) (annotate) - [select for diffs]
Modified Tue Jul 30 14:17:58 2002 UTC (22 years, 7 months ago) by bh
Original Path: trunk/thuban/Thuban/Model/session.py
File length: 5669 byte(s)
Diff to previous 241
(Session.Destroy): Don't bypass the
direct base class' Destroy method.


Revision 241 - (view) (annotate) - [select for diffs]
Modified Wed Jul 24 17:16:17 2002 UTC (22 years, 7 months ago) by bh
Original Path: trunk/thuban/Thuban/Model/session.py
File length: 5668 byte(s)
Diff to previous 232
(Session.RemoveMap): New


Revision 232 - (view) (annotate) - [select for diffs]
Modified Fri Jul 19 15:14:57 2002 UTC (22 years, 7 months ago) by bh
Original Path: trunk/thuban/Thuban/Model/session.py
File length: 5442 byte(s)
Diff to previous 217
	* Thuban/Model/session.py: Issue a CHANGED message every time
	another changed message is issued to make it easier to get
	notified of changes.
	(Session): Update the doc string
	(Session.forward): Issue changed-events as CHANGED as well.
	(Session.changed): Overwrite the inherited version to issue
	CHANGED events as well.


Revision 217 - (view) (annotate) - [select for diffs]
Modified Wed Jul 17 10:50:40 2002 UTC (22 years, 7 months ago) by bh
Original Path: trunk/thuban/Thuban/Model/session.py
File length: 4226 byte(s)
Diff to previous 197
* Thuban/UI/tree.py (color_string): Removed. No longer used.
(SessionTreeCtrl.update_tree, SessionTreeCtrl.add_items): Split
update_tree into update_tree and add_items. The tree now uses a
more generic way to display the contents of the tree.
(SessionTreeCtrl): Add a doc string explaining the TreeInfo method

* Thuban/Model/layer.py (Layer.TreeInfo),
Thuban/Model/extension.py (Extension.TreeInfo),
Thuban/Model/map.py (Map.TreeInfo),
Thuban/Model/session.py (Session.TreeInfo):
Add TreeInfo methods to implement the new tree view update scheme


Revision 197 - (view) (annotate) - [select for diffs]
Modified Thu Jun 20 15:20:58 2002 UTC (22 years, 8 months ago) by jan
Original Path: trunk/thuban/Thuban/Model/session.py
File length: 3795 byte(s)
Diff to previous 128
Session.Extensions, Session.HasExtensions, Session.AddExtension:
new for handling extensions.
Also some other minor changes to round up extension handling.


Revision 128 - (view) (annotate) - [select for diffs]
Modified Fri May 3 14:38:16 2002 UTC (22 years, 10 months ago) by bh
Original Path: trunk/thuban/Thuban/Model/session.py
File length: 3107 byte(s)
Diff to previous 103
	* Thuban/Model/session.py (Session.AddMap, forwarded_channels):
	Move the map channels to be forwarded by the session into the
	class constant with forwarded_channels.


Revision 103 - (view) (annotate) - [select for diffs]
Modified Fri Apr 19 14:23:24 2002 UTC (22 years, 10 months ago) by jan
Original Path: trunk/thuban/Thuban/Model/session.py
File length: 2753 byte(s)
Diff to previous 56
new session don't have a filename


Revision 56 - (view) (annotate) - [select for diffs]
Modified Thu Sep 13 13:54:37 2001 UTC (23 years, 5 months ago) by bh
Original Path: trunk/thuban/Thuban/Model/session.py
File length: 2752 byte(s)
Diff to previous 27
	* Thuban/Model/session.py (create_empty_session): Unset the
	modified bit before returning it


Revision 27 - (view) (annotate) - [select for diffs]
Modified Thu Sep 6 13:27:52 2001 UTC (23 years, 6 months ago) by bh
Original Path: trunk/thuban/Thuban/Model/session.py
File length: 2724 byte(s)
Diff to previous 6
(Session.UnsetModified): Remove debug prints


Revision 6 - (view) (annotate) - [select for diffs]
Added Tue Aug 28 15:41:52 2001 UTC (23 years, 6 months ago) by bh
Original Path: trunk/thuban/Thuban/Model/session.py
File length: 2843 byte(s)
import all the source files


This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, enter a numeric revision.

  Diffs between and
  Type of Diff should be a

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26