[Thuban-commits] r2817 - in trunk/thuban: . Extensions/bboxdump Extensions/export_shapefile Extensions/gns2shp Extensions/importAPR Extensions/svgexport Extensions/umn_mapserver Thuban/UI

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Sun Jan 27 01:01:35 CET 2008


Author: bernhard
Date: 2008-01-27 01:01:32 +0100 (Sun, 27 Jan 2008)
New Revision: 2817

Modified:
   trunk/thuban/ChangeLog
   trunk/thuban/Extensions/bboxdump/bboxdump.py
   trunk/thuban/Extensions/export_shapefile/export_shapefile.py
   trunk/thuban/Extensions/gns2shp/gns2shp.py
   trunk/thuban/Extensions/importAPR/importAPR.py
   trunk/thuban/Extensions/svgexport/maplegend.py
   trunk/thuban/Extensions/svgexport/svgsaver.py
   trunk/thuban/Extensions/umn_mapserver/mf_import.py
   trunk/thuban/Thuban/UI/classgen.py
   trunk/thuban/Thuban/UI/classifier.py
   trunk/thuban/Thuban/UI/mainwindow.py
   trunk/thuban/Thuban/UI/tableview.py
   trunk/thuban/Thuban/UI/view.py
Log:
Changed a few places in Thuban and Extensions to convert wx
strings to internal string encoding. 

* Thuban/UI/classgen.py: Checked for return strings from wx problems.
Added one clarifing comment, removed two unused variables.

* Thuban/UI/mainwindow.py(OpenSession, SaveSessionAs, TableOpen): Using 
internal_from_wxstring for the pathname.

* Thuban/UI/tableview.py(doExport):  Using internal_from_wxstring
for the pathname.

* Thuban/UI/view.py(MapCanvas.Export):  Using internal_from_wxstring
for the pathname.

* Extensions/bboxdump/bboxdump.py(OnSelectFilename),
Extensions/export_shapefile/export_shapefile.py,
Extensions/gns2shp/gns2shp.py, Extensions/importAPR/importAPR.py,
Extensions/svgexport/maplegend.py, Extensions/svgexport/svgsaver.py,
Extensions/umn_mapserver/mf_import.py: Using
internal_from_wxstring for the pathname.


Modified: trunk/thuban/ChangeLog
===================================================================
--- trunk/thuban/ChangeLog	2008-01-26 22:21:53 UTC (rev 2816)
+++ trunk/thuban/ChangeLog	2008-01-27 00:01:32 UTC (rev 2817)
@@ -1,3 +1,30 @@
+2008-01-27   Bernhard Reiter <bernhard at intevation.de>
+
+	Changed a few places in Thuban and Extensions to convert wx
+	strings to internal string encoding. 
+
+	* Thuban/UI/classgen.py: Checked for return strings from wx problems.
+	Added one clarifing comment, removed two unused variables.
+
+	* Thuban/UI/mainwindow.py(OpenSession, SaveSessionAs, TableOpen): Using 
+	internal_from_wxstring for the pathname.
+
+	* Thuban/UI/tableview.py(doExport):  Using internal_from_wxstring
+	for the pathname.
+
+	* Thuban/UI/view.py(MapCanvas.Export):  Using internal_from_wxstring
+	for the pathname.
+
+	* Extensions/bboxdump/bboxdump.py(OnSelectFilename),
+	Extensions/export_shapefile/export_shapefile.py,
+	Extensions/gns2shp/gns2shp.py, Extensions/importAPR/importAPR.py,
+	Extensions/svgexport/maplegend.py, Extensions/svgexport/svgsaver.py,
+	Extensions/umn_mapserver/mf_import.py: Using
+	internal_from_wxstring for the pathname.
+
+
+
+
 2008-01-26   Bernhard Reiter <bernhard at intevation.de>
 	
 	Fixed projection dialog so you can set [#586].

Modified: trunk/thuban/Extensions/bboxdump/bboxdump.py
===================================================================
--- trunk/thuban/Extensions/bboxdump/bboxdump.py	2008-01-26 22:21:53 UTC (rev 2816)
+++ trunk/thuban/Extensions/bboxdump/bboxdump.py	2008-01-27 00:01:32 UTC (rev 2817)
@@ -23,10 +23,12 @@
 import wx
 from wx.lib.dialogs import ScrolledMessageDialog
 
+from Thuban import _
+
+from Thuban.UI import internal_from_wxstring
 from Thuban.UI.common import ThubanBeginBusyCursor, ThubanEndBusyCursor
 from Thuban.UI.command import registry, Command
 from Thuban.UI.mainwindow import main_menu, _has_selected_shape_layer
-from Thuban import _
 
 import shapelib
 import dbflib
@@ -139,7 +141,7 @@
                        _("All Files (*.*)|*.*"),
                        wx.SAVE|wx.OVERWRITE_PROMPT)
         if dlg.ShowModal() == wx.ID_OK:
