[Thuban-commits] r2721 - in trunk/thuban: . Extensions/bboxdump Extensions/gns2shp Extensions/importAPR Extensions/mouseposition Extensions/ogr Extensions/profiling Extensions/svgexport

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Sat Jan 13 16:11:44 CET 2007


Author: dpinte
Date: 2007-01-13 16:11:42 +0100 (Sat, 13 Jan 2007)
New Revision: 2721

Modified:
   trunk/thuban/ChangeLog
   trunk/thuban/Extensions/bboxdump/bboxdump.py
   trunk/thuban/Extensions/gns2shp/gns2shp.py
   trunk/thuban/Extensions/importAPR/importAPR.py
   trunk/thuban/Extensions/mouseposition/mouseposition.py
   trunk/thuban/Extensions/ogr/ogrdialog.py
   trunk/thuban/Extensions/ogr/ogrstart.py
   trunk/thuban/Extensions/profiling/profiling.py
   trunk/thuban/Extensions/svgexport/maplegend.py
   trunk/thuban/Extensions/svgexport/svgsaver.py
Log:
2007-01-13 Didrik Pinte <dpinte at itae.be>

    bboxdump, gns2shp, importAPR, mouseposition, ogr, profiling, svgexport
    extensions migrated to wxPython 2.6

    * Extensions/bboxdump/bboxdump.py: 
    updated wx statements

    * Extensions/gns2shp/gns2shp.py: 
    updated wx statements

    * Extensions/importAPR/importAPR.py:
    updated wx statements

    * Extensions/mouseposition/mouseposition.py:
    updated wx statements

    * Extensions/ogr/
    ogrdialog.py, ogrstart.py:
    updated wx statements

    * Extensions/profiling/profiling.py:
    updated wx statements

    * Extensions/svgexport/
    maplegend.py,svgsaver.py:
    updated wx statements



Modified: trunk/thuban/ChangeLog
===================================================================
--- trunk/thuban/ChangeLog	2007-01-08 16:57:36 UTC (rev 2720)
+++ trunk/thuban/ChangeLog	2007-01-13 15:11:42 UTC (rev 2721)
@@ -1,3 +1,32 @@
+2007-01-13 Didrik Pinte <dpinte at itae.be>
+
+	bboxdump, gns2shp, importAPR, mouseposition, ogr, profiling, svgexport
+	extensions migrated to wxPython 2.6
+
+	* Extensions/bboxdump/bboxdump.py: 
+	updated wx statements
+
+	* Extensions/gns2shp/gns2shp.py: 
+	updated wx statements
+
+	* Extensions/importAPR/importAPR.py:
+	updated wx statements
+
+	* Extensions/mouseposition/mouseposition.py:
+	updated wx statements
+
+	* Extensions/ogr/
+	ogrdialog.py, ogrstart.py:
+	updated wx statements
+
+	* Extensions/profiling/profiling.py:
+	updated wx statements
+
+	* Extensions/svgexport/
+	maplegend.py, svgsaver.py:
+	updated wx statements
+
+
 2007-01-08 Didrik Pinte <dpinte at itae.be>
 	
 	export_shapefile extension migrated to wxPython 2.6

Modified: trunk/thuban/Extensions/bboxdump/bboxdump.py
===================================================================
--- trunk/thuban/Extensions/bboxdump/bboxdump.py	2007-01-08 16:57:36 UTC (rev 2720)
+++ trunk/thuban/Extensions/bboxdump/bboxdump.py	2007-01-13 15:11:42 UTC (rev 2721)
@@ -20,8 +20,8 @@
 import os, sys
 import string
 
-from wxPython.wx import *
-from wxPython.lib.dialogs import wxScrolledMessageDialog
+import wx
+from wx.lib.dialogs import ScrolledMessageDialog
 
 from Thuban.UI.common import ThubanBeginBusyCursor, ThubanEndBusyCursor
 from Thuban.UI.command import registry, Command
@@ -36,7 +36,7 @@
 ID_ATTRIBUTES = 4002
 ID_SELFN = 4003
 
-class BBoxDumpDialog(wxDialog):
+class BBoxDumpDialog(wx.Dialog):
     """Bounding Box Dump Dialog
 
     Specify a filename for the dump and optionally a layer's column 
@@ -44,57 +44,57 @@
     """
 
     def __init__(self, parent, title, layer = None):
