jschuengel: thuban/Extensions/umn_mapserver mf_import.py,1.2,1.3
cvs@intevation.de
cvs at intevation.de
Wed Jun 23 14:40:47 CEST 2004
Author: jschuengel
Update of /thubanrepository/thuban/Extensions/umn_mapserver
In directory doto:/tmp/cvs-serv1727
Modified Files:
mf_import.py
Log Message:
Removed the wxCHANGE_DIR, because of the hint from Bernhard Herzog.
Corrected the handling of absolute pathnames.
Changed the Text of the Menu-Item, now the beginning is upper case.
Index: mf_import.py
===================================================================
RCS file: /thubanrepository/thuban/Extensions/umn_mapserver/mf_import.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- mf_import.py 16 Jun 2004 10:44:34 -0000 1.2
+++ mf_import.py 23 Jun 2004 12:40:45 -0000 1.3
@@ -22,11 +22,11 @@
#
# ###################################
-import os#, sys
+import os
from mapscript import mapObj
-from wxPython.wx import wxFileDialog, wxCHANGE_DIR,\
+from wxPython.wx import wxFileDialog, \
wxOPEN, wxOVERWRITE_PROMPT, wxID_OK
from wxPython.lib.dialogs import wxMultipleChoiceDialog
@@ -78,7 +78,7 @@
_("Select MapFile file"), ".", "",
_("UMN MapServer Mapfiles (*.map)|*.map|") +
_("All Files (*.*)|*.*"),
- wxOPEN|wxOVERWRITE_PROMPT|wxCHANGE_DIR)
+ wxOPEN|wxOVERWRITE_PROMPT)
if dlg.ShowModal() == wxID_OK:
filename = dlg.GetPath()
dlg.Destroy()
@@ -140,7 +140,10 @@
if maplayer.get_type() == 'raster':
imgpath = maplayer.get_data()
try:
- filename = filepath +"/" + mapobj.get_shapepath() +'/' + imgpath
+ if os.path.isabs(mapobj.get_shapepath()):
+ filename = mapobj.get_shapepath() +'/' + imgpath
+ else:
+ filename = filepath +"/" + mapobj.get_shapepath() +'/' + imgpath
# Normalize the pathname by collapses
# redundant separators and up-level references
filename = os.path.normpath(filename)
@@ -161,7 +164,10 @@
(maplayer.get_type() == 'circle') or
(maplayer.get_type() == 'point')):
try:
- filename = filepath + "/" + mapobj.get_shapepath() + "/" + \
+ if os.path.isabs(mapobj.get_layers()[layernr].get_data()):
+ filename = mapobj.get_layers()[layernr].get_data() +".shp"
+ else:
+ filename = filepath + "/" + mapobj.get_shapepath() + "/" + \
mapobj.get_layers()[layernr].get_data() +".shp"
# Normalize the pathname by collapses
# redundant separators and up-level references
@@ -196,8 +202,6 @@
map_clazz = map_clazzes[map_clazznr]
layer_style = map_clazz.get_styles()[0]
clazz_name = map_clazz.get_name()
- if not clazz_name:
- clazz_name = "none"
clazz = layer.GetClassification()
prop = ClassGroupProperties()
@@ -328,7 +332,7 @@
# ###################################
# register the new command
-registry.Add(Command("import_mapfile", _("import Mapfile"), import_mapfile,
+registry.Add(Command("import_mapfile", _("Import Mapfile"), import_mapfile,
helptext = _("Import a mapfile")))
# find the extensions menu (create it anew if not found)
More information about the Thuban-devel
mailing list
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)