[Thuban-commits] r2746 - in trunk/thuban: . Extensions/drawshape Extensions/export_shapefile Extensions/ogr Extensions/svgexport Extensions/umn_mapserver Extensions/wms

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Sat Mar 17 14:31:33 CET 2007


Author: dpinte
Date: 2007-03-17 14:31:31 +0100 (Sat, 17 Mar 2007)
New Revision: 2746

Modified:
   trunk/thuban/ChangeLog
   trunk/thuban/Extensions/drawshape/drawshape.py
   trunk/thuban/Extensions/export_shapefile/export_shapefile.py
   trunk/thuban/Extensions/ogr/ogrdialog.py
   trunk/thuban/Extensions/ogr/ogrstart.py
   trunk/thuban/Extensions/svgexport/maplegend.py
   trunk/thuban/Extensions/svgexport/svgsaver.py
   trunk/thuban/Extensions/umn_mapserver/mf_export.py
   trunk/thuban/Extensions/umn_mapserver/mf_handle.py
   trunk/thuban/Extensions/umn_mapserver/mf_import.py
   trunk/thuban/Extensions/wms/infodialog.py
   trunk/thuban/Extensions/wms/properties.py
   trunk/thuban/Extensions/wms/wms.py
   trunk/thuban/setup.py
Log:
2007-03-17  Didrik Pinte <dpinte at itae.be>

    *  Extensions/ 
    drawshape/drawshape.py, 
    export_shapefile/export_shapefile.py,
    ogr/ogrdialog.py, ogrstart.py,
    svgexport/maplegend.py, svgsaver.py,
    umn_mapserver/mf_export.py, mf_handle.py, mf_import.py,
    wms/infodialog.py, properties.py, wms.py: 
    final updates for the  wx 2.6 transition

    *  setup.py : updated the gdal path for win32, added a missing 
    ressource for the mouseposition extension



Modified: trunk/thuban/ChangeLog
===================================================================
--- trunk/thuban/ChangeLog	2007-03-15 22:27:02 UTC (rev 2745)
+++ trunk/thuban/ChangeLog	2007-03-17 13:31:31 UTC (rev 2746)
@@ -1,3 +1,17 @@
+2007-03-17  Didrik Pinte <dpinte at itae.be>
+
+	*  Extensions/ 
+	drawshape/drawshape.py, 
+	export_shapefile/export_shapefile.py,
+	ogr/ogrdialog.py, ogrstart.py,
+	svgexport/maplegend.py, svgsaver.py,
+	umn_mapserver/mf_export.py, mf_handle.py, mf_import.py,
+	wms/infodialog.py, properties.py, wms.py: final updates for the 
+	wx 2.6 transition
+
+	*  setup.py : updated the gdal path for win32, added a missing 
+	ressource for the mouseposition extension
+
 2007-03-14  Bernhard Reiter <bernhard at intevation.de>
 
 	*  Doc/technotes/release_process.txt: Improved with SVN instructions,

Modified: trunk/thuban/Extensions/drawshape/drawshape.py
===================================================================
--- trunk/thuban/Extensions/drawshape/drawshape.py	2007-03-15 22:27:02 UTC (rev 2745)
+++ trunk/thuban/Extensions/drawshape/drawshape.py	2007-03-17 13:31:31 UTC (rev 2746)
@@ -20,7 +20,7 @@
 
 import os
 
-from wxPython.wx import *
+import wx
 
 import shapelib
 import Thuban
@@ -123,8 +123,8 @@
             dc.DrawPolygon(points)
 
     def DrawPermanent(self, dc):
-        dc.SetPen(wxPen(wxColor(255, 128, 0), 2))
-        dc.SetBrush(wxTRANSPARENT_BRUSH)
+        dc.SetPen(wx.Pen(wx.Color(255, 128, 0), 2))
+        dc.SetBrush(wx.TRANSPARENT_BRUSH)
         dc.DrawPolygon([self.view.proj_to_win(*p) for p in self.points])
 
 

Modified: trunk/thuban/Extensions/export_shapefile/export_shapefile.py
===================================================================
--- trunk/thuban/Extensions/export_shapefile/export_shapefile.py	2007-03-15 22:27:02 UTC (rev 2745)
+++ trunk/thuban/Extensions/export_shapefile/export_shapefile.py	2007-03-17 13:31:31 UTC (rev 2746)
@@ -14,7 +14,8 @@
 # $Source$
 # $Id$
 