-            self.filename.SetValue(dlg.GetPath())
+            self.filename.SetValue(internal_from_wxstring(dlg.GetPath()))
             dlg.Destroy()
         else:
             dlg.Destroy()

Modified: trunk/thuban/Extensions/export_shapefile/export_shapefile.py
===================================================================
--- trunk/thuban/Extensions/export_shapefile/export_shapefile.py	2008-01-26 22:21:53 UTC (rev 2816)
+++ trunk/thuban/Extensions/export_shapefile/export_shapefile.py	2008-01-27 00:01:32 UTC (rev 2817)
@@ -20,6 +20,7 @@
 from Thuban.Model.data import SHAPETYPE_POLYGON, SHAPETYPE_ARC, \
                               SHAPETYPE_POINT
 from Thuban.Model.table import table_to_dbf
+from Thuban.UI import internal_from_wxstring
 from Thuban.UI.command import registry, Command
 from Thuban.UI.mainwindow import main_menu
 from Thuban import _
@@ -45,7 +46,7 @@
                        _('Shapefile  Files (*.shp)|*.shp|'),
                        OPEN|OVERWRITE_PROMPT)
     if dlg.ShowModal() == ID_OK:
-        filename = dlg.GetPath()[:-4]
+        filename = internal_from_wxstring(dlg.GetPath()[:-4])
         dlg.Destroy()
     else:
         return

Modified: trunk/thuban/Extensions/gns2shp/gns2shp.py
===================================================================
--- trunk/thuban/Extensions/gns2shp/gns2shp.py	2008-01-26 22:21:53 UTC (rev 2816)
+++ trunk/thuban/Extensions/gns2shp/gns2shp.py	2008-01-27 00:01:32 UTC (rev 2817)
@@ -27,6 +27,7 @@
 if __name__ != '__main__':
     import wx
 
+    from Thuban.UI import internal_from_wxstring
     from Thuban.UI.command import registry, Command
     from Thuban.UI.mainwindow import main_menu
     from Thuban import _
@@ -129,7 +130,7 @@
                        _('All Files (*.*)|*.*'),
                        wx.OPEN|wx.OVERWRITE_PROMPT)
     if dlg.ShowModal() == wx.ID_OK:
-        gns_filename = dlg.GetPath()
+        gns_filename = internal_from_wxstring(dlg.GetPath())
         dlg.Destroy()
     else:
         return

Modified: trunk/thuban/Extensions/importAPR/importAPR.py
===================================================================
--- trunk/thuban/Extensions/importAPR/importAPR.py	2008-01-26 22:21:53 UTC (rev 2816)
+++ trunk/thuban/Extensions/importAPR/importAPR.py	2008-01-27 00:01:32 UTC (rev 2817)
@@ -22,6 +22,7 @@
 
 from Thuban.Model.extension import Extension
 from Thuban.Model.base import TitledObject, Modifiable
+from Thuban.UI import internal_from_wxstring
 from Thuban.UI.command import registry, Command
 from Thuban.UI.mainwindow import main_menu
 from Thuban import _
