Parent Directory
|
Revision Log
Sticky Revision: |
made a copy
* 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
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
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.
* 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.
(Session.AddTable): call self.changed to set the modified flag
* 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.
(Session.OpenTableFile): New. Open a dbf file and add the table to the tables managed by the session
* Thuban/Model/session.py (Session.AddShapeStore): Define AddShapeStore analogously to AddTable. * test/test_session.py (TestSessionSimple.test_add_shapestore): New. Test for AddShapeStore
* Thuban/Model/session.py (Session.RemoveTable): New method to remove tables * test/test_session.py (TestSessionSimple.test_remove_table): New. Test for RemoveTable
* 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
* 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
(Session.Destroy): Explicitly close the transient DB if it exists to make sure it doesn't leave a journal file in the temp directory.
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.
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
Use LAYER_CHANGED instead of LAYER_LEGEND_CHANGED.
Rename and use new messages.
Replace user string by _() for i18n.
(Session.forwarded_channels): Forward the CHANGED channel too.
(Session.Destroy): Don't bypass the direct base class' Destroy method.
(Session.RemoveMap): New
* 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.
* 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
Session.Extensions, Session.HasExtensions, Session.AddExtension: new for handling extensions. Also some other minor changes to round up extension handling.
* 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.
new session don't have a filename
* Thuban/Model/session.py (create_empty_session): Unset the modified bit before returning it
(Session.UnsetModified): Remove debug prints
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.
[email protected] | ViewVC Help |
Powered by ViewVC 1.1.26 |