[Thuban-commits] r2783 - in trunk/thuban: . Extensions/ogr

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Nov 26 01:13:58 CET 2007


Author: bernhard
Date: 2007-11-26 01:13:57 +0100 (Mon, 26 Nov 2007)
New Revision: 2783

Modified:
   trunk/thuban/ChangeLog
   trunk/thuban/Extensions/ogr/ogrstart.py
Log:
Extensions/ogr/ogrstart.py: Re-added parameters for wx.FileDialog()
that had been accidently dropped in r2746. Transformed result from
GetPaths to internal encoding. Refactored map to mymap. Removed two
unused variables from select_file_format().



Modified: trunk/thuban/ChangeLog
===================================================================
--- trunk/thuban/ChangeLog	2007-11-25 23:54:38 UTC (rev 2782)
+++ trunk/thuban/ChangeLog	2007-11-26 00:13:57 UTC (rev 2783)
@@ -1,5 +1,10 @@
 2007-11-26  Bernhard Reiter <bernhard at intevation.de>
 
+	* Extensions/ogr/ogrstart.py: Re-added parameters for wx.FileDialog()
+	that had been accidently dropped in r2746. Transformed result from
+	GetPaths to internal encoding. Refactored map to mymap. Removed two
+	unused variables from select_file_format().
+
 	* Thuban/UI/altpathdialog.py: transformed result from GetPaths to
 	internal encoding. Made sure the translation is actually used as
 	the _() function will only match on a fixed string.

Modified: trunk/thuban/Extensions/ogr/ogrstart.py
===================================================================
--- trunk/thuban/Extensions/ogr/ogrstart.py	2007-11-25 23:54:38 UTC (rev 2782)
+++ trunk/thuban/Extensions/ogr/ogrstart.py	2007-11-26 00:13:57 UTC (rev 2783)
@@ -1,4 +1,4 @@
-# Copyright (c) 2004,2006 by Intevation GmbH    vim:encoding=latin-1:
+# Copyright (c) 2004,2006,2007 by Intevation GmbH    vim:encoding=latin-1:
 # Authors:
 # Nina Hüffmeyer <nhueffme at intevation.de>
 #
@@ -19,6 +19,7 @@
 from Thuban import _
 
 from Thuban.Model.layer import Layer
+from Thuban.UI import internal_from_wxstring
 
 # Import ogr related classes
 from Extensions.ogr import ogrshapes, ogrdialog
@@ -31,7 +32,7 @@
     '''Open a file supported by ogr.
     '''
     canvas = context.mainwindow.canvas
-    map = canvas.Map()
+    mymap = canvas.Map()
 
     # Get the file to be opened
     wildcard = _("Shapefiles (*.shp)") + "|*.shp|" +\
@@ -41,13 +42,14 @@
                            _("CSV files (*.csv)") + "|*.csv|" +\
                            _("All Files (*.*)") + "|*.*"
     dlg = wx.FileDialog(canvas, _("Select a data file"),
+                           context.application.Path("data"), "",
                            wildcard,
                            wx.OPEN | wx.MULTIPLE)
     if dlg.ShowModal() == wx.ID_OK:
-        filenames = dlg.GetPaths()
+        filenames = map(internal_from_wxstring, dlg.GetPaths())
         for filename in filenames:
             title = os.path.splitext(os.path.basename(filename))[0]
-            has_layers = map.HasLayers()
+            has_layers = mymap.HasLayers()
             layerDlg = ogrdialog.ChooseLayer(canvas, filename)
             if layerDlg.ShowModal() == wx.ID_OK:
                 layername = layerDlg.GetLayer()
@@ -63,7 +65,7 @@
                 else:
                     if store is not None:
                         layer = Layer(title, store)
-                        map.AddLayer(layer)
+                        mymap.AddLayer(layer)
                         if not has_layers:
                             # if we're adding a layer to an empty map, fit the
                             # new map to the window
@@ -74,10 +76,7 @@
 def select_file_format(context):
     ''' Display all available supported formats.
     '''
-
     canvas = context.mainwindow.canvas
-    file = None
-    map = canvas.Map()
 
     session = context.application.Session()
 



More information about the Thuban-commits mailing list