-        wxDialog.__init__(self, parent, -1, title,
-                          style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
+        wx.Dialog.__init__(self, parent, -1, title,
+                          style = wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER)
 
         if layer is None:
-            return wxID_CANCEL
+            return wx.ID_CANCEL
 
         # Store the layer
         self.layer = layer
 
         # Filename selection elements
-        self.filename = wxTextCtrl(self, ID_FILENAME, "")
-        self.button_selectfile = wxButton(self, ID_SELFN, _('Select...'))
-        EVT_BUTTON(self, ID_SELFN, self.OnSelectFilename)
+        self.filename = wx.TextCtrl(self, ID_FILENAME, "")
+        self.button_selectfile = wx.Button(self, ID_SELFN, _('Select...'))
+        wx.EVT_BUTTON(self, ID_SELFN, self.OnSelectFilename)
 
         # Column choice elements
-        self.choice_column = wxChoice(self, ID_ATTRIBUTES)
+        self.choice_column = wx.Choice(self, ID_ATTRIBUTES)
         self.choice_column.Append(_('Select...'), None)
         for col in self.layer.ShapeStore().Table().Columns():
                 self.choice_column.Append(col.name, col)
         self.choice_column.SetSelection(0)
 
         # Dialog button elements
-        self.button_dump = wxButton(self, wxID_OK, _("OK"))
-        EVT_BUTTON(self, wxID_OK, self.OnDump)
+        self.button_dump = wx.Button(self, wx.ID_OK, _("OK"))
+        wx.EVT_BUTTON(self, wx.ID_OK, self.OnDump)
         self.button_dump.SetDefault()
         # TODO: Disable the OK button until a filename is entered ...
         # self.button_dump.Enable(False)
-        self.button_cancel = wxButton(self, wxID_CANCEL, _("Cancel"))
+        self.button_cancel = wx.Button(self, wx.ID_CANCEL, _("Cancel"))
 
 
         # Dialog Layout: three horizontal box sizers.
-        topbox = wxBoxSizer(wxVERTICAL)
+        topbox = wx.BoxSizer(wx.VERTICAL)
 
-        hbox = wxBoxSizer(wxHORIZONTAL)
-        topbox.Add(hbox, 0, wxALL|wxEXPAND)
-        hbox.Add(wxStaticText(self, -1, _("File:")),
-                 0, wxALL|wxALIGN_CENTER_VERTICAL, 4)
-        hbox.Add(self.filename, 1, wxALL|wxEXPAND, 4)
-        hbox.Add(self.button_selectfile, 0, wxALL, 4)
+        hbox = wx.BoxSizer(wx.HORIZONTAL)
+        topbox.Add(hbox, 0, wx.ALL|wx.EXPAND)
+        hbox.Add(wx.StaticText(self, -1, _("File:")),
+                 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4)
+        hbox.Add(self.filename, 1, wx.ALL|wx.EXPAND, 4)
+        hbox.Add(self.button_selectfile, 0, wx.ALL, 4)
 
-        hbox = wxBoxSizer(wxHORIZONTAL)
-        topbox.Add(hbox, 0, wxALL|wxEXPAND)
-        hbox.Add(wxStaticText(self, -1, _("Group by:")),
-                 0, wxALL|wxALIGN_CENTER_VERTICAL, 4)
-        hbox.Add(self.choice_column, 1, wxALL|wxEXPAND, 4)
+        hbox = wx.BoxSizer(wx.HORIZONTAL)
+        topbox.Add(hbox, 0, wx.ALL|wx.EXPAND)
+        hbox.Add(wx.StaticText(self, -1, _("Group by:")),
+                 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4)
+        hbox.Add(self.choice_column, 1, wx.ALL|wx.EXPAND, 4)
 
-        hbox = wxBoxSizer(wxHORIZONTAL)
-        topbox.Add(hbox, 0, wxALL|wxEXPAND)
-        hbox.Add(self.button_dump, 0, wxALL|wxALIGN_CENTER,
+        hbox = wx.BoxSizer(wx.HORIZONTAL)
+        topbox.Add(hbox, 0, wx.ALL|wx.EXPAND)
+        hbox.Add(self.button_dump, 0, wx.ALL|wx.ALIGN_CENTER,
                   10)
-        hbox.Add(self.button_cancel, 0, wxALL|wxALIGN_CENTER,
+        hbox.Add(self.button_cancel, 0, wx.ALL|wx.ALIGN_CENTER,
                   10)
 
         # Finalize ...
@@ -122,7 +122,7 @@
             ThubanEndBusyCursor()
 
         if bboxmessage:
-            dlg = wxScrolledMessageDialog(
+            dlg = ScrolledMessageDialog(
                                 self.parent, bboxmessage,
                                 _("Bounding Box Dump %s") % self.layer.Title())
             dlg.ShowModal()
@@ -132,13 +132,13 @@
 
         Opens a file dialog to specify a file to dump into.
         """
-        dlg = wxFileDialog(self, _("Dump Bounding Boxes To"), 
+        dlg = wx.FileDialog(self, _("Dump Bounding Boxes To"), 
                        os.path.dirname(self.filename.GetValue()), 
                        os.path.basename(self.filename.GetValue()),
                        _("CSV Files (*.csv)|*.csv|") +
                        _("All Files (*.*)|*.*"),
-                       wxSAVE|wxOVERWRITE_PROMPT)
-        if dlg.ShowModal() == wxID_OK:
+                       wx.SAVE|wx.OVERWRITE_PROMPT)
+        if dlg.ShowModal() == wx.ID_OK:
             self.filename.SetValue(dlg.GetPath())
             dlg.Destroy()
         else:
@@ -157,7 +157,7 @@
     shapelist = {}
     bboxmessage = []
  
-    dlg= wxProgressDialog(_("Bounding Box Dump"),
+    dlg= wx.ProgressDialog(_("Bounding Box Dump"),
                           _("Collecting shapes ..."),
                           layer.ShapeStore().NumShapes(),
                           None)
@@ -190,7 +190,7 @@
             cnt = cnt + 1
 
     dlg.Destroy()
-    dlg= wxProgressDialog(_("Bounding Box Dump"),
+    dlg= wx.ProgressDialog(_("Bounding Box Dump"),
                           _("Dump bounding boxes of selected shapes ..."),
                           len(shapelist),
                           None)

Modified: trunk/thuban/Extensions/gns2shp/gns2shp.py
===================================================================
--- trunk/thuban/Extensions/gns2shp/gns2shp.py	2007-01-08 16:57:36 UTC (rev 2720)
+++ trunk/thuban/Extensions/gns2shp/gns2shp.py	2007-01-13 15:11:42 UTC (rev 2721)
@@ -25,7 +25,7 @@
 
 # only import GUI and register when not called as command line tool
 if __name__ != '__main__':
-    from wxPython.wx import *
+    import wx
 
     from Thuban.UI.command import registry, Command
     from Thuban.UI.mainwindow import main_menu
@@ -123,12 +123,12 @@
 
     context -- The Thuban context.
     """
-    dlg = wxFileDialog(context.mainwindow,
+    dlg = wx.FileDialog(context.mainwindow,
                        _('Select GNS file'), '.', '',
                        _('Generate Files (*.txt)|*.txt|') +
                        _('All Files (*.*)|*.*'),
-                       wxOPEN|wxOVERWRITE_PROMPT)
-    if dlg.ShowModal() == wxID_OK:
+                       wx.OPEN|wx.OVERWRITE_PROMPT)
+    if dlg.ShowModal() == wx.ID_OK:
         gns_filename = dlg.GetPath()
         dlg.Destroy()
     else:

Modified: trunk/thuban/Extensions/importAPR/importAPR.py
===================================================================
--- trunk/thuban/Extensions/importAPR/importAPR.py	2007-01-08 16:57:36 UTC (rev 2720)
+++ trunk/thuban/Extensions/importAPR/importAPR.py	2007-01-13 15:11:42 UTC (rev 2721)
@@ -18,7 +18,7 @@
 
 from types import StringType
 
-from wxPython.wx import *
+import wx
 
 from Thuban.Model.extension import Extension
 from Thuban.Model.base import TitledObject, Modifiable
@@ -165,12 +165,12 @@
 
     context -- The Thuban context.
     """
-    dlg = wxFileDialog(context.mainwindow,
+    dlg = wx.FileDialog(context.mainwindow,
                        _("Select APR file"), ".", "",
                        _("ArcView Project Files (*.apr)|*.apr|") +
                        _("All Files (*.*)|*.*"),
-                       wxOPEN|wxOVERWRITE_PROMPT)
-    if dlg.ShowModal() == wxID_OK:
+                       wx.OPEN|wx.OVERWRITE_PROMPT)
+    if dlg.ShowModal() == wx.ID_OK:
         filename = dlg.GetPath()
         dlg.Destroy()
     else:
@@ -202,12 +202,12 @@
     # let the user select one of the views
     if len(views) > 1:
         titles = views.keys()
-        dlg = wxSingleChoiceDialog(context.mainwindow,
+        dlg = wx.SingleChoiceDialog(context.mainwindow,
                                    _('Pick a View to import:'),
                                    _('Import APR'), titles,
-                                   style = wxDEFAULT_DIALOG_STYLE | 
-                                           wxRESIZE_BORDER)
-        if dlg.ShowModal() == wxID_OK:
+                                   style = wx.DEFAULT_DIALOG_STYLE | 
+                                           wx.RESIZE_BORDER)
+        if dlg.ShowModal() == wx.ID_OK:
             view = views[views.keys()[dlg.GetSelection()]]
         else:
             return

Modified: trunk/thuban/Extensions/mouseposition/mouseposition.py
===================================================================
--- trunk/thuban/Extensions/mouseposition/mouseposition.py	2007-01-08 16:57:36 UTC (rev 2720)
+++ trunk/thuban/Extensions/mouseposition/mouseposition.py	2007-01-13 15:11:42 UTC (rev 2721)
@@ -6,7 +6,7 @@
 # Read the file COPYING coming with Thuban for details.
 
 """
-Extend thuban with a locator tool.
+xtend thuban with a locator tool.
 
 Collect positions of mouse clicks (in map coordinates) in a text control. 
 
@@ -23,8 +23,8 @@
 import os, sys
 import string
 
-from wxPython import wx
-from wxPython.lib.layoutf import Layoutf
+import wx
+from wx.lib.layoutf import Layoutf
 
 from Thuban.UI.common import ThubanBeginBusyCursor, ThubanEndBusyCursor
 from Thuban.UI.command import registry, ToolCommand
@@ -37,22 +37,22 @@
 import Thuban
 
 class DynamicMessageDialog(NonModalDialog):
-    """Similar to the wxScrolledMessageDialog, contents dynamically 
+    """Similar to the wx.ScrolledMessageDialog, contents dynamically 
        changeable by calling applications.
 
     """
-    def __init__(self, parent, msg, name, caption, pos = wx.wxDefaultPosition):
+    def __init__(self, parent, msg, name, caption, pos = wx.DefaultPosition):
         NonModalDialog.__init__(self, parent, name, caption)
         x, y = pos
         if x == -1 and y == -1:
-            self.CenterOnScreen(wx.wxBOTH)
-        text = wx.wxTextCtrl(self, -1, msg, wx.wxDefaultPosition,
-                             wx.wxDefaultSize,
-                             wx.wxTE_MULTILINE | wx.wxTE_READONLY)
-        ok = wx.wxButton(self, wx.wxID_OK, "OK")
+            self.CenterOnScreen(wx.BOTH)
+        text = wx.TextCtrl(self, -1, msg, wx.DefaultPosition,
+                             wx.DefaultSize,
+                             wx.TE_MULTILINE | wx.TE_READONLY)
+        ok = wx.Button(self, wx.ID_OK, "OK")
         text.SetConstraints(Layoutf('t=t5#1;b=t5#2;l=l5#1;r=r5#1', (self,ok)))
         ok.SetConstraints(Layoutf('b=b5#1;x%w50#1;w!80;h!25', (self,)))
-        wx.EVT_BUTTON(self, wx.wxID_OK, self.OnClose)
+        wx.EVT_BUTTON(self, wx.ID_OK, self.OnClose)
         self.text = text
         self.SetAutoLayout(1)
         self.Layout()

Modified: trunk/thuban/Extensions/ogr/ogrdialog.py
===================================================================
--- trunk/thuban/Extensions/ogr/ogrdialog.py	2007-01-08 16:57:36 UTC (rev 2720)
+++ trunk/thuban/Extensions/ogr/ogrdialog.py	2007-01-13 15:11:42 UTC (rev 2721)
@@ -1,6 +1,6 @@
 # Copyright (c) 2001, 2003, 2004 by Intevation GmbH     vim:encoding=latin-1:
 # Authors:
-# Martin Müller <mmueller at intevation.de>
+# Martin Müller <mmueller at intevation.de>
 # Bernhard Herzog <bh at intevation.de>
 #
 # This program is free software under the GPL (>=v2)
@@ -11,7 +11,7 @@
 
 import sys, traceback
 
-from wxPython.wx import *
+import wx
 
 try:
     import ogr
@@ -29,14 +29,14 @@
 ID_LB_DCLICK         = 9204
 
 
-class ChooseFileFormat(wxDialog):
+class ChooseFileFormat(wx.Dialog):
     """This dialog lists all available drivers.
     """
     def __init__(self, parent, session):
         """Initialize the dialog.
         """
-        wxDialog.__init__(self, parent, -1, _("Choose file format"),
-                          style = wxDIALOG_MODAL|wxCAPTION)
+        wx.Dialog.__init__(self, parent, -1, _("Choose file format"),
+                          style = wx.DIALOG_MODAL|wx.CAPTION)
         self.session = session
         self.tables = []
 
@@ -45,18 +45,18 @@
         #
 
         # Sizer for the entire dialog
-        top = wxFlexGridSizer(2, 1, 0, 0)
+        top = wx.FlexGridSizer(2, 1, 0, 0)
 
         # Sizer for the main part with the list box
-        main_sizer = wxBoxSizer(wxHORIZONTAL)
-        top.Add(main_sizer, 1, wxEXPAND, 0)
+        main_sizer = wx.BoxSizer(wx.HORIZONTAL)
+        top.Add(main_sizer, 1, wx.EXPAND, 0)
 
         # The list box with the drivers
-        static_box = wxStaticBoxSizer(wxStaticBox(self, -1, "File formats"),
-                                   wxHORIZONTAL)
-        self.lb_drivers = wxListBox(self, -1)
-        static_box.Add(self.lb_drivers, 0, wxEXPAND, 0)
-        main_sizer.Add(static_box, 1, wxEXPAND, 0)
+        static_box = wx.StaticBoxSizer(wx.StaticBox(self, -1, "File formats"),
+                                   wx.HORIZONTAL)
+        self.lb_drivers = wx.ListBox(self, -1)
+        static_box.Add(self.lb_drivers, 0, wx.EXPAND, 0)
+        main_sizer.Add(static_box, 1, wx.EXPAND, 0)
 
         for i in range(ogr.GetDriverCount()):
             self.lb_drivers.Append(ogr.GetDriver(i).GetName())
@@ -64,14 +64,14 @@
             self.lb_drivers.SetSelection(0, True)
 
         # The standard button box at the bottom of the dialog
-        buttons = wxFlexGridSizer(1, 2, 0, 0)
-        ok_button = wxButton(self, ID_DBCHOOSE_OK, _("OK"))
-        EVT_BUTTON(self, ID_DBCHOOSE_OK, self.OnOK)
-        buttons.Add(ok_button, 0, wxALL|wxALIGN_RIGHT, 4)
-        cancel_button = wxButton(self, ID_DBCHOOSE_CANCEL, _("Cancel"))
-        EVT_BUTTON(self, ID_DBCHOOSE_CANCEL, self.OnCancel)
-        buttons.Add(cancel_button, 0, wxALL, 4)
-        top.Add(buttons, 1, wxALL|wxALIGN_CENTER_HORIZONTAL, 4)
+        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)
+        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)
+        buttons.Add(cancel_button, 0, wx.ALL, 4)
+        top.Add(buttons, 1, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 4)
 
         # Autosizing
         self.SetAutoLayout(1)
@@ -90,23 +90,23 @@
         """Close dialog.
         """
         if self.lb_tables.GetSelection() >= 0:
-            self.EndModal(wxID_OK)
+            self.EndModal(wx.ID_OK)
             self.Show(False)
 
     def OnOK(self, event):
         """Close dialog.
         """
-        self.EndModal(wxID_OK)
+        self.EndModal(wx.ID_OK)
         self.Show(False)
 
     def OnCancel(self, event):
         """Close dialog.
         """
-        self.EndModal(wxID_CANCEL)
+        self.EndModal(wx.ID_CANCEL)
         self.Show(False)
 
 
-class ChooseLayer(wxDialog):
+class ChooseLayer(wx.Dialog):
     """This dialog lists all the layers contained in the given datasource.
 
     One layer can be chosen, which is then opened.
@@ -115,8 +115,8 @@
     def __init__(self, parent, filename):
         """Initialize the dialog.
         """
-        wxDialog.__init__(self, parent, -1, _("Choose layer"),
-                          style = wxDIALOG_MODAL|wxCAPTION)
+        wx.Dialog.__init__(self, parent, -1, _("Choose layer"),
+                          style = wx.DIALOG_MODAL|wx.CAPTION)
         self.tables = []
 
         #
@@ -124,18 +124,18 @@
         #
 
         # Sizer for the entire dialog
-        top = wxFlexGridSizer(2, 1, 0, 0)
+        top = wx.FlexGridSizer(2, 1, 0, 0)
 
         # Sizer for the main part with the list boxes
-        main_sizer = wxBoxSizer(wxHORIZONTAL)
-        top.Add(main_sizer, 1, wxEXPAND, 0)
+        main_sizer = wx.BoxSizer(wx.HORIZONTAL)
+        top.Add(main_sizer, 1, wx.EXPAND, 0)
 
         # The list box with the drivers
-        static_box = wxStaticBoxSizer(wxStaticBox(self, -1, _("Layers")),
-                                   wxHORIZONTAL)
-        self.lb_drivers = wxListBox(self, -1)
-        static_box.Add(self.lb_drivers, 0, wxEXPAND, 0)
-        main_sizer.Add(static_box, 1, wxEXPAND, 0)
+        static_box = wx.StaticBoxSizer(wx.StaticBox(self, -1, _("Layers")),
+                                   wx.HORIZONTAL)
+        self.lb_drivers = wx.ListBox(self, -1)
+        static_box.Add(self.lb_drivers, 0, wx.EXPAND, 0)
+        main_sizer.Add(static_box, 1, wx.EXPAND, 0)
 
         datasource = ogr.Open(filename)
         self.layer = []
@@ -146,14 +146,14 @@
             self.lb_drivers.SetSelection(0, True)
 
         # The standard button box at the bottom of the dialog
-        buttons = wxFlexGridSizer(1, 2, 0, 0)
-        ok_button = wxButton(self, ID_DBCHOOSE_OK, _("OK"))
-        EVT_BUTTON(self, ID_DBCHOOSE_OK, self.OnOK)
-        buttons.Add(ok_button, 0, wxALL|wxALIGN_RIGHT, 4)
-        cancel_button = wxButton(self, ID_DBCHOOSE_CANCEL, _("Cancel"))
-        EVT_BUTTON(self, ID_DBCHOOSE_CANCEL, self.OnCancel)
-        buttons.Add(cancel_button, 0, wxALL, 4)
-        top.Add(buttons, 1, wxALL|wxALIGN_CENTER_HORIZONTAL, 4)
+        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)
+        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)
+        buttons.Add(cancel_button, 0, wx.ALL, 4)
+        top.Add(buttons, 1, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 4)
 
         # Autosizing
         self.SetAutoLayout(1)
@@ -168,9 +168,9 @@
         """
         self.result = result
         if result is not None:
-            self.EndModal(wxID_OK)
+            self.EndModal(wx.ID_OK)
         else:
-            self.EndModal(wxID_CANCEL)
+            self.EndModal(wx.ID_CANCEL)
         self.Show(False)
 
     def OnOK(self, event):
@@ -188,7 +188,7 @@
         return self.layer[self.lb_drivers.GetSelection()].GetName()
 
 
-class ChooseOGRDBTableDialog(wxDialog):
+class ChooseOGRDBTableDialog(wx.Dialog):
     """This dialog opens a datasource from an existing database connection.
 
     A list of all available database connections is offered. If one connection
@@ -199,8 +199,8 @@
     def __init__(self, parent, session):
         """Initialize the dialog.
         """
-        wxDialog.__init__(self, parent, -1, _("Choose layer from database"),
-                          style = wxDIALOG_MODAL|wxCAPTION)
+        wx.Dialog.__init__(self, parent, -1, _("Choose layer from database"),
+                          style = wx.DIALOG_MODAL|wx.CAPTION)
         self.session = session
         self.dbconns = self.session.DBConnections()
         self.tables = []
@@ -210,18 +210,18 @@
         #
 
         # Sizer for the entire dialog
-        top = wxFlexGridSizer(2, 1, 0, 0)
+        top = wx.FlexGridSizer(2, 1, 0, 0)
 
         # Sizer for the main part with the list boxes
-        main_sizer = wxBoxSizer(wxHORIZONTAL)
-        top.Add(main_sizer, 1, wxEXPAND, 0)
+        main_sizer = wx.BoxSizer(wx.HORIZONTAL)
+        top.Add(main_sizer, 1, wx.EXPAND, 0)
 
         # The list box with the connections
-        static_box = wxStaticBoxSizer(wxStaticBox(self, -1, _("Databases")),
-                                   wxHORIZONTAL)
-        self.lb_connections = wxListBox(self, -1)
-        static_box.Add(self.lb_connections, 0, wxEXPAND, 0)
-        main_sizer.Add(static_box, 1, wxEXPAND, 0)
+        static_box = wx.StaticBoxSizer(wx.StaticBox(self, -1, _("Databases")),
+                                   wx.HORIZONTAL)
+        self.lb_connections = wx.ListBox(self, -1)
+        static_box.Add(self.lb_connections, 0, wx.EXPAND, 0)
+        main_sizer.Add(static_box, 1, wx.EXPAND, 0)
 
         for i in range(len(self.dbconns)):
             self.lb_connections.Append(self.dbconns[i].BriefDescription())
@@ -230,42 +230,42 @@
 
         # The button box between the connections list box and the table
         # list box
-        buttons = wxFlexGridSizer(3, 1, 0, 0)
-        buttons.Add(20, 80, 0, wxEXPAND, 0)
-        retrieve_button = wxButton(self, ID_DBCHOOSE_RETRIEVE, _("Retrieve"))
-        EVT_BUTTON(self, ID_DBCHOOSE_RETRIEVE, self.OnRetrieve)
-        buttons.Add(retrieve_button, 0, wxALL
-                    |wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 4)
-        buttons.Add(20, 80, 0, wxEXPAND, 0)
-        main_sizer.Add(buttons, 0, wxEXPAND, 0)
+        buttons = wx.FlexGridSizer(3, 1, 0, 0)
+        buttons.Add(20, 80, 0, wx.EXPAND, 0)
+        retrieve_button = wx.Button(self, ID_DBCHOOSE_RETRIEVE, _("Retrieve"))
+        wx.EVT_BUTTON(self, ID_DBCHOOSE_RETRIEVE, self.OnRetrieve)
+        buttons.Add(retrieve_button, 0, wx.ALL
+                    |wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 4)
+        buttons.Add(20, 80, 0, wx.EXPAND, 0)
+        main_sizer.Add(buttons, 0, wx.EXPAND, 0)
 
         # The list box with the tables
-        static_box = wxStaticBoxSizer(wxStaticBox(self, -1, _("Tables")),
-                                   wxHORIZONTAL)
-        self.lb_tables = wxListBox(self, ID_LB_DCLICK)
-        EVT_LISTBOX(self, ID_LB_DCLICK, self.OnTableSelect)
-        EVT_LISTBOX_DCLICK(self, ID_LB_DCLICK, self.OnLBDClick)
-        static_box.Add(self.lb_tables, 0, wxEXPAND, 0)
-        main_sizer.Add(static_box, 1, wxEXPAND, 0)
+        static_box = wx.StaticBoxSizer(wx.StaticBox(self, -1, _("Tables")),
+                                   wx.HORIZONTAL)
+        self.lb_tables = wx.ListBox(self, ID_LB_DCLICK)
+        wx.EVT_LISTBOX(self, ID_LB_DCLICK, self.OnTableSelect)
+        wx.EVT_LISTBOX_DCLICK(self, ID_LB_DCLICK, self.OnLBDClick)
+        static_box.Add(self.lb_tables, 0, wx.EXPAND, 0)
+        main_sizer.Add(static_box, 1, wx.EXPAND, 0)
 
         # id column and geometry column selection
-        box = wxBoxSizer(wxVERTICAL)
-        box.Add(wxStaticText(self, -1, _("ID Column")), 0,
-                wxALL|wxALIGN_CENTER_VERTICAL, 4)
-        self.text_id_column = wxComboBox(self, -1, "")
+        box = wx.BoxSizer(wx.VERTICAL)
+        box.Add(wx.StaticText(self, -1, _("ID Column")), 0,
+                wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4)
+        self.text_id_column = wx.ComboBox(self, -1, "")
         box.Add(self.text_id_column, 0,
-                wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 4)
-        main_sizer.Add(box, 1, wxEXPAND, 0)
+                wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.EXPAND, 4)
+        main_sizer.Add(box, 1, wx.EXPAND, 0)
 
         # The standard button box at the bottom of the dialog
-        buttons = wxFlexGridSizer(1, 2, 0, 0)
-        ok_button = wxButton(self, ID_DBCHOOSE_OK, _("OK"))
-        EVT_BUTTON(self, ID_DBCHOOSE_OK, self.OnOK)
-        buttons.Add(ok_button, 0, wxALL|wxALIGN_RIGHT, 4)
-        cancel_button = wxButton(self, ID_DBCHOOSE_CANCEL, _("Cancel"))
-        EVT_BUTTON(self, ID_DBCHOOSE_CANCEL, self.OnCancel)
-        buttons.Add(cancel_button, 0, wxALL, 4)
-        top.Add(buttons, 1, wxALL|wxALIGN_CENTER_HORIZONTAL, 4)
+        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)
+        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)
+        buttons.Add(cancel_button, 0, wx.ALL, 4)
+        top.Add(buttons, 1, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 4)
 
         # Autosizing
         self.SetAutoLayout(1)