@@ -171,7 +172,7 @@
                        _("All Files (*.*)|*.*"),
                        wx.OPEN|wx.OVERWRITE_PROMPT)
     if dlg.ShowModal() == wx.ID_OK:
-        filename = dlg.GetPath()
+        filename = internal_from_wxstring(dlg.GetPath())
         dlg.Destroy()
     else:
         return

Modified: trunk/thuban/Extensions/svgexport/maplegend.py
===================================================================
--- trunk/thuban/Extensions/svgexport/maplegend.py	2008-01-26 22:21:53 UTC (rev 2816)
+++ trunk/thuban/Extensions/svgexport/maplegend.py	2008-01-27 00:01:32 UTC (rev 2817)
@@ -32,6 +32,8 @@
 from Thuban.Model.data import SHAPETYPE_POLYGON, SHAPETYPE_ARC, \
     SHAPETYPE_POINT, RAW_SHAPEFILE
 
+from Thuban.UI import internal_from_wxstring
+
 # Import SVG related classes
 from svgmapwriter import SVGRenderer, VirtualDC, TRANSPARENT_PEN, \
         TRANSPARENT_BRUSH, SOLID, Pen, Brush, Point
@@ -138,7 +140,7 @@
     #
     response = dlg.ShowModal()
     if response == ID_OK:
-        file = dlg.GetPath()
+        file = internal_from_wxstring(dlg.GetPath())
     else: # Do nothing if choice was interrupted.
         return 0
         

Modified: trunk/thuban/Extensions/svgexport/svgsaver.py
===================================================================
--- trunk/thuban/Extensions/svgexport/svgsaver.py	2008-01-26 22:21:53 UTC (rev 2816)
+++ trunk/thuban/Extensions/svgexport/svgsaver.py	2008-01-27 00:01:32 UTC (rev 2817)
@@ -27,6 +27,7 @@
 
 # use _() already now for all strings that may later be translated
 from Thuban import _
+from Thuban.UI import internal_from_wxstring
 
 # Import SVG related classes
 from svgmapwriter import VirtualDC, SVGRenderer, SVGMapWriterError
@@ -52,7 +53,7 @@
     
     response = dlg.ShowModal()
     if response == ID_OK:
-        file = dlg.GetPath()
+        file = internal_from_wxstring(dlg.GetPath())
     else: # Do nothing if choice was interrupted.
         return 0
         

Modified: trunk/thuban/Extensions/umn_mapserver/mf_import.py
===================================================================
--- trunk/thuban/Extensions/umn_mapserver/mf_import.py	2008-01-26 22:21:53 UTC (rev 2816)
+++ trunk/thuban/Extensions/umn_mapserver/mf_import.py	2008-01-27 00:01:32 UTC (rev 2817)
@@ -35,6 +35,8 @@
 # use _() already now for all strings that may later be translated
 from Thuban import _
 
+from Thuban.UI import internal_from_wxstring
+
 # Thuban has named commands which can be registered in the central
 # instance registry.
 from Thuban.UI.command import registry, Command
@@ -533,7 +535,7 @@
                        _("All Files (*.*)|*.*"),
                        OPEN|OVERWRITE_PROMPT)
     if dlg.ShowModal() == ID_OK:
-        filename = dlg.GetPath()
+        filename = internal_from_wxstring(dlg.GetPath())
         dlg.Destroy()
     else:
         return
@@ -567,7 +569,7 @@
                        _("All Files (*.*)|*.*"),
                        OPEN|OVERWRITE_PROMPT)
     if dlg.ShowModal() == ID_OK:
-        filename = dlg.GetPath()
+        filename = internal_from_wxstring(dlg.GetPath())
         dlg.Destroy()
     else:
         return
@@ -633,7 +635,7 @@
                            _("All Files (*.*)|*.*"),
                            OPEN|OVERWRITE_PROMPT)
         if dlg.ShowModal() == ID_OK:
-            filename = dlg.GetPath()
+            filename = internal_from_wxstring(dlg.GetPath())
             dlg.Destroy()
         else:
             return

Modified: trunk/thuban/Thuban/UI/classgen.py
===================================================================
--- trunk/thuban/Thuban/UI/classgen.py	2008-01-26 22:21:53 UTC (rev 2816)
+++ trunk/thuban/Thuban/UI/classgen.py	2008-01-27 00:01:32 UTC (rev 2817)
@@ -227,7 +227,6 @@
 
             index = self.propCombo.GetSelection()
 
-            propSel = self.propCombo.GetString(index)
             propPanel = self.propCombo.GetClientData(index)
 
             ramp = propPanel.GetRamp()
@@ -311,7 +310,6 @@
         combo = event.GetEventObject()
 
         selIndex = combo.GetSelection()
-        sel = combo.GetString(selIndex)
 
         if isinstance(self.propPanel, wx.Panel):
             self.topBox.Show(self.propPanel, False)
@@ -796,6 +794,7 @@
 
     def __MoveListItem(self, index, list_src, list_dest):
 
+        # The following code is neutral regarding the type of the "String"s.
         item = list_src.GetItem(index)
 
         x = list_dest.InsertStringItem(

Modified: trunk/thuban/Thuban/UI/classifier.py
===================================================================
--- trunk/thuban/Thuban/UI/classifier.py	2008-01-26 22:21:53 UTC (rev 2816)
+++ trunk/thuban/Thuban/UI/classifier.py	2008-01-27 00:01:32 UTC (rev 2817)
@@ -25,6 +25,7 @@
 from wx import grid
 
 from Thuban import _
+from Thuban.UI import internal_from_wxstring
 from Thuban.UI.common import Color2wxColour, wxColour2Color
 
 from Thuban.Model.messages import MAP_LAYERS_REMOVED, LAYER_SHAPESTORE_REPLACED
@@ -930,7 +931,7 @@
             fieldName = None
             fieldType = None
         else:
-            fieldName = self.fields.GetString(fieldIndex)
+            fieldName = internal_from_wxstring(self.fields.GetString(fieldIndex))
             fieldType = self.layer.GetFieldType(fieldName)
 
         clazz = self.fields.GetClientData(fieldIndex)
@@ -956,7 +957,7 @@
                     self.layer.GetClassification().
                                GetDefaultGroup().GetProperties()))
 
-        fieldName = self.fields.GetString(fieldIndex)
+        fieldName = internal_from_wxstring(self.fields.GetString(fieldIndex))
         fieldType = self.layer.GetFieldType(fieldName)
 
         self.classGrid.CreateTable(clazz, fieldType,
@@ -966,7 +967,7 @@
         """Set the field type string using the data type of the field
         at fieldIndex.
         """
-        fieldName = self.fields.GetString(fieldIndex)
+        fieldName = internal_from_wxstring(self.fields.GetString(fieldIndex))
         fieldType = self.layer.GetFieldType(fieldName)
 
         assert Classifier.type2string.has_key(fieldType)
@@ -1053,7 +1054,7 @@
         """Open up a dialog for the user to generate classifications."""
 
         self.genDlg = ClassGenDialog(self, self.layer,
-                          self.fields.GetString(self.__cur_field))
+              internal_from_wxstring(self.fields.GetString(self.__cur_field)))
 
         self.Bind(wx.EVT_CLOSE, self._OnGenDialogClose, self.genDlg)
 

Modified: trunk/thuban/Thuban/UI/mainwindow.py
===================================================================
--- trunk/thuban/Thuban/UI/mainwindow.py	2008-01-26 22:21:53 UTC (rev 2816)
+++ trunk/thuban/Thuban/UI/mainwindow.py	2008-01-27 00:01:32 UTC (rev 2817)
@@ -470,9 +470,9 @@
                                "Thuban Session File (*.thuban)|*.thuban",
                                wx.OPEN)
             if dlg.ShowModal() == wx.ID_OK:
-                self.application.OpenSession(dlg.GetPath(),
-                                             self.run_db_param_dialog)
-                self.application.SetPath("data", dlg.GetPath())
+                path = internal_from_wxstring(dlg.GetPath())
+                self.application.OpenSession(path, self.run_db_param_dialog)
+                self.application.SetPath("data", path)
             dlg.Destroy()
 
     def run_db_param_dialog(self, parameters, message):
@@ -492,9 +492,10 @@
                            "Thuban Session File (*.thuban)|*.thuban",
                            wx.SAVE|wx.OVERWRITE_PROMPT)
         if dlg.ShowModal() == wx.ID_OK:
-            self.application.session.SetFilename(dlg.GetPath())
+            path = internal_from_wxstring(dlg.GetPath())
+            self.application.session.SetFilename(path)
             self.application.SaveSession()
-            self.application.SetPath("data",dlg.GetPath())
+            self.application.SetPath("data",path)
         dlg.Destroy()
 
     def Exit(self):
@@ -855,7 +856,7 @@
                            _("All Files (*.*)") + "|*.*",
                            wx.OPEN)
         if dlg.ShowModal() == wx.ID_OK:
-            filename = dlg.GetPath()
+            filename = internal_from_wxstring(dlg.GetPath())
             dlg.Destroy()
             try:
                 table = self.application.session.OpenTableFile(filename)

Modified: trunk/thuban/Thuban/UI/tableview.py
===================================================================
--- trunk/thuban/Thuban/UI/tableview.py	2008-01-26 22:21:53 UTC (rev 2816)
+++ trunk/thuban/Thuban/UI/tableview.py	2008-01-27 00:01:32 UTC (rev 2817)
@@ -21,6 +21,7 @@
 
 from messages import SHAPES_SELECTED, SESSION_REPLACED
 from Thuban.Model.messages import TABLE_REMOVED, MAP_LAYERS_REMOVED
+from Thuban.UI import internal_from_wxstring
 from Thuban.UI.common import ThubanBeginBusyCursor, ThubanEndBusyCursor
 
 wx_value_type_map = {FIELDTYPE_INT: grid.GRID_VALUE_NUMBER,
@@ -538,7 +539,7 @@
                            _("All Files (*.*)|*.*"),
                            wx.SAVE|wx.OVERWRITE_PROMPT)
         if dlg.ShowModal() == wx.ID_OK:
-            filename = dlg.GetPath()
+            filename = internal_from_wxstring(dlg.GetPath())
             type = os.path.basename(filename).split('.')[-1:][0]
             dlg.Destroy()
 

Modified: trunk/thuban/Thuban/UI/view.py
===================================================================
--- trunk/thuban/Thuban/UI/view.py	2008-01-26 22:21:53 UTC (rev 2816)
+++ trunk/thuban/Thuban/UI/view.py	2008-01-27 00:01:32 UTC (rev 2817)
@@ -30,6 +30,7 @@
 
 from Thuban.Model.messages import MAP_LAYERS_CHANGED, LAYER_CHANGED, \
      LAYER_VISIBILITY_CHANGED
+from Thuban.UI import internal_from_wxstring
 
 from renderer import ScreenRenderer, ExportRenderer, PrinterRenderer
 
@@ -286,8 +287,9 @@
                            "Enhanced Metafile (*.wmf)|*.wmf",
                            wx.SAVE|wx.OVERWRITE_PROMPT)
         if dlg.ShowModal() == wx.ID_OK:
-            self.export_path = os.path.dirname(dlg.GetPath())
-            dc = wx.MetaFileDC(dlg.GetPath())
+            path = internal_from_wxstring(dlg.GetPath())
+            self.export_path = os.path.dirname(path)
+            dc = wx.MetaFileDC(path)
 
             scale, offset, mapregion = output_transform(self.scale,
                                                         self.offset,



More information about the Thuban-commits mailing list