jan: thuban/Extensions/ogr ogrstart.py,1.5,1.6

cvs@intevation.de cvs at intevation.de
Thu Apr 28 11:40:00 CEST 2005


Author: jan

Update of /thubanrepository/thuban/Extensions/ogr
In directory doto:/tmp/cvs-serv31447

Modified Files:
	ogrstart.py 
Log Message:
(open_with_ogr): Added forgotten _ for i18n.
Adapted call OpenFileShapestore regarding new parameter.
(OpenFileShapestore): Use OGRFileShapeStore instead of
OGRShapeStore. Fix return value (None instead of null).
Add new parameter "mainwindow" to avoid accessing global
context.


Index: ogrstart.py
===================================================================
RCS file: /thubanrepository/thuban/Extensions/ogr/ogrstart.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- ogrstart.py	4 Mar 2005 15:07:59 -0000	1.5
+++ ogrstart.py	28 Apr 2005 09:39:58 -0000	1.6
@@ -54,12 +54,13 @@
                 layername = layerDlg.GetLayer()
                 try:
                     session = context.application.Session()
-                    store = OpenFileShapestore(session, filename, layername)
+                    store = OpenFileShapestore(context.mainwindow, session,
+                                               filename, layername)
                     session.AddShapeStore(store)
                 except:
                     # the layer couldn't be opened
-                    context.mainwindow.RunMessageBox(("Add Layer"),
-                                ("Can't open the file '%s'.")%filename)
+                    context.mainwindow.RunMessageBox(_("Add Layer"),
+                                _("Can't open the file '%s'.") % filename)
                 else:
                     if store is not None:
                         layer = Layer(title, store)
@@ -148,19 +149,18 @@
                     canvas.FitMapToWindow()
     dlg.Destroy()
 
-def OpenFileShapestore(session, filename, layername):
+def OpenFileShapestore(mainwindow, session, filename, layername):
     """Open a datasource and add the required layer.
     """
     try:
-        store = ogrshapes.OGRShapeStore(session, filename, layername)
+        store = ogrshapes.OGRFileShapeStore(session, filename, layername)
         return store
     except:
         # Some error occured while initializing the layer
-        context.mainwindow.RunMessageBox(_("Open datasource"),
+        mainwindow.RunMessageBox(_("Open datasource"),
                            _("Can't open the datasource '%s'")
                            % filename)
-    else:
-        return null
+        return None
 
 def OpenDBShapestore(session, dbconn, layername, id_column, geo_column):
     """Open a datasource and add the required layer.





More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)