-import wx
+from wx import FileDialog, OPEN, OVERWRITE_PROMPT, ID_OK, \
+     ProgressDialog
 
 from Thuban.Model.data import SHAPETYPE_POLYGON, SHAPETYPE_ARC, \
                               SHAPETYPE_POINT
@@ -39,11 +40,11 @@
        return
 
     # Second, get the basefilename for the shapefile.
-    dlg = wx.FileDialog(context.mainwindow,
+    dlg = FileDialog(context.mainwindow,
                        _('Export Shapefile'), '.', '',
                        _('Shapefile  Files (*.shp)|*.shp|'),
-                       wx.SAVE|wx.OVERWRITE_PROMPT)
-    if dlg.ShowModal() == wx.ID_OK:
+                       OPEN|OVERWRITE_PROMPT)
+    if dlg.ShowModal() == ID_OK:
         filename = dlg.GetPath()[:-4]
         dlg.Destroy()
     else:
@@ -63,7 +64,7 @@
     shp = shapelib.create(shp_filename, shapetypes[layer.ShapeType()])
 
     # Now go through all shapes and store them to the file
-    dlg= wx.ProgressDialog(_("Export Shapefile"),
+    dlg= ProgressDialog(_("Export Shapefile"),
                           _("Storing shapes ..."),
                           layer.ShapeStore().NumShapes(),
                           None)

Modified: trunk/thuban/Extensions/ogr/ogrdialog.py
===================================================================
--- trunk/thuban/Extensions/ogr/ogrdialog.py	2007-03-15 22:27:02 UTC (rev 2745)
+++ trunk/thuban/Extensions/ogr/ogrdialog.py	2007-03-17 13:31:31 UTC (rev 2746)
@@ -163,7 +163,7 @@
         self.Layout()
 
     def end_dialog(self, result):
-        """If the dialog is closed with OK, set chosen layer as layer 
+        """If the dialog is closed with OK, set chosen layer as layer
         to be opened.
         """
         self.result = result
@@ -276,7 +276,7 @@
 
 
     def GetTable(self):
-        """Return the chosen DB connection, the table to be opened, 
+        """Return the chosen DB connection, the table to be opened,
         the connection string for ogr and the ID column.
         """
         i = self.lb_tables.GetSelection()
@@ -366,10 +366,10 @@
         # The standard button box at the bottom of the dialog
         buttons = wx.FlexGridSizer(1, 2, 0, 0)
         ok_button = wx.Button(self, ID_DBCHOOSE_OK, _("OK"))
-        wx.EVT_BUTTON(self, ID_DBCHOOSE_OK, self.OnOK)
+        self.Bind(wx.EVT_BUTTON, self.OnOK, ok_button)
         buttons.Add(ok_button, 0, wx.ALL|wx.ALIGN_RIGHT, 4)
         cancel_button = wx.Button(self, ID_DBCHOOSE_CANCEL, _("Cancel"))
-        wx.EVT_BUTTON(self, ID_DBCHOOSE_CANCEL, self.OnCancel)
+        self.Bind(wx.EVT_BUTTON, self.OnCancel, cancel_button)
         buttons.Add(cancel_button, 0, wx.ALL, 4)
         top.Add(buttons, 1, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 4)
 

Modified: trunk/thuban/Extensions/ogr/ogrstart.py
===================================================================
--- trunk/thuban/Extensions/ogr/ogrstart.py	2007-03-15 22:27:02 UTC (rev 2745)
+++ trunk/thuban/Extensions/ogr/ogrstart.py	2007-03-17 13:31:31 UTC (rev 2746)
@@ -9,7 +9,7 @@
 # $Source$
 # $Id$
 
-# Needed wx.-toolkit classes
+# Needed wx-toolkit classes
 import wx
 
 # We need os.path
@@ -34,16 +34,15 @@
     map = canvas.Map()
 
     # Get the file to be opened
+    wildcard = _("Shapefiles (*.shp)") + "|*.shp|" +\
+                           _("GML files (*.gml)") + "|*.gml|" +\
+                           _("MapInfo files (*.tab)") + "|*.tab|" +\
+                           _("DGN files (*.dgn)") + "|*.dgn|" +\
+                           _("CSV files (*.csv)") + "|*.csv|" +\
+                           _("All Files (*.*)") + "|*.*"
     dlg = wx.FileDialog(canvas, _("Select a data file"),
-                           context.application.Path("data"), "",
-                           _("Shapefiles (*.shp)") + "|*.shp|" +
-                           _("GML files (*.gml)") + "|*.gml|" +
-                           _("MapInfo files (*.tab)") + "|*.tab|" +
-                           _("DGN files (*.dgn)") + "|*.dgn|" +
-                           _("CSV files (*.csv)") + "|*.csv|" +
-                           _("All Files (*.*)") + "|*.*|",
+                           wildcard,
                            wx.OPEN | wx.MULTIPLE)
-
     if dlg.ShowModal() == wx.ID_OK:
         filenames = dlg.GetPaths()
         for filename in filenames:
@@ -214,7 +213,7 @@
                      helptext = 'Open a file supported from ogr'))
 
 #registry.Add(Command('select_file_format', 'Select a file format',