@@ -324,54 +324,54 @@
         """Close dialog.
         """
         if self.lb_tables.GetSelection() >= 0:
-            self.EndModal(wxID_OK)
+            self.EndModal(wx.ID_OK)
             self.Show(False)
 
     def OnOK(self, event):
         """Dialog closed with OK button.
         """
-        self.EndModal(wxID_OK)
+        self.EndModal(wx.ID_OK)
         self.Show(False)
 
     def OnCancel(self, event):
         """Dialog closed with Cancel.
         """
-        self.EndModal(wxID_CANCEL)
+        self.EndModal(wx.ID_CANCEL)
         self.Show(False)
 
 
-class OGRConnectionDialog(wxDialog):
+class OGRConnectionDialog(wx.Dialog):
     """A string can be enteres, which is directly passed to ogr to open a
     datasource.
     """
     def __init__(self, parent, session):
         """Initialize the dialog.
         """
-        wxDialog.__init__(self, parent, -1, "Enter string for OGRConnection",
-                          style = wxDIALOG_MODAL|wxCAPTION)
+        wx.Dialog.__init__(self, parent, -1, "Enter string for OGRConnection",
+                          style = wx.DIALOG_MODAL|wx.CAPTION)
         self.session = session
 
         # Sizer for the entire dialog
