[Thuban-commits] r2719 - in trunk/thuban: . Extensions/umn_mapserver
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Jan 8 17:30:30 CET 2007
Author: dpinte
Date: 2007-01-08 17:30:29 +0100 (Mon, 08 Jan 2007)
New Revision: 2719
Modified:
trunk/thuban/ChangeLog
trunk/thuban/Extensions/umn_mapserver/mf_export.py
trunk/thuban/Extensions/umn_mapserver/mf_handle.py
trunk/thuban/Extensions/umn_mapserver/mf_import.py
Log:
2007-01-08 Didrik Pinte <dpinte at itae.be>
umn_mapserver extension migrated to wxPython 2.6
* Extensions/umn_maserver/
mf_handle.py, mf_import.py, mf_export.py:
update wx imports to 2.6 policy
Modified: trunk/thuban/ChangeLog
===================================================================
--- trunk/thuban/ChangeLog 2007-01-05 23:43:49 UTC (rev 2718)
+++ trunk/thuban/ChangeLog 2007-01-08 16:30:29 UTC (rev 2719)
@@ -1,3 +1,11 @@
+2007-01-08 Didrik Pinte <dpinte at itae.be>
+
+ umn_mapserver extension migrated to wxPython 2.6
+
+ * Extensions/umn_maserver/
+ mf_handle.py, mf_import.py, mf_export.py:
+ update wx imports to 2.6 policy
+
2007-01-06 Didrik Pinte <dpinte at itae.be>
UTF-8 locales support reading non utf-8 files. This is a workaround and not
Modified: trunk/thuban/Extensions/umn_mapserver/mf_export.py
===================================================================
--- trunk/thuban/Extensions/umn_mapserver/mf_export.py 2007-01-05 23:43:49 UTC (rev 2718)
+++ trunk/thuban/Extensions/umn_mapserver/mf_export.py 2007-01-08 16:30:29 UTC (rev 2719)
@@ -27,9 +27,8 @@
# mapscript
from mapscript import mapObj
-# wxPython support
-from wxPython.wx import wxFileDialog, \
- wxID_OK, wxSAVE, wxOVERWRITE_PROMPT
+# wx.Python support
+import wx
# Thuban
# use _() already now for all strings that may later be translated
@@ -144,11 +143,11 @@
"""
theMap = context.mainwindow.canvas.Map().extension_umn_mapobj
- dlg = wxFileDialog(context.mainwindow, "Save file as...", ".", "",
+ dlg = wx.FileDialog(context.mainwindow, "Save file as...", ".", "",
"UMN MapServer Mapfiles (*.map)|*.map|" \
"All files (*.*)|*.*",
- wxSAVE |wxOVERWRITE_PROMPT)
- if dlg.ShowModal() == wxID_OK:
+ wx.SAVE |wx.OVERWRITE_PROMPT)
+ if dlg.ShowModal() == wx.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-01-05 23:43:49 UTC (rev 2718)
+++ trunk/thuban/Extensions/umn_mapserver/mf_handle.py 2007-01-08 16:30:29 UTC (rev 2719)
@@ -27,10 +27,9 @@
# mapscript
from mapscript import mapObj, layerObj
-# wxPython support
-# TODO: explicitly use from .. import
-from wxPython.wx import *
-from wxPython.grid import *
+# wx.Python support
+import wx
+from wx import grid
# Thuban
# use _() already now for all strings that may later be translated
@@ -61,43 +60,43 @@
ID_COLOR_CHANGE= 8001
ID_IMGCOLOR_CHANGE = 8002
-class Map_Dialog(wxDialog):
+class Map_Dialog(wx.Dialog):
def __init__(self, parent, ID, title,
- pos=wxDefaultPosition, size=wxDefaultSize,
- style=wxDEFAULT_DIALOG_STYLE):
+ pos=wx.DefaultPosition, size=wx.DefaultSize,
+ style=wx.DEFAULT_DIALOG_STYLE):
# initialize the Dialog
- wxDialog.__init__(self, parent, ID, title, pos, size, style)
+ wx.Dialog.__init__(self, parent, ID, title, pos, size, style)
# parent.canvas.Map()
self.tb_map = parent.canvas.Map()
self.tb_map_umn = self.tb_map.extension_umn_mapobj
# create name
- box_name = wxBoxSizer(wxHORIZONTAL)
- box_name.Add(wxStaticText(self, -1, _("Map-Name:")), 0,
- wxALL|wxALIGN_CENTER_VERTICAL, 4)
- box_name.Add(wxStaticText(self, -1, self.tb_map.Title()), 0,
- wxALL|wxALIGN_CENTER_VERTICAL, 4)
+ box_name = wx.BoxSizer(wx.HORIZONTAL)
+ box_name.Add(wx.StaticText(self, -1, _("Map-Name:")), 0,
+ wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4)
+ box_name.Add(wx.StaticText(self, -1, self.tb_map.Title()), 0,
+ wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4)
#create size settings
insidetxt = self.tb_map_umn.get_size()
- staticSize = wxStaticBox(self, 1010, _("Size"), style = 0,
+ staticSize = wx.StaticBox(self, 1010, _("Size"), style = 0,
name = "staticBox", )
- box_size = wxStaticBoxSizer(staticSize, wxVERTICAL)
+ box_size = wx.StaticBoxSizer(staticSize, wx.VERTICAL)
- box_sizepartWidth = wxBoxSizer(wxHORIZONTAL)
- box_sizepartWidth.Add(wxStaticText(self, -1, _("Width: ")), 0, wxALL, 4)
- self.text_width = wxTextCtrl(self, -1, str(insidetxt[0]))
- box_sizepartWidth.Add(self.text_width, 2, wxALL, 4)
- box_size.Add(box_sizepartWidth, 0, wxALIGN_RIGHT | wxALL, 5)
- box_sizepartHeight = wxBoxSizer(wxHORIZONTAL)
- box_sizepartHeight.Add(wxStaticText(self, -1, _("Height: ")), 0,
- wxALL, 4)
- self.text_height = wxTextCtrl(self, -1, str(insidetxt[1]))
- box_sizepartHeight.Add(self.text_height, 2, wxALL, 4)
- box_size.Add(box_sizepartHeight, 0, wxALIGN_RIGHT | wxALL, 5)
+ box_sizepartWidth = wx.BoxSizer(wx.HORIZONTAL)
+ box_sizepartWidth.Add(wx.StaticText(self, -1, _("Width: ")), 0, wx.ALL, 4)
+ self.text_width = wx.TextCtrl(self, -1, str(insidetxt[0]))
+ box_sizepartWidth.Add(self.text_width, 2, wx.ALL, 4)
+ box_size.Add(box_sizepartWidth, 0, wx.ALIGN_RIGHT | wx.ALL, 5)
+ box_sizepartHeight = wx.BoxSizer(wx.HORIZONTAL)
+ box_sizepartHeight.Add(wx.StaticText(self, -1, _("Height: ")), 0,
+ wx.ALL, 4)
+ self.text_height = wx.TextCtrl(self, -1, str(insidetxt[1]))
+ box_sizepartHeight.Add(self.text_height, 2, wx.ALL, 4)
+ box_size.Add(box_sizepartHeight, 0, wx.ALIGN_RIGHT | wx.ALL, 5)
# get the web object
self.tb_map = parent.canvas.Map()
@@ -110,72 +109,72 @@
for format in self.tb_map_umn.get_alloutputformats():
umn_outputformats.append(format.get_name())
#Imagetype selector
- box_imagetypeStatic = wxStaticBox(self, -1, _("Image Type"),
+ box_imagetypeStatic = wx.StaticBox(self, -1, _("Image Type"),
style = 0, name = "imagetype")
- box_imagetype = wxStaticBoxSizer(box_imagetypeStatic, wxVERTICAL)
- self.choice_imgtype = wxChoice(self, 8060, (80, 50),
+ box_imagetype = wx.StaticBoxSizer(box_imagetypeStatic, wx.VERTICAL)
+ self.choice_imgtype = wx.Choice(self, 8060, (80, 50),
choices = umn_outputformats)
EVT_CHOICE(self, 8060, self.EvtChoiceBox)
self.choice_imgtype.SetStringSelection(umn_imagetype)
- box_imagetype.Add(self.choice_imgtype,0, wxEXPAND, wxALL, 5)
+ box_imagetype.Add(self.choice_imgtype,0, wx.EXPAND, wx.ALL, 5)
#unittype
insideunit = self.tb_map_umn.get_units()
#Unittype selector
- box_unitsStatic = wxStaticBox(self, 1011, _("Unit Type"),
+ box_unitsStatic = wx.StaticBox(self, 1011, _("Unit Type"),
style = 0, name = "imagecolor")
- box_units = wxStaticBoxSizer(box_unitsStatic, wxVERTICAL)
+ box_units = wx.StaticBoxSizer(box_unitsStatic, wx.VERTICAL)
sam = []
for key in unit_type:
sam.append(unit_type[key])
- self.choice_units = wxChoice(self, 40, (80, 50), choices = sam)
+ self.choice_units = wx.Choice(self, 40, (80, 50), choices = sam)
self.choice_units.SetStringSelection(insideunit)
- box_units.Add(self.choice_units,0, wxEXPAND, wxALL, 5)
+ box_units.Add(self.choice_units,0, wx.EXPAND, wx.ALL, 5)
# color chouser
- box_colorStatic = wxStaticBox(self, 1011, _("ImageColor"),
+ box_colorStatic = wx.StaticBox(self, 1011, _("ImageColor"),
style = 0, name = "imagecolor")
- box_color = wxStaticBoxSizer(box_colorStatic, wxVERTICAL)
+ box_color = wx.StaticBoxSizer(box_colorStatic, wx.VERTICAL)
# preview box
- self.previewcolor = wxPanel(self,99, name = 'backgroundPanel',
- style = wxSIMPLE_BORDER | wxCLIP_CHILDREN)
+ self.previewcolor = wx.Panel(self,99, name = 'backgroundPanel',
+ style = wx.SIMPLE_BORDER | wx.CLIP_CHILDREN)
imagecolor = self.tb_map_umn.get_imagecolor()
- self.previewcolor.SetBackgroundColour(wxColour(imagecolor.get_red(),
+ self.previewcolor.SetBackgroundColour(wx.Colour(imagecolor.get_red(),
imagecolor.get_green(), imagecolor.get_blue()))
- box_color.Add(self.previewcolor, 1, wxGROW | wxALL, 5)
+ box_color.Add(self.previewcolor, 1, wx.GROW | wx.ALL, 5)
# color change button, opens a new color dialog
- button = wxButton(self, ID_COLOR_CHANGE, _("Change Color"))
+ button = wx.Button(self, ID_COLOR_CHANGE, _("Change Color"))
button.SetFocus()
EVT_BUTTON(self, ID_COLOR_CHANGE, self.OnChangeColor)
- box_color.Add(button, 1, wxEXPAND|wxALL, 5)
+ box_color.Add(button, 1, wx.EXPAND|wx.ALL, 5)
# status
umn_status = self.tb_map_umn.get_status()
- self.choice_status = wxRadioBox(self, -1, choices=["True","False"],
+ self.choice_status = wx.RadioBox(self, -1, choices=["True","False"],
label='status', majorDimension=1,
- name='status check', size=wxDefaultSize, style=wxRA_SPECIFY_ROWS)
+ name='status check', size=wx.DefaultSize, style=wx.RA_SPECIFY_ROWS)
self.choice_status.SetStringSelection(str(umn_status))
#buttons
- box_buttons = wxBoxSizer(wxHORIZONTAL)
- button = wxButton(self, wxID_OK, _("OK"))
- box_buttons.Add(button, 0, wxALL, 5)
- button = wxButton(self, wxID_CANCEL, _("Cancel"))
- box_buttons.Add(button, 0, wxALL, 5)
+ box_buttons = wx.BoxSizer(wx.HORIZONTAL)
+ button = wx.Button(self, wx.ID_OK, _("OK"))
+ box_buttons.Add(button, 0, wx.ALL, 5)
+ button = wx.Button(self, wx.ID_CANCEL, _("Cancel"))
+ box_buttons.Add(button, 0, wx.ALL, 5)
#button functions
- 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)
#add all boxes to the box top
- top = wxBoxSizer(wxVERTICAL)
- top.Add(box_name, 0, wxEXPAND |wxALL, 5)
- top.Add(box_size, 0, wxEXPAND |wxALL, 5)
- top.Add(box_imagetype,0, wxEXPAND |wxALL, 5)
- top.Add(box_units,0, wxEXPAND |wxALL, 5)
- top.Add(box_color,0, wxEXPAND |wxALL, 5)
- top.Add(self.choice_status,0, wxEXPAND |wxALL, 5)
- top.Add(box_buttons, 0, wxALIGN_RIGHT)
+ top = wx.BoxSizer(wx.VERTICAL)
+ top.Add(box_name, 0, wx.EXPAND |wx.ALL, 5)
+ top.Add(box_size, 0, wx.EXPAND |wx.ALL, 5)
+ top.Add(box_imagetype,0, wx.EXPAND |wx.ALL, 5)
+ top.Add(box_units,0, wx.EXPAND |wx.ALL, 5)
+ top.Add(box_color,0, wx.EXPAND |wx.ALL, 5)
+ top.Add(self.choice_status,0, wx.EXPAND |wx.ALL, 5)
+ top.Add(box_buttons, 0, wx.ALIGN_RIGHT)
# final layout settings
self.SetSizer(top)
@@ -186,14 +185,14 @@
dialog = ColorDialog(self)
dialog.SetColor(cur)
self.retcolor = None
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
self.retcolor = dialog.GetColor()
dialog.Destroy()
if self.retcolor:
self.redcolor = int(round(self.retcolor.red*255))
self.greencolor = int(round(self.retcolor.green*255))
self.bluecolor = int(round(self.retcolor.blue*255))
- self.previewcolor.SetBackgroundColour(wxColour((self.redcolor),
+ self.previewcolor.SetBackgroundColour(wx.Colour((self.redcolor),
int(self.greencolor), int(self.bluecolor)))
# refresh the colorbox to show the new color
self.previewcolor.Refresh()
@@ -208,9 +207,9 @@
def end_dialog(self, result):
self.result = result
if self.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):
@@ -232,63 +231,63 @@
self.end_dialog(None)
-class Web_Dialog(wxDialog):
+class Web_Dialog(wx.Dialog):
def __init__(self, parent, ID, title,
- pos=wxDefaultPosition, size=wxDefaultSize,
- style=wxDEFAULT_DIALOG_STYLE):
+ pos=wx.DefaultPosition, size=wx.DefaultSize,
+ style=wx.DEFAULT_DIALOG_STYLE):
# initialize the Dialog
- wxDialog.__init__(self, parent, ID, title, pos, size, style)
+ wx.Dialog.__init__(self, parent, ID, title, pos, size, style)
# get the web object
self.tb_map = parent.canvas.Map()
self.umn_web = self.tb_map.extension_umn_mapobj.get_web()
# Template
- box_template = wxBoxSizer(wxHORIZONTAL)
- box_template.Add(wxStaticText(self, -1, _("Template:")), 0,
- wxALL|wxALIGN_LEFT, 4)
- self.text_template = wxTextCtrl(self, -1,
+ box_template = wx.BoxSizer(wx.HORIZONTAL)
+ box_template.Add(wx.StaticText(self, -1, _("Template:")), 0,
+ wx.ALL|wx.ALIGN_LEFT, 4)
+ self.text_template = wx.TextCtrl(self, -1,
str(self.umn_web.get_template()))
self.text_template.SetSize((250,self.text_template.GetSize()[1]))
box_template.Add(self.text_template, 0,
- wxALL|wxALIGN_CENTER_VERTICAL, 4)
+ wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4)
# Imagepath
- box_imagepath = wxBoxSizer(wxHORIZONTAL)
- box_imagepath.Add(wxStaticText(self, -1, _("Imagepath:")), 0,
- wxALL|wxALIGN_LEFT, 4)
- self.text_imagepath = wxTextCtrl(self, -1,
+ box_imagepath = wx.BoxSizer(wx.HORIZONTAL)
+ box_imagepath.Add(wx.StaticText(self, -1, _("Imagepath:")), 0,
+ wx.ALL|wx.ALIGN_LEFT, 4)
+ self.text_imagepath = wx.TextCtrl(self, -1,
str(self.umn_web.get_imagepath()))
box_imagepath.Add(self.text_imagepath, 0,
- wxALL|wxALIGN_CENTER_VERTICAL, 4)
+ wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4)
# Imageurl
- box_imageurl = wxBoxSizer(wxHORIZONTAL)
- box_imageurl.Add(wxStaticText(self, -1, _("Imageurl:")), 0,
- wxALL|wxALIGN_LEFT, 4)
- self.text_imageurl = wxTextCtrl(self, -1,
+ box_imageurl = wx.BoxSizer(wx.HORIZONTAL)
+ box_imageurl.Add(wx.StaticText(self, -1, _("Imageurl:")), 0,
+ wx.ALL|wx.ALIGN_LEFT, 4)
+ self.text_imageurl = wx.TextCtrl(self, -1,
str(self.umn_web.get_imageurl()))
box_imageurl.Add(self.text_imageurl, 0,
- wxALL|wxALIGN_CENTER_VERTICAL, 4)
+ wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4)
#buttons
- box_buttons = wxBoxSizer(wxHORIZONTAL)
- button = wxButton(self, wxID_OK, _("OK"))
- box_buttons.Add(button, 0, wxALL, 5)
- button = wxButton(self, wxID_CANCEL, _("Cancel"))
- box_buttons.Add(button, 0, wxALL, 5)
+ box_buttons = wx.BoxSizer(wx.HORIZONTAL)
+ button = wx.Button(self, wx.ID_OK, _("OK"))
+ box_buttons.Add(button, 0, wx.ALL, 5)
+ button = wx.Button(self, wx.ID_CANCEL, _("Cancel"))
+ box_buttons.Add(button, 0, wx.ALL, 5)
#set the button funcitons
- 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)
# compose the final dialog
- top = wxBoxSizer(wxVERTICAL)
- top.Add(box_template, 0, wxEXPAND |wxALL, 5)
- top.Add(box_imagepath, 0, wxEXPAND |wxALL, 5)
- top.Add(box_imageurl, 0, wxEXPAND |wxALL, 5)
- top.Add(box_buttons, 0, wxALIGN_RIGHT)
+ top = wx.BoxSizer(wx.VERTICAL)
+ top.Add(box_template, 0, wx.EXPAND |wx.ALL, 5)
+ top.Add(box_imagepath, 0, wx.EXPAND |wx.ALL, 5)
+ top.Add(box_imageurl, 0, wx.EXPAND |wx.ALL, 5)
+ top.Add(box_buttons, 0, wx.ALIGN_RIGHT)
# final layout settings
self.SetSizer(top)
@@ -301,9 +300,9 @@
def end_dialog(self, result):
self.result = result
if self.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):
@@ -320,14 +319,14 @@
from Extensions.umn_mapserver.mapfile import MF_Layer
-class Layer_Dialog(wxDialog):
+class Layer_Dialog(wx.Dialog):
def __init__(self, parent, ID, title,
- pos=wxDefaultPosition, size=wxDefaultSize,
- style=wxDEFAULT_DIALOG_STYLE):
+ pos=wx.DefaultPosition, size=wx.DefaultSize,
+ style=wx.DEFAULT_DIALOG_STYLE):
# initialize the Dialog
- wxDialog.__init__(self, parent, ID, title, pos, size, style)
+ wx.Dialog.__init__(self, parent, ID, title, pos, size, style)
# get the web object
self.tb_layer = parent.current_layer()
@@ -339,47 +338,47 @@
self.umn_layer = self.tb_layer.extension_umn_layerobj
# create name
- layer_name = wxBoxSizer(wxHORIZONTAL)
- layer_name.Add(wxStaticText(self, -1, _("Layer-Name:")), 0,
- wxALL|wxALIGN_CENTER_VERTICAL, 4)
- layer_name.Add(wxStaticText(self, -1, self.tb_layer.Title()), 0,
- wxALL|wxALIGN_CENTER_VERTICAL, 4)
+ layer_name = wx.BoxSizer(wx.HORIZONTAL)
+ layer_name.Add(wx.StaticText(self, -1, _("Layer-Name:")), 0,
+ wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4)
+ layer_name.Add(wx.StaticText(self, -1, self.tb_layer.Title()), 0,
+ wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4)
# metadata button
- metadata_button = wxButton(self, ID_METADATA_CHANGE, _("Edit Metadata"))
+ metadata_button = wx.Button(self, ID_METADATA_CHANGE, _("Edit Metadata"))
EVT_BUTTON(self, ID_METADATA_CHANGE, self.OnChangeMetadata)
# Group
- box_group = wxBoxSizer(wxHORIZONTAL)
+ box_group = wx.BoxSizer(wx.HORIZONTAL)
if self.umn_layer.get_group():
umn_layer_group = self.umn_layer.get_group()
else:
umn_layer_group = ""
- box_group.Add(wxStaticText(self, -1, _("Group:")), 0,
- wxALL|wxALIGN_LEFT, 4)
- self.text_group = wxTextCtrl(self, -1,
+ box_group.Add(wx.StaticText(self, -1, _("Group:")), 0,
+ wx.ALL|wx.ALIGN_LEFT, 4)
+ self.text_group = wx.TextCtrl(self, -1,
str(umn_layer_group))
self.text_group.SetSize((250,self.text_group.GetSize()[1]))
box_group.Add(self.text_group, 0,
- wxALL|wxALIGN_CENTER_VERTICAL, 4)
+ wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4)
# buttons
- box_buttons = wxBoxSizer(wxHORIZONTAL)
- button = wxButton(self, wxID_OK, _("OK"))
- box_buttons.Add(button, 0, wxALL, 5)
- button = wxButton(self, wxID_CANCEL, _("Cancel"))
- box_buttons.Add(button, 0, wxALL, 5)
+ box_buttons = wx.BoxSizer(wx.HORIZONTAL)
+ button = wx.Button(self, wx.ID_OK, _("OK"))
+ box_buttons.Add(button, 0, wx.ALL, 5)
+ button = wx.Button(self, wx.ID_CANCEL, _("Cancel"))
+ box_buttons.Add(button, 0, wx.ALL, 5)
#set the button funcitons
- 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)
# compose the final dialog
- top = wxBoxSizer(wxVERTICAL)
- #top.Add(box_template, 0, wxEXPAND |wxALL, 5)
- top.Add(layer_name, 0, wxEXPAND|wxALL, 5)
- top.Add(box_group, 0, wxEXPAND|wxALL, 5)
- top.Add(metadata_button, 0, wxEXPAND|wxALL, 5)
- top.Add(box_buttons, 0, wxALIGN_RIGHT)
+ top = wx.BoxSizer(wx.VERTICAL)
+ #top.Add(box_template, 0, wx.EXPAND |wx.ALL, 5)
+ top.Add(layer_name, 0, wx.EXPAND|wx.ALL, 5)
+ top.Add(box_group, 0, wx.EXPAND|wx.ALL, 5)
+ top.Add(metadata_button, 0, wx.EXPAND|wx.ALL, 5)
+ top.Add(box_buttons, 0, wx.ALIGN_RIGHT)
# final layout settings
self.SetSizer(top)
@@ -389,11 +388,11 @@
# set the umn_label for scalebar so the Label_Dialog can be used
self.umn_metadata= self.umn_layer.get_metadata()
dialog = Metadata_Dialog(self, -1, "Layer Metadata Settings",
- size=wxSize(450, 200),
- style = wxDEFAULT_DIALOG_STYLE
+ size=wx.Size(450, 200),
+ style = wx.DEFAULT_DIALOG_STYLE
)
dialog.CenterOnScreen()
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
return
dialog.Destroy()
@@ -405,9 +404,9 @@
def end_dialog(self, result):
self.result = result
if self.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):
@@ -424,84 +423,84 @@
ID_LABEL_CHANGE = 8011
-class Legend_Dialog(wxDialog):
+class Legend_Dialog(wx.Dialog):
def __init__(self, parent, ID, title,
- pos=wxDefaultPosition, size=wxDefaultSize,
- style=wxDEFAULT_DIALOG_STYLE):
+ pos=wx.DefaultPosition, size=wx.DefaultSize,
+ style=wx.DEFAULT_DIALOG_STYLE):
# initialize the Dialog
- wxDialog.__init__(self, parent, ID, title, pos, size, style)
+ wx.Dialog.__init__(self, parent, ID, title, pos, size, style)
# get the web object
self.tb_map = parent.canvas.Map()
self.umn_legend = self.tb_map.extension_umn_mapobj.get_legend()
# create the Keysize
- keySize = wxStaticBox(self, 1010, _("KeySize"), style = 0,
+ keySize = wx.StaticBox(self, 1010, _("KeySize"), style = 0,
name = "KeySize Box", )
- box_keysize = wxStaticBoxSizer(keySize, wxVERTICAL)
+ box_keysize = wx.StaticBoxSizer(keySize, wx.VERTICAL)
umn_legend_keysize = self.umn_legend.get_keysize()
- box_sizepartWidth = wxBoxSizer(wxHORIZONTAL)
- box_sizepartWidth.Add(wxStaticText(self, -1, _("Width: ")), 0, wxALL, 2)
- self.text_keysize_width = wxSpinCtrl(self, -1,
+ box_sizepartWidth = wx.BoxSizer(wx.HORIZONTAL)
+ box_sizepartWidth.Add(wx.StaticText(self, -1, _("Width: ")), 0, wx.ALL, 2)
+ self.text_keysize_width = wx.SpinCtrl(self, -1,
value=str(umn_legend_keysize[0]), max=100, min=0,
- name='keywidth', style=wxSP_ARROW_KEYS)
- box_sizepartWidth.Add(self.text_keysize_width, 2, wxALL, 2)
- box_keysize.Add(box_sizepartWidth, 0, wxALIGN_RIGHT | wxALL, 2)
- box_sizepartHeight = wxBoxSizer(wxHORIZONTAL)
- box_sizepartHeight.Add(wxStaticText(self, -1, _("Height: ")), 0, wxALL, 2),
- self.text_keysize_height = wxSpinCtrl(self, -1,
+ name='keywidth', style=wx.SP_ARROW_KEYS)
+ box_sizepartWidth.Add(self.text_keysize_width, 2, wx.ALL, 2)
+ box_keysize.Add(box_sizepartWidth, 0, wx.ALIGN_RIGHT | wx.ALL, 2)
+ box_sizepartHeight = wx.BoxSizer(wx.HORIZONTAL)
+ box_sizepartHeight.Add(wx.StaticText(self, -1, _("Height: ")), 0, wx.ALL, 2),
+ self.text_keysize_height = wx.SpinCtrl(self, -1,
value=str(umn_legend_keysize[1]), max=100, min=0,
- name='keyheight', style=wxSP_ARROW_KEYS)
- box_sizepartHeight.Add(self.text_keysize_height, 2, wxALL, 2)
- box_keysize.Add(box_sizepartHeight, 0, wxALIGN_RIGHT | wxALL, 2)
+ name='keyheight', style=wx.SP_ARROW_KEYS)
+ box_sizepartHeight.Add(self.text_keysize_height, 2, wx.ALL, 2)
+ box_keysize.Add(box_sizepartHeight, 0, wx.ALIGN_RIGHT | wx.ALL, 2)
# create the Keyspacing
- keySpacing= wxStaticBox(self, 1010, _("KeySpacing"), style = 0,
+ keySpacing= wx.StaticBox(self, 1010, _("KeySpacing"), style = 0,
name = "KeySpacing Box", )
- box_keyspacing = wxStaticBoxSizer(keySpacing, wxVERTICAL)
+ box_keyspacing = wx.StaticBoxSizer(keySpacing, wx.VERTICAL)
umn_legend_keyspacing = self.umn_legend.get_keyspacing()
- box_sizepartWidth = wxBoxSizer(wxHORIZONTAL)
- box_sizepartWidth.Add(wxStaticText(self, -1, _("Width: ")), 0, wxALL, 2)
- self.text_keyspacing_width = wxSpinCtrl(self, -1,
+ box_sizepartWidth = wx.BoxSizer(wx.HORIZONTAL)
+ box_sizepartWidth.Add(wx.StaticText(self, -1, _("Width: ")), 0, wx.ALL, 2)
+ self.text_keyspacing_width = wx.SpinCtrl(self, -1,
value=str(umn_legend_keyspacing[0]), max=100,
- min=0, name='spacingwidth', style=wxSP_ARROW_KEYS)
- box_sizepartWidth.Add(self.text_keyspacing_width, 2, wxALL, 2)
- box_keyspacing.Add(box_sizepartWidth, 0, wxALIGN_RIGHT | wxALL, 2)
- box_sizepartHeight = wxBoxSizer(wxHORIZONTAL)
- box_sizepartHeight.Add(wxStaticText(self, -1, _("Height: ")), 0, wxALL, 2),
- self.text_keyspacing_height = wxSpinCtrl(self, -1,
+ min=0, name='spacingwidth', style=wx.SP_ARROW_KEYS)
+ box_sizepartWidth.Add(self.text_keyspacing_width, 2, wx.ALL, 2)
+ box_keyspacing.Add(box_sizepartWidth, 0, wx.ALIGN_RIGHT | wx.ALL, 2)
+ box_sizepartHeight = wx.BoxSizer(wx.HORIZONTAL)
+ box_sizepartHeight.Add(wx.StaticText(self, -1, _("Height: ")), 0, wx.ALL, 2),
+ self.text_keyspacing_height = wx.SpinCtrl(self, -1,
value=str(umn_legend_keyspacing[1]), max=100,
- min=0,name='spacingheight', style=wxSP_ARROW_KEYS)
- box_sizepartHeight.Add(self.text_keyspacing_height, 2, wxALL, 2)
- box_keyspacing.Add(box_sizepartHeight, 0, wxALIGN_RIGHT | wxALL, 2)
+ min=0,name='spacingheight', style=wx.SP_ARROW_KEYS)
+ box_sizepartHeight.Add(self.text_keyspacing_height, 2, wx.ALL, 2)
+ box_keyspacing.Add(box_sizepartHeight, 0, wx.ALIGN_RIGHT | wx.ALL, 2)
# color chooser
- box_colorStatic = wxStaticBox(self, 1011, _("ImageColor"), style = 0,
+ box_colorStatic = wx.StaticBox(self, 1011, _("ImageColor"), style = 0,
name = "imagecolor")
- box_color = wxStaticBoxSizer(box_colorStatic, wxVERTICAL)
+ box_color = wx.StaticBoxSizer(box_colorStatic, wx.VERTICAL)
# preview box
- self.previewcolor = wxPanel(self, 99, name = 'imagecolorPanel',
- style = wxSIMPLE_BORDER | wxCLIP_CHILDREN)
+ self.previewcolor = wx.Panel(self, 99, name = 'imagecolorPanel',
+ style = wx.SIMPLE_BORDER | wx.CLIP_CHILDREN)
imagecolor = self.umn_legend.get_imagecolor()
- self.previewcolor.SetBackgroundColour(wxColour(imagecolor.get_red(),
+ self.previewcolor.SetBackgroundColour(wx.Colour(imagecolor.get_red(),
imagecolor.get_green(), imagecolor.get_blue()))
- box_color.Add(self.previewcolor, 1, wxGROW | wxALL, 5)
+ box_color.Add(self.previewcolor, 1, wx.GROW | wx.ALL, 5)
# color change button, opens a new color dialog
- button = wxButton(self, ID_COLOR_CHANGE, _("Change Color"))
+ button = wx.Button(self, ID_COLOR_CHANGE, _("Change Color"))
button.SetFocus()
EVT_BUTTON(self, ID_COLOR_CHANGE, self.OnChangeColor)
- box_color.Add(button, 1, wxEXPAND|wxALL, 5)
+ box_color.Add(button, 1, wx.EXPAND|wx.ALL, 5)
# status
umn_legend_status= self.umn_legend.get_status(mode="string")
possible_choices = []
for key in legend_status_type:
possible_choices.append(legend_status_type[key])
- self.choice_status = wxRadioBox(self, -1, choices=possible_choices,
+ self.choice_status = wx.RadioBox(self, -1, choices=possible_choices,
label='Status', majorDimension=1,
- name='status check', size=wxDefaultSize, style=wxRA_SPECIFY_ROWS)
+ name='status check', size=wx.DefaultSize, style=wx.RA_SPECIFY_ROWS)
self.choice_status.SetStringSelection(umn_legend_status)
# create the positionbox
@@ -509,36 +508,36 @@
possible_choices = []
for key in legend_position_type:
possible_choices.append(legend_position_type[key])
- self.choice_position = wxRadioBox(self, -1, choices=possible_choices,
+ self.choice_position = wx.RadioBox(self, -1, choices=possible_choices,
label='Position', majorDimension=1,
name='position check',
- size=wxDefaultSize,
- style=wxRA_SPECIFY_ROWS)
+ size=wx.DefaultSize,
+ style=wx.RA_SPECIFY_ROWS)
self.choice_position.SetStringSelection(umn_legend_position)
# button for label
- labelbutton = wxButton(self, ID_LABEL_CHANGE, _("Change Label"))
+ labelbutton = wx.Button(self, ID_LABEL_CHANGE, _("Change Label"))
EVT_BUTTON(self, ID_LABEL_CHANGE, self.OnChangeLabel)
#buttons
- box_buttons = wxBoxSizer(wxHORIZONTAL)
- button = wxButton(self, wxID_OK, _("OK"))
- box_buttons.Add(button, 0, wxALL, 5)
- button = wxButton(self, wxID_CANCEL, _("Cancel"))
- box_buttons.Add(button, 0, wxALL, 5)
+ box_buttons = wx.BoxSizer(wx.HORIZONTAL)
+ button = wx.Button(self, wx.ID_OK, _("OK"))
+ box_buttons.Add(button, 0, wx.ALL, 5)
+ button = wx.Button(self, wx.ID_CANCEL, _("Cancel"))
+ box_buttons.Add(button, 0, wx.ALL, 5)
#set the button funcitons
- 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)
# compose the final layout
- top = wxBoxSizer(wxVERTICAL)
- top.Add(box_keysize,0, wxEXPAND |wxALL, 5)
- top.Add(box_keyspacing,0, wxEXPAND |wxALL, 5)
- top.Add(box_color,0, wxEXPAND |wxALL, 5)
- top.Add(self.choice_status,0, wxEXPAND |wxALL, 5)
- top.Add(self.choice_position,0, wxEXPAND |wxALL, 5)
- top.Add(labelbutton, 1, wxEXPAND|wxALL, 5)
- top.Add(box_buttons, 0, wxALIGN_RIGHT)
+ top = wx.BoxSizer(wx.VERTICAL)
+ top.Add(box_keysize,0, wx.EXPAND |wx.ALL, 5)
+ top.Add(box_keyspacing,0, wx.EXPAND |wx.ALL, 5)
+ top.Add(box_color,0, wx.EXPAND |wx.ALL, 5)
+ top.Add(self.choice_status,0, wx.EXPAND |wx.ALL, 5)
+ top.Add(self.choice_position,0, wx.EXPAND |wx.ALL, 5)
+ top.Add(labelbutton, 1, wx.EXPAND|wx.ALL, 5)
+ top.Add(box_buttons, 0, wx.ALIGN_RIGHT)
# final layout settings
self.SetSizer(top)
@@ -547,11 +546,11 @@
def OnChangeLabel(self, event):
self.umn_label = self.umn_legend.get_label()
dialog = Label_Dialog(self, -1, "Legend Label Settings",
- size=wxSize(350, 200),
- style = wxDEFAULT_DIALOG_STYLE
+ size=wx.Size(350, 200),
+ style = wx.DEFAULT_DIALOG_STYLE
)
dialog.CenterOnScreen()
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
return
dialog.Destroy()
@@ -560,14 +559,14 @@
dialog = ColorDialog(self)
dialog.SetColor(cur)
self.retcolor = None
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
self.retcolor = dialog.GetColor()
dialog.Destroy()
if self.retcolor:
self.redcolor = int(round(self.retcolor.red*255))
self.greencolor = int(round(self.retcolor.green*255))
self.bluecolor = int(round(self.retcolor.blue*255))
- self.previewcolor.SetBackgroundColour(wxColour(int(self.redcolor),
+ self.previewcolor.SetBackgroundColour(wx.Colour(int(self.redcolor),
int(self.greencolor),
int(self.bluecolor)))
# refresh the colorbox to show the new color
@@ -580,9 +579,9 @@
def end_dialog(self, result):
self.result = result
if self.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):
@@ -601,182 +600,182 @@
def OnCancel(self, event):
self.end_dialog(None)
-class Label_Dialog(wxDialog):
+class Label_Dialog(wx.Dialog):
def __init__(self, parent, ID, title,
- pos=wxDefaultPosition, size=wxDefaultSize,
- style=wxDEFAULT_DIALOG_STYLE):
+ pos=wx.DefaultPosition, size=wx.DefaultSize,
+ style=wx.DEFAULT_DIALOG_STYLE):
# initialize the Dialog
- wxDialog.__init__(self, parent, ID, title, pos, size, style)
+ wx.Dialog.__init__(self, parent, ID, title, pos, size, style)
# get the web object
self.umn_label = parent.umn_label
# size
- labelsize= wxStaticBox(self, 1010, _("Size"), style = 0,
+ labelsize= wx.StaticBox(self, 1010, _("Size"), style = 0,
name = "Size Box", )
- box_labelsize = wxStaticBoxSizer(labelsize, wxVERTICAL)
+ box_labelsize = wx.StaticBoxSizer(labelsize, wx.VERTICAL)
umn_label_size= self.umn_label.get_size()
- box_size = wxBoxSizer(wxHORIZONTAL)
- self.text_labelsize = wxSpinCtrl(self, -1,
+ box_size = wx.BoxSizer(wx.HORIZONTAL)
+ self.text_labelsize = wx.SpinCtrl(self, -1,
value=str(umn_label_size), max=10, min=0,
- name='size', style=wxSP_ARROW_KEYS)
- box_size.Add(self.text_labelsize, 2, wxALL, 2)
- box_labelsize.Add(box_size, 0, wxALIGN_RIGHT | wxALL, 2)
+ name='size', style=wx.SP_ARROW_KEYS)
+ box_size.Add(self.text_labelsize, 2, wx.ALL, 2)
+ box_labelsize.Add(box_size, 0, wx.ALIGN_RIGHT | wx.ALL, 2)
# color chooser
- box_colorStatic = wxStaticBox(self, 1011, _("Color"), style = 0,
+ box_colorStatic = wx.StaticBox(self, 1011, _("Color"), style = 0,
name = "color")
- box_color = wxStaticBoxSizer(box_colorStatic, wxVERTICAL)
+ box_color = wx.StaticBoxSizer(box_colorStatic, wx.VERTICAL)
# preview box
- self.previewcolor = wxPanel(self, 99, name = 'colorPanel',
- style = wxSIMPLE_BORDER | wxCLIP_CHILDREN)
+ self.previewcolor = wx.Panel(self, 99, name = 'colorPanel',
+ style = wx.SIMPLE_BORDER | wx.CLIP_CHILDREN)
color = self.umn_label.get_color()
- self.previewcolor.SetBackgroundColour(wxColour(color.get_red(),
+ self.previewcolor.SetBackgroundColour(wx.Colour(color.get_red(),
color.get_green(), color.get_blue()))
- box_color.Add(self.previewcolor, 1, wxGROW | wxALL, 5)
+ box_color.Add(self.previewcolor, 1, wx.GROW | wx.ALL, 5)
# color change button, opens a new color dialog
- button = wxButton(self, ID_COLOR_CHANGE, _("Change Color"))
+ button = wx.Button(self, ID_COLOR_CHANGE, _("Change Color"))
button.SetFocus()
EVT_BUTTON(self, ID_COLOR_CHANGE, self.OnChangeColor)
- box_color.Add(button, 1, wxEXPAND|wxALL, 5)
+ box_color.Add(button, 1, wx.EXPAND|wx.ALL, 5)
#get the set type
insidetype = self.umn_label.get_type()
#create the type selector for fonttype (Bitmap, TrueType)
# TODO: Truetype is not supported yet
- box_typeStatic = wxStaticBox(self, 1011, _("Type"), style = 0,
+ box_typeStatic = wx.StaticBox(self, 1011, _("Type"), style = 0,
name = "type")
- box_type = wxStaticBoxSizer(box_typeStatic, wxVERTICAL)
+ box_type = wx.StaticBoxSizer(box_typeStatic, wx.VERTICAL)
sam = []
for key in label_font_type:
# dont add truetype
#if key != 0:
sam.append(label_font_type[key])
- self.choice_type = wxChoice(self, 40, (80, 50), choices = sam)
+ self.choice_type = wx.Choice(self, 40, (80, 50), choices = sam)
self.choice_type.SetStringSelection(insidetype)
- box_type.Add(self.choice_type,0, wxEXPAND, wxALL, 5)
+ box_type.Add(self.choice_type,0, wx.EXPAND, wx.ALL, 5)
# Offset
- offset= wxStaticBox(self, 1010, _("Offset"), style = 0,
+ offset= wx.StaticBox(self, 1010, _("Offset"), style = 0,
name = "Offset Box", )
- box_offset = wxStaticBoxSizer(offset, wxVERTICAL)
+ box_offset = wx.StaticBoxSizer(offset, wx.VERTICAL)
umn_label_offset = self.umn_label.get_offset()
- box_offsetX = wxBoxSizer(wxHORIZONTAL)
- box_offsetX.Add(wxStaticText(self, -1, _("X: ")), 0, wxALL, 2)
- self.text_offsetx = wxSpinCtrl(self, -1,
+ box_offsetX = wx.BoxSizer(wx.HORIZONTAL)
+ box_offsetX.Add(wx.StaticText(self, -1, _("X: ")), 0, wx.ALL, 2)
+ self.text_offsetx = wx.SpinCtrl(self, -1,
value=str(umn_label_offset[0]), max=20, min=0,
- name='offsetX', style=wxSP_ARROW_KEYS)
- box_offsetX.Add(self.text_offsetx, 2, wxALL, 2)
- box_offset.Add(box_offsetX, 0, wxALIGN_RIGHT | wxALL, 2)
- box_offsetY = wxBoxSizer(wxHORIZONTAL)
- box_offsetY.Add(wxStaticText(self, -1, _("Y: ")), 0, wxALL, 2),
- self.text_offsety = wxSpinCtrl(self, -1,
+ name='offsetX', style=wx.SP_ARROW_KEYS)
+ box_offsetX.Add(self.text_offsetx, 2, wx.ALL, 2)
+ box_offset.Add(box_offsetX, 0, wx.ALIGN_RIGHT | wx.ALL, 2)
+ box_offsetY = wx.BoxSizer(wx.HORIZONTAL)
+ box_offsetY.Add(wx.StaticText(self, -1, _("Y: ")), 0, wx.ALL, 2),
+ self.text_offsety = wx.SpinCtrl(self, -1,
value=str(umn_label_offset[1]), max=100, min=0,
- name='offsetY', style=wxSP_ARROW_KEYS)
- box_offsetY.Add(self.text_offsety, 2, wxALL, 2)
- box_offset.Add(box_offsetY, 0, wxALIGN_RIGHT | wxALL, 2)
+ name='offsetY', style=wx.SP_ARROW_KEYS)
+ box_offsetY.Add(self.text_offsety, 2, wx.ALL, 2)
+ box_offset.Add(box_offsetY, 0, wx.ALIGN_RIGHT | wx.ALL, 2)
# partials
umn_partials = self.umn_label.get_partials()
- self.choice_partials = wxRadioBox(self, -1, choices=["True","False"],
+ self.choice_partials = wx.RadioBox(self, -1, choices=["True","False"],
label='partials', majorDimension=1,
name='partials check',
- size=wxDefaultSize,
- style=wxRA_SPECIFY_ROWS)
+ size=wx.DefaultSize,
+ style=wx.RA_SPECIFY_ROWS)
self.choice_partials.SetStringSelection(str(umn_partials))
# force
umn_force = self.umn_label.get_force()
- self.choice_force = wxRadioBox(self, -1, choices=["True","False"],
+ self.choice_force = wx.RadioBox(self, -1, choices=["True","False"],
label='force', majorDimension=1,
- name='force check', size=wxDefaultSize, style=wxRA_SPECIFY_ROWS)
+ name='force check', size=wx.DefaultSize, style=wx.RA_SPECIFY_ROWS)
self.choice_force.SetStringSelection(str(umn_force))
# buffer
- buffer = wxStaticBox(self, 1010, _("Buffer"), style = 0,
+ buffer = wx.StaticBox(self, 1010, _("Buffer"), style = 0,
name = "Buffer Box", )
- box_buffer = wxStaticBoxSizer(buffer, wxVERTICAL)
+ box_buffer = wx.StaticBoxSizer(buffer, wx.VERTICAL)
umn_buffer= self.umn_label.get_buffer()
- box_buffertext = wxBoxSizer(wxHORIZONTAL)
- self.text_buffer = wxSpinCtrl(self, -1,
+ box_buffertext = wx.BoxSizer(wx.HORIZONTAL)
+ self.text_buffer = wx.SpinCtrl(self, -1,
value=str(umn_buffer), max=10, min=0,
- name='size', style=wxSP_ARROW_KEYS)
- box_buffertext.Add(self.text_buffer, 2, wxALL, 2)
- box_buffer.Add(box_buffertext, 0, wxALIGN_RIGHT | wxALL, 2)
+ name='size', style=wx.SP_ARROW_KEYS)
+ box_buffertext.Add(self.text_buffer, 2, wx.ALL, 2)
+ box_buffer.Add(box_buffertext, 0, wx.ALIGN_RIGHT | wx.ALL, 2)
# minfeaturesize
- minfeaturesize = wxStaticBox(self, 1010, _("Minfeaturesize"),
+ minfeaturesize = wx.StaticBox(self, 1010, _("Minfeaturesize"),
style = 0, name = "Minfeaturesize Box")
- box_minfeaturesize = wxStaticBoxSizer(minfeaturesize, wxVERTICAL)
+ box_minfeaturesize = wx.StaticBoxSizer(minfeaturesize, wx.VERTICAL)
umn_minfeaturesize= self.umn_label.get_minfeaturesize()
- box_minfeaturesizetext = wxBoxSizer(wxHORIZONTAL)
- self.text_minfeaturesize = wxSpinCtrl(self, -1,
+ box_minfeaturesizetext = wx.BoxSizer(wx.HORIZONTAL)
+ self.text_minfeaturesize = wx.SpinCtrl(self, -1,
value=str(umn_minfeaturesize), max=10, min=-1,
- name='minfeaturesize', style=wxSP_ARROW_KEYS)
- box_minfeaturesizetext.Add(self.text_minfeaturesize, 2, wxALL, 2)
+ name='minfeaturesize', style=wx.SP_ARROW_KEYS)
+ box_minfeaturesizetext.Add(self.text_minfeaturesize, 2, wx.ALL, 2)
box_minfeaturesize.Add(box_minfeaturesizetext, 0,
- wxALIGN_RIGHT | wxALL, 2)
+ wx.ALIGN_RIGHT | wx.ALL, 2)
# mindistance
- mindistance = wxStaticBox(self, 1010, _("Mindistance"), style = 0,
+ mindistance = wx.StaticBox(self, 1010, _("Mindistance"), style = 0,
name = "Mindistance Box", )
- box_mindistance = wxStaticBoxSizer(mindistance, wxVERTICAL)
+ box_mindistance = wx.StaticBoxSizer(mindistance, wx.VERTICAL)
umn_mindistance= self.umn_label.get_mindistance()
- box_mindistancetext = wxBoxSizer(wxHORIZONTAL)
- self.text_mindistance = wxSpinCtrl(self, -1,
+ box_mindistancetext = wx.BoxSizer(wx.HORIZONTAL)
+ self.text_mindistance = wx.SpinCtrl(self, -1,
value=str(umn_mindistance), max=10, min=-1,
- name='mindistance', style=wxSP_ARROW_KEYS)
- box_mindistancetext.Add(self.text_mindistance, 2, wxALL, 2)
+ name='mindistance', style=wx.SP_ARROW_KEYS)
+ box_mindistancetext.Add(self.text_mindistance, 2, wx.ALL, 2)
box_mindistance.Add(box_mindistancetext, 0,
- wxALIGN_RIGHT | wxALL, 2)
+ wx.ALIGN_RIGHT | wx.ALL, 2)
# position
umn_label_position= self.umn_label.get_position(mode="string")
possible_choices = []
for key in label_position_type:
possible_choices.append(label_position_type[key])
- self.choice_position = wxRadioBox(self, -1, choices=possible_choices,
+ self.choice_position = wx.RadioBox(self, -1, choices=possible_choices,
label='Position', majorDimension=1,
name='position check',
- size=wxDefaultSize,
- style=wxRA_SPECIFY_ROWS)
+ size=wx.DefaultSize,
+ style=wx.RA_SPECIFY_ROWS)
self.choice_position.SetStringSelection(umn_label_position)
#buttons
- box_buttons = wxBoxSizer(wxHORIZONTAL)
- button = wxButton(self, wxID_OK, _("OK"))
- box_buttons.Add(button, 0, wxALL, 5)
- button = wxButton(self, wxID_CANCEL, _("Cancel"))
- box_buttons.Add(button, 0, wxALL, 5)
+ box_buttons = wx.BoxSizer(wx.HORIZONTAL)
+ button = wx.Button(self, wx.ID_OK, _("OK"))
+ box_buttons.Add(button, 0, wx.ALL, 5)
+ button = wx.Button(self, wx.ID_CANCEL, _("Cancel"))
+ box_buttons.Add(button, 0, wx.ALL, 5)
#set the button funcitons
- 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)
# compose the Dialog
- top = wxBoxSizer(wxVERTICAL)
+ top = wx.BoxSizer(wx.VERTICAL)
- top1 = wxBoxSizer(wxHORIZONTAL)
- top1.Add(box_labelsize,0, wxEXPAND |wxALL, 5)
- top1.Add(box_color,0, wxEXPAND |wxALL, 5)
- top1.Add(box_minfeaturesize,0, wxEXPAND |wxALL, 5)
+ top1 = wx.BoxSizer(wx.HORIZONTAL)
+ top1.Add(box_labelsize,0, wx.EXPAND |wx.ALL, 5)
+ top1.Add(box_color,0, wx.EXPAND |wx.ALL, 5)
+ top1.Add(box_minfeaturesize,0, wx.EXPAND |wx.ALL, 5)
- top2 = wxBoxSizer(wxHORIZONTAL)
- top2.Add(box_type,0,wxEXPAND |wxALL, 5)
- top2.Add(box_offset,0, wxEXPAND |wxALL, 5)
- top2.Add(box_mindistance,0, wxEXPAND |wxALL, 5)
+ top2 = wx.BoxSizer(wx.HORIZONTAL)
+ top2.Add(box_type,0,wx.EXPAND |wx.ALL, 5)
+ top2.Add(box_offset,0, wx.EXPAND |wx.ALL, 5)
+ top2.Add(box_mindistance,0, wx.EXPAND |wx.ALL, 5)
- top3 = wxBoxSizer(wxHORIZONTAL)
- top3.Add(self.choice_partials,0, wxEXPAND |wxALL, 5)
- top3.Add(box_buffer,0, wxEXPAND |wxALL, 5)
- top3.Add(self.choice_force,0, wxEXPAND |wxALL, 5)
+ top3 = wx.BoxSizer(wx.HORIZONTAL)
+ top3.Add(self.choice_partials,0, wx.EXPAND |wx.ALL, 5)
+ top3.Add(box_buffer,0, wx.EXPAND |wx.ALL, 5)
+ top3.Add(self.choice_force,0, wx.EXPAND |wx.ALL, 5)
- top.Add(top1, 0, wxEXPAND)
- top.Add(top2, 0, wxEXPAND)
- top.Add(top3, 0, wxEXPAND)
- top.Add(self.choice_position,0, wxEXPAND |wxALL, 5)
- top.Add(box_buttons, 0, wxALIGN_RIGHT)
+ top.Add(top1, 0, wx.EXPAND)
+ top.Add(top2, 0, wx.EXPAND)
+ top.Add(top3, 0, wx.EXPAND)
+ top.Add(self.choice_position,0, wx.EXPAND |wx.ALL, 5)
+ top.Add(box_buttons, 0, wx.ALIGN_RIGHT)
# final layout settings
self.SetSizer(top)
@@ -787,14 +786,14 @@
dialog = ColorDialog(self)
dialog.SetColor(cur)
self.retcolor = None
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
self.retcolor = dialog.GetColor()
dialog.Destroy()
if self.retcolor:
self.redcolor = int(round(self.retcolor.red*255))
self.greencolor = int(round(self.retcolor.green*255))
self.bluecolor = int(round(self.retcolor.blue*255))
- self.previewcolor.SetBackgroundColour(wxColour(int(self.redcolor),
+ self.previewcolor.SetBackgroundColour(wx.Colour(int(self.redcolor),
int(self.greencolor),
int(self.bluecolor)))
# refresh the colorbox to show the new color
@@ -807,9 +806,9 @@
def end_dialog(self, result):
self.result = result
if self.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):
@@ -838,79 +837,79 @@
def OnCancel(self, event):
self.end_dialog(None)
-class Scalebar_Dialog(wxDialog):
+class Scalebar_Dialog(wx.Dialog):
def __init__(self, parent, ID, title,
- pos=wxDefaultPosition, size=wxDefaultSize,
- style=wxDEFAULT_DIALOG_STYLE):
+ pos=wx.DefaultPosition, size=wx.DefaultSize,
+ style=wx.DEFAULT_DIALOG_STYLE):
# initialize the Dialog
- wxDialog.__init__(self, parent, ID, title, pos, size, style)
+ wx.Dialog.__init__(self, parent, ID, title, pos, size, style)
# get the web object
self.tb_map = parent.canvas.Map()
self.umn_scalebar = self.tb_map.extension_umn_mapobj.get_scalebar()
# color chooser
- box_colorStatic = wxStaticBox(self, 1011, _("Color"), style = 0,
+ box_colorStatic = wx.StaticBox(self, 1011, _("Color"), style = 0,
name = "color")
- box_color = wxStaticBoxSizer(box_colorStatic, wxVERTICAL)
+ box_color = wx.StaticBoxSizer(box_colorStatic, wx.VERTICAL)
# preview box
- self.previewcolor = wxPanel(self, 99, name = 'colorPanel',
- style = wxSIMPLE_BORDER | wxCLIP_CHILDREN)
+ self.previewcolor = wx.Panel(self, 99, name = 'colorPanel',
+ style = wx.SIMPLE_BORDER | wx.CLIP_CHILDREN)
color = self.umn_scalebar.get_color()
- self.previewcolor.SetBackgroundColour(wxColour(color.get_red(),
+ self.previewcolor.SetBackgroundColour(wx.Colour(color.get_red(),
color.get_green(), color.get_blue()))
- box_color.Add(self.previewcolor, 1, wxGROW | wxALL, 5)
+ box_color.Add(self.previewcolor, 1, wx.GROW | wx.ALL, 5)
# color change button, opens a new color dialog
- button = wxButton(self, ID_COLOR_CHANGE, _("Change Color"))
+ button = wx.Button(self, ID_COLOR_CHANGE, _("Change Color"))
button.SetFocus()
EVT_BUTTON(self, ID_COLOR_CHANGE, self.OnChangeColor)
- box_color.Add(button, 1, wxEXPAND|wxALL, 5)
+ box_color.Add(button, 1, wx.EXPAND|wx.ALL, 5)
# show the two color chooser horizontal
- colorHor = wxBoxSizer(wxHORIZONTAL)
- colorHor.Add(box_color,0, wxEXPAND |wxALL, 5)
+ colorHor = wx.BoxSizer(wx.HORIZONTAL)
+ colorHor.Add(box_color,0, wx.EXPAND |wx.ALL, 5)
# imagecolor chooser
- box_imgcolorStatic = wxStaticBox(self, 1011, _("Image Color"),
+ box_imgcolorStatic = wx.StaticBox(self, 1011, _("Image Color"),
style = 0, name = "imgcolor")
- box_imgcolor = wxStaticBoxSizer(box_imgcolorStatic, wxVERTICAL)
+ box_imgcolor = wx.StaticBoxSizer(box_imgcolorStatic, wx.VERTICAL)
# preview box
- self.previewimgcolor = wxPanel(self, 99, name = 'colorPanel',
- style = wxSIMPLE_BORDER|wxCLIP_CHILDREN)
+ self.previewimgcolor = wx.Panel(self, 99, name = 'colorPanel',
+ style = wx.SIMPLE_BORDER|wx.CLIP_CHILDREN)
color = self.umn_scalebar.get_imagecolor()
- self.previewimgcolor.SetBackgroundColour(wxColour(color.get_red(),
+ self.previewimgcolor.SetBackgroundColour(wx.Colour(color.get_red(),
color.get_green(), color.get_blue()))
- box_imgcolor.Add(self.previewimgcolor, 1, wxGROW | wxALL, 5)
+ box_imgcolor.Add(self.previewimgcolor, 1, wx.GROW | wx.ALL, 5)
# color change button, opens a new color dialog
- button = wxButton(self, ID_IMGCOLOR_CHANGE, _("Change ImageColor"))
+ button = wx.Button(self, ID_IMGCOLOR_CHANGE, _("Change ImageColor"))
button.SetFocus()
EVT_BUTTON(self, ID_IMGCOLOR_CHANGE, self.OnChangeImageColor)
- box_imgcolor.Add(button, 1, wxEXPAND|wxALL, 5)
- colorHor.Add(box_imgcolor,0, wxEXPAND |wxALL, 5)
+ box_imgcolor.Add(button, 1, wx.EXPAND|wx.ALL, 5)
+ colorHor.Add(box_imgcolor,0, wx.EXPAND |wx.ALL, 5)
# create the intervals
- intervalsStatic = wxStaticBox(self, 1010, _("Intervals"), style = 0,
+ intervalsStatic = wx.StaticBox(self, 1010, _("Intervals"), style = 0,
name = "Intervals Box", )
- box_intervals = wxStaticBoxSizer(intervalsStatic, wxVERTICAL)
+ box_intervals = wx.StaticBoxSizer(intervalsStatic, wx.VERTICAL)
umn_scalebar_intervals = self.umn_scalebar.get_intervals()
- self.text_intervals = wxSpinCtrl(self, -1,
+ self.text_intervals = wx.SpinCtrl(self, -1,
value=str(umn_scalebar_intervals), max=100, min=0,
- name='intervals', style=wxSP_ARROW_KEYS)
- box_intervals.Add(self.text_intervals, 0, wxALIGN_RIGHT | wxALL, 2)
- hori2 = wxBoxSizer(wxHORIZONTAL)
- hori2.Add(box_intervals,0, wxEXPAND |wxALL, 5)
+ name='intervals', style=wx.SP_ARROW_KEYS)
+ box_intervals.Add(self.text_intervals, 0, wx.ALIGN_RIGHT | wx.ALL, 2)
+ hori2 = wx.BoxSizer(wx.HORIZONTAL)
+ hori2.Add(box_intervals,0, wx.EXPAND |wx.ALL, 5)
#style
umn_scalebar_style= self.umn_scalebar.get_style()
possible_choices = []
for key in scalebar_style_type:
possible_choices.append(scalebar_style_type[key])
- self.choice_style = wxRadioBox(self, -1, choices=possible_choices,
+ self.choice_style = wx.RadioBox(self, -1, choices=possible_choices,
label='Style', majorDimension=1,
- name='style check', size=wxDefaultSize, style=wxRA_SPECIFY_ROWS)
+ name='style check', size=wx.DefaultSize, style=wx.RA_SPECIFY_ROWS)
self.choice_style.SetSelection(umn_scalebar_style)
- hori2.Add(self.choice_style, 1, wxEXPAND|wxALL, 5)
+ hori2.Add(self.choice_style, 1, wx.EXPAND|wx.ALL, 5)
#create size settings
try:
@@ -918,30 +917,30 @@
except:
insidetxt = (0,0)
# create the Size Box
- staticSize = wxStaticBox(self, -1, _("Size"), style = 0,
+ staticSize = wx.StaticBox(self, -1, _("Size"), style = 0,
name="sizeBox")
- box_size = wxStaticBoxSizer(staticSize, wxHORIZONTAL)
+ box_size = wx.StaticBoxSizer(staticSize, wx.HORIZONTAL)
- box_sizepartWidth = wxBoxSizer(wxHORIZONTAL)
- box_sizepartWidth.Add(wxStaticText(self, -1, _("Width: ")), 0, wxALL, 4)
- self.text_width = wxTextCtrl(self, -1, str(insidetxt[0]))
- box_sizepartWidth.Add(self.text_width, 2, wxALL, 4)
- box_size.Add(box_sizepartWidth, 0, wxALIGN_RIGHT | wxALL, 5)
- box_sizepartHeight = wxBoxSizer(wxHORIZONTAL)
- box_sizepartHeight.Add(wxStaticText(self, -1, _("Height: ")), 0,
- wxALL, 4)
- self.text_height = wxTextCtrl(self, -1, str(insidetxt[1]))
- box_sizepartHeight.Add(self.text_height, 2, wxALL, 4)
- box_size.Add(box_sizepartHeight, 0, wxALIGN_RIGHT | wxALL, 5)
+ box_sizepartWidth = wx.BoxSizer(wx.HORIZONTAL)
+ box_sizepartWidth.Add(wx.StaticText(self, -1, _("Width: ")), 0, wx.ALL, 4)
+ self.text_width = wx.TextCtrl(self, -1, str(insidetxt[0]))
+ box_sizepartWidth.Add(self.text_width, 2, wx.ALL, 4)
+ box_size.Add(box_sizepartWidth, 0, wx.ALIGN_RIGHT | wx.ALL, 5)
+ box_sizepartHeight = wx.BoxSizer(wx.HORIZONTAL)
+ box_sizepartHeight.Add(wx.StaticText(self, -1, _("Height: ")), 0,
+ wx.ALL, 4)
+ self.text_height = wx.TextCtrl(self, -1, str(insidetxt[1]))
+ box_sizepartHeight.Add(self.text_height, 2, wx.ALL, 4)
+ box_size.Add(box_sizepartHeight, 0, wx.ALIGN_RIGHT | wx.ALL, 5)
# status
umn_scalebar_status= self.umn_scalebar.get_status(mode="string")
possible_choices = []
for key in legend_status_type:
possible_choices.append(scalebar_status_type[key])
- self.choice_status = wxRadioBox(self, -1, choices=possible_choices,
+ self.choice_status = wx.RadioBox(self, -1, choices=possible_choices,
label='Status', majorDimension=1,
- name='status check', size=wxDefaultSize, style=wxRA_SPECIFY_ROWS)
+ name='status check', size=wx.DefaultSize, style=wx.RA_SPECIFY_ROWS)
self.choice_status.SetStringSelection(umn_scalebar_status)
# position
@@ -949,50 +948,50 @@
possible_choices = []
for key in scalebar_position_type:
possible_choices.append(scalebar_position_type[key])
- self.choice_position = wxRadioBox(self, -1, choices=possible_choices,
+ self.choice_position = wx.RadioBox(self, -1, choices=possible_choices,
label='Position', majorDimension=1,
- name='position check', size=wxDefaultSize,
- style=wxRA_SPECIFY_ROWS)
+ name='position check', size=wx.DefaultSize,
+ style=wx.RA_SPECIFY_ROWS)
self.choice_position.SetStringSelection(umn_scalebar_position)
#get the set unittype
insideunit = self.umn_scalebar .get_units()
#create the Unittype selector
- box_unitsStatic = wxStaticBox(self, -1, _("Unit Type"), style = 0,
+ box_unitsStatic = wx.StaticBox(self, -1, _("Unit Type"), style = 0,
name = "unittype")
- box_units = wxStaticBoxSizer(box_unitsStatic, wxVERTICAL)
+ box_units = wx.StaticBoxSizer(box_unitsStatic, wx.VERTICAL)
sam = []
for key in unit_type:
sam.append(unit_type[key])
- self.choice_units = wxChoice(self, 40, (80, 50), choices = sam)
+ self.choice_units = wx.Choice(self, 40, (80, 50), choices = sam)
self.choice_units.SetStringSelection(insideunit)
- box_units.Add(self.choice_units,0, wxEXPAND, wxALL, 5)
+ box_units.Add(self.choice_units,0, wx.EXPAND, wx.ALL, 5)
# button for label
- labelbutton = wxButton(self, ID_LABEL_CHANGE, _("Change Label"))
+ labelbutton = wx.Button(self, ID_LABEL_CHANGE, _("Change Label"))
EVT_BUTTON(self, ID_LABEL_CHANGE, self.OnChangeLabel)
#buttons
- box_buttons = wxBoxSizer(wxHORIZONTAL)
- button = wxButton(self, wxID_OK, _("OK"))
- box_buttons.Add(button, 0, wxALL, 5)
- button = wxButton(self, wxID_CANCEL, _("Cancel"))
+ box_buttons = wx.BoxSizer(wx.HORIZONTAL)
+ button = wx.Button(self, wx.ID_OK, _("OK"))
+ box_buttons.Add(button, 0, wx.ALL, 5)
+ button = wx.Button(self, wx.ID_CANCEL, _("Cancel"))
button.SetFocus()
- box_buttons.Add(button, 0, wxALL, 5)
+ box_buttons.Add(button, 0, wx.ALL, 5)
#set the button funcitons
- 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)
# compose the dialog
- top = wxBoxSizer(wxVERTICAL)
- top.Add(colorHor,0, wxEXPAND |wxALL, 5)
- top.Add(hori2, 1, wxEXPAND|wxALL, 5)
- top.Add(box_size, 1, wxEXPAND|wxALL, 5)
- top.Add(self.choice_status,0, wxEXPAND |wxALL, 5)
- top.Add(self.choice_position,0, wxEXPAND |wxALL, 5)
- top.Add(box_units, 1, wxEXPAND|wxALL, 5)
- top.Add(labelbutton, 0, wxEXPAND|wxALL, 5)
- top.Add(box_buttons, 0, wxALIGN_RIGHT)
+ top = wx.BoxSizer(wx.VERTICAL)
+ top.Add(colorHor,0, wx.EXPAND |wx.ALL, 5)
+ top.Add(hori2, 1, wx.EXPAND|wx.ALL, 5)
+ top.Add(box_size, 1, wx.EXPAND|wx.ALL, 5)
+ top.Add(self.choice_status,0, wx.EXPAND |wx.ALL, 5)
+ top.Add(self.choice_position,0, wx.EXPAND |wx.ALL, 5)
+ top.Add(box_units, 1, wx.EXPAND|wx.ALL, 5)
+ top.Add(labelbutton, 0, wx.EXPAND|wx.ALL, 5)
+ top.Add(box_buttons, 0, wx.ALIGN_RIGHT)
# final layout settings
self.SetSizer(top)
@@ -1002,11 +1001,11 @@
# set the umn_label for scalebar so the Label_Dialog can be used
self.umn_label = self.umn_scalebar.get_label()
dialog = Label_Dialog(self, -1, "Scalbar Label Settings",
- size=wxSize(350, 200),
- style = wxDEFAULT_DIALOG_STYLE
+ size=wx.Size(350, 200),
+ style = wx.DEFAULT_DIALOG_STYLE
)
dialog.CenterOnScreen()
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
return
dialog.Destroy()
@@ -1015,14 +1014,14 @@
dialog = ColorDialog(self)
dialog.SetColor(cur)
self.retcolor = None
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
self.retcolor = dialog.GetColor()
dialog.Destroy()
if self.retcolor:
self.redcolor = int(round(self.retcolor.red*255))
self.greencolor = int(round(self.retcolor.green*255))
self.bluecolor = int(round(self.retcolor.blue*255))
- self.previewimgcolor.SetBackgroundColour(wxColour(int(self.redcolor),
+ self.previewimgcolor.SetBackgroundColour(wx.Colour(int(self.redcolor),
int(self.greencolor),
int(self.bluecolor)))
# refresh the colorbox to show the new color
@@ -1033,14 +1032,14 @@
dialog = ColorDialog(self)
dialog.SetColor(cur)
self.retcolor = None
- if dialog.ShowModal() == wxID_OK:
+ if dialog.ShowModal() == wx.ID_OK:
self.retcolor = dialog.GetColor()
dialog.Destroy()
if self.retcolor:
self.redcolor = int(round(self.retcolor.red*255))
self.greencolor = int(round(self.retcolor.green*255))
self.bluecolor = int(round(self.retcolor.blue*255))
- self.previewcolor.SetBackgroundColour(wxColour(int(self.redcolor),
+ self.previewcolor.SetBackgroundColour(wx.Colour(int(self.redcolor),
int(self.greencolor),
int(self.bluecolor)))
# refresh the colorbox to show the new color
@@ -1053,9 +1052,9 @@
def end_dialog(self, result):
self.result = result
if self.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):
@@ -1080,25 +1079,25 @@
self.end_dialog(None)
-class Metadata_CustomDataTable(wxPyGridTableBase):
+class Metadata_CustomDataTable(grid.PyGridTableBase):
"""
creates a custum Grid.
- copied from the wx demo.
+ copied from the wx. demo.
"""
def __init__(self, data):
- wxPyGridTableBase.__init__(self)
+ gridPyGridTableBase.__init__(self)
self.colLabels = ['ID', 'Description']
- self.dataTypes = [wxGRID_VALUE_STRING,
- wxGRID_VALUE_STRING
+ self.dataTypes = [wx.GRID_VALUE_STRING,
+ wx.GRID_VALUE_STRING
]
if data:
self.data = data
else:
self.data = [["",""]] #--------------------------------------------------
- # required methods for the wxPyGridTableBase interface
+ # required methods for the grid.PyGridTableBase interface
def GetNumberRows(self):
return len(self.data) + 1
@@ -1132,8 +1131,8 @@
self.SetValue(row, col, value)
# tell the grid we've added a row
- msg = wxGridTableMessage(self, # The table
- wxGRIDTABLE_NOTIFY_ROWS_APPENDED, # what we did to it
+ msg = grid.GridTableMessage(self, # The table
+ wx.GRIDTABLE_NOTIFY_ROWS_APPENDED, # what we did to it
1) # how many
self.GetView().ProcessTableMessage(msg)
@@ -1165,9 +1164,9 @@
return self.CanGetValueAs(row, col, typeName)
-class Metadata_TableGrid(wxGrid):
+class Metadata_TableGrid(grid.Grid):
def __init__(self, parent, data):
- wxGrid.__init__(self, parent, -1)
+ grid.Grid.__init__(self, parent, -1)
self.table = Metadata_CustomDataTable(data)
@@ -1194,14 +1193,14 @@
self.EnableCellEditControl()
-class Metadata_Dialog(wxDialog):
+class Metadata_Dialog(wx.Dialog):
def __init__(self, parent, ID, title,
- pos=wxDefaultPosition, size=wxDefaultSize,
- style=wxDEFAULT_DIALOG_STYLE):
+ pos=wx.DefaultPosition, size=wx.DefaultSize,
+ style=wx.DEFAULT_DIALOG_STYLE):
# initialize the Dialog
- wxDialog.__init__(self, parent, ID, title, pos, size, style)
+ wx.Dialog.__init__(self, parent, ID, title, pos, size, style)
# get the web object
if hasattr(parent,"umn_metadata"):
@@ -1215,20 +1214,20 @@
self.grid = Metadata_TableGrid(self, self.umn_metadata.get_metadata())
#buttons
- box_buttons = wxBoxSizer(wxHORIZONTAL)
- button = wxButton(self, wxID_OK, _("OK"))
- box_buttons.Add(button, 0, wxALL, 5)
- button = wxButton(self, wxID_CANCEL, _("Cancel"))
+ box_buttons = wx.BoxSizer(wx.HORIZONTAL)
+ button = wx.Button(self, wx.ID_OK, _("OK"))
+ box_buttons.Add(button, 0, wx.ALL, 5)
+ button = wx.Button(self, wx.ID_CANCEL, _("Cancel"))
button.SetFocus()
- box_buttons.Add(button, 0, wxALL, 5)
+ box_buttons.Add(button, 0, wx.ALL, 5)
#set the button funcitons
- 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)
# compose the dialog
- top = wxBoxSizer(wxVERTICAL)
- top.Add(self.grid, 1, wxGROW|wxALL, 5)
- top.Add(box_buttons, 0, wxALIGN_RIGHT)
+ top = wx.BoxSizer(wx.VERTICAL)
+ top.Add(self.grid, 1, wx.GROW|wx.ALL, 5)
+ top.Add(box_buttons, 0, wx.ALIGN_RIGHT)
# final layout settings
self.SetSizer(top)
@@ -1252,9 +1251,9 @@
def end_dialog(self, result):
self.result = result
if self.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):
@@ -1277,51 +1276,51 @@
def metadatasettings(context):
win = Metadata_Dialog(context.mainwindow, -1, "Metadata Settings",
- size=wxSize(450, 250),
- style = wxDEFAULT_DIALOG_STYLE)
+ size=wx.Size(450, 250),
+ style = wx.DEFAULT_DIALOG_STYLE)
win.CenterOnScreen()
val = win.ShowModal()
def scalebarsettings(context):
win = Scalebar_Dialog(context.mainwindow, -1, "Scalebar Settings",
- size=wxSize(350, 200),
- style = wxDEFAULT_DIALOG_STYLE)
+ size=wx.Size(350, 200),
+ style = wx.DEFAULT_DIALOG_STYLE)
win.CenterOnScreen()
val = win.ShowModal()
def mapsettings(context):
win = Map_Dialog(context.mainwindow, -1, "Map Settings",
- size=wxSize(350, 200),
- style = wxDEFAULT_DIALOG_STYLE)
+ size=wx.Size(350, 200),
+ style = wx.DEFAULT_DIALOG_STYLE)
win.CenterOnScreen()
val = win.ShowModal()
def outputformatsettings(context):
win = OutputFormat_Dialog(context.mainwindow, -1, "OutputFormat Settings",
- size=wxSize(350, 200),
- style = wxDEFAULT_DIALOG_STYLE)
+ size=wx.Size(350, 200),
+ style = wx.DEFAULT_DIALOG_STYLE)
win.CenterOnScreen()
val = win.ShowModal()
def websettings(context):
win = Web_Dialog(context.mainwindow, -1, "Web Settings",
- size=wxSize(350, 200),
- style = wxDEFAULT_DIALOG_STYLE)
+ size=wx.Size(350, 200),
+ style = wx.DEFAULT_DIALOG_STYLE)
win.CenterOnScreen()
val = win.ShowModal()
def layersettings(context):
win = Layer_Dialog(context.mainwindow, -1, "Layer Settings",
- size=wxSize(350, 200),
- style = wxDEFAULT_DIALOG_STYLE)
+ size=wx.Size(350, 200),
+ style = wx.DEFAULT_DIALOG_STYLE)
win.CenterOnScreen()
val = win.ShowModal()
def legendsettings(context):
win = Legend_Dialog(context.mainwindow, -1, "Legend Settings",
- size=wxSize(350, 200),
- style = wxDEFAULT_DIALOG_STYLE)
+ size=wx.Size(350, 200),
+ style = wx.DEFAULT_DIALOG_STYLE)
win.CenterOnScreen()
val = win.ShowModal()
Modified: trunk/thuban/Extensions/umn_mapserver/mf_import.py
===================================================================
--- trunk/thuban/Extensions/umn_mapserver/mf_import.py 2007-01-05 23:43:49 UTC (rev 2718)
+++ trunk/thuban/Extensions/umn_mapserver/mf_import.py 2007-01-08 16:30:29 UTC (rev 2719)
@@ -27,11 +27,8 @@
from mapscript import mapObj
-from wxPython.wx import wxFileDialog, \
- wxOPEN, wxOVERWRITE_PROMPT, wxID_OK
+import wx
-from wxPython.lib.dialogs import wxMultipleChoiceDialog
-
# use _() already now for all strings that may later be translated
from Thuban import _
@@ -47,7 +44,7 @@
from Thuban.Model.proj import Projection
# needed to add the new menu
-from Thuban.UI.mainwindow import main_menu, wxID_CANCEL
+from Thuban.UI.mainwindow import main_menu
from Thuban.Model.classification import ClassGroupSingleton, \
ClassGroupRange, \
@@ -513,12 +510,12 @@
dlgsize = (300,130+len(lst)*20)
if dlgsize[1] >= 300:
dlgsize = (300,300)
- dlg = wxMultipleChoiceDialog(context.mainwindow,
+ dlg = wx.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() == wxID_OK):
+ if (dlg.ShowModal() == wx.ID_OK):
selectedlayer = dlg.GetValue()
return selectedlayer
@@ -527,12 +524,12 @@
Import only the layers which are selectes from a mapfile
"""
# open a dialog to select the mapfile to import
- dlg = wxFileDialog(context.mainwindow,
+ dlg = wx.FileDialog(context.mainwindow,
_("Select MapFile file"), ".", "",
_("UMN MapServer Mapfiles (*.map)|*.map|") +
_("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:
@@ -561,12 +558,12 @@
import layers from a mapfile
"""
# open a dialog to select the mapfile to import from
- dlg = wxFileDialog(context.mainwindow,
+ dlg = wx.FileDialog(context.mainwindow,
_("Select MapFile file"), ".", "",
_("UMN MapServer Mapfiles (*.map)|*.map|") +
_("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:
@@ -622,17 +619,17 @@
context - the thuban context
"""
# create a new session befor a mapfile is imported
- if context.mainwindow.save_modified_session() != wxID_CANCEL:
+ if context.mainwindow.save_modified_session() != wx.ID_CANCEL:
context.application.SetSession(mainwindow.create_empty_session())
# context.mainwindow.NewSession()
# open a dialog to select the mapfile to import
- dlg = wxFileDialog(context.mainwindow,
+ dlg = wx.FileDialog(context.mainwindow,
_("Select MapFile file"), ".", "",
_("UMN MapServer Mapfiles (*.map)|*.map|") +
_("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:
More information about the Thuban-commits
mailing list