-#                     select_file_format, 
+#                     select_file_format,
 #                     helptext = "Select a file format supported from ogr"))
 
 registry.Add(Command('open_db', 'Open a layer from a database',
@@ -225,7 +224,7 @@
 registry.Add(Command('open_OGRConnection',
                      ("Open a datasource with an OGRConnection string"),
                      open_OGRConnection,
-                     sensitive = _has_gdal_support, helptext = 
+                     sensitive = _has_gdal_support, helptext =
                      "Open a datasource with an OGRConnection string"))
 
 # finally bind the new command with an entry in the extensions menu

Modified: trunk/thuban/Extensions/svgexport/maplegend.py
===================================================================
--- trunk/thuban/Extensions/svgexport/maplegend.py	2007-03-15 22:27:02 UTC (rev 2745)
+++ trunk/thuban/Extensions/svgexport/maplegend.py	2007-03-17 13:31:31 UTC (rev 2746)
@@ -15,8 +15,9 @@
 """
 
 
-# Needed wx.-toolkit classes
-import wx
+# Needed wx-toolkit classes
+from wx import FileDialog, SAVE, OVERWRITE_PROMPT, \
+        ID_OK, Rect
 
 # We need os.path
 import os
@@ -82,7 +83,7 @@
                         shapeType = l.ShapeType()
                         for g in clazz:
                             if g.IsVisible():
-                                self.Draw(dc, wx.Rect(posx+dx, 
+                                self.Draw(dc, Rect(posx+dx, 
                                         posy-iconheight+2,
                                         iconwidth, iconheight),
                                         g.GetProperties(), shapeType)
@@ -131,12 +132,12 @@
     else:
         export_path="."
     # Get the file the session shall be written to
-    dlg = wx.FileDialog(canvas, _("Write SVG"), export_path, "", 
+    dlg = FileDialog(canvas, _("Write SVG"), export_path, "", 
             "Scalable Vector Graphics (*.svg)|*.svg", 
-            wx.SAVE|wx.OVERWRITE_PROMPT)
+            SAVE|OVERWRITE_PROMPT)
     #
     response = dlg.ShowModal()
-    if response == wx.ID_OK:
+    if response == ID_OK:
         file = dlg.GetPath()
     else: # Do nothing if choice was interrupted.
         return 0

Modified: trunk/thuban/Extensions/svgexport/svgsaver.py
===================================================================
--- trunk/thuban/Extensions/svgexport/svgsaver.py	2007-03-15 22:27:02 UTC (rev 2745)
+++ trunk/thuban/Extensions/svgexport/svgsaver.py	2007-03-17 13:31:31 UTC (rev 2746)
@@ -18,8 +18,9 @@
 """
 
 
-# Needed wx.-toolkit classes
-import wx
+# Needed wx-toolkit classes
+from wx import FileDialog, SAVE, OVERWRITE_PROMPT, ID_OK, \
+        OK, ICON_HAND
 
 # We need os.path
 import os
@@ -45,12 +46,12 @@
     else:
         export_path="."
     # Get the file the session shall be written to
-    dlg = wx.FileDialog(canvas, _("Write SVG"), export_path, "", 
+    dlg = FileDialog(canvas, _("Write SVG"), export_path, "", 
             "Scalable Vector Graphics (*.svg)|*.svg", 
-            wx.SAVE|wx.OVERWRITE_PROMPT)
+            SAVE|OVERWRITE_PROMPT)
     
     response = dlg.ShowModal()
-    if response == wx.ID_OK:
+    if response == ID_OK:
         file = dlg.GetPath()
     else: # Do nothing if choice was interrupted.
         return 0
@@ -80,7 +81,7 @@
         except SVGMapWriterError, inst:
             context.mainwindow.RunMessageBox(_("Error: SVG not written!"),
                 text=_("Could not write SVG because: ")+ str(inst),
-                flags= wx.OK | wx.ICON_HAND)
+                flags= OK | ICON_HAND)
             # delete partly writting file
             os.remove(file)
 

Modified: trunk/thuban/Extensions/umn_mapserver/mf_export.py
===================================================================
--- trunk/thuban/Extensions/umn_mapserver/mf_export.py	2007-03-15 22:27:02 UTC (rev 2745)
+++ trunk/thuban/Extensions/umn_mapserver/mf_export.py	2007-03-17 13:31:31 UTC (rev 2746)
@@ -27,8 +27,9 @@
 # mapscript
 from mapscript import mapObj
 
-# wx.Python support
-import wx
+# wxPython support
+from wx import FileDialog, \
+                        ID_OK, SAVE, OVERWRITE_PROMPT
 
 # Thuban
 # use _() already now for all strings that may later be translated
@@ -143,11 +144,11 @@
     """
     theMap = context.mainwindow.canvas.Map().extension_umn_mapobj
     
-    dlg = wx.FileDialog(context.mainwindow, "Save file as...", ".", "", 
+    dlg = FileDialog(context.mainwindow, "Save file as...", ".", "", 
                        "UMN MapServer Mapfiles (*.map)|*.map|"     \
                        "All files (*.*)|*.*",
-                       wx.SAVE |wx.OVERWRITE_PROMPT)
-    if dlg.ShowModal() == wx.ID_OK:
+                       SAVE |OVERWRITE_PROMPT)
+    if dlg.ShowModal() == ID_OK:
         path = dlg.GetDirectory()
         file = dlg.GetFilename()
         dlg.Destroy()

Modified: trunk/thuban/Extensions/umn_mapserver/mf_handle.py
===================================================================
--- trunk/thuban/Extensions/umn_mapserver/mf_handle.py	2007-03-15 22:27:02 UTC (rev 2745)
+++ trunk/thuban/Extensions/umn_mapserver/mf_handle.py	2007-03-17 13:31:31 UTC (rev 2746)
@@ -27,7 +27,8 @@
 # mapscript
 from mapscript import mapObj, layerObj
 
-# wx.Python support
+# wxPython support
+# TODO: explicitly use from .. import
 import wx
 from wx import grid
 
@@ -1086,7 +1087,7 @@
     copied from the wx. demo.
     """
     def __init__(self, data):
-        gridPyGridTableBase.__init__(self)
+        grid.PyGridTableBase.__init__(self)
 
         self.colLabels = ['ID', 'Description']
         self.dataTypes = [wx.GRID_VALUE_STRING,

Modified: trunk/thuban/Extensions/umn_mapserver/mf_import.py
===================================================================
--- trunk/thuban/Extensions/umn_mapserver/mf_import.py	2007-03-15 22:27:02 UTC (rev 2745)
+++ trunk/thuban/Extensions/umn_mapserver/mf_import.py	2007-03-17 13:31:31 UTC (rev 2746)
@@ -27,8 +27,11 @@
 
 from mapscript import mapObj
 
-import wx
+from wx import FileDialog, \
+                        OPEN, OVERWRITE_PROMPT, ID_OK
 
+from Python.lib.dialogs import MultipleChoiceDialog
+
 # use _() already now for all strings that may later be translated
 from Thuban import _
 
@@ -44,7 +47,7 @@
 from Thuban.Model.proj import Projection
 
 # needed to add the new menu
-from Thuban.UI.mainwindow import main_menu
+from Thuban.UI.mainwindow import main_menu, ID_CANCEL
 
 from Thuban.Model.classification import ClassGroupSingleton, \
                                         ClassGroupRange, \
@@ -510,12 +513,12 @@
     dlgsize = (300,130+len(lst)*20)
     if dlgsize[1] >= 300:
         dlgsize = (300,300)
-    dlg = wx.MultipleChoiceDialog(context.mainwindow,
+    dlg = MultipleChoiceDialog(context.mainwindow,
                                  "Select the layers from the\n" +
                                  "list to load into thuban.\n" +
                                  "annotation not supported !",
                                  "Select Layer.", lst, size = dlgsize)
-    if (dlg.ShowModal() == wx.ID_OK):
+    if (dlg.ShowModal() == ID_OK):
         selectedlayer = dlg.GetValue()
     return selectedlayer
 
@@ -524,12 +527,12 @@
     Import only the layers which are selectes from a mapfile
     """
     # open a dialog to select the mapfile to import
-    dlg = wx.FileDialog(context.mainwindow,
+    dlg = FileDialog(context.mainwindow,
                        _("Select MapFile file"), ".", "",
                        _("UMN MapServer Mapfiles (*.map)|*.map|") +
                        _("All Files (*.*)|*.*"),
-                       wx.OPEN|wx.OVERWRITE_PROMPT)
-    if dlg.ShowModal() == wx.ID_OK:
+                       OPEN|OVERWRITE_PROMPT)
+    if dlg.ShowModal() == ID_OK:
         filename = dlg.GetPath()
         dlg.Destroy()
     else:
@@ -558,12 +561,12 @@
     import layers from a mapfile
     """
     # open a dialog to select the mapfile to import from
-    dlg = wx.FileDialog(context.mainwindow,
+    dlg = FileDialog(context.mainwindow,
                        _("Select MapFile file"), ".", "",
                        _("UMN MapServer Mapfiles (*.map)|*.map|") +
                        _("All Files (*.*)|*.*"),
-                       wx.OPEN|wx.OVERWRITE_PROMPT)
-    if dlg.ShowModal() == wx.ID_OK:
+                       OPEN|OVERWRITE_PROMPT)
+    if dlg.ShowModal() == ID_OK:
         filename = dlg.GetPath()
         dlg.Destroy()
     else:
@@ -619,17 +622,17 @@
     context - the thuban context
     """
     # create a new session befor a mapfile is imported
-    if context.mainwindow.save_modified_session() != wx.ID_CANCEL:
+    if context.mainwindow.save_modified_session() != ID_CANCEL:
         context.application.SetSession(mainwindow.create_empty_session())
         
         # context.mainwindow.NewSession()
         # open a dialog to select the mapfile to import
-        dlg = wx.FileDialog(context.mainwindow,
+        dlg = FileDialog(context.mainwindow,
                            _("Select MapFile file"), ".", "",
                            _("UMN MapServer Mapfiles (*.map)|*.map|") +
                            _("All Files (*.*)|*.*"),
-                           wx.OPEN|wx.OVERWRITE_PROMPT)
-        if dlg.ShowModal() == wx.ID_OK:
+                           OPEN|OVERWRITE_PROMPT)
+        if dlg.ShowModal() == ID_OK:
             filename = dlg.GetPath()
             dlg.Destroy()
         else:

Modified: trunk/thuban/Extensions/wms/infodialog.py
===================================================================
--- trunk/thuban/Extensions/wms/infodialog.py	2007-03-15 22:27:02 UTC (rev 2745)
+++ trunk/thuban/Extensions/wms/infodialog.py	2007-03-17 13:31:31 UTC (rev 2746)
@@ -35,9 +35,9 @@
 from Thuban import _
 from Thuban.UI.dialogs import ThubanFrame
 
-from wxPython.wx import wxBoxSizer, wxTextCtrl, wxVERTICAL, \
-    wxHORIZONTAL, wxTE_READONLY, wxTE_MULTILINE, wxTE_LINEWRAP, \
-    wxEXPAND, wxALL, wxButton, wxALIGN_CENTER_HORIZONTAL, wxID_OK, \
+from wx import BoxSizer, TextCtrl, VERTICAL, \
+    HORIZONTAL, TE_READONLY, TE_MULTILINE, TE_LINEWRAP, \
+    EXPAND, ALL, Button, ALIGN_CENTER_HORIZONTAL, ID_OK, \
     EVT_BUTTON
 
 
@@ -63,21 +63,21 @@
         Set up the information dialog
         """
 
-        vbox = wxBoxSizer(wxVERTICAL)
+        vbox = BoxSizer(VERTICAL)
 
-        textBox = wxTextCtrl(self, -1, text,
-                             style=wxTE_READONLY|wxTE_MULTILINE|wxTE_LINEWRAP)
+        textBox = TextCtrl(self, -1, text,
+                             style=TE_READONLY|TE_MULTILINE|TE_LINEWRAP)
         w, h = (500, 300)
         textBox.SetSizeHints(w, h)
         textBox.SetSize((w, h))
         
-        vbox.Add(textBox, 1, wxEXPAND|wxALL, 10)
+        vbox.Add(textBox, 1, EXPAND|ALL, 10)
         
-        buttons = wxBoxSizer(wxHORIZONTAL)
-        buttons.Add(wxButton(self, wxID_OK, _("Close")), 0, wxALL, 4)
-        vbox.Add(buttons, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 10)
+        buttons = BoxSizer(HORIZONTAL)
+        buttons.Add(Button(self, ID_OK, _("Close")), 0, ALL, 4)
+        vbox.Add(buttons, 0, ALIGN_CENTER_HORIZONTAL|ALL, 10)
         
-        EVT_BUTTON(self, wxID_OK, self.OnClose)
+        EVT_BUTTON(self, ID_OK, self.OnClose)
         
         self.SetAutoLayout(True)
         self.SetSizer(vbox)

Modified: trunk/thuban/Extensions/wms/properties.py
===================================================================
--- trunk/thuban/Extensions/wms/properties.py	2007-03-15 22:27:02 UTC (rev 2745)
+++ trunk/thuban/Extensions/wms/properties.py	2007-03-17 13:31:31 UTC (rev 2746)
@@ -29,7 +29,7 @@
 
 Problems:
 
-    1. The wxTextCtrl should fit to the right side of the horizontal
+    1. The TextCtrl should fit to the right side of the horizontal
        box/sizer.  It doesn't.  I only found the sizer.Add() method to
        be able to take proportions but no way to tell the object to
        fill all remaining space.
@@ -39,10 +39,10 @@
        people's screen anymore.
 
        Todo: This can be solved (in C it was possible at least),
-       probably with wxScrolledWindow
+       probably with ScrolledWindow
 
     3. The button hbox is not aligned to the right side which should
-       be.  For some reason wxALIGN_RIGHT does not have any effect.
+       be.  For some reason ALIGN_RIGHT does not have any effect.
        Maybe I just misunderstood the documentation?
 
 """
@@ -54,11 +54,11 @@
 from Thuban import _
 from Thuban.UI.dialogs import NonModalNonParentDialog
 
-from wxPython.wx import *
-#    wxBoxSizer, wxVERTICAL, wxHORIZONTAL, \
-#    wxButton, wxID_OK, wxID_CANCEL, wxALL, wxALIGN_CENTER_HORIZONTAL, \
-#    EVT_BUTTON, wxEXPAND, wxStaticBoxSizer, wxStaticBox, wxALIGN_RIGHT, \
-#    wxALIGN_BOTTOM
+import wx
+#    wx.BoxSizer, wx.VERTICAL, wx.HORIZONTAL, \
+#    wx.Button, wx.ID_OK, wx.ID_CANCEL, wx.ALL, wx.ALIGN_CENTER_HORIZONTAL, \
+#    EVT_BUTTON, wx.EXPAND, wx.StaticBoxSizer, wx.StaticBox, wx.ALIGN_RIGHT, \
+#    wx.ALIGN_BOTTOM
 
 ID_WMS_TITLE   = 5001
 ID_WMS_LAYER   = 5002
@@ -95,43 +95,43 @@
         """
 
         # main box for the entire dialog
-        mainbox = wxBoxSizer(wxHORIZONTAL)
+        mainbox = wx.BoxSizer(wx.HORIZONTAL)
         
         # vertical box to contain the three parts
         #     (title, layers, formats+buttons)
-        vbox = wxBoxSizer(wxVERTICAL)
-        mainbox.Add(vbox, 0, wxALL|wxEXPAND, 4)
+        vbox = wx.BoxSizer(wx.VERTICAL)
+        mainbox.Add(vbox, 0, wx.ALL|wx.EXPAND, 4)
         
         # edit the title
-        hbox = wxBoxSizer(wxHORIZONTAL)
-        vbox.Add(hbox, 0, wxALL, 0)
-        label = wxStaticText(self, ID_WMS_TITLE, _("Title:"))
-        hbox.Add(label, 1, wxALL|wxEXPAND, 4)
-        self.entry = wxTextCtrl(self, ID_WMS_TITLE, layer.Title())
-        hbox.Add(self.entry, 7, wxALL|wxEXPAND|wxALIGN_RIGHT, 0)
+        hbox = wx.BoxSizer(wx.HORIZONTAL)
+        vbox.Add(hbox, 0, wx.ALL, 0)
+        label = wx.StaticText(self, ID_WMS_TITLE, _("Title:"))
+        hbox.Add(label, 1, wx.ALL|wx.EXPAND, 4)
+        self.entry = wx.TextCtrl(self, ID_WMS_TITLE, layer.Title())
+        hbox.Add(self.entry, 7, wx.ALL|wx.EXPAND|wx.ALIGN_RIGHT, 0)
 
-        layerbox = wxStaticBox(self, ID_WMS_LAYER, _("Layers"))
-        lbox = wxStaticBoxSizer(layerbox, wxVERTICAL)
-        vbox.Add(lbox, 0, wxALL, 0)
+        layerbox = wx.StaticBox(self, ID_WMS_LAYER, _("Layers"))
+        lbox = wx.StaticBoxSizer(layerbox, wx.VERTICAL)
+        vbox.Add(lbox, 0, wx.ALL, 0)
         visible = layer.getVisibleLayers()
         for l in layer.getLayers():
-            checker = wxCheckBox(self, ID_WMS_LAYER, layer.getLayerTitle(l)[0:MAX_LAYERNAME_LENGTH].encode('latin1'))
+            checker = wx.CheckBox(self, ID_WMS_LAYER, layer.getLayerTitle(l)[0:MAX_LAYERNAME_LENGTH].encode('latin1'))
             self.layers[l] = checker
             if l in visible:
                 checker.SetValue(True)
-            lbox.Add(checker, 0, wxALL|wxEXPAND, 0)
+            lbox.Add(checker, 0, wx.ALL|wx.EXPAND, 0)
 
         # tiled box:
-        hbox = wxBoxSizer(wxHORIZONTAL)
-        vbox.Add(hbox, 0, wxALL|wxEXPAND, 0)
+        hbox = wx.BoxSizer(wx.HORIZONTAL)
+        vbox.Add(hbox, 0, wx.ALL|wx.EXPAND, 0)
         
         # left part: image format selection
-        formatbox = wxBoxSizer(wxHORIZONTAL)
-        hbox.Add(formatbox, 1, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 0)
-        label = wxStaticText(self, ID_WMS_FORMATS, _("Format:"))
-        formatbox.Add(label, 0, wxALL|wxALIGN_CENTER_VERTICAL, 4)
-        self.formats = wxChoice(self, ID_WMS_FORMATS)
-        formatbox.Add(self.formats, 1, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 4)
+        formatbox = wx.BoxSizer(wx.HORIZONTAL)
+        hbox.Add(formatbox, 1, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 0)
+        label = wx.StaticText(self, ID_WMS_FORMATS, _("Format:"))
+        formatbox.Add(label, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4)
+        self.formats = wx.Choice(self, ID_WMS_FORMATS)
+        formatbox.Add(self.formats, 1, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_VERTICAL, 4)
 
         # fill the select box
         match = 0
@@ -147,12 +147,12 @@
         self.formats.SetSelection(match)
 
         # Build the button hbox, to be added into row
-        buttons = wxBoxSizer(wxHORIZONTAL)
-        hbox.Add(buttons, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 0)
-        buttons.Add(wxButton(self, wxID_OK, _("OK")), 0, wxALL, 4)
-        buttons.Add(wxButton(self, wxID_CANCEL, _("Cancel")), 0, wxALL, 4)
-        EVT_BUTTON(self, wxID_OK, self.OnOK)
-        EVT_BUTTON(self, wxID_CANCEL, self.OnCancel)
+        buttons = wx.BoxSizer(wx.HORIZONTAL)
+        hbox.Add(buttons, 1, wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 0)
+        buttons.Add(wx.Button(self, wx.ID_OK, _("OK")), 0, wx.ALL, 4)
+        buttons.Add(wx.Button(self, wx.ID_CANCEL, _("Cancel")), 0, wx.ALL, 4)
+        EVT_BUTTON(self, wx.ID_OK, self.OnOK)
+        EVT_BUTTON(self, wx.ID_CANCEL, self.OnCancel)
 
         self.SetAutoLayout(True)
         self.SetSizer(mainbox)

Modified: trunk/thuban/Extensions/wms/wms.py
===================================================================
--- trunk/thuban/Extensions/wms/wms.py	2007-03-15 22:27:02 UTC (rev 2745)
+++ trunk/thuban/Extensions/wms/wms.py	2007-03-17 13:31:31 UTC (rev 2746)
@@ -25,7 +25,7 @@
 import xml.dom.minidom
 import tempfile
 
-from wxPython.wx import *
+import wx
 
 from Thuban.Model.proj import Projection
 from Thuban.Model.extension import Extension
@@ -66,17 +66,17 @@
 layer_properties_dialogs.add(WMSLayer, wmsProperties)
 
 
-class SelectWMSServer(wxDialog):
+class SelectWMSServer(wx.Dialog):
 
     ID_COMBOVALUE = 4003
 
     def __init__(self, parent):
-        wxDialog.__init__(self, parent, -1, _("Select WMS Server"),
-            style = wxDEFAULT_DIALOG_STYLE
-                  | wxSYSTEM_MENU
-                  | wxRESIZE_BORDER)
+        wx.Dialog.__init__(self, parent, -1, _("Select WMS Server"),
+            style = wx.DEFAULT_DIALOG_STYLE
+                  | wx.SYSTEM_MENU
+                  | wx.RESIZE_BORDER)
 
-        self.combo_value = wxComboBox(self, self.ID_COMBOVALUE, size=(500,-1))
+        self.combo_value = wx.ComboBox(self, self.ID_COMBOVALUE, size=(500,-1))
         self.combo_value.Append("")
         self.combo_value.Append('http://frida.intevation.org/cgi-bin/frida_wms?')
         #self.combo_value.Append('http://wms.jpl.nasa.gov/wms.cgi?')
@@ -85,15 +85,15 @@
         #self.combo_value.Append('http://demo.cubewerx.com/demo/cubeserv/cubeserv.cgi?CONFIG=gita&')
         self.combo_value.SetSelection(0)
 
-        button_ok = wxButton(self, wxID_OK, _("OK"))
+        button_ok = wx.Button(self, wx.ID_OK, _("OK"))
         button_ok.SetDefault()
-        button_close = wxButton(self, wxID_CANCEL, _("Close"))
+        button_close = wx.Button(self, wx.ID_CANCEL, _("Close"))
 
-        vbox = wxBoxSizer(wxVERTICAL)
-        vbox.Add(self.combo_value, 1, wxEXPAND|wxALL|wxCB_SORT, 10)
-        hbox = wxBoxSizer(wxHORIZONTAL)
-        hbox.Add(button_ok, 0, wxALL, 10)
-        hbox.Add(button_close, 0, wxALL, 10)
+        vbox = wx.BoxSizer(wx.VERTICAL)
+        vbox.Add(self.combo_value, 1, wx.EXPAND|wx.ALL|wx.CB_SORT, 10)
+        hbox = wx.BoxSizer(wx.HORIZONTAL)
+        hbox.Add(button_ok, 0, wx.ALL, 10)
+        hbox.Add(button_close, 0, wx.ALL, 10)
         vbox.Add(hbox, 0, 10)
 
         self.SetAutoLayout(True)
@@ -102,15 +102,15 @@
         vbox.SetSizeHints(self)
         self.Layout()
 
-        EVT_BUTTON(self, wxID_OK, self.OnOK)
-        EVT_BUTTON(self, wxID_CANCEL, self.OnCancel)
+        EVT_BUTTON(self, wx.ID_OK, self.OnOK)
+        EVT_BUTTON(self, wx.ID_CANCEL, self.OnCancel)
 
     def OnOK(self, event):
         self.url = self.combo_value.GetValue()
-        self.EndModal(wxID_OK)
+        self.EndModal(wx.ID_OK)
 
     def OnCancel(self, event):
-        self.EndModal(wxID_CANCEL)
+        self.EndModal(wx.ID_CANCEL)
 
 def wms_dialog(context):
     """Request URL from user and add WMS Layer.
@@ -119,7 +119,7 @@
     """
     dialog = SelectWMSServer(context.mainwindow)
 
-    if dialog.ShowModal() == wxID_OK:
+    if dialog.ShowModal() == wx.ID_OK:
         url = dialog.url
         if len(url) == 0:
             url = None
@@ -144,7 +144,7 @@
         # new map to the window
         context.mainwindow.canvas.FitMapToWindow()
 
-wxInitAllImageHandlers()
+wx.InitAllImageHandlers()
 wms_extension = WMSExtension('WMS')
 
 # register the new command

Modified: trunk/thuban/setup.py
===================================================================
--- trunk/thuban/setup.py	2007-03-15 22:27:02 UTC (rev 2745)
+++ trunk/thuban/setup.py	2007-03-17 13:31:31 UTC (rev 2746)
@@ -98,7 +98,7 @@
     wx_lib = [os.path.join(wx_prefix, "lib", "vc_dll")]
 
     # Define include and lib directories for GDAL 
-    gdal_prefix = os.path.join(basedir, "..", "gdal-1.3.2")
+    gdal_prefix = os.path.join(basedir, "..", "gdal-1.4.0")
     gdal_inc = [os.path.join(gdal_prefix, 'alg'),
                 os.path.join(gdal_prefix, 'ogr'),
                 os.path.join(gdal_prefix, 'port'),
@@ -311,7 +311,9 @@
                     ("Resources/XML/*.dtd",)),
                    ("Extensions/importAPR/samples",
                     ("Extensions/importAPR/samples/README",
-                     "Extensions/importAPR/samples/*.apr")),
+                     "Extensions/importAPR/samples/*.apr",)),
+                   ("Extensions/mouseposition",
+                    ("Extensions/mouseposition/position.xpm",)),
                    ]:
     for pattern in patterns:
         data_files.append((d, glob.glob(pattern)))



More information about the Thuban-commits mailing list