-        top = wxBoxSizer(wxVERTICAL)
+        top = wx.BoxSizer(wx.VERTICAL)
 
         # The list box with the drivers
-        box = wxBoxSizer(wxHORIZONTAL)#wxBox(self, -1, _("OGRConnection")),
-                            #       wxHORIZONTAL)
-        box.Add(wxStaticText(self, -1, _("URL:")), 0,
-                wxALL|wxALIGN_CENTER_VERTICAL, 4)
-        self.text_string = wxTextCtrl(self, -1, "")
-        box.Add(self.text_string, 0, wxEXPAND, 0)
-        top.Add(box, 0, wxEXPAND)
+        box = wx.BoxSizer(wx.HORIZONTAL)#wx.Box(self, -1, _("OGRConnection")),
+                            #       wx.HORIZONTAL)
+        box.Add(wx.StaticText(self, -1, _("URL:")), 0,
+                wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4)
+        self.text_string = wx.TextCtrl(self, -1, "")
+        box.Add(self.text_string, 0, wx.EXPAND, 0)
+        top.Add(box, 0, wx.EXPAND)
 
         # The standard button box at the bottom of the dialog
-        buttons = wxFlexGridSizer(1, 2, 0, 0)
-        ok_button = wxButton(self, ID_DBCHOOSE_OK, _("OK"))
-        EVT_BUTTON(self, ID_DBCHOOSE_OK, self.OnOK)
-        buttons.Add(ok_button, 0, wxALL|wxALIGN_RIGHT, 4)
-        cancel_button = wxButton(self, ID_DBCHOOSE_CANCEL, _("Cancel"))
-        EVT_BUTTON(self, ID_DBCHOOSE_CANCEL, self.OnCancel)
-        buttons.Add(cancel_button, 0, wxALL, 4)
-        top.Add(buttons, 1, wxALL|wxALIGN_CENTER_HORIZONTAL, 4)
+        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)
+        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)
+        buttons.Add(cancel_button, 0, wx.ALL, 4)
+        top.Add(buttons, 1, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 4)
 
         # Autosizing
         self.SetAutoLayout(1)
@@ -392,9 +392,9 @@
         """
         self.result = result
         if result is not None:
-            self.EndModal(wxID_OK)
+            self.EndModal(wx.ID_OK)
         else:
-            self.EndModal(wxID_CANCEL)
+            self.EndModal(wx.ID_CANCEL)
         self.Show(False)
 
     def OnOK(self, event):

Modified: trunk/thuban/Extensions/ogr/ogrstart.py
===================================================================
--- trunk/thuban/Extensions/ogr/ogrstart.py	2007-01-08 16:57:36 UTC (rev 2720)
+++ trunk/thuban/Extensions/ogr/ogrstart.py	2007-01-13 15:11:42 UTC (rev 2721)
@@ -1,6 +1,6 @@
 # Copyright (c) 2004,2006 by Intevation GmbH    vim:encoding=latin-1:
 # Authors:
-# Nina Hüffmeyer <nhueffme at intevation.de>
+# Nina Hüffmeyer <nhueffme at intevation.de>
 #
 # This program is free software under the GPL (>=v2)
 # Read the file COPYING coming with Thuban for details.
@@ -9,8 +9,8 @@
 # $Source$
 # $Id$
 
-# Needed wx-toolkit classes
-from wxPython.wx import wxFileDialog, wxOPEN, wxMULTIPLE, wxID_OK
+# Needed wx.-toolkit classes
+import wx
 
 # We need os.path
 import os
@@ -34,7 +34,7 @@
     map = canvas.Map()
 
     # Get the file to be opened
-    dlg = wxFileDialog(canvas, _("Select a data file"),
+    dlg = wx.FileDialog(canvas, _("Select a data file"),
                            context.application.Path("data"), "",
                            _("Shapefiles (*.shp)") + "|*.shp|" +
                            _("GML files (*.gml)") + "|*.gml|" +
@@ -42,15 +42,15 @@
                            _("DGN files (*.dgn)") + "|*.dgn|" +
                            _("CSV files (*.csv)") + "|*.csv|" +
                            _("All Files (*.*)") + "|*.*|",
-                           wxOPEN | wxMULTIPLE)
+                           wx.OPEN | wx.MULTIPLE)
 
-    if dlg.ShowModal() == wxID_OK:
+    if dlg.ShowModal() == wx.ID_OK:
         filenames = dlg.GetPaths()
         for filename in filenames:
             title = os.path.splitext(os.path.basename(filename))[0]
             has_layers = map.HasLayers()
             layerDlg = ogrdialog.ChooseLayer(canvas, filename)
-            if layerDlg.ShowModal() == wxID_OK:
+            if layerDlg.ShowModal() == wx.ID_OK:
                 layername = layerDlg.GetLayer()
                 try:
                     session = context.application.Session()
@@ -84,7 +84,7 @@
 
     dlg = ogrdialog.ChooseFileFormat(canvas, session)
 
-    if dlg.ShowModal() == wxID_OK:
+    if dlg.ShowModal() == wx.ID_OK:
         pass
     dlg.Destroy()
 
@@ -98,7 +98,7 @@
     session = context.application.Session()
     dlg = ChooseOGRDBTableDialog(canvas, session)
 
-    if dlg.ShowModal() == wxID_OK:
+    if dlg.ShowModal() == wx.ID_OK:
         dbconn, connString, dbtable, id_column = dlg.GetTable()
         try:
             store = OpenDBShapestore(session, dbconn, dbtable, id_column,
@@ -126,11 +126,11 @@
     session = context.application.Session()
     dlg = ogrdialog.OGRConnectionDialog(canvas, session)
 
-    if dlg.ShowModal() == wxID_OK:
+    if dlg.ShowModal() == wx.ID_OK:
         dsname = dlg.GetDatasourceName()
 
         layerDlg = ogrdialog.ChooseLayer(canvas, dsname)
-        if layerDlg.ShowModal() == wxID_OK:
+        if layerDlg.ShowModal() == wx.ID_OK:
             layername = layerDlg.GetLayer()
             try:
                 store = ogrshapes.OGRShapeStore(session, dsname, layername)

Modified: trunk/thuban/Extensions/profiling/profiling.py
===================================================================
--- trunk/thuban/Extensions/profiling/profiling.py	2007-01-08 16:57:36 UTC (rev 2720)
+++ trunk/thuban/Extensions/profiling/profiling.py	2007-01-13 15:11:42 UTC (rev 2721)
@@ -29,7 +29,7 @@
 import time
 import pstats
 
-from wxPython.lib.dialogs import wxScrolledMessageDialog
+from wx.lib.dialogs import ScrolledMessageDialog
 
 from Thuban import _
 from Thuban.UI.command import registry, Command
@@ -107,7 +107,7 @@
         finally:
             sys.stdout = orig_stdout
 
-        dlg = wxScrolledMessageDialog(context.mainwindow, msg,
+        dlg = ScrolledMessageDialog(context.mainwindow, msg,
                                       _('Profile Screen Render'))
         dlg.ShowModal()
 

Modified: trunk/thuban/Extensions/svgexport/maplegend.py
===================================================================
--- trunk/thuban/Extensions/svgexport/maplegend.py	2007-01-08 16:57:36 UTC (rev 2720)
+++ trunk/thuban/Extensions/svgexport/maplegend.py	2007-01-13 15:11:42 UTC (rev 2721)
@@ -15,9 +15,8 @@
 """
 
 
-# Needed wx-toolkit classes
-from wxPython.wx import wxFileDialog, wxSAVE, wxOVERWRITE_PROMPT, \
-        wxID_OK, wxRect
+# Needed wx.-toolkit classes
+import wx
 
 # We need os.path
 import os
@@ -83,7 +82,7 @@
                         shapeType = l.ShapeType()
                         for g in clazz:
                             if g.IsVisible():
-                                self.Draw(dc, wxRect(posx+dx, 
+                                self.Draw(dc, wx.Rect(posx+dx, 
                                         posy-iconheight+2,
                                         iconwidth, iconheight),
                                         g.GetProperties(), shapeType)
@@ -132,12 +131,12 @@
     else:
         export_path="."
     # Get the file the session shall be written to
-    dlg = wxFileDialog(canvas, _("Write SVG"), export_path, "", 
+    dlg = wx.FileDialog(canvas, _("Write SVG"), export_path, "", 
             "Scalable Vector Graphics (*.svg)|*.svg", 
-            wxSAVE|wxOVERWRITE_PROMPT)
+            wx.SAVE|wx.OVERWRITE_PROMPT)
     #
     response = dlg.ShowModal()
-    if response == wxID_OK:
+    if response == wx.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-01-08 16:57:36 UTC (rev 2720)
+++ trunk/thuban/Extensions/svgexport/svgsaver.py	2007-01-13 15:11:42 UTC (rev 2721)
@@ -18,9 +18,8 @@
 """
 
 
-# Needed wx-toolkit classes
-from wxPython.wx import wxFileDialog, wxSAVE, wxOVERWRITE_PROMPT, wxID_OK, \
-        wxOK, wxICON_HAND
+# Needed wx.-toolkit classes
+import wx
 
 # We need os.path
 import os
@@ -46,12 +45,12 @@
     else:
         export_path="."
     # Get the file the session shall be written to
-    dlg = wxFileDialog(canvas, _("Write SVG"), export_path, "", 
+    dlg = wx.FileDialog(canvas, _("Write SVG"), export_path, "", 
             "Scalable Vector Graphics (*.svg)|*.svg", 
-            wxSAVE|wxOVERWRITE_PROMPT)
+            wx.SAVE|wx.OVERWRITE_PROMPT)
     
     response = dlg.ShowModal()
-    if response == wxID_OK:
+    if response == wx.ID_OK:
         file = dlg.GetPath()
     else: # Do nothing if choice was interrupted.
         return 0
@@ -81,7 +80,7 @@
         except SVGMapWriterError, inst:
             context.mainwindow.RunMessageBox(_("Error: SVG not written!"),
                 text=_("Could not write SVG because: ")+ str(inst),
-                flags= wxOK | wxICON_HAND)
+                flags= wx.OK | wx.ICON_HAND)
             # delete partly writting file
             os.remove(file)
 



More information about the Thuban-commits mailing list