Prechádzať zdrojové kódy

experimental GSoC 2018 Python 3 support by Sanjeet Bhatti

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@73229 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 6 rokov pred
rodič
commit
7e1945f230
100 zmenil súbory, kde vykonal 2215 pridanie a 1994 odobranie
  1. 1 1
      gui/wxpython/animation/anim.py
  2. 80 79
      gui/wxpython/animation/dialogs.py
  3. 10 7
      gui/wxpython/animation/frame.py
  4. 5 5
      gui/wxpython/animation/mapwindow.py
  5. 2 1
      gui/wxpython/animation/provider.py
  6. 8 5
      gui/wxpython/animation/utils.py
  7. 16 16
      gui/wxpython/core/gcmd.py
  8. 6 1
      gui/wxpython/core/gconsole.py
  9. 5 1
      gui/wxpython/core/gthread.py
  10. 3 3
      gui/wxpython/core/render.py
  11. 6 6
      gui/wxpython/core/settings.py
  12. 5 5
      gui/wxpython/core/toolboxes.py
  13. 2 1
      gui/wxpython/core/treemodel.py
  14. 2 1
      gui/wxpython/core/units.py
  15. 10 4
      gui/wxpython/core/utils.py
  16. 16 15
      gui/wxpython/core/workspace.py
  17. 3 2
      gui/wxpython/core/ws.py
  18. 15 14
      gui/wxpython/datacatalog/dialogs.py
  19. 3 2
      gui/wxpython/datacatalog/frame.py
  20. 3 2
      gui/wxpython/datacatalog/toolbars.py
  21. 2 2
      gui/wxpython/datacatalog/tree.py
  22. 98 91
      gui/wxpython/dbmgr/base.py
  23. 32 30
      gui/wxpython/dbmgr/dialogs.py
  24. 35 34
      gui/wxpython/dbmgr/sqlbuilder.py
  25. 22 17
      gui/wxpython/dbmgr/vinfo.py
  26. 57 53
      gui/wxpython/gcp/manager.py
  27. 3 2
      gui/wxpython/gcp/mapdisplay.py
  28. 11 8
      gui/wxpython/gis_set.py
  29. 51 48
      gui/wxpython/gmodeler/dialogs.py
  30. 41 40
      gui/wxpython/gmodeler/frame.py
  31. 12 10
      gui/wxpython/gmodeler/model.py
  32. 77 76
      gui/wxpython/gmodeler/preferences.py
  33. 106 101
      gui/wxpython/gui_core/dialogs.py
  34. 44 39
      gui/wxpython/gui_core/forms.py
  35. 68 66
      gui/wxpython/gui_core/ghelp.py
  36. 7 6
      gui/wxpython/gui_core/goutput.py
  37. 51 49
      gui/wxpython/gui_core/gselect.py
  38. 2 1
      gui/wxpython/gui_core/mapdisp.py
  39. 3 3
      gui/wxpython/gui_core/menu.py
  40. 87 86
      gui/wxpython/gui_core/preferences.py
  41. 4 1
      gui/wxpython/gui_core/pyedit.py
  42. 8 6
      gui/wxpython/gui_core/query.py
  43. 3 2
      gui/wxpython/gui_core/simplelmgr.py
  44. 3 3
      gui/wxpython/gui_core/toolbars.py
  45. 2 1
      gui/wxpython/gui_core/treeview.py
  46. 2 1
      gui/wxpython/gui_core/vselect.py
  47. 11 9
      gui/wxpython/gui_core/widgets.py
  48. 69 0
      gui/wxpython/gui_core/wrap.py
  49. 7 5
      gui/wxpython/gui_core/wxlibplot.py
  50. 27 25
      gui/wxpython/iclass/dialogs.py
  51. 5 3
      gui/wxpython/iclass/frame.py
  52. 2 1
      gui/wxpython/iclass/statistics.py
  53. 2 1
      gui/wxpython/iclass/toolbars.py
  54. 6 4
      gui/wxpython/icons/icon.py
  55. 8 8
      gui/wxpython/image2target/ii2t_gis_set.py
  56. 57 55
      gui/wxpython/image2target/ii2t_manager.py
  57. 3 2
      gui/wxpython/image2target/ii2t_mapdisplay.py
  58. 8 7
      gui/wxpython/iscatt/controllers.py
  59. 6 5
      gui/wxpython/iscatt/core_c.py
  60. 30 28
      gui/wxpython/iscatt/dialogs.py
  61. 6 4
      gui/wxpython/iscatt/frame.py
  62. 14 13
      gui/wxpython/iscatt/iscatt_core.py
  63. 5 3
      gui/wxpython/iscatt/plots.py
  64. 2 2
      gui/wxpython/lmgr/layertree.py
  65. 9 8
      gui/wxpython/location_wizard/base.py
  66. 15 13
      gui/wxpython/location_wizard/dialogs.py
  67. 24 21
      gui/wxpython/location_wizard/wizard.py
  68. 3 2
      gui/wxpython/mapdisp/frame.py
  69. 2 1
      gui/wxpython/mapdisp/main.py
  70. 7 5
      gui/wxpython/mapdisp/statusbar.py
  71. 3 2
      gui/wxpython/mapdisp/test_mapdisp.py
  72. 12 12
      gui/wxpython/mapswipe/dialogs.py
  73. 1 0
      gui/wxpython/mapswipe/frame.py
  74. 4 3
      gui/wxpython/mapswipe/mapwindow.py
  75. 2 1
      gui/wxpython/mapswipe/toolbars.py
  76. 5 4
      gui/wxpython/mapwin/base.py
  77. 24 23
      gui/wxpython/mapwin/buffered.py
  78. 41 39
      gui/wxpython/modules/colorrules.py
  79. 23 22
      gui/wxpython/modules/extensions.py
  80. 5 5
      gui/wxpython/modules/histogram.py
  81. 5 5
      gui/wxpython/modules/import_export.py
  82. 16 15
      gui/wxpython/modules/mcalc_builder.py
  83. 20 18
      gui/wxpython/modules/vclean.py
  84. 2 1
      gui/wxpython/nviz/mapwindow.py
  85. 67 66
      gui/wxpython/nviz/preferences.py
  86. 225 223
      gui/wxpython/nviz/tools.py
  87. 18 12
      gui/wxpython/nviz/workspace.py
  88. 36 34
      gui/wxpython/photo2image/ip2i_manager.py
  89. 3 2
      gui/wxpython/photo2image/ip2i_mapdisplay.py
  90. 184 183
      gui/wxpython/psmap/dialogs.py
  91. 32 29
      gui/wxpython/psmap/frame.py
  92. 3 2
      gui/wxpython/psmap/instructions.py
  93. 7 8
      gui/wxpython/psmap/utils.py
  94. 6 5
      gui/wxpython/rdigit/dialogs.py
  95. 5 4
      gui/wxpython/rdigit/toolbars.py
  96. 17 16
      gui/wxpython/rlisetup/frame.py
  97. 1 1
      gui/wxpython/rlisetup/sampling_frame.py
  98. 85 84
      gui/wxpython/rlisetup/wizard.py
  99. 3 3
      gui/wxpython/startup/locdownload.py
  100. 0 0
      gui/wxpython/timeline/frame.py

+ 1 - 1
gui/wxpython/animation/anim.py

@@ -15,7 +15,7 @@ This program is free software under the GNU General Public License
 """
 """
 
 
 import wx
 import wx
-from utils import Orientation, ReplayMode
+from .utils import Orientation, ReplayMode
 from core.utils import _
 from core.utils import _
 
 
 
 

+ 80 - 79
gui/wxpython/animation/dialogs.py

@@ -39,7 +39,8 @@ from core.settings import UserSettings
 from core.utils import _
 from core.utils import _
 from gui_core.gselect import Select
 from gui_core.gselect import Select
 from gui_core.widgets import FloatValidator
 from gui_core.widgets import FloatValidator
-from gui_core.wrap import SpinCtrl
+from gui_core.wrap import SpinCtrl, CheckBox, TextCtrl, Button, \
+    BitmapButton, StaticText, StaticBox, Choice, RadioButton
 
 
 from animation.utils import TemporalMode, getRegisteredMaps, getNameAndLayer, getCpuCount
 from animation.utils import TemporalMode, getRegisteredMaps, getNameAndLayer, getCpuCount
 from animation.data import AnimationData, AnimLayer
 from animation.data import AnimationData, AnimLayer
@@ -99,14 +100,14 @@ class SpeedDialog(wx.Dialog):
         #
         #
         # simple mode
         # simple mode
         #
         #
-        self.nontemporalBox = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                                           label=' %s ' % _("Simple mode"))
+        self.nontemporalBox = StaticBox(parent=self, id=wx.ID_ANY,
+                                        label=' %s ' % _("Simple mode"))
         box = wx.StaticBoxSizer(self.nontemporalBox, wx.VERTICAL)
         box = wx.StaticBoxSizer(self.nontemporalBox, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(hgap=5, vgap=5)
         gridSizer = wx.GridBagSizer(hgap=5, vgap=5)
 
 
-        labelDuration = wx.StaticText(
+        labelDuration = StaticText(
             self, id=wx.ID_ANY, label=_("Frame duration:"))
             self, id=wx.ID_ANY, label=_("Frame duration:"))
-        labelUnits = wx.StaticText(self, id=wx.ID_ANY, label=_("ms"))
+        labelUnits = StaticText(self, id=wx.ID_ANY, label=_("ms"))
         self.spinDuration = SpinCtrl(
         self.spinDuration = SpinCtrl(
             self,
             self,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
@@ -138,16 +139,16 @@ class SpeedDialog(wx.Dialog):
         #
         #
         # temporal mode
         # temporal mode
         #
         #
-        self.temporalBox = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                                        label=' %s ' % _("Temporal mode"))
+        self.temporalBox = StaticBox(parent=self, id=wx.ID_ANY,
+                                     label=' %s ' % _("Temporal mode"))
         box = wx.StaticBoxSizer(self.temporalBox, wx.VERTICAL)
         box = wx.StaticBoxSizer(self.temporalBox, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(hgap=5, vgap=5)
         gridSizer = wx.GridBagSizer(hgap=5, vgap=5)
 
 
-        labelTimeUnit = wx.StaticText(
+        labelTimeUnit = StaticText(
             self, id=wx.ID_ANY, label=_("Time unit:"))
             self, id=wx.ID_ANY, label=_("Time unit:"))
-        labelDuration = wx.StaticText(
+        labelDuration = StaticText(
             self, id=wx.ID_ANY, label=_("Duration of time unit:"))
             self, id=wx.ID_ANY, label=_("Duration of time unit:"))
-        labelUnits = wx.StaticText(self, id=wx.ID_ANY, label=_("ms"))
+        labelUnits = StaticText(self, id=wx.ID_ANY, label=_("ms"))
         self.spinDurationTemp = SpinCtrl(
         self.spinDurationTemp = SpinCtrl(
             self, id=wx.ID_ANY, min=self.minimumDuration, max=10000,
             self, id=wx.ID_ANY, min=self.minimumDuration, max=10000,
             initial=self.defaultSpeed)
             initial=self.defaultSpeed)
@@ -183,9 +184,9 @@ class SpeedDialog(wx.Dialog):
             flag=wx.EXPAND | wx.ALL,
             flag=wx.EXPAND | wx.ALL,
             border=5)
             border=5)
 
 
-        self.btnOk = wx.Button(self, wx.ID_OK)
-        self.btnApply = wx.Button(self, wx.ID_APPLY)
-        self.btnCancel = wx.Button(self, wx.ID_CANCEL)
+        self.btnOk = Button(self, wx.ID_OK)
+        self.btnApply = Button(self, wx.ID_APPLY)
+        self.btnCancel = Button(self, wx.ID_CANCEL)
         self.btnOk.SetDefault()
         self.btnOk.SetDefault()
 
 
         self.btnOk.Bind(wx.EVT_BUTTON, self.OnOk)
         self.btnOk.Bind(wx.EVT_BUTTON, self.OnOk)
@@ -352,8 +353,8 @@ class InputDialog(wx.Dialog):
             border=3)
             border=3)
 
 
         # buttons
         # buttons
-        self.btnOk = wx.Button(self, wx.ID_OK)
-        self.btnCancel = wx.Button(self, wx.ID_CANCEL)
+        self.btnOk = Button(self, wx.ID_OK)
+        self.btnCancel = Button(self, wx.ID_CANCEL)
         self.btnOk.SetDefault()
         self.btnOk.SetDefault()
         self.btnOk.Bind(wx.EVT_BUTTON, self.OnOk)
         self.btnOk.Bind(wx.EVT_BUTTON, self.OnOk)
         # button sizer
         # button sizer
@@ -381,10 +382,10 @@ class InputDialog(wx.Dialog):
                 _("bottom right")])
                 _("bottom right")])
         self.windowChoice.SetSelection(self.animationData.windowIndex)
         self.windowChoice.SetSelection(self.animationData.windowIndex)
 
 
-        self.nameCtrl = wx.TextCtrl(
+        self.nameCtrl = TextCtrl(
             panel, id=wx.ID_ANY, value=self.animationData.name)
             panel, id=wx.ID_ANY, value=self.animationData.name)
 
 
-        self.nDChoice = wx.Choice(panel, id=wx.ID_ANY)
+        self.nDChoice = Choice(panel, id=wx.ID_ANY)
         mode = self.animationData.viewMode
         mode = self.animationData.viewMode
         index = 0
         index = 0
         for i, (viewMode, viewModeName) in enumerate(
         for i, (viewMode, viewModeName) in enumerate(
@@ -394,19 +395,19 @@ class InputDialog(wx.Dialog):
                 index = i
                 index = i
 
 
         self.nDChoice.SetSelection(index)
         self.nDChoice.SetSelection(index)
-        self.nDChoice.SetToolTipString(_("Select 2D or 3D view"))
+        self.nDChoice.SetToolTip(_("Select 2D or 3D view"))
         self.nDChoice.Bind(wx.EVT_CHOICE, self.OnViewMode)
         self.nDChoice.Bind(wx.EVT_CHOICE, self.OnViewMode)
 
 
         gridSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5)
         gridSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5)
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 panel,
                 panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Name:")),
                 label=_("Name:")),
             flag=wx.ALIGN_CENTER_VERTICAL)
             flag=wx.ALIGN_CENTER_VERTICAL)
         gridSizer.Add(self.nameCtrl, proportion=1, flag=wx.EXPAND)
         gridSizer.Add(self.nameCtrl, proportion=1, flag=wx.EXPAND)
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 panel,
                 panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Window position:")),
                 label=_("Window position:")),
@@ -416,7 +417,7 @@ class InputDialog(wx.Dialog):
             proportion=1,
             proportion=1,
             flag=wx.ALIGN_RIGHT)
             flag=wx.ALIGN_RIGHT)
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 panel,
                 panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("View mode:")),
                 label=_("View mode:")),
@@ -432,7 +433,7 @@ class InputDialog(wx.Dialog):
         label = _(
         label = _(
             "For 3D animation, please select only one space-time dataset\n"
             "For 3D animation, please select only one space-time dataset\n"
             "or one series of map layers.")
             "or one series of map layers.")
-        self.warning3DLayers = wx.StaticText(panel, label=label)
+        self.warning3DLayers = StaticText(panel, label=label)
         self.warning3DLayers.SetForegroundColour(
         self.warning3DLayers.SetForegroundColour(
             wx.SystemSettings.GetColour(wx.SYS_COLOUR_GRAYTEXT))
             wx.SystemSettings.GetColour(wx.SYS_COLOUR_GRAYTEXT))
         mainSizer.Add(
         mainSizer.Add(
@@ -475,7 +476,7 @@ class InputDialog(wx.Dialog):
 
 
         self.legend = wx.CheckBox(panel, label=_("Show raster legend"))
         self.legend = wx.CheckBox(panel, label=_("Show raster legend"))
         self.legend.SetValue(bool(self.animationData.legendCmd))
         self.legend.SetValue(bool(self.animationData.legendCmd))
-        self.legendBtn = wx.Button(panel, label=_("Set options"))
+        self.legendBtn = Button(panel, label=_("Set options"))
         self.legend.Bind(wx.EVT_CHECKBOX, self.OnLegend)
         self.legend.Bind(wx.EVT_CHECKBOX, self.OnLegend)
         self.legendBtn.Bind(wx.EVT_BUTTON, self.OnLegendProperties)
         self.legendBtn.Bind(wx.EVT_BUTTON, self.OnLegendProperties)
 
 
@@ -495,8 +496,8 @@ class InputDialog(wx.Dialog):
 
 
     def _create3DPanel(self, parent):
     def _create3DPanel(self, parent):
         panel = wx.Panel(parent, id=wx.ID_ANY)
         panel = wx.Panel(parent, id=wx.ID_ANY)
-        dataStBox = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                                 label=' %s ' % _("3D view parameters"))
+        dataStBox = StaticBox(parent=panel, id=wx.ID_ANY,
+                              label=' %s ' % _("3D view parameters"))
         dataBoxSizer = wx.StaticBoxSizer(dataStBox, wx.VERTICAL)
         dataBoxSizer = wx.StaticBoxSizer(dataStBox, wx.VERTICAL)
 
 
         # workspace file
         # workspace file
@@ -514,7 +515,7 @@ class InputDialog(wx.Dialog):
             fileMask="GRASS Workspace File (*.gxw)|*.gxw")
             fileMask="GRASS Workspace File (*.gxw)|*.gxw")
         if self.animationData.workspaceFile:
         if self.animationData.workspaceFile:
             self.fileSelector.SetValue(self.animationData.workspaceFile)
             self.fileSelector.SetValue(self.animationData.workspaceFile)
-        self.paramLabel = wx.StaticText(
+        self.paramLabel = StaticText(
             panel, wx.ID_ANY, label=_("Parameter for animation:"))
             panel, wx.ID_ANY, label=_("Parameter for animation:"))
         self.paramChoice = wx.Choice(
         self.paramChoice = wx.Choice(
             panel, id=wx.ID_ANY, choices=self.animationData.nvizParameters)
             panel, id=wx.ID_ANY, choices=self.animationData.nvizParameters)
@@ -552,13 +553,13 @@ class InputDialog(wx.Dialog):
         panel = wx.Panel(parent=parent)
         panel = wx.Panel(parent=parent)
 
 
         mainSizer = wx.BoxSizer(wx.VERTICAL)
         mainSizer = wx.BoxSizer(wx.VERTICAL)
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel, label=" %s " %
             parent=panel, label=" %s " %
             _("Animate region change (2D view only)"))
             _("Animate region change (2D view only)"))
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
 
 
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
-        gridSizer.Add(wx.StaticText(panel, label=_("Start region:")),
+        gridSizer.Add(StaticText(panel, label=_("Start region:")),
                       pos=(0, 0), flag=wx.ALIGN_CENTER_VERTICAL)
                       pos=(0, 0), flag=wx.ALIGN_CENTER_VERTICAL)
         self.stRegion = Select(parent=panel, type='region', size=(200, -1))
         self.stRegion = Select(parent=panel, type='region', size=(200, -1))
         if self.animationData.startRegion:
         if self.animationData.startRegion:
@@ -567,25 +568,25 @@ class InputDialog(wx.Dialog):
             self.stRegion, pos=(0, 1),
             self.stRegion, pos=(0, 1),
             flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND)
             flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND)
 
 
-        self.endRegRadio = wx.RadioButton(
+        self.endRegRadio = RadioButton(
             panel, label=_("End region:"), style=wx.RB_GROUP)
             panel, label=_("End region:"), style=wx.RB_GROUP)
         gridSizer.Add(self.endRegRadio, pos=(1, 0), flag=wx.EXPAND)
         gridSizer.Add(self.endRegRadio, pos=(1, 0), flag=wx.EXPAND)
         self.endRegion = Select(parent=panel, type='region', size=(200, -1))
         self.endRegion = Select(parent=panel, type='region', size=(200, -1))
         gridSizer.Add(
         gridSizer.Add(
             self.endRegion, pos=(1, 1),
             self.endRegion, pos=(1, 1),
             flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND)
             flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND)
-        self.zoomRadio = wx.RadioButton(panel, label=_("Zoom value:"))
-        self.zoomRadio.SetToolTipString(_("N-S/E-W distances in map units used to "
-                                          "gradually reduce region."))
+        self.zoomRadio = RadioButton(panel, label=_("Zoom value:"))
+        self.zoomRadio.SetToolTip(_("N-S/E-W distances in map units used to "
+                                    "gradually reduce region."))
         gridSizer.Add(self.zoomRadio, pos=(2, 0), flag=wx.EXPAND)
         gridSizer.Add(self.zoomRadio, pos=(2, 0), flag=wx.EXPAND)
 
 
         zoomSizer = wx.BoxSizer(wx.HORIZONTAL)
         zoomSizer = wx.BoxSizer(wx.HORIZONTAL)
-        self.zoomNS = wx.TextCtrl(panel, validator=FloatValidator())
-        self.zoomEW = wx.TextCtrl(panel, validator=FloatValidator())
-        zoomSizer.Add(wx.StaticText(panel, label=_("N-S:")), proportion=0,
+        self.zoomNS = TextCtrl(panel, validator=FloatValidator())
+        self.zoomEW = TextCtrl(panel, validator=FloatValidator())
+        zoomSizer.Add(StaticText(panel, label=_("N-S:")), proportion=0,
                       flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT, border=3)
                       flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT, border=3)
         zoomSizer.Add(self.zoomNS, proportion=1, flag=wx.LEFT, border=3)
         zoomSizer.Add(self.zoomNS, proportion=1, flag=wx.LEFT, border=3)
-        zoomSizer.Add(wx.StaticText(panel, label=_("E-W:")), proportion=0,
+        zoomSizer.Add(StaticText(panel, label=_("E-W:")), proportion=0,
                       flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT, border=3)
                       flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT, border=3)
         zoomSizer.Add(self.zoomEW, proportion=1, flag=wx.LEFT, border=3)
         zoomSizer.Add(self.zoomEW, proportion=1, flag=wx.LEFT, border=3)
         gridSizer.Add(
         gridSizer.Add(
@@ -761,7 +762,7 @@ class EditDialog(wx.Dialog):
 
 
     def _layout(self):
     def _layout(self):
         mainSizer = wx.BoxSizer(wx.VERTICAL)
         mainSizer = wx.BoxSizer(wx.VERTICAL)
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=self,
             parent=self,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=" %s " %
             label=" %s " %
@@ -776,11 +777,11 @@ class EditDialog(wx.Dialog):
             style=wx.LB_SINGLE | wx.LB_NEEDED_SB)
             style=wx.LB_SINGLE | wx.LB_NEEDED_SB)
         self.listbox.Bind(wx.EVT_LISTBOX_DCLICK, self.OnEdit)
         self.listbox.Bind(wx.EVT_LISTBOX_DCLICK, self.OnEdit)
 
 
-        self.addButton = wx.Button(self, id=wx.ID_ANY, label=_("Add"))
+        self.addButton = Button(self, id=wx.ID_ANY, label=_("Add"))
         self.addButton.Bind(wx.EVT_BUTTON, self.OnAdd)
         self.addButton.Bind(wx.EVT_BUTTON, self.OnAdd)
-        self.editButton = wx.Button(self, id=wx.ID_ANY, label=_("Edit"))
+        self.editButton = Button(self, id=wx.ID_ANY, label=_("Edit"))
         self.editButton.Bind(wx.EVT_BUTTON, self.OnEdit)
         self.editButton.Bind(wx.EVT_BUTTON, self.OnEdit)
-        self.removeButton = wx.Button(self, id=wx.ID_ANY, label=_("Remove"))
+        self.removeButton = Button(self, id=wx.ID_ANY, label=_("Remove"))
         self.removeButton.Bind(wx.EVT_BUTTON, self.OnRemove)
         self.removeButton.Bind(wx.EVT_BUTTON, self.OnRemove)
 
 
         self._updateListBox()
         self._updateListBox()
@@ -802,8 +803,8 @@ class EditDialog(wx.Dialog):
                       flag=wx.EXPAND | wx.ALL, border=5)
                       flag=wx.EXPAND | wx.ALL, border=5)
 
 
         # buttons
         # buttons
-        self.btnOk = wx.Button(self, wx.ID_OK)
-        self.btnCancel = wx.Button(self, wx.ID_CANCEL)
+        self.btnOk = Button(self, wx.ID_OK)
+        self.btnCancel = Button(self, wx.ID_CANCEL)
         self.btnOk.SetDefault()
         self.btnOk.SetDefault()
         self.btnOk.Bind(wx.EVT_BUTTON, self.OnOk)
         self.btnOk.Bind(wx.EVT_BUTTON, self.OnOk)
         # button sizer
         # button sizer
@@ -933,9 +934,9 @@ class ExportDialog(wx.Dialog):
         mainSizer.Add(notebook, proportion=0,
         mainSizer.Add(notebook, proportion=0,
                       flag=wx.EXPAND | wx.ALL | wx.ALIGN_RIGHT, border=5)
                       flag=wx.EXPAND | wx.ALL | wx.ALIGN_RIGHT, border=5)
 
 
-        self.btnExport = wx.Button(self, wx.ID_OK)
+        self.btnExport = Button(self, wx.ID_OK)
         self.btnExport.SetLabel(_("Export"))
         self.btnExport.SetLabel(_("Export"))
-        self.btnCancel = wx.Button(self, wx.ID_CANCEL)
+        self.btnCancel = Button(self, wx.ID_CANCEL)
         self.btnExport.SetDefault()
         self.btnExport.SetDefault()
 
 
         self.btnExport.Bind(wx.EVT_BUTTON, self.OnExport)
         self.btnExport.Bind(wx.EVT_BUTTON, self.OnExport)
@@ -993,7 +994,7 @@ class ExportDialog(wx.Dialog):
         for buttonName, buttonLabel in zip(buttonNames, buttonLabels):
         for buttonName, buttonLabel in zip(buttonNames, buttonLabels):
             if buttonName == 'time' and self.temporal == TemporalMode.NONTEMPORAL:
             if buttonName == 'time' and self.temporal == TemporalMode.NONTEMPORAL:
                 continue
                 continue
-            btn = wx.Button(
+            btn = Button(
                 panel,
                 panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 name=buttonName,
                 name=buttonName,
@@ -1012,7 +1013,7 @@ class ExportDialog(wx.Dialog):
                 flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                 flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                 border=0)
                 border=0)
             i += 1
             i += 1
-        removeButton = wx.Button(panel, id=wx.ID_ANY, label=_("Remove"))
+        removeButton = Button(panel, id=wx.ID_ANY, label=_("Remove"))
         removeButton.Bind(wx.EVT_BUTTON, self.OnRemove)
         removeButton.Bind(wx.EVT_BUTTON, self.OnRemove)
         gridBagSizer.Add(
         gridBagSizer.Add(
             removeButton,
             removeButton,
@@ -1034,7 +1035,7 @@ class ExportDialog(wx.Dialog):
         else:
         else:
             label = _("Add image or text decoration by one of the buttons above.")
             label = _("Add image or text decoration by one of the buttons above.")
 
 
-        label = wx.StaticText(panel, id=wx.ID_ANY, label=label)
+        label = StaticText(panel, id=wx.ID_ANY, label=label)
         label.Wrap(400)
         label.Wrap(400)
         self.informBox.Add(
         self.informBox.Add(
             label,
             label,
@@ -1050,18 +1051,18 @@ class ExportDialog(wx.Dialog):
         # font
         # font
         self.fontBox = wx.BoxSizer(wx.HORIZONTAL)
         self.fontBox = wx.BoxSizer(wx.HORIZONTAL)
         self.fontBox.Add(
         self.fontBox.Add(
-            wx.StaticText(
+            StaticText(
                 panel,
                 panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Font settings:")),
                 label=_("Font settings:")),
             proportion=0,
             proportion=0,
             flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT,
             flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT,
             border=5)
             border=5)
-        self.sampleLabel = wx.StaticText(
+        self.sampleLabel = StaticText(
             panel, id=wx.ID_ANY, label=_("Sample text"))
             panel, id=wx.ID_ANY, label=_("Sample text"))
         self.fontBox.Add(self.sampleLabel, proportion=1,
         self.fontBox.Add(self.sampleLabel, proportion=1,
                          flag=wx.ALIGN_CENTER | wx.RIGHT | wx.LEFT, border=5)
                          flag=wx.ALIGN_CENTER | wx.RIGHT | wx.LEFT, border=5)
-        fontButton = wx.Button(panel, id=wx.ID_ANY, label=_("Set font"))
+        fontButton = Button(panel, id=wx.ID_ANY, label=_("Set font"))
         fontButton.Bind(wx.EVT_BUTTON, self.OnFont)
         fontButton.Bind(wx.EVT_BUTTON, self.OnFont)
         self.fontBox.Add(
         self.fontBox.Add(
             fontButton,
             fontButton,
@@ -1092,14 +1093,14 @@ class ExportDialog(wx.Dialog):
         # text
         # text
         self.textBox = wx.BoxSizer(wx.HORIZONTAL)
         self.textBox = wx.BoxSizer(wx.HORIZONTAL)
         self.textBox.Add(
         self.textBox.Add(
-            wx.StaticText(
+            StaticText(
                 panel,
                 panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Text:")),
                 label=_("Text:")),
             proportion=0,
             proportion=0,
             flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT,
             flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT,
             border=5)
             border=5)
-        self.textCtrl = wx.TextCtrl(panel, id=wx.ID_ANY)
+        self.textCtrl = TextCtrl(panel, id=wx.ID_ANY)
         self.textCtrl.Bind(wx.EVT_TEXT, self.OnText)
         self.textCtrl.Bind(wx.EVT_TEXT, self.OnText)
         self.textBox.Add(self.textCtrl, proportion=1, flag=wx.EXPAND)
         self.textBox.Add(self.textCtrl, proportion=1, flag=wx.EXPAND)
         self.hidevbox.Add(self.textBox, proportion=0, flag=wx.EXPAND)
         self.hidevbox.Add(self.textBox, proportion=0, flag=wx.EXPAND)
@@ -1114,7 +1115,7 @@ class ExportDialog(wx.Dialog):
 
 
     def _positionWidget(self, panel):
     def _positionWidget(self, panel):
         grid = wx.GridBagSizer(vgap=5, hgap=5)
         grid = wx.GridBagSizer(vgap=5, hgap=5)
-        label = wx.StaticText(
+        label = StaticText(
             panel, id=wx.ID_ANY, label=_(
             panel, id=wx.ID_ANY, label=_(
                 "Placement as percentage of"
                 "Placement as percentage of"
                 " screen coordinates (X: 0, Y: 0 is top left):"))
                 " screen coordinates (X: 0, Y: 0 is top left):"))
@@ -1137,9 +1138,9 @@ class ExportDialog(wx.Dialog):
                 temp))
                 temp))
 
 
         grid.Add(label, pos=(0, 0), span=(1, 4), flag=wx.EXPAND)
         grid.Add(label, pos=(0, 0), span=(1, 4), flag=wx.EXPAND)
-        grid.Add(wx.StaticText(panel, id=wx.ID_ANY, label=_("X:")), pos=(1, 0),
+        grid.Add(StaticText(panel, id=wx.ID_ANY, label=_("X:")), pos=(1, 0),
                  flag=wx.ALIGN_CENTER_VERTICAL)
                  flag=wx.ALIGN_CENTER_VERTICAL)
-        grid.Add(wx.StaticText(panel, id=wx.ID_ANY, label=_("Y:")), pos=(1, 2),
+        grid.Add(StaticText(panel, id=wx.ID_ANY, label=_("Y:")), pos=(1, 2),
                  flag=wx.ALIGN_CENTER_VERTICAL)
                  flag=wx.ALIGN_CENTER_VERTICAL)
         grid.Add(self.spinX, pos=(1, 1))
         grid.Add(self.spinX, pos=(1, 1))
         grid.Add(self.spinY, pos=(1, 3))
         grid.Add(self.spinY, pos=(1, 3))
@@ -1159,7 +1160,7 @@ class ExportDialog(wx.Dialog):
             lambda event: self.ChangeFormat(
             lambda event: self.ChangeFormat(
                 event.GetSelection()))
                 event.GetSelection()))
         hSizer.Add(
         hSizer.Add(
-            wx.StaticText(
+            StaticText(
                 panel,
                 panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Export to:")),
                 label=_("Export to:")),
@@ -1186,11 +1187,11 @@ class ExportDialog(wx.Dialog):
 
 
         # panel for image sequence
         # panel for image sequence
         imSeqPanel = wx.Panel(parent=panel, id=wx.ID_ANY)
         imSeqPanel = wx.Panel(parent=panel, id=wx.ID_ANY)
-        prefixLabel = wx.StaticText(
+        prefixLabel = StaticText(
             imSeqPanel, id=wx.ID_ANY, label=_("File prefix:"))
             imSeqPanel, id=wx.ID_ANY, label=_("File prefix:"))
-        self.prefixCtrl = wx.TextCtrl(
+        self.prefixCtrl = TextCtrl(
             imSeqPanel, id=wx.ID_ANY, value=_("animation_"))
             imSeqPanel, id=wx.ID_ANY, value=_("animation_"))
-        formatLabel = wx.StaticText(
+        formatLabel = StaticText(
             imSeqPanel, id=wx.ID_ANY, label=_("File format:"))
             imSeqPanel, id=wx.ID_ANY, label=_("File format:"))
         imageTypes = ['PNG', 'JPEG', 'GIF', 'TIFF', 'PPM', 'BMP']
         imageTypes = ['PNG', 'JPEG', 'GIF', 'TIFF', 'PPM', 'BMP']
         self.imSeqFormatChoice = wx.Choice(imSeqPanel, choices=imageTypes)
         self.imSeqFormatChoice = wx.Choice(imSeqPanel, choices=imageTypes)
@@ -1281,7 +1282,7 @@ class ExportDialog(wx.Dialog):
             warning = _(
             warning = _(
                 "Program 'ffmpeg' was not found.\nPlease install it first "
                 "Program 'ffmpeg' was not found.\nPlease install it first "
                 "and make sure\nit's in the PATH variable.")
                 "and make sure\nit's in the PATH variable.")
-            warningLabel = wx.StaticText(parent=aviPanel, label=warning)
+            warningLabel = StaticText(parent=aviPanel, label=warning)
             warningLabel.SetForegroundColour(wx.RED)
             warningLabel.SetForegroundColour(wx.RED)
         self.aviBrowse = filebrowse.FileBrowseButton(
         self.aviBrowse = filebrowse.FileBrowseButton(
             parent=aviPanel,
             parent=aviPanel,
@@ -1292,16 +1293,16 @@ class ExportDialog(wx.Dialog):
             buttonText=_("Browse"),
             buttonText=_("Browse"),
             startDirectory=os.getcwd(),
             startDirectory=os.getcwd(),
             fileMode=wx.FD_SAVE)
             fileMode=wx.FD_SAVE)
-        encodingLabel = wx.StaticText(
+        encodingLabel = StaticText(
             parent=aviPanel,
             parent=aviPanel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_("Video codec:"))
             label=_("Video codec:"))
-        self.encodingText = wx.TextCtrl(
+        self.encodingText = TextCtrl(
             parent=aviPanel, id=wx.ID_ANY, value='mpeg4')
             parent=aviPanel, id=wx.ID_ANY, value='mpeg4')
-        optionsLabel = wx.StaticText(
+        optionsLabel = StaticText(
             parent=aviPanel, label=_("Additional options:"))
             parent=aviPanel, label=_("Additional options:"))
-        self.optionsText = wx.TextCtrl(parent=aviPanel)
-        self.optionsText.SetToolTipString(
+        self.optionsText = TextCtrl(parent=aviPanel)
+        self.optionsText.SetToolTip(
             _(
             _(
                 "Consider adding '-sameq' or '-qscale 1' "
                 "Consider adding '-sameq' or '-qscale 1' "
                 "if not satisfied with video quality. "
                 "if not satisfied with video quality. "
@@ -1337,7 +1338,7 @@ class ExportDialog(wx.Dialog):
         fpsSizer = wx.BoxSizer(wx.HORIZONTAL)
         fpsSizer = wx.BoxSizer(wx.HORIZONTAL)
         fps = 1000 / self.timeTick
         fps = 1000 / self.timeTick
         fpsSizer.Add(
         fpsSizer.Add(
-            wx.StaticText(
+            StaticText(
                 panel,
                 panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Current frame rate: %.2f fps") %
                 label=_("Current frame rate: %.2f fps") %
@@ -1635,7 +1636,7 @@ class AddTemporalLayerDialog(wx.Dialog):
         else:
         else:
             bitmap = wx.ArtProvider.GetBitmap(
             bitmap = wx.ArtProvider.GetBitmap(
                 id=wx.ART_MISSING_IMAGE, client=wx.ART_TOOLBAR)
                 id=wx.ART_MISSING_IMAGE, client=wx.ART_TOOLBAR)
-        self.addManyMapsButton = wx.BitmapButton(self, bitmap=bitmap)
+        self.addManyMapsButton = BitmapButton(self, bitmap=bitmap)
         self.addManyMapsButton.Bind(wx.EVT_BUTTON, self._onAddMaps)
         self.addManyMapsButton.Bind(wx.EVT_BUTTON, self._onAddMaps)
 
 
         types = [('raster', _("Multiple raster maps")),
         types = [('raster', _("Multiple raster maps")),
@@ -1653,10 +1654,10 @@ class AddTemporalLayerDialog(wx.Dialog):
         for type_, text in types:
         for type_, text in types:
             self.tchoice.Append(text, clientData=type_)
             self.tchoice.Append(text, clientData=type_)
 
 
-        self.editBtn = wx.Button(parent=self, label='Set properties')
+        self.editBtn = Button(parent=self, label='Set properties')
 
 
-        self.okBtn = wx.Button(parent=self, id=wx.ID_OK)
-        self.cancelBtn = wx.Button(parent=self, id=wx.ID_CANCEL)
+        self.okBtn = Button(parent=self, id=wx.ID_OK)
+        self.cancelBtn = Button(parent=self, id=wx.ID_CANCEL)
 
 
         self.okBtn.Bind(wx.EVT_BUTTON, self._onOK)
         self.okBtn.Bind(wx.EVT_BUTTON, self._onOK)
         self.editBtn.Bind(wx.EVT_BUTTON, self._onProperties)
         self.editBtn.Bind(wx.EVT_BUTTON, self._onProperties)
@@ -1682,7 +1683,7 @@ class AddTemporalLayerDialog(wx.Dialog):
         bodySizer = wx.BoxSizer(wx.VERTICAL)
         bodySizer = wx.BoxSizer(wx.VERTICAL)
         typeSizer = wx.BoxSizer(wx.HORIZONTAL)
         typeSizer = wx.BoxSizer(wx.HORIZONTAL)
         selectSizer = wx.BoxSizer(wx.HORIZONTAL)
         selectSizer = wx.BoxSizer(wx.HORIZONTAL)
-        typeSizer.Add(wx.StaticText(self, label=_("Input data type:")),
+        typeSizer.Add(StaticText(self, label=_("Input data type:")),
                       flag=wx.ALIGN_CENTER_VERTICAL)
                       flag=wx.ALIGN_CENTER_VERTICAL)
         typeSizer.AddStretchSpacer()
         typeSizer.AddStretchSpacer()
         typeSizer.Add(self.tchoice)
         typeSizer.Add(self.tchoice)
@@ -1862,7 +1863,7 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
         row = 0
         row = 0
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 label=_("Background color:")),
                 label=_("Background color:")),
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,
@@ -1883,7 +1884,7 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
         row += 1
         row += 1
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 label=_("Number of parallel processes:")),
                 label=_("Number of parallel processes:")),
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,
@@ -1912,7 +1913,7 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
         row += 1
         row += 1
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 label=_("Text foreground color:")),
                 label=_("Text foreground color:")),
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,
@@ -1933,7 +1934,7 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
         row += 1
         row += 1
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 label=_("Text background color:")),
                 label=_("Text background color:")),
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,
@@ -1975,7 +1976,7 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
         row = 0
         row = 0
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 label=_("Absolute time format:")),
                 label=_("Absolute time format:")),
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,
@@ -1987,7 +1988,7 @@ class PreferencesDialog(PreferencesBaseDialog):
         self.tempFormat.SetValue(self._initFormat)
         self.tempFormat.SetValue(self._initFormat)
         self.winId['animation:temporal:format'] = self.tempFormat.GetId()
         self.winId['animation:temporal:format'] = self.tempFormat.GetId()
         gridSizer.Add(self.tempFormat, pos=(row, 1), flag=wx.ALIGN_RIGHT)
         gridSizer.Add(self.tempFormat, pos=(row, 1), flag=wx.ALIGN_RIGHT)
-        self.infoTimeLabel = wx.StaticText(parent=panel)
+        self.infoTimeLabel = StaticText(parent=panel)
         self.tempFormat.Bind(
         self.tempFormat.Bind(
             wx.EVT_COMBOBOX,
             wx.EVT_COMBOBOX,
             lambda evt: self._setTimeFormat(
             lambda evt: self._setTimeFormat(
@@ -2021,9 +2022,9 @@ class PreferencesDialog(PreferencesBaseDialog):
                       flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT)
                       flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT)
 
 
         row += 2
         row += 2
-        noDataCheck = wx.CheckBox(
+        noDataCheck = CheckBox(
             panel, label=_("Display instances with no data"))
             panel, label=_("Display instances with no data"))
-        noDataCheck.SetToolTipString(
+        noDataCheck.SetToolTip(
             _(
             _(
                 "When animating instant-based data which have irregular timestamps "
                 "When animating instant-based data which have irregular timestamps "
                 "you can display 'no data frame' (checked option) or "
                 "you can display 'no data frame' (checked option) or "

+ 10 - 7
gui/wxpython/animation/frame.py

@@ -22,11 +22,13 @@ import sys
 import wx
 import wx
 import wx.aui
 import wx.aui
 import tempfile
 import tempfile
+import six
 
 
 import grass.script as gcore
 import grass.script as gcore
 import grass.temporal as tgis
 import grass.temporal as tgis
 from core import globalvar
 from core import globalvar
 from gui_core.widgets import IntegerValidator
 from gui_core.widgets import IntegerValidator
+from gui_core.wrap import StaticText, TextCtrl
 from core.gcmd import RunCommand
 from core.gcmd import RunCommand
 from core.utils import _
 from core.utils import _
 
 
@@ -136,7 +138,7 @@ class AnimationFrame(wx.Frame):
                           Name('animPanel').CentrePane().CaptionVisible(False).PaneBorder(False).
                           Name('animPanel').CentrePane().CaptionVisible(False).PaneBorder(False).
                           Floatable(False).BestSize((-1, -1)).
                           Floatable(False).BestSize((-1, -1)).
                           CloseButton(False).DestroyOnClose(True).Layer(0))
                           CloseButton(False).DestroyOnClose(True).Layer(0))
-        for name, slider in self.animationSliders.iteritems():
+        for name, slider in six.iteritems(self.animationSliders):
             self._mgr.AddPane(
             self._mgr.AddPane(
                 slider,
                 slider,
                 wx.aui.AuiPaneInfo().PaneBorder(False).Name(
                 wx.aui.AuiPaneInfo().PaneBorder(False).Name(
@@ -328,6 +330,7 @@ class AnimationFrame(wx.Frame):
         if self.controller.timer.IsRunning():
         if self.controller.timer.IsRunning():
             self.controller.timer.Stop()
             self.controller.timer.Stop()
         CleanUp(TMP_DIR)()
         CleanUp(TMP_DIR)()
+        self._mgr.UnInit()
         self.Destroy()
         self.Destroy()
 
 
     def __del__(self):
     def __del__(self):
@@ -383,11 +386,11 @@ class AnimationSliderBase(wx.Panel):
 
 
     def __init__(self, parent):
     def __init__(self, parent):
         wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)
         wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)
-        self.label1 = wx.StaticText(self, id=wx.ID_ANY)
+        self.label1 = StaticText(self, id=wx.ID_ANY)
         self.slider = wx.Slider(self, id=wx.ID_ANY, style=wx.SL_HORIZONTAL)
         self.slider = wx.Slider(self, id=wx.ID_ANY, style=wx.SL_HORIZONTAL)
-        self.indexField = wx.TextCtrl(self, id=wx.ID_ANY, size=(40, -1),
-                                      style=wx.TE_PROCESS_ENTER | wx.TE_RIGHT,
-                                      validator=IntegerValidator())
+        self.indexField = TextCtrl(self, id=wx.ID_ANY, size=(40, -1),
+                                   style=wx.TE_PROCESS_ENTER | wx.TE_RIGHT,
+                                   validator=IntegerValidator())
 
 
         self.callbackSliderChanging = None
         self.callbackSliderChanging = None
         self.callbackSliderChanged = None
         self.callbackSliderChanged = None
@@ -512,8 +515,8 @@ class TimeAnimationSlider(AnimationSliderBase):
     def __init__(self, parent):
     def __init__(self, parent):
         AnimationSliderBase.__init__(self, parent)
         AnimationSliderBase.__init__(self, parent)
         self.timeLabels = []
         self.timeLabels = []
-        self.label2 = wx.StaticText(self, id=wx.ID_ANY)
-        self.label3 = wx.StaticText(self, id=wx.ID_ANY)
+        self.label2 = StaticText(self, id=wx.ID_ANY)
+        self.label3 = StaticText(self, id=wx.ID_ANY)
         self.label2Length = 0
         self.label2Length = 0
         self.temporalType = TemporalType.RELATIVE
         self.temporalType = TemporalType.RELATIVE
 
 

+ 5 - 5
gui/wxpython/animation/mapwindow.py

@@ -17,8 +17,8 @@ This program is free software under the GNU General Public License
 
 
 import wx
 import wx
 from core.debug import Debug
 from core.debug import Debug
-from gui_core.wrap import PseudoDC, EmptyBitmap
-from utils import ComputeScaledRect
+from gui_core.wrap import PseudoDC, EmptyBitmap, Rect
+from .utils import ComputeScaledRect
 
 
 
 
 class BufferedWindow(wx.Window):
 class BufferedWindow(wx.Window):
@@ -44,8 +44,8 @@ class BufferedWindow(wx.Window):
         wx.Window.__init__(self, *args, **kwargs)
         wx.Window.__init__(self, *args, **kwargs)
 
 
         Debug.msg(2, "BufferedWindow.__init__()")
         Debug.msg(2, "BufferedWindow.__init__()")
-        wx.EVT_PAINT(self, self.OnPaint)
-        wx.EVT_SIZE(self, self.OnSize)
+        self.Bind(wx.EVT_PAINT, self.OnPaint)
+        self.Bind(wx.EVT_SIZE, self.OnSize)
         # OnSize called to make sure the buffer is initialized.
         # OnSize called to make sure the buffer is initialized.
         # This might result in OnSize getting called twice on some
         # This might result in OnSize getting called twice on some
         # platforms at initialization, but little harm done.
         # platforms at initialization, but little harm done.
@@ -177,7 +177,7 @@ class AnimationWindow(BufferedWindow):
         self._pdc.BeginDrawing()
         self._pdc.BeginDrawing()
         self._pdc.SetId(1)
         self._pdc.SetId(1)
         self._pdc.DrawBitmap(bmp=self._overlay, x=x, y=y)
         self._pdc.DrawBitmap(bmp=self._overlay, x=x, y=y)
-        self._pdc.SetIdBounds(1, wx.Rect(x, y, self._overlay.GetWidth(),
+        self._pdc.SetIdBounds(1, Rect(x, y, self._overlay.GetWidth(),
                                          self._overlay.GetHeight()))
                                          self._overlay.GetHeight()))
         self._pdc.EndDrawing()
         self._pdc.EndDrawing()
 
 

+ 2 - 1
gui/wxpython/animation/provider.py

@@ -32,6 +32,7 @@ from core.debug import Debug
 from core.utils import _, autoCropImageFromFile
 from core.utils import _, autoCropImageFromFile
 
 
 from animation.utils import HashCmd, HashCmds, GetFileFromCmd, GetFileFromCmds
 from animation.utils import HashCmd, HashCmds, GetFileFromCmd, GetFileFromCmds
+from gui_core.wrap import EmptyBitmap
 
 
 import grass.script.core as gcore
 import grass.script.core as gcore
 from grass.script.task import cmdlist_to_tuple
 from grass.script.task import cmdlist_to_tuple
@@ -802,7 +803,7 @@ def createNoDataBitmap(imageWidth, imageHeight, text="No data"):
     """
     """
     Debug.msg(4, "createNoDataBitmap: w={w}, h={h}, text={t}".format(
     Debug.msg(4, "createNoDataBitmap: w={w}, h={h}, text={t}".format(
         w=imageWidth, h=imageHeight, t=text))
         w=imageWidth, h=imageHeight, t=text))
-    bitmap = wx.EmptyBitmap(imageWidth, imageHeight)
+    bitmap = EmptyBitmap(imageWidth, imageHeight)
     dc = wx.MemoryDC()
     dc = wx.MemoryDC()
     dc.SelectObject(bitmap)
     dc.SelectObject(bitmap)
     dc.Clear()
     dc.Clear()

+ 8 - 5
gui/wxpython/animation/utils.py

@@ -20,6 +20,7 @@ This program is free software under the GNU General Public License
 import os
 import os
 import wx
 import wx
 import hashlib
 import hashlib
+import six
 from multiprocessing import cpu_count
 from multiprocessing import cpu_count
 try:
 try:
     from PIL import Image
     from PIL import Image
@@ -29,6 +30,8 @@ except ImportError:
 
 
 import grass.temporal as tgis
 import grass.temporal as tgis
 import grass.script as grass
 import grass.script as grass
+from grass.script.utils import encode
+from gui_core.wrap import EmptyBitmap
 
 
 from core.gcmd import GException
 from core.gcmd import GException
 from core.utils import _
 from core.utils import _
@@ -97,7 +100,7 @@ def validateMapNames(names, etype):
                 raise GException(_("Map <%s> not found.") % name)
                 raise GException(_("Map <%s> not found.") % name)
         else:
         else:
             found = False
             found = False
-            for mapset, mapNames in mapDict.iteritems():
+            for mapset, mapNames in six.iteritems(mapDict):
                 if name in mapNames:
                 if name in mapNames:
                     found = True
                     found = True
                     newNames.append(name + "@" + mapset)
                     newNames.append(name + "@" + mapset)
@@ -245,10 +248,10 @@ def ComputeScaledRect(sourceSize, destSize):
 
 
 def RenderText(text, font, bgcolor, fgcolor):
 def RenderText(text, font, bgcolor, fgcolor):
     """Renderes text with given font to bitmap."""
     """Renderes text with given font to bitmap."""
-    dc = wx.MemoryDC(wx.EmptyBitmap(20, 20))
+    dc = wx.MemoryDC(EmptyBitmap(20, 20))
     dc.SetFont(font)
     dc.SetFont(font)
     w, h = dc.GetTextExtent(text)
     w, h = dc.GetTextExtent(text)
-    bmp = wx.EmptyBitmap(w + 2, h + 2)
+    bmp = EmptyBitmap(w + 2, h + 2)
     dc.SelectObject(bmp)
     dc.SelectObject(bmp)
     dc.SetBackgroundMode(wx.SOLID)
     dc.SetBackgroundMode(wx.SOLID)
     dc.SetTextBackground(wx.Colour(*bgcolor))
     dc.SetTextBackground(wx.Colour(*bgcolor))
@@ -278,7 +281,7 @@ def HashCmd(cmd, region):
     name = '_'.join(cmd)
     name = '_'.join(cmd)
     if region:
     if region:
         name += str(sorted(region.items()))
         name += str(sorted(region.items()))
-    return hashlib.sha1(name).hexdigest()
+    return hashlib.sha1(encode(name)).hexdigest()
 
 
 
 
 def HashCmds(cmds, region):
 def HashCmds(cmds, region):
@@ -286,7 +289,7 @@ def HashCmds(cmds, region):
     name = ';'.join([item for sublist in cmds for item in sublist])
     name = ';'.join([item for sublist in cmds for item in sublist])
     if region:
     if region:
         name += str(sorted(region.items()))
         name += str(sorted(region.items()))
-    return hashlib.sha1(name).hexdigest()
+    return hashlib.sha1(encode(name)).hexdigest()
 
 
 
 
 def GetFileFromCmd(dirname, cmd, region, extension='ppm'):
 def GetFileFromCmd(dirname, cmd, region, extension='ppm'):

+ 16 - 16
gui/wxpython/core/gcmd.py

@@ -35,19 +35,19 @@ import signal
 import traceback
 import traceback
 import locale
 import locale
 import subprocess
 import subprocess
-if sys.platform == 'win32':
+from threading import Thread
+import wx
+
+is_mswindows = sys.platform == 'win32'
+if is_mswindows:
     from win32file import ReadFile, WriteFile
     from win32file import ReadFile, WriteFile
     from win32pipe import PeekNamedPipe
     from win32pipe import PeekNamedPipe
     import msvcrt
     import msvcrt
 else:
 else:
     import select
     import select
     import fcntl
     import fcntl
-from threading import Thread
-
-import wx
 
 
 from grass.script import core as grass
 from grass.script import core as grass
-
 from core import globalvar
 from core import globalvar
 from core.debug import Debug
 from core.debug import Debug
 
 
@@ -66,6 +66,9 @@ except IOError:
         return string
         return string
     _ = null_gettext
     _ = null_gettext
 
 
+if sys.version_info.major == 2:
+    bytes = str
+
 
 
 def DecodeString(string):
 def DecodeString(string):
     """Decode string using system encoding
     """Decode string using system encoding
@@ -77,10 +80,9 @@ def DecodeString(string):
     if not string:
     if not string:
         return string
         return string
 
 
-    if _enc:
+    if _enc and isinstance(string, bytes):
         Debug.msg(5, "DecodeString(): enc=%s" % _enc)
         Debug.msg(5, "DecodeString(): enc=%s" % _enc)
         return string.decode(_enc)
         return string.decode(_enc)
-
     return string
     return string
 
 
 
 
@@ -93,11 +95,9 @@ def EncodeString(string):
     """
     """
     if not string:
     if not string:
         return string
         return string
-
     if _enc:
     if _enc:
         Debug.msg(5, "EncodeString(): enc=%s" % _enc)
         Debug.msg(5, "EncodeString(): enc=%s" % _enc)
         return string.encode(_enc)
         return string.encode(_enc)
-
     return string
     return string
 
 
 
 
@@ -174,7 +174,7 @@ class Popen(subprocess.Popen):
     """Subclass subprocess.Popen"""
     """Subclass subprocess.Popen"""
 
 
     def __init__(self, args, **kwargs):
     def __init__(self, args, **kwargs):
-        if subprocess.mswindows:
+        if is_mswindows:
             args = map(EncodeString, args)
             args = map(EncodeString, args)
 
 
             # The Windows shell (cmd.exe) requires some special characters to
             # The Windows shell (cmd.exe) requires some special characters to
@@ -230,7 +230,7 @@ class Popen(subprocess.Popen):
 
 
     def kill(self):
     def kill(self):
         """Try to kill running process"""
         """Try to kill running process"""
-        if subprocess.mswindows:
+        if is_mswindows:
             import win32api
             import win32api
             handle = win32api.OpenProcess(1, 0, self.pid)
             handle = win32api.OpenProcess(1, 0, self.pid)
             return (0 != win32api.TerminateProcess(handle, 0))
             return (0 != win32api.TerminateProcess(handle, 0))
@@ -620,14 +620,14 @@ class CommandThread(Thread):
         if self.stdout:
         if self.stdout:
             # make module stdout/stderr non-blocking
             # make module stdout/stderr non-blocking
             out_fileno = self.module.stdout.fileno()
             out_fileno = self.module.stdout.fileno()
-            if not subprocess.mswindows:
+            if not is_mswindows:
                 flags = fcntl.fcntl(out_fileno, fcntl.F_GETFL)
                 flags = fcntl.fcntl(out_fileno, fcntl.F_GETFL)
                 fcntl.fcntl(out_fileno, fcntl.F_SETFL, flags | os.O_NONBLOCK)
                 fcntl.fcntl(out_fileno, fcntl.F_SETFL, flags | os.O_NONBLOCK)
 
 
         if self.stderr:
         if self.stderr:
             # make module stdout/stderr non-blocking
             # make module stdout/stderr non-blocking
             out_fileno = self.module.stderr.fileno()
             out_fileno = self.module.stderr.fileno()
-            if not subprocess.mswindows:
+            if not is_mswindows:
                 flags = fcntl.fcntl(out_fileno, fcntl.F_GETFL)
                 flags = fcntl.fcntl(out_fileno, fcntl.F_GETFL)
                 fcntl.fcntl(out_fileno, fcntl.F_SETFL, flags | os.O_NONBLOCK)
                 fcntl.fcntl(out_fileno, fcntl.F_SETFL, flags | os.O_NONBLOCK)
 
 
@@ -703,8 +703,8 @@ def RunCommand(prog, flags="", overwrite=False, quiet=False,
     :return: returncode, stdout, messages (read == True and getErrorMsg == True)
     :return: returncode, stdout, messages (read == True and getErrorMsg == True)
     :return: stdout, stderr
     :return: stdout, stderr
     """
     """
-    cmdString = ' '.join(grass.make_command(prog, flags, overwrite,
-                                            quiet, verbose, **kwargs))
+    cmdString = b' '.join(grass.make_command(prog, flags, overwrite,
+                                             quiet, verbose, **kwargs))
 
 
     Debug.msg(1, "gcmd.RunCommand(): %s" % cmdString)
     Debug.msg(1, "gcmd.RunCommand(): %s" % cmdString)
 
 
@@ -729,7 +729,7 @@ def RunCommand(prog, flags="", overwrite=False, quiet=False,
         ps.stdin.close()
         ps.stdin.close()
         ps.stdin = None
         ps.stdin = None
 
 
-    stdout, stderr = map(DecodeString, ps.communicate())
+    stdout, stderr = list(map(DecodeString, ps.communicate()))
 
 
     if parent:  # restore previous settings
     if parent:  # restore previous settings
         os.environ['GRASS_MESSAGE_FORMAT'] = messageFormat
         os.environ['GRASS_MESSAGE_FORMAT'] = messageFormat

+ 6 - 1
gui/wxpython/core/gconsole.py

@@ -27,7 +27,12 @@ import sys
 import re
 import re
 import time
 import time
 import threading
 import threading
-import Queue
+
+if sys.version_info.major == 2:
+    import Queue
+else:
+    import queue as Queue
+
 import codecs
 import codecs
 import locale
 import locale
 
 

+ 5 - 1
gui/wxpython/core/gthread.py

@@ -19,7 +19,11 @@ import time
 
 
 import wx
 import wx
 
 
-import Queue
+import sys
+if sys.version_info.major == 2:
+    import Queue
+else:
+    import queue as Queue
 
 
 from core.gconsole import EVT_CMD_DONE, wxCmdDone
 from core.gconsole import EVT_CMD_DONE, wxCmdDone
 
 

+ 3 - 3
gui/wxpython/core/render.py

@@ -144,7 +144,7 @@ class Layer(object):
                   (self.type, self.name, self.mapfile))
                   (self.type, self.name, self.mapfile))
 
 
         # prepare command for each layer
         # prepare command for each layer
-        layertypes = utils.command2ltype.values() + ['overlay', 'command']
+        layertypes = list(utils.command2ltype.values()) + ['overlay', 'command']
 
 
         if self.type not in layertypes:
         if self.type not in layertypes:
             raise GException(
             raise GException(
@@ -254,7 +254,7 @@ class Layer(object):
 
 
     def SetType(self, ltype):
     def SetType(self, ltype):
         """Set layer type"""
         """Set layer type"""
-        if ltype not in utils.command2ltype.values() + ['overlay', 'command']:
+        if ltype not in list(utils.command2ltype.values()) + ['overlay', 'command']:
             raise GException(_("Unsupported map layer type '%s'") % ltype)
             raise GException(_("Unsupported map layer type '%s'") % ltype)
 
 
         if not self.renderMgr:
         if not self.renderMgr:
@@ -1154,7 +1154,7 @@ class Map(object):
         """
         """
         selected = []
         selected = []
 
 
-        if isinstance(ltype, types.StringType):
+        if isinstance(ltype, str):
             one_type = True
             one_type = True
         else:
         else:
             one_type = False
             one_type = False

+ 6 - 6
gui/wxpython/core/settings.py

@@ -858,9 +858,9 @@ class Settings:
         """Define internal settings (based on user settings)
         """Define internal settings (based on user settings)
         """
         """
         self.internalSettings = {}
         self.internalSettings = {}
-        for group in self.userSettings.keys():
+        for group in list(self.userSettings.keys()):
             self.internalSettings[group] = {}
             self.internalSettings[group] = {}
-            for key in self.userSettings[group].keys():
+            for key in list(self.userSettings[group].keys()):
                 self.internalSettings[group][key] = {}
                 self.internalSettings[group][key] = {}
 
 
         # self.internalSettings['general']["mapsetPath"]['value'] = self.GetMapsetPath()
         # self.internalSettings['general']["mapsetPath"]['value'] = self.GetMapsetPath()
@@ -1030,9 +1030,9 @@ class Settings:
 
 
         try:
         try:
             file = open(self.filePath, "w")
             file = open(self.filePath, "w")
-            for group in settings.keys():
-                for key in settings[group].keys():
-                    subkeys = settings[group][key].keys()
+            for group in list(settings.keys()):
+                for key in list(settings[group].keys()):
+                    subkeys = list(settings[group][key].keys())
                     file.write('%s%s%s%s' % (group, self.sep, key, self.sep))
                     file.write('%s%s%s%s' % (group, self.sep, key, self.sep))
                     for idx in range(len(subkeys)):
                     for idx in range(len(subkeys)):
                         value = settings[group][key][subkeys[idx]]
                         value = settings[group][key][subkeys[idx]]
@@ -1042,7 +1042,7 @@ class Settings:
                                     '%s%s%s%s%s' %
                                     '%s%s%s%s%s' %
                                     (os.linesep, group, self.sep, key, self.sep))
                                     (os.linesep, group, self.sep, key, self.sep))
                             file.write('%s%s' % (subkeys[idx], self.sep))
                             file.write('%s%s' % (subkeys[idx], self.sep))
-                            kvalues = settings[group][key][subkeys[idx]].keys()
+                            kvalues = list(settings[group][key][subkeys[idx]].keys())
                             srange = range(len(kvalues))
                             srange = range(len(kvalues))
                             for sidx in srange:
                             for sidx in srange:
                                 svalue = self._parseValue(
                                 svalue = self._parseValue(

+ 5 - 5
gui/wxpython/core/toolboxes.py

@@ -34,7 +34,7 @@ else:
 
 
 import grass.script.task as gtask
 import grass.script.task as gtask
 import grass.script.core as gcore
 import grass.script.core as gcore
-from grass.script.utils import try_remove
+from grass.script.utils import try_remove, decode
 from grass.exceptions import ScriptError, CalledModuleError
 from grass.exceptions import ScriptError, CalledModuleError
 
 
 
 
@@ -766,9 +766,9 @@ def _getXMLString(root):
     :return: XML as string
     :return: XML as string
     """
     """
     xml = etree.tostring(root, encoding='UTF-8')
     xml = etree.tostring(root, encoding='UTF-8')
-    return xml.replace("<?xml version='1.0' encoding='UTF-8'?>\n",
-                       "<?xml version='1.0' encoding='UTF-8'?>\n"
-                       "<!--This is an auto-generated file-->\n")
+    return xml.replace(b"<?xml version='1.0' encoding='UTF-8'?>\n",
+                       b"<?xml version='1.0' encoding='UTF-8'?>\n"
+                       b"<!--This is an auto-generated file-->\n")
 
 
 
 
 def do_doctest_gettext_workaround():
 def do_doctest_gettext_workaround():
@@ -897,7 +897,7 @@ def main():
     tree = createTree(distributionRootFile=mainFile, userRootFile=None,
     tree = createTree(distributionRootFile=mainFile, userRootFile=None,
                       userDefined=False)
                       userDefined=False)
     root = tree.getroot()
     root = tree.getroot()
-    sys.stdout.write(_getXMLString(root))
+    sys.stdout.write(decode(_getXMLString(root), encoding='UTF-8'))
 
 
     return 0
     return 0
 
 

+ 2 - 1
gui/wxpython/core/treemodel.py

@@ -15,6 +15,7 @@ This program is free software under the GNU General Public License
 
 
 @author Anna Petrasova <kratochanna gmail.com>
 @author Anna Petrasova <kratochanna gmail.com>
 """
 """
+import six
 
 
 
 
 class TreeModel(object):
 class TreeModel(object):
@@ -174,7 +175,7 @@ class DictNode(object):
     def nprint(self, text, indent=0):
     def nprint(self, text, indent=0):
         text.append(indent * ' ' + self.label)
         text.append(indent * ' ' + self.label)
         if self.data:
         if self.data:
-            for key, value in self.data.iteritems():
+            for key, value in six.iteritems(self.data):
                 text.append(
                 text.append(
                     "%(indent)s* %(key)s : %(value)s" %
                     "%(indent)s* %(key)s : %(value)s" %
                     {'indent': (indent + 2) * ' ', 'key': key, 'value': value})
                     {'indent': (indent + 2) * ' ', 'key': key, 'value': value})

+ 2 - 1
gui/wxpython/core/units.py

@@ -21,6 +21,7 @@ This program is free software under the GNU General Public License
 @author Martin Landa <landa.martin gmail.com>
 @author Martin Landa <landa.martin gmail.com>
 """
 """
 
 
+import six
 import math
 import math
 
 
 if __name__ == '__main__':
 if __name__ == '__main__':
@@ -79,7 +80,7 @@ class BaseUnits:
 
 
         :return: index
         :return: index
         """
         """
-        for k, u in self._units[type].iteritems():
+        for k, u in six.iteritems(self._units[type]):
             if u['key'] == key:
             if u['key'] == key:
                 return k
                 return k
         return 0
         return 0

+ 10 - 4
gui/wxpython/core/utils.py

@@ -20,6 +20,7 @@ import glob
 import shlex
 import shlex
 import re
 import re
 import inspect
 import inspect
+import six
 
 
 from grass.script import core as grass
 from grass.script import core as grass
 from grass.script import task as gtask
 from grass.script import task as gtask
@@ -44,9 +45,14 @@ except IOError:
     _ = null_gettext
     _ = null_gettext
 
 
 
 
+def cmp(a, b):
+    """cmp function"""
+    return ((a > b) - (a < b))
+
+
 def normalize_whitespace(text):
 def normalize_whitespace(text):
     """Remove redundant whitespace from a string"""
     """Remove redundant whitespace from a string"""
-    return string.join(string.split(text), ' ')
+    return (' ').join(text.split())
 
 
 
 
 def split(s):
 def split(s):
@@ -324,7 +330,7 @@ def ListOfMapsets(get='ordered'):
 
 
 def ListSortLower(list):
 def ListSortLower(list):
     """Sort list items (not case-sensitive)"""
     """Sort list items (not case-sensitive)"""
-    list.sort(cmp=lambda x, y: cmp(x.lower(), y.lower()))
+    list.sort(key=lambda x: x.lower())
 
 
 
 
 def GetVectorNumberOfLayers(vector):
 def GetVectorNumberOfLayers(vector):
@@ -731,7 +737,7 @@ def _parseFormats(output, writableOnly=False):
         else:
         else:
             formats['file'].append(name)
             formats['file'].append(name)
 
 
-    for items in formats.itervalues():
+    for items in six.itervalues(formats):
         items.sort()
         items.sort()
 
 
     return formats
     return formats
@@ -917,7 +923,7 @@ def StoreEnvVariable(key, value=None, envFile=None):
     else:
     else:
         expCmd = 'export'
         expCmd = 'export'
 
 
-    for key, value in environ.iteritems():
+    for key, value in six.iteritems(environ):
         fd.write('%s %s=%s\n' % (expCmd, key, value))
         fd.write('%s %s=%s\n' % (expCmd, key, value))
 
 
     # write also skipped lines
     # write also skipped lines

+ 16 - 15
gui/wxpython/core/workspace.py

@@ -19,6 +19,7 @@ This program is free software under the GNU General Public License
 import os
 import os
 
 
 import wx
 import wx
+import six
 
 
 from core.utils import normalize_whitespace, _
 from core.utils import normalize_whitespace, _
 from core.settings import UserSettings
 from core.settings import UserSettings
@@ -976,7 +977,7 @@ class WriteWorkspaceFile(object):
                     '%s<task name="%s">\n' %
                     '%s<task name="%s">\n' %
                     (' ' * self.indent, cmd[0]))
                     (' ' * self.indent, cmd[0]))
                 self.indent += 4
                 self.indent += 4
-                for key, val in cmd[1].iteritems():
+                for key, val in six.iteritems(cmd[1]):
                     if key == 'flags':
                     if key == 'flags':
                         for f in val:
                         for f in val:
                             self.file.write('%s<flag name="%s" />\n' %
                             self.file.write('%s<flag name="%s" />\n' %
@@ -1003,7 +1004,7 @@ class WriteWorkspaceFile(object):
                     self.file.write('%s<vdigit>\n' % (' ' * self.indent))
                     self.file.write('%s<vdigit>\n' % (' ' * self.indent))
                     if 'geomAttr' in vdigit:
                     if 'geomAttr' in vdigit:
                         self.indent += 4
                         self.indent += 4
-                        for type, val in vdigit['geomAttr'].iteritems():
+                        for type, val in six.iteritems(vdigit['geomAttr']):
                             units = ''
                             units = ''
                             if val['units'] != 'mu':
                             if val['units'] != 'mu':
                                 units = ' units="%s"' % val['units']
                                 units = ' units="%s"' % val['units']
@@ -1038,13 +1039,13 @@ class WriteWorkspaceFile(object):
         self.indent += 4
         self.indent += 4
         self.file.write('%s<surface>\n' % (' ' * self.indent))
         self.file.write('%s<surface>\n' % (' ' * self.indent))
         self.indent += 4
         self.indent += 4
-        for attrb in data.iterkeys():
+        for attrb in six.iterkeys(data):
             if len(data[attrb]) < 1:  # skip empty attributes
             if len(data[attrb]) < 1:  # skip empty attributes
                 continue
                 continue
             if attrb == 'object':
             if attrb == 'object':
                 continue
                 continue
 
 
-            for name in data[attrb].iterkeys():
+            for name in six.iterkeys(data[attrb]):
                 # surface attribute
                 # surface attribute
                 if attrb == 'attribute':
                 if attrb == 'attribute':
                     if data[attrb][name]['map'] is None:
                     if data[attrb][name]['map'] is None:
@@ -1064,7 +1065,7 @@ class WriteWorkspaceFile(object):
             if attrb == 'draw':
             if attrb == 'draw':
                 self.file.write('%s<%s' % (' ' * self.indent, attrb))
                 self.file.write('%s<%s' % (' ' * self.indent, attrb))
                 if 'mode' in data[attrb]:
                 if 'mode' in data[attrb]:
-                    for tag, value in data[attrb]['mode']['desc'].iteritems():
+                    for tag, value in six.iteritems(data[attrb]['mode']['desc']):
                         self.file.write(' %s="%s"' % (tag, value))
                         self.file.write(' %s="%s"' % (tag, value))
                 self.file.write('>\n')  # <draw ...>
                 self.file.write('>\n')  # <draw ...>
 
 
@@ -1121,14 +1122,14 @@ class WriteWorkspaceFile(object):
         self.indent += 4
         self.indent += 4
         self.file.write('%s<volume>\n' % (' ' * self.indent))
         self.file.write('%s<volume>\n' % (' ' * self.indent))
         self.indent += 4
         self.indent += 4
-        for attrb in data.iterkeys():
+        for attrb in six.iterkeys(data):
             if len(data[attrb]) < 1:  # skip empty attributes
             if len(data[attrb]) < 1:  # skip empty attributes
                 continue
                 continue
             if attrb == 'object':
             if attrb == 'object':
                 continue
                 continue
 
 
             if attrb == 'attribute':
             if attrb == 'attribute':
-                for name in data[attrb].iterkeys():
+                for name in six.iterkeys(data[attrb]):
                     # surface attribute
                     # surface attribute
                     if data[attrb][name]['map'] is None:
                     if data[attrb][name]['map'] is None:
                         continue
                         continue
@@ -1211,10 +1212,10 @@ class WriteWorkspaceFile(object):
             if attrb == 'isosurface':
             if attrb == 'isosurface':
                 for isosurface in data[attrb]:
                 for isosurface in data[attrb]:
                     self.file.write('%s<%s>\n' % (' ' * self.indent, attrb))
                     self.file.write('%s<%s>\n' % (' ' * self.indent, attrb))
-                    for name in isosurface.iterkeys():
+                    for name in six.iterkeys(isosurface):
                         self.indent += 4
                         self.indent += 4
                         self.file.write('%s<%s>\n' % (' ' * self.indent, name))
                         self.file.write('%s<%s>\n' % (' ' * self.indent, name))
-                        for att in isosurface[name].iterkeys():
+                        for att in six.iterkeys(isosurface[name]):
                             if isosurface[name][att] is True:
                             if isosurface[name][att] is True:
                                 val = '1'
                                 val = '1'
                             elif isosurface[name][att] is False:
                             elif isosurface[name][att] is False:
@@ -1242,10 +1243,10 @@ class WriteWorkspaceFile(object):
             if attrb == 'slice':
             if attrb == 'slice':
                 for slice_ in data[attrb]:
                 for slice_ in data[attrb]:
                     self.file.write('%s<%s>\n' % (' ' * self.indent, attrb))
                     self.file.write('%s<%s>\n' % (' ' * self.indent, attrb))
-                    for name in slice_.iterkeys():
+                    for name in six.iterkeys(slice_):
                         self.indent += 4
                         self.indent += 4
                         self.file.write('%s<%s>\n' % (' ' * self.indent, name))
                         self.file.write('%s<%s>\n' % (' ' * self.indent, name))
-                        for att in slice_[name].iterkeys():
+                        for att in six.iterkeys(slice_[name]):
                             if att in ('map', 'update'):
                             if att in ('map', 'update'):
                                 continue
                                 continue
                             val = slice_[name][att]
                             val = slice_[name][att]
@@ -1275,7 +1276,7 @@ class WriteWorkspaceFile(object):
         :param data: Nviz layer properties
         :param data: Nviz layer properties
         """
         """
         self.indent += 4
         self.indent += 4
-        for attrb in data.iterkeys():
+        for attrb in six.iterkeys(data):
             if len(data[attrb]) < 1:  # skip empty attributes
             if len(data[attrb]) < 1:  # skip empty attributes
                 continue
                 continue
 
 
@@ -1292,7 +1293,7 @@ class WriteWorkspaceFile(object):
                                                            attrb,
                                                            attrb,
                                                            marker))
                                                            marker))
             self.indent += 4
             self.indent += 4
-            for name in data[attrb].iterkeys():
+            for name in six.iterkeys(data[attrb]):
                 if name in ('object', 'marker'):
                 if name in ('object', 'marker'):
                     continue
                     continue
                 if name == 'mode':
                 if name == 'mode':
@@ -1318,14 +1319,14 @@ class WriteWorkspaceFile(object):
                     self.file.write('%s</%s>\n' % ((' ' * self.indent, name)))
                     self.file.write('%s</%s>\n' % ((' ' * self.indent, name)))
                 elif name == 'thematic':
                 elif name == 'thematic':
                     self.file.write('%s<%s ' % (' ' * self.indent, name))
                     self.file.write('%s<%s ' % (' ' * self.indent, name))
-                    for key in data[attrb][name].iterkeys():
+                    for key in six.iterkeys(data[attrb][name]):
                         if key.startswith('use'):
                         if key.startswith('use'):
                             self.file.write(
                             self.file.write(
                                 '%s="%s" ' %
                                 '%s="%s" ' %
                                 (key, int(data[attrb][name][key])))
                                 (key, int(data[attrb][name][key])))
                     self.file.write('>\n')
                     self.file.write('>\n')
                     self.indent += 4
                     self.indent += 4
-                    for key, value in data[attrb][name].iteritems():
+                    for key, value in six.iteritems(data[attrb][name]):
                         if key.startswith('use'):
                         if key.startswith('use'):
                             continue
                             continue
                         if value is None:
                         if value is None:

+ 3 - 2
gui/wxpython/core/ws.py

@@ -19,6 +19,7 @@ This program is free software under the GNU General Public License
 import sys
 import sys
 import copy
 import copy
 import time
 import time
+import six
 
 
 import wx
 import wx
 from wx.lib.newevent import NewEvent
 from wx.lib.newevent import NewEvent
@@ -213,7 +214,7 @@ class RenderWMSMgr(wx.EvtHandler):
         """Create string for GRASS_REGION env variable from  dict created by _getRegionDict.
         """Create string for GRASS_REGION env variable from  dict created by _getRegionDict.
         """
         """
         regionStr = ''
         regionStr = ''
-        for k, v in region.iteritems():
+        for k, v in six.iteritems(region):
             item = k + ': ' + str(v)
             item = k + ': ' + str(v)
             if regionStr:
             if regionStr:
                 regionStr += '; '
                 regionStr += '; '
@@ -356,7 +357,7 @@ class GDALRasterMerger:
         if sXsize < 1 or sYsize < 1:
         if sXsize < 1 or sYsize < 1:
             return
             return
 
 
-        for sBandNnum, tBandNum in sTBands.iteritems():
+        for sBandNnum, tBandNum in six.iteritems(sTBands):
             bandData = sDataset.GetRasterBand(sBandNnum).ReadRaster(
             bandData = sDataset.GetRasterBand(sBandNnum).ReadRaster(
                 sXoff, sYoff, sXsize, sYsize, tXsize, tYsize, gdal.GDT_Byte)
                 sXoff, sYoff, sXsize, sYsize, tXsize, tYsize, gdal.GDT_Byte)
             self.tDataset.GetRasterBand(tBandNum).WriteRaster(
             self.tDataset.GetRasterBand(tBandNum).WriteRaster(

+ 15 - 14
gui/wxpython/datacatalog/dialogs.py

@@ -20,6 +20,7 @@ import wx
 from gui_core.widgets import FloatValidator, IntegerValidator
 from gui_core.widgets import FloatValidator, IntegerValidator
 from core.giface import Notification
 from core.giface import Notification
 from core.gcmd import RunCommand
 from core.gcmd import RunCommand
+from gui_core.wrap import Button, StaticText, TextCtrl
 
 
 from grass.script import parse_key_val, region_env
 from grass.script import parse_key_val, region_env
 
 
@@ -61,26 +62,26 @@ class CatalogReprojectionDialog(wx.Dialog):
 
 
     def _widgets(self):
     def _widgets(self):
         if self.etype == 'raster':
         if self.etype == 'raster':
-            self.resolution = wx.TextCtrl(self.panel, validator=FloatValidator())
+            self.resolution = TextCtrl(self.panel, validator=FloatValidator())
             self.resampling = wx.Choice(self.panel, size=(200, -1),
             self.resampling = wx.Choice(self.panel, size=(200, -1),
                                         choices=['nearest', 'bilinear', 'bicubic', 'lanczos',
                                         choices=['nearest', 'bilinear', 'bicubic', 'lanczos',
                                                  'bilinear_f', 'bicubic_f', 'lanczos_f'])
                                                  'bilinear_f', 'bicubic_f', 'lanczos_f'])
         else:
         else:
-            self.vsplit = wx.TextCtrl(self.panel, validator=IntegerValidator())
+            self.vsplit = TextCtrl(self.panel, validator=IntegerValidator())
             self.vsplit.SetValue('10000')
             self.vsplit.SetValue('10000')
 
 
         #
         #
         # buttons
         # buttons
         #
         #
-        self.btn_close = wx.Button(parent=self.panel, id=wx.ID_CLOSE)
+        self.btn_close = Button(parent=self.panel, id=wx.ID_CLOSE)
         self.SetEscapeId(self.btn_close.GetId())
         self.SetEscapeId(self.btn_close.GetId())
 
 
         # run
         # run
-        self.btn_run = wx.Button(parent=self.panel, id=wx.ID_OK, label=_("Reproject"))
+        self.btn_run = Button(parent=self.panel, id=wx.ID_OK, label=_("Reproject"))
         if self.etype == 'raster':
         if self.etype == 'raster':
-            self.btn_run.SetToolTipString(_("Reproject raster"))
+            self.btn_run.SetToolTip(_("Reproject raster"))
         elif self.etype == 'vector':
         elif self.etype == 'vector':
-            self.btn_run.SetToolTipString(_("Reproject vector"))
+            self.btn_run.SetToolTip(_("Reproject vector"))
         self.btn_run.SetDefault()
         self.btn_run.SetDefault()
         self.btn_run.Bind(wx.EVT_BUTTON, self.OnReproject)
         self.btn_run.Bind(wx.EVT_BUTTON, self.OnReproject)
 
 
@@ -91,25 +92,25 @@ class CatalogReprojectionDialog(wx.Dialog):
 
 
         label = _("Map layer <{ml}> needs to be reprojected.\n"
         label = _("Map layer <{ml}> needs to be reprojected.\n"
                   "Please review and modify reprojection parameters:").format(ml=self.iLayer)
                   "Please review and modify reprojection parameters:").format(ml=self.iLayer)
-        dialogSizer.Add(wx.StaticText(self.panel, label=label),
+        dialogSizer.Add(StaticText(self.panel, label=label),
                         flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, border=10)
                         flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, border=10)
         if self.etype == 'raster':
         if self.etype == 'raster':
-            optionsSizer.Add(wx.StaticText(self.panel, label=_("Estimated resolution:")),
+            optionsSizer.Add(StaticText(self.panel, label=_("Estimated resolution:")),
                              pos=(0, 0), flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL)
                              pos=(0, 0), flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL)
             optionsSizer.Add(self.resolution, pos=(0, 1), flag=wx.EXPAND)
             optionsSizer.Add(self.resolution, pos=(0, 1), flag=wx.EXPAND)
-            optionsSizer.Add(wx.StaticText(self.panel, label=_("Resampling method:")),
+            optionsSizer.Add(StaticText(self.panel, label=_("Resampling method:")),
                              pos=(1, 0), flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL)
                              pos=(1, 0), flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL)
             optionsSizer.Add(self.resampling, pos=(1, 1), flag=wx.EXPAND)
             optionsSizer.Add(self.resampling, pos=(1, 1), flag=wx.EXPAND)
         else:
         else:
-            optionsSizer.Add(wx.StaticText(self.panel, label=_("Maximum segment length:")),
+            optionsSizer.Add(StaticText(self.panel, label=_("Maximum segment length:")),
                              pos=(1, 0), flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL)
                              pos=(1, 0), flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL)
             optionsSizer.Add(self.vsplit, pos=(1, 1), flag=wx.EXPAND)
             optionsSizer.Add(self.vsplit, pos=(1, 1), flag=wx.EXPAND)
         optionsSizer.AddGrowableCol(1)
         optionsSizer.AddGrowableCol(1)
         dialogSizer.Add(optionsSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=10)
         dialogSizer.Add(optionsSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=10)
-        helptext = wx.StaticText(self.panel,
-                                 label="For more reprojection options,"
-                                       " please see {module}".format(module='r.proj' if self.etype == 'raster'
-                                                                     else 'v.proj'))
+        helptext = StaticText(self.panel,
+                              label="For more reprojection options,"
+                              " please see {module}".format(module='r.proj' if self.etype == 'raster'
+                                                            else 'v.proj'))
         dialogSizer.Add(helptext, proportion=0, flag=wx.ALL | wx.EXPAND, border=10)
         dialogSizer.Add(helptext, proportion=0, flag=wx.ALL | wx.EXPAND, border=10)
         #
         #
         # buttons
         # buttons

+ 3 - 2
gui/wxpython/datacatalog/frame.py

@@ -26,6 +26,7 @@ from core.globalvar import ICONDIR
 from core.gcmd import RunCommand, GMessage
 from core.gcmd import RunCommand, GMessage
 from datacatalog.tree import DataCatalogTree
 from datacatalog.tree import DataCatalogTree
 from datacatalog.toolbars import DataCatalogToolbar
 from datacatalog.toolbars import DataCatalogToolbar
+from gui_core.wrap import Button
 
 
 
 
 class DataCatalogFrame(wx.Frame):
 class DataCatalogFrame(wx.Frame):
@@ -62,8 +63,8 @@ class DataCatalogFrame(wx.Frame):
                                                                    mapset=mapset))
                                                                    mapset=mapset))
 
 
         # buttons
         # buttons
-        self.btnClose = wx.Button(parent=self.panel, id=wx.ID_CLOSE)
-        self.btnClose.SetToolTipString(_("Close GRASS GIS Data Catalog"))
+        self.btnClose = Button(parent=self.panel, id=wx.ID_CLOSE)
+        self.btnClose.SetToolTip(_("Close GRASS GIS Data Catalog"))
         self.btnClose.SetDefault()
         self.btnClose.SetDefault()
 
 
         # events
         # events

+ 3 - 2
gui/wxpython/datacatalog/toolbars.py

@@ -16,6 +16,7 @@ This program is free software under the GNU General Public License
 
 
 import wx
 import wx
 from gui_core.toolbars import BaseToolbar
 from gui_core.toolbars import BaseToolbar
+from gui_core.wrap import StaticText, TextCtrl
 from icons.icon import MetaIcon
 from icons.icon import MetaIcon
 from core.utils import _
 from core.utils import _
 
 
@@ -46,12 +47,12 @@ class DataCatalogToolbar(BaseToolbar):
 
 
         self.InitToolbar(self._toolbarData())
         self.InitToolbar(self._toolbarData())
         self.filterId = wx.NewId()
         self.filterId = wx.NewId()
-        self.filter = wx.TextCtrl(parent=self, id=self.filterId)
+        self.filter = TextCtrl(parent=self, id=self.filterId)
         self.filter.SetSize((120, self.filter.GetBestSize()[1]))
         self.filter.SetSize((120, self.filter.GetBestSize()[1]))
         self.filter.Bind(wx.EVT_TEXT,
         self.filter.Bind(wx.EVT_TEXT,
                          lambda event: self.parent.Filter(
                          lambda event: self.parent.Filter(
                          self.filter.GetValue()))
                          self.filter.GetValue()))
-        self.AddControl(wx.StaticText(self, label=_("Search:")))
+        self.AddControl(StaticText(self, label=_("Search:")))
         self.AddControl(self.filter)
         self.AddControl(self.filter)
         help = _("Type to search database by map type or name. "
         help = _("Type to search database by map type or name. "
                  "Use prefix 'r:', 'v:' and 'r3:'"
                  "Use prefix 'r:', 'v:' and 'r3:'"

+ 2 - 2
gui/wxpython/datacatalog/tree.py

@@ -1009,7 +1009,7 @@ class DataCatalogTree(LocationMapTree):
 
 
     def _popupMenuMapset(self):
     def _popupMenuMapset(self):
         """Create popup menu for mapsets"""
         """Create popup menu for mapsets"""
-        menu = wx.Menu()
+        menu = Menu()
         genv = gisenv()
         genv = gisenv()
         currentLocation, currentMapset = self._isCurrent(genv)
         currentLocation, currentMapset = self._isCurrent(genv)
 
 
@@ -1030,7 +1030,7 @@ class DataCatalogTree(LocationMapTree):
 
 
     def _popupMenuElement(self):
     def _popupMenuElement(self):
         """Create popup menu for elements"""
         """Create popup menu for elements"""
-        menu = wx.Menu()
+        menu = Menu()
         item = wx.MenuItem(menu, wx.NewId(), _("&Paste"))
         item = wx.MenuItem(menu, wx.NewId(), _("&Paste"))
         menu.AppendItem(item)
         menu.AppendItem(item)
         self.Bind(wx.EVT_MENU, self.OnPasteMap, item)
         self.Bind(wx.EVT_MENU, self.OnPasteMap, item)

+ 98 - 91
gui/wxpython/dbmgr/base.py

@@ -36,6 +36,7 @@ import tempfile
 import copy
 import copy
 import types
 import types
 import math
 import math
+import functools
 
 
 from core import globalvar
 from core import globalvar
 import wx
 import wx
@@ -51,6 +52,7 @@ else:
 import wx.lib.scrolledpanel as scrolled
 import wx.lib.scrolledpanel as scrolled
 
 
 import grass.script as grass
 import grass.script as grass
+from grass.script.utils import decode
 
 
 from dbmgr.sqlbuilder import SQLBuilderSelect, SQLBuilderUpdate
 from dbmgr.sqlbuilder import SQLBuilderSelect, SQLBuilderUpdate
 from core.gcmd import RunCommand, GException, GError, GMessage, GWarning
 from core.gcmd import RunCommand, GException, GError, GMessage, GWarning
@@ -60,7 +62,12 @@ from dbmgr.vinfo import VectorDBInfo, GetUnicodeValue, CreateDbInfoDesc
 from core.debug import Debug
 from core.debug import Debug
 from dbmgr.dialogs import ModifyTableRecord, AddColumnDialog
 from dbmgr.dialogs import ModifyTableRecord, AddColumnDialog
 from core.settings import UserSettings
 from core.settings import UserSettings
-from gui_core.wrap import SpinCtrl, Button, TextCtrl, ListCtrl, CheckBox
+from gui_core.wrap import SpinCtrl, Button, TextCtrl, ListCtrl, CheckBox, \
+    StaticText, StaticBox, Menu
+from core.utils import cmp
+
+if sys.version_info.major >= 3:
+    unicode = str
 
 
 
 
 class Log:
 class Log:
@@ -268,7 +275,7 @@ class VirtualAttributeList(wx.ListCtrl,
             # but we need strip to get rid of the ending newline
             # but we need strip to get rid of the ending newline
             # which on windows leaves \r in a last empty attribute table cell
             # which on windows leaves \r in a last empty attribute table cell
             # and causes error
             # and causes error
-            record = outFile.readline().strip().replace('\n', '')
+            record = decode(outFile.readline().strip()).replace('\n', '')
 
 
             if not record:
             if not record:
                 break
                 break
@@ -332,7 +339,7 @@ class VirtualAttributeList(wx.ListCtrl,
             cat = i + 1
             cat = i + 1
 
 
         for value in record:
         for value in record:
-            if self.columns[columns[j]]['ctype'] != types.StringType:
+            if self.columns[columns[j]]['ctype'] != str:
                 try:
                 try:
                     # casting disabled (2009/03)
                     # casting disabled (2009/03)
                     # self.itemDataMap[i].append(self.columns[columns[j]]['ctype'](value))
                     # self.itemDataMap[i].append(self.columns[columns[j]]['ctype'](value))
@@ -431,7 +438,7 @@ class VirtualAttributeList(wx.ListCtrl,
         """Column heading right mouse button -> pop-up menu"""
         """Column heading right mouse button -> pop-up menu"""
         self._col = event.GetColumn()
         self._col = event.GetColumn()
 
 
-        popupMenu = wx.Menu()
+        popupMenu = Menu()
 
 
         if not hasattr(self, "popupID"):
         if not hasattr(self, "popupID"):
             self.popupId = {'sortAsc': wx.NewId(),
             self.popupId = {'sortAsc': wx.NewId(),
@@ -452,7 +459,7 @@ class VirtualAttributeList(wx.ListCtrl,
         popupMenu.Append(self.popupId['sortAsc'], text=_("Sort ascending"))
         popupMenu.Append(self.popupId['sortAsc'], text=_("Sort ascending"))
         popupMenu.Append(self.popupId['sortDesc'], text=_("Sort descending"))
         popupMenu.Append(self.popupId['sortDesc'], text=_("Sort descending"))
         popupMenu.AppendSeparator()
         popupMenu.AppendSeparator()
-        subMenu = wx.Menu()
+        subMenu = Menu()
         popupMenu.AppendMenu(self.popupId['calculate'], _(
         popupMenu.AppendMenu(self.popupId['calculate'], _(
             "Calculate (only numeric columns)"), subMenu)
             "Calculate (only numeric columns)"), subMenu)
         popupMenu.Append(
         popupMenu.Append(
@@ -641,7 +648,7 @@ class VirtualAttributeList(wx.ListCtrl,
         """Sort items"""
         """Sort items"""
         wx.BeginBusyCursor()
         wx.BeginBusyCursor()
         items = list(self.itemDataMap.keys())
         items = list(self.itemDataMap.keys())
-        items.sort(self.Sorter)
+        items.sort(key=functools.cmp_to_key(self.Sorter))
         self.itemIndexMap = items
         self.itemIndexMap = items
 
 
         # redraw the list
         # redraw the list
@@ -661,8 +668,8 @@ class VirtualAttributeList(wx.ListCtrl,
             item2 = self.itemDataMap[key2][self._col]
             item2 = self.itemDataMap[key2][self._col]
 
 
         if isinstance(
         if isinstance(
-                item1, types.StringType) or isinstance(
-                item2, types.StringTypes):
+                item1, str) or isinstance(
+                item2, unicode):
             cmpVal = locale.strcoll(GetUnicodeValue(item1), GetUnicodeValue(item2))
             cmpVal = locale.strcoll(GetUnicodeValue(item1), GetUnicodeValue(item2))
         else:
         else:
             cmpVal = cmp(item1, item2)
             cmpVal = cmp(item1, item2)
@@ -1119,7 +1126,7 @@ class DbMgrBrowsePage(DbMgrNotebookBase):
         #   controls that are placed IN the wx.StaticBox, or it will freeze
         #   controls that are placed IN the wx.StaticBox, or it will freeze
         #   on the Mac
         #   on the Mac
 
 
-        listBox = wx.StaticBox(
+        listBox = StaticBox(
             parent=panel, id=wx.ID_ANY, label=" %s " %
             parent=panel, id=wx.ID_ANY, label=" %s " %
             _("Attribute data - right-click to edit/manage records"))
             _("Attribute data - right-click to edit/manage records"))
         listSizer = wx.StaticBoxSizer(listBox, wx.VERTICAL)
         listSizer = wx.StaticBoxSizer(listBox, wx.VERTICAL)
@@ -1151,8 +1158,8 @@ class DbMgrBrowsePage(DbMgrNotebookBase):
         sqlQueryPanel = wx.Panel(parent=panel, id=wx.ID_ANY)
         sqlQueryPanel = wx.Panel(parent=panel, id=wx.ID_ANY)
 
 
         # attribute data
         # attribute data
-        sqlBox = wx.StaticBox(parent=sqlQueryPanel, id=wx.ID_ANY,
-                              label=" %s " % _("SQL Query"))
+        sqlBox = StaticBox(parent=sqlQueryPanel, id=wx.ID_ANY,
+                           label=" %s " % _("SQL Query"))
 
 
         sqlSizer = wx.StaticBoxSizer(sqlBox, wx.VERTICAL)
         sqlSizer = wx.StaticBoxSizer(sqlBox, wx.VERTICAL)
 
 
@@ -1215,7 +1222,7 @@ class DbMgrBrowsePage(DbMgrNotebookBase):
             _("Example: %s") %
             _("Example: %s") %
             "MULTILANE = 'no' AND OBJECTID < 10")
             "MULTILANE = 'no' AND OBJECTID < 10")
 
 
-        sqlLabel = wx.StaticText(
+        sqlLabel = StaticText(
             parent=simpleSqlPanel,
             parent=simpleSqlPanel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label="SELECT * FROM %s WHERE " %
             label="SELECT * FROM %s WHERE " %
@@ -1225,7 +1232,7 @@ class DbMgrBrowsePage(DbMgrNotebookBase):
         sqlNtb.AddPage(page=advancedSqlPanel,
         sqlNtb.AddPage(page=advancedSqlPanel,
                        text=_('Builder'))
                        text=_('Builder'))
 
 
-        btnSqlBuilder = wx.Button(
+        btnSqlBuilder = Button(
             parent=advancedSqlPanel,
             parent=advancedSqlPanel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_("SQL Builder"))
             label=_("SQL Builder"))
@@ -1404,7 +1411,7 @@ class DbMgrBrowsePage(DbMgrNotebookBase):
 
 
         tlist = self.FindWindowById(self.layerPage[self.selLayer]['data'])
         tlist = self.FindWindowById(self.layerPage[self.selLayer]['data'])
         # generate popup-menu
         # generate popup-menu
-        menu = wx.Menu()
+        menu = Menu()
         menu.Append(self.popupDataID1, _("Edit selected record"))
         menu.Append(self.popupDataID1, _("Edit selected record"))
         selected = tlist.GetFirstSelected()
         selected = tlist.GetFirstSelected()
         if not self.dbMgrData[
         if not self.dbMgrData[
@@ -1778,7 +1785,7 @@ class DbMgrBrowsePage(DbMgrNotebookBase):
         else:
         else:
             fn = tlist.GetItems
             fn = tlist.GetItems
 
 
-        cats = map(int, fn())
+        cats = list(map(int, fn()))
 
 
         digitToolbar = None
         digitToolbar = None
         if 'vdigit' in self.mapdisplay.toolbars:
         if 'vdigit' in self.mapdisplay.toolbars:
@@ -1980,7 +1987,7 @@ class DbMgrBrowsePage(DbMgrNotebookBase):
             if digitToolbar and digitToolbar.GetLayer() and digitToolbar.GetLayer(
             if digitToolbar and digitToolbar.GetLayer() and digitToolbar.GetLayer(
             ).GetName() == self.dbMgrData['vectName']:
             ).GetName() == self.dbMgrData['vectName']:
                 display = self.mapdisplay.GetMapWindow().GetDisplay()
                 display = self.mapdisplay.GetMapWindow().GetDisplay()
-                display.SetSelected(map(int, cats), layer=self.selLayer)
+                display.SetSelected(list(map(int, cats)), layer=self.selLayer)
                 self.mapdisplay.MapWindow.UpdateMap(
                 self.mapdisplay.MapWindow.UpdateMap(
                     render=True, renderVector=True)
                     render=True, renderVector=True)
 
 
@@ -2274,8 +2281,8 @@ class DbMgrTablesPage(DbMgrNotebookBase):
         #
         #
         # dbInfo
         # dbInfo
         #
         #
-        dbBox = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                             label=" %s " % _("Database connection"))
+        dbBox = StaticBox(parent=panel, id=wx.ID_ANY,
+                          label=" %s " % _("Database connection"))
         dbSizer = wx.StaticBoxSizer(dbBox, wx.VERTICAL)
         dbSizer = wx.StaticBoxSizer(dbBox, wx.VERTICAL)
         dbSizer.Add(
         dbSizer.Add(
             CreateDbInfoDesc(
             CreateDbInfoDesc(
@@ -2290,7 +2297,7 @@ class DbMgrTablesPage(DbMgrNotebookBase):
         # table description
         # table description
         #
         #
         table = self.dbMgrData['mapDBInfo'].layers[layer]['table']
         table = self.dbMgrData['mapDBInfo'].layers[layer]['table']
-        tableBox = wx.StaticBox(
+        tableBox = StaticBox(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=" %s " %
             label=" %s " %
@@ -2305,17 +2312,17 @@ class DbMgrTablesPage(DbMgrNotebookBase):
         self.layerPage[layer]['tableData'] = tlist.GetId()
         self.layerPage[layer]['tableData'] = tlist.GetId()
 
 
         # manage columns (add)
         # manage columns (add)
-        addBox = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                              label=" %s " % _("Add column"))
+        addBox = StaticBox(parent=panel, id=wx.ID_ANY,
+                           label=" %s " % _("Add column"))
         addSizer = wx.StaticBoxSizer(addBox, wx.HORIZONTAL)
         addSizer = wx.StaticBoxSizer(addBox, wx.HORIZONTAL)
 
 
-        column = wx.TextCtrl(parent=panel, id=wx.ID_ANY, value='',
-                             size=(150, -1), style=wx.TE_PROCESS_ENTER)
+        column = TextCtrl(parent=panel, id=wx.ID_ANY, value='',
+                          size=(150, -1), style=wx.TE_PROCESS_ENTER)
         column.Bind(wx.EVT_TEXT, self.OnTableAddColumnName)
         column.Bind(wx.EVT_TEXT, self.OnTableAddColumnName)
         column.Bind(wx.EVT_TEXT_ENTER, self.OnTableItemAdd)
         column.Bind(wx.EVT_TEXT_ENTER, self.OnTableItemAdd)
         self.layerPage[layer]['addColName'] = column.GetId()
         self.layerPage[layer]['addColName'] = column.GetId()
         addSizer.Add(
         addSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Column")),
                 label=_("Column")),
@@ -2334,7 +2341,7 @@ class DbMgrTablesPage(DbMgrNotebookBase):
         ctype.Bind(wx.EVT_CHOICE, self.OnTableChangeType)
         ctype.Bind(wx.EVT_CHOICE, self.OnTableChangeType)
         self.layerPage[layer]['addColType'] = ctype.GetId()
         self.layerPage[layer]['addColType'] = ctype.GetId()
         addSizer.Add(
         addSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Type")),
                 label=_("Type")),
@@ -2350,7 +2357,7 @@ class DbMgrTablesPage(DbMgrNotebookBase):
         length.Enable(False)
         length.Enable(False)
         self.layerPage[layer]['addColLength'] = length.GetId()
         self.layerPage[layer]['addColLength'] = length.GetId()
         addSizer.Add(
         addSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Length")),
                 label=_("Length")),
@@ -2360,7 +2367,7 @@ class DbMgrTablesPage(DbMgrNotebookBase):
                      flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT,
                      flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT,
                      border=5)
                      border=5)
 
 
-        btnAddCol = wx.Button(parent=panel, id=wx.ID_ANY, label=_("Add"))
+        btnAddCol = Button(parent=panel, id=wx.ID_ANY, label=_("Add"))
         btnAddCol.Bind(wx.EVT_BUTTON, self.OnTableItemAdd)
         btnAddCol.Bind(wx.EVT_BUTTON, self.OnTableItemAdd)
         btnAddCol.Enable(False)
         btnAddCol.Enable(False)
         self.layerPage[layer]['addColButton'] = btnAddCol.GetId()
         self.layerPage[layer]['addColButton'] = btnAddCol.GetId()
@@ -2368,8 +2375,8 @@ class DbMgrTablesPage(DbMgrNotebookBase):
                      border=3)
                      border=3)
 
 
         # manage columns (rename)
         # manage columns (rename)
-        renameBox = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                                 label=" %s " % _("Rename column"))
+        renameBox = StaticBox(parent=panel, id=wx.ID_ANY,
+                              label=" %s " % _("Rename column"))
         renameSizer = wx.StaticBoxSizer(renameBox, wx.HORIZONTAL)
         renameSizer = wx.StaticBoxSizer(renameBox, wx.HORIZONTAL)
 
 
         columnFrom = wx.ComboBox(
         columnFrom = wx.ComboBox(
@@ -2379,7 +2386,7 @@ class DbMgrTablesPage(DbMgrNotebookBase):
         columnFrom.SetSelection(0)
         columnFrom.SetSelection(0)
         self.layerPage[layer]['renameCol'] = columnFrom.GetId()
         self.layerPage[layer]['renameCol'] = columnFrom.GetId()
         renameSizer.Add(
         renameSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Column")),
                 label=_("Column")),
@@ -2389,13 +2396,13 @@ class DbMgrTablesPage(DbMgrNotebookBase):
                         flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT,
                         flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT,
                         border=5)
                         border=5)
 
 
-        columnTo = wx.TextCtrl(parent=panel, id=wx.ID_ANY, value='',
-                               size=(150, -1), style=wx.TE_PROCESS_ENTER)
+        columnTo = TextCtrl(parent=panel, id=wx.ID_ANY, value='',
+                            size=(150, -1), style=wx.TE_PROCESS_ENTER)
         columnTo.Bind(wx.EVT_TEXT, self.OnTableRenameColumnName)
         columnTo.Bind(wx.EVT_TEXT, self.OnTableRenameColumnName)
         columnTo.Bind(wx.EVT_TEXT_ENTER, self.OnTableItemChange)
         columnTo.Bind(wx.EVT_TEXT_ENTER, self.OnTableItemChange)
         self.layerPage[layer]['renameColTo'] = columnTo.GetId()
         self.layerPage[layer]['renameColTo'] = columnTo.GetId()
         renameSizer.Add(
         renameSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("To")),
                 label=_("To")),
@@ -2405,7 +2412,7 @@ class DbMgrTablesPage(DbMgrNotebookBase):
                         flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT,
                         flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT,
                         border=5)
                         border=5)
 
 
-        btnRenameCol = wx.Button(
+        btnRenameCol = Button(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_("&Rename"))
             label=_("&Rename"))
@@ -2580,7 +2587,7 @@ class DbMgrTablesPage(DbMgrNotebookBase):
             self.Bind(wx.EVT_MENU, self.OnTableReload, id=self.popupTableID3)
             self.Bind(wx.EVT_MENU, self.OnTableReload, id=self.popupTableID3)
 
 
         # generate popup-menu
         # generate popup-menu
-        menu = wx.Menu()
+        menu = Menu()
         menu.Append(self.popupTableID1, _("Drop selected column"))
         menu.Append(self.popupTableID1, _("Drop selected column"))
         if self.FindWindowById(self.layerPage[self.selLayer][
         if self.FindWindowById(self.layerPage[self.selLayer][
                                'tableData']).GetFirstSelected() == -1:
                                'tableData']).GetFirstSelected() == -1:
@@ -2766,8 +2773,8 @@ class DbMgrLayersPage(wx.Panel):
         panelList = wx.Panel(parent=splitterWin, id=wx.ID_ANY)
         panelList = wx.Panel(parent=splitterWin, id=wx.ID_ANY)
 
 
         panelListSizer = wx.BoxSizer(wx.VERTICAL)
         panelListSizer = wx.BoxSizer(wx.VERTICAL)
-        layerBox = wx.StaticBox(parent=panelList, id=wx.ID_ANY,
-                                label=" %s " % _("List of layers"))
+        layerBox = StaticBox(parent=panelList, id=wx.ID_ANY,
+                             label=" %s " % _("List of layers"))
         layerSizer = wx.StaticBoxSizer(layerBox, wx.VERTICAL)
         layerSizer = wx.StaticBoxSizer(layerBox, wx.VERTICAL)
 
 
         self.layerList = self._createLayerDesc(panelList)
         self.layerList = self._createLayerDesc(panelList)
@@ -2838,7 +2845,7 @@ class DbMgrLayersPage(wx.Panel):
         self.layerList.Update(self.dbMgrData['mapDBInfo'].layers)
         self.layerList.Update(self.dbMgrData['mapDBInfo'].layers)
         self.layerList.Populate(update=True)
         self.layerList.Populate(update=True)
         # update selected widgets
         # update selected widgets
-        listOfLayers = map(str, self.dbMgrData['mapDBInfo'].layers.keys())
+        listOfLayers = list(map(str, self.dbMgrData['mapDBInfo'].layers.keys()))
         # delete layer page
         # delete layer page
         self.manageLayerBook.deleteLayer.SetItems(listOfLayers)
         self.manageLayerBook.deleteLayer.SetItems(listOfLayers)
         if len(listOfLayers) > 0:
         if len(listOfLayers) > 0:
@@ -3063,38 +3070,38 @@ class LayerBook(wx.Notebook):
 
 
         # layer description
         # layer description
 
 
-        layerBox = wx.StaticBox(parent=self.addPanel, id=wx.ID_ANY,
-                                label=" %s " % (_("Layer description")))
+        layerBox = StaticBox(parent=self.addPanel, id=wx.ID_ANY,
+                             label=" %s " % (_("Layer description")))
         layerSizer = wx.StaticBoxSizer(layerBox, wx.VERTICAL)
         layerSizer = wx.StaticBoxSizer(layerBox, wx.VERTICAL)
 
 
         #
         #
         # list of layer widgets (label, value)
         # list of layer widgets (label, value)
         #
         #
         self.addLayerWidgets = {'layer':
         self.addLayerWidgets = {'layer':
-                                (wx.StaticText(parent=self.addPanel, id=wx.ID_ANY,
-                                               label='%s:' % _("Layer")),
+                                (StaticText(parent=self.addPanel, id=wx.ID_ANY,
+                                            label='%s:' % _("Layer")),
                                  SpinCtrl(parent=self.addPanel, id=wx.ID_ANY, size=(65, -1),
                                  SpinCtrl(parent=self.addPanel, id=wx.ID_ANY, size=(65, -1),
                                           initial=maxLayer + 1,
                                           initial=maxLayer + 1,
                                           min=1, max=1e6)),
                                           min=1, max=1e6)),
                                 'driver':
                                 'driver':
-                                    (wx.StaticText(parent=self.addPanel, id=wx.ID_ANY,
-                                                   label='%s:' % _("Driver")),
+                                    (StaticText(parent=self.addPanel, id=wx.ID_ANY,
+                                                label='%s:' % _("Driver")),
                                      wx.Choice(parent=self.addPanel, id=wx.ID_ANY, size=(200, -1),
                                      wx.Choice(parent=self.addPanel, id=wx.ID_ANY, size=(200, -1),
                                                choices=self.listOfDrivers)),
                                                choices=self.listOfDrivers)),
                                 'database':
                                 'database':
-                                    (wx.StaticText(parent=self.addPanel, id=wx.ID_ANY,
-                                                   label='%s:' % _("Database")),
-                                     wx.TextCtrl(parent=self.addPanel, id=wx.ID_ANY,
-                                                 value='',
-                                                 style=wx.TE_PROCESS_ENTER)),
+                                    (StaticText(parent=self.addPanel, id=wx.ID_ANY,
+                                                label='%s:' % _("Database")),
+                                     TextCtrl(parent=self.addPanel, id=wx.ID_ANY,
+                                              value='',
+                                              style=wx.TE_PROCESS_ENTER)),
                                 'table':
                                 'table':
-                                    (wx.StaticText(parent=self.addPanel, id=wx.ID_ANY,
-                                                   label='%s:' % _("Table")),
+                                    (StaticText(parent=self.addPanel, id=wx.ID_ANY,
+                                                label='%s:' % _("Table")),
                                      wx.Choice(parent=self.addPanel, id=wx.ID_ANY, size=(200, -1),
                                      wx.Choice(parent=self.addPanel, id=wx.ID_ANY, size=(200, -1),
                                                choices=self.defaultTables)),
                                                choices=self.defaultTables)),
                                 'key':
                                 'key':
-                                    (wx.StaticText(parent=self.addPanel, id=wx.ID_ANY,
-                                                   label='%s:' % _("Key column")),
+                                    (StaticText(parent=self.addPanel, id=wx.ID_ANY,
+                                                label='%s:' % _("Key column")),
                                      wx.Choice(parent=self.addPanel, id=wx.ID_ANY, size=(200, -1),
                                      wx.Choice(parent=self.addPanel, id=wx.ID_ANY, size=(200, -1),
                                                choices=self.defaultColumns)),
                                                choices=self.defaultColumns)),
                                 'addCat':
                                 'addCat':
@@ -3124,38 +3131,38 @@ class LayerBook(wx.Notebook):
             _("You need to add categories " "by v.category module."))
             _("You need to add categories " "by v.category module."))
 
 
         # table description
         # table description
-        tableBox = wx.StaticBox(parent=self.addPanel, id=wx.ID_ANY,
-                                label=" %s " % (_("Table description")))
+        tableBox = StaticBox(parent=self.addPanel, id=wx.ID_ANY,
+                             label=" %s " % (_("Table description")))
         tableSizer = wx.StaticBoxSizer(tableBox, wx.VERTICAL)
         tableSizer = wx.StaticBoxSizer(tableBox, wx.VERTICAL)
 
 
         #
         #
         # list of table widgets
         # list of table widgets
         #
         #
         keyCol = UserSettings.Get(group='atm', key='keycolumn', subkey='value')
         keyCol = UserSettings.Get(group='atm', key='keycolumn', subkey='value')
-        self.tableWidgets = {'table': (wx.StaticText(parent=self.addPanel, id=wx.ID_ANY,
-                                                     label='%s:' % _("Table name")),
-                                       wx.TextCtrl(parent=self.addPanel, id=wx.ID_ANY,
-                                                   value='',
-                                                   style=wx.TE_PROCESS_ENTER)),
-                             'key': (wx.StaticText(parent=self.addPanel, id=wx.ID_ANY,
-                                                   label='%s:' % _("Key column")),
-                                     wx.TextCtrl(parent=self.addPanel, id=wx.ID_ANY,
-                                                 value=keyCol,
-                                                 style=wx.TE_PROCESS_ENTER))}
+        self.tableWidgets = {'table': (StaticText(parent=self.addPanel, id=wx.ID_ANY,
+                                                  label='%s:' % _("Table name")),
+                                       TextCtrl(parent=self.addPanel, id=wx.ID_ANY,
+                                                value='',
+                                                style=wx.TE_PROCESS_ENTER)),
+                             'key': (StaticText(parent=self.addPanel, id=wx.ID_ANY,
+                                                label='%s:' % _("Key column")),
+                                     TextCtrl(parent=self.addPanel, id=wx.ID_ANY,
+                                              value=keyCol,
+                                              style=wx.TE_PROCESS_ENTER))}
         # events
         # events
         self.tableWidgets['table'][1].Bind(
         self.tableWidgets['table'][1].Bind(
             wx.EVT_TEXT_ENTER, self.OnCreateTable)
             wx.EVT_TEXT_ENTER, self.OnCreateTable)
         self.tableWidgets['key'][1].Bind(wx.EVT_TEXT_ENTER, self.OnCreateTable)
         self.tableWidgets['key'][1].Bind(wx.EVT_TEXT_ENTER, self.OnCreateTable)
 
 
-        btnTable = wx.Button(self.addPanel, wx.ID_ANY, _("&Create table"),
+        btnTable = Button(self.addPanel, wx.ID_ANY, _("&Create table"),
                              size=(125, -1))
                              size=(125, -1))
         btnTable.Bind(wx.EVT_BUTTON, self.OnCreateTable)
         btnTable.Bind(wx.EVT_BUTTON, self.OnCreateTable)
 
 
-        btnLayer = wx.Button(self.addPanel, wx.ID_ANY, _("&Add layer"),
+        btnLayer = Button(self.addPanel, wx.ID_ANY, _("&Add layer"),
                              size=(125, -1))
                              size=(125, -1))
         btnLayer.Bind(wx.EVT_BUTTON, self.OnAddLayer)
         btnLayer.Bind(wx.EVT_BUTTON, self.OnAddLayer)
 
 
-        btnDefault = wx.Button(self.addPanel, wx.ID_ANY, _("&Set default"),
+        btnDefault = Button(self.addPanel, wx.ID_ANY, _("&Set default"),
                                size=(125, -1))
                                size=(125, -1))
         btnDefault.Bind(wx.EVT_BUTTON, self.OnSetDefault)
         btnDefault.Bind(wx.EVT_BUTTON, self.OnSetDefault)
 
 
@@ -3261,13 +3268,13 @@ class LayerBook(wx.Notebook):
         self.deletePanel = wx.Panel(parent=self, id=wx.ID_ANY)
         self.deletePanel = wx.Panel(parent=self, id=wx.ID_ANY)
         self.AddPage(page=self.deletePanel, text=_("Remove layer"))
         self.AddPage(page=self.deletePanel, text=_("Remove layer"))
 
 
-        label = wx.StaticText(parent=self.deletePanel, id=wx.ID_ANY,
-                              label='%s:' % _("Layer to remove"))
+        label = StaticText(parent=self.deletePanel, id=wx.ID_ANY,
+                           label='%s:' % _("Layer to remove"))
 
 
         self.deleteLayer = wx.ComboBox(
         self.deleteLayer = wx.ComboBox(
             parent=self.deletePanel, id=wx.ID_ANY, size=(100, -1),
             parent=self.deletePanel, id=wx.ID_ANY, size=(100, -1),
             style=wx.CB_SIMPLE | wx.CB_READONLY,
             style=wx.CB_SIMPLE | wx.CB_READONLY,
-            choices=map(str, self.mapDBInfo.layers.keys()))
+            choices=list(map(str, self.mapDBInfo.layers.keys())))
         self.deleteLayer.SetSelection(0)
         self.deleteLayer.SetSelection(0)
         self.deleteLayer.Bind(wx.EVT_COMBOBOX, self.OnChangeLayer)
         self.deleteLayer.Bind(wx.EVT_COMBOBOX, self.OnChangeLayer)
 
 
@@ -3287,7 +3294,7 @@ class LayerBook(wx.Notebook):
             self.deleteLayer.Enable(False)
             self.deleteLayer.Enable(False)
             self.deleteTable.Enable(False)
             self.deleteTable.Enable(False)
 
 
-        btnDelete = wx.Button(
+        btnDelete = Button(
             self.deletePanel, wx.ID_DELETE, _("&Remove layer"),
             self.deletePanel, wx.ID_DELETE, _("&Remove layer"),
             size=(125, -1))
             size=(125, -1))
         btnDelete.Bind(wx.EVT_BUTTON, self.OnDeleteLayer)
         btnDelete.Bind(wx.EVT_BUTTON, self.OnDeleteLayer)
@@ -3337,34 +3344,34 @@ class LayerBook(wx.Notebook):
         # list of layer widgets (label, value)
         # list of layer widgets (label, value)
         #
         #
         self.modifyLayerWidgets = {'layer':
         self.modifyLayerWidgets = {'layer':
-                                   (wx.StaticText(parent=self.modifyPanel, id=wx.ID_ANY,
-                                                  label='%s:' % _("Layer")),
+                                   (StaticText(parent=self.modifyPanel, id=wx.ID_ANY,
+                                               label='%s:' % _("Layer")),
                                     wx.ComboBox(parent=self.modifyPanel, id=wx.ID_ANY,
                                     wx.ComboBox(parent=self.modifyPanel, id=wx.ID_ANY,
                                                 size=(100, -1),
                                                 size=(100, -1),
                                                 style=wx.CB_SIMPLE | wx.CB_READONLY,
                                                 style=wx.CB_SIMPLE | wx.CB_READONLY,
-                                                choices=map(str,
-                                                            self.mapDBInfo.layers.keys()))),
+                                                choices=list(map(str,
+                                                            self.mapDBInfo.layers.keys())))),
                                    'driver':
                                    'driver':
-                                       (wx.StaticText(parent=self.modifyPanel, id=wx.ID_ANY,
-                                                      label='%s:' % _("Driver")),
+                                       (StaticText(parent=self.modifyPanel, id=wx.ID_ANY,
+                                                   label='%s:' % _("Driver")),
                                         wx.Choice(parent=self.modifyPanel, id=wx.ID_ANY,
                                         wx.Choice(parent=self.modifyPanel, id=wx.ID_ANY,
                                                   size=(200, -1),
                                                   size=(200, -1),
                                                   choices=self.listOfDrivers)),
                                                   choices=self.listOfDrivers)),
                                    'database':
                                    'database':
-                                       (wx.StaticText(parent=self.modifyPanel, id=wx.ID_ANY,
-                                                      label='%s:' % _("Database")),
-                                        wx.TextCtrl(parent=self.modifyPanel, id=wx.ID_ANY,
-                                                    value='', size=(350, -1),
-                                                    style=wx.TE_PROCESS_ENTER)),
+                                       (StaticText(parent=self.modifyPanel, id=wx.ID_ANY,
+                                                   label='%s:' % _("Database")),
+                                        TextCtrl(parent=self.modifyPanel, id=wx.ID_ANY,
+                                                 value='', size=(350, -1),
+                                                 style=wx.TE_PROCESS_ENTER)),
                                    'table':
                                    'table':
-                                       (wx.StaticText(parent=self.modifyPanel, id=wx.ID_ANY,
-                                                      label='%s:' % _("Table")),
+                                       (StaticText(parent=self.modifyPanel, id=wx.ID_ANY,
+                                                   label='%s:' % _("Table")),
                                         wx.Choice(parent=self.modifyPanel, id=wx.ID_ANY,
                                         wx.Choice(parent=self.modifyPanel, id=wx.ID_ANY,
                                                   size=(200, -1),
                                                   size=(200, -1),
                                                   choices=self.defaultTables)),
                                                   choices=self.defaultTables)),
                                    'key':
                                    'key':
-                                       (wx.StaticText(parent=self.modifyPanel, id=wx.ID_ANY,
-                                                      label='%s:' % _("Key column")),
+                                       (StaticText(parent=self.modifyPanel, id=wx.ID_ANY,
+                                                   label='%s:' % _("Key column")),
                                         wx.Choice(parent=self.modifyPanel, id=wx.ID_ANY,
                                         wx.Choice(parent=self.modifyPanel, id=wx.ID_ANY,
                                                   size=(200, -1),
                                                   size=(200, -1),
                                                   choices=self.defaultColumns))}
                                                   choices=self.defaultColumns))}
@@ -3406,7 +3413,7 @@ class LayerBook(wx.Notebook):
         # self.modifyLayerWidgets['database'][1].Bind(wx.EVT_TEXT_ENTER, self.OnDatabaseChanged)
         # self.modifyLayerWidgets['database'][1].Bind(wx.EVT_TEXT_ENTER, self.OnDatabaseChanged)
         # self.modifyLayerWidgets['table'][1].Bind(wx.EVT_CHOICE, self.OnTableChanged)
         # self.modifyLayerWidgets['table'][1].Bind(wx.EVT_CHOICE, self.OnTableChanged)
 
 
-        btnModify = wx.Button(
+        btnModify = Button(
             self.modifyPanel, wx.ID_DELETE, _("&Modify layer"),
             self.modifyPanel, wx.ID_DELETE, _("&Modify layer"),
             size=(125, -1))
             size=(125, -1))
         btnModify.Bind(wx.EVT_BUTTON, self.OnModifyLayer)
         btnModify.Bind(wx.EVT_BUTTON, self.OnModifyLayer)
@@ -3782,7 +3789,7 @@ class FieldStatistics(wx.Frame):
 
 
         self.sp = scrolled.ScrolledPanel(parent=self.panel, id=wx.ID_ANY, size=(
         self.sp = scrolled.ScrolledPanel(parent=self.panel, id=wx.ID_ANY, size=(
             250, 150), style=wx.TAB_TRAVERSAL | wx.SUNKEN_BORDER, name="Statistics")
             250, 150), style=wx.TAB_TRAVERSAL | wx.SUNKEN_BORDER, name="Statistics")
-        self.text = wx.TextCtrl(
+        self.text = TextCtrl(
             parent=self.sp,
             parent=self.sp,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             style=wx.TE_MULTILINE | wx.TE_READONLY)
             style=wx.TE_MULTILINE | wx.TE_READONLY)
@@ -3792,7 +3799,7 @@ class FieldStatistics(wx.Frame):
         self.btnClipboard = Button(parent=self.panel, id=wx.ID_COPY)
         self.btnClipboard = Button(parent=self.panel, id=wx.ID_COPY)
         self.btnClipboard.SetToolTip(
         self.btnClipboard.SetToolTip(
             _("Copy statistics the clipboard (Ctrl+C)"))
             _("Copy statistics the clipboard (Ctrl+C)"))
-        self.btnCancel = wx.Button(parent=self.panel, id=wx.ID_CLOSE)
+        self.btnCancel = Button(parent=self.panel, id=wx.ID_CLOSE)
         self.btnCancel.SetDefault()
         self.btnCancel.SetDefault()
 
 
         # bindings
         # bindings
@@ -3915,7 +3922,7 @@ class FieldStatistics(wx.Frame):
             GWarning(parent=self.parent,
             GWarning(parent=self.parent,
                      message=_("Unable to calculte standard deviation."))
                      message=_("Unable to calculte standard deviation."))
         varSum = 0
         varSum = 0
-        for var in dataVar.splitlines():
+        for var in decode(dataVar).splitlines():
             varSum += float(var)
             varSum += float(var)
         stddev = math.sqrt(varSum / count)
         stddev = math.sqrt(varSum / count)
 
 

+ 32 - 30
gui/wxpython/dbmgr/dialogs.py

@@ -19,6 +19,7 @@ This program is free software under the GNU General Public License
 
 
 import os
 import os
 import types
 import types
+import six
 
 
 from core import globalvar
 from core import globalvar
 from core.utils import _
 from core.utils import _
@@ -30,7 +31,8 @@ from core.debug import Debug
 from core.settings import UserSettings
 from core.settings import UserSettings
 from dbmgr.vinfo import VectorDBInfo, GetUnicodeValue
 from dbmgr.vinfo import VectorDBInfo, GetUnicodeValue
 from gui_core.widgets import IntegerValidator, FloatValidator
 from gui_core.widgets import IntegerValidator, FloatValidator
-from gui_core.wrap import SpinCtrl
+from gui_core.wrap import SpinCtrl, Button, StaticText, StaticBox, \
+    TextCtrl
 
 
 
 
 class DisplayAttributesDialog(wx.Dialog):
 class DisplayAttributesDialog(wx.Dialog):
@@ -110,10 +112,10 @@ class DisplayAttributesDialog(wx.Dialog):
         self.fidMulti = wx.Choice(parent=self, id=wx.ID_ANY,
         self.fidMulti = wx.Choice(parent=self, id=wx.ID_ANY,
                                   size=(150, -1))
                                   size=(150, -1))
         self.fidMulti.Bind(wx.EVT_CHOICE, self.OnFeature)
         self.fidMulti.Bind(wx.EVT_CHOICE, self.OnFeature)
-        self.fidText = wx.StaticText(parent=self, id=wx.ID_ANY)
+        self.fidText = StaticText(parent=self, id=wx.ID_ANY)
 
 
-        self.noFoundMsg = wx.StaticText(parent=self, id=wx.ID_ANY,
-                                        label=_("No attributes found"))
+        self.noFoundMsg = StaticText(parent=self, id=wx.ID_ANY,
+                                     label=_("No attributes found"))
 
 
         self.UpdateDialog(query=query, cats=cats)
         self.UpdateDialog(query=query, cats=cats)
 
 
@@ -126,9 +128,9 @@ class DisplayAttributesDialog(wx.Dialog):
             self.SetTitle(_("Display attributes"))
             self.SetTitle(_("Display attributes"))
 
 
         # buttons
         # buttons
-        btnCancel = wx.Button(self, wx.ID_CANCEL)
-        btnReset = wx.Button(self, wx.ID_UNDO, _("&Reload"))
-        btnSubmit = wx.Button(self, wx.ID_OK, _("&Submit"))
+        btnCancel = Button(self, wx.ID_CANCEL)
+        btnReset = Button(self, wx.ID_UNDO, _("&Reload"))
+        btnSubmit = Button(self, wx.ID_OK, _("&Submit"))
         if self.action == 'display':
         if self.action == 'display':
             btnSubmit.Enable(False)
             btnSubmit.Enable(False)
 
 
@@ -145,8 +147,8 @@ class DisplayAttributesDialog(wx.Dialog):
         mainSizer.Add(self.notebook, proportion=1,
         mainSizer.Add(self.notebook, proportion=1,
                       flag=wx.EXPAND | wx.ALL, border=5)
                       flag=wx.EXPAND | wx.ALL, border=5)
         fidSizer = wx.BoxSizer(wx.HORIZONTAL)
         fidSizer = wx.BoxSizer(wx.HORIZONTAL)
-        fidSizer.Add(wx.StaticText(parent=self, id=wx.ID_ANY,
-                                   label=_("Feature id:")),
+        fidSizer.Add(StaticText(parent=self, id=wx.ID_ANY,
+                                label=_("Feature id:")),
                      proportion=0, border=5,
                      proportion=0, border=5,
                      flag=wx.ALIGN_CENTER_VERTICAL)
                      flag=wx.ALIGN_CENTER_VERTICAL)
         fidSizer.Add(self.fidMulti, proportion=0,
         fidSizer.Add(self.fidMulti, proportion=0,
@@ -536,11 +538,11 @@ class DisplayAttributesDialog(wx.Dialog):
                     else:
                     else:
                         value = ''
                         value = ''
 
 
-                    colName = wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                            label=name)
-                    colType = wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                            label="[%s]:" % vtype)
-                    colValue = wx.TextCtrl(
+                    colName = StaticText(parent=panel, id=wx.ID_ANY,
+                                         label=name)
+                    colType = StaticText(parent=panel, id=wx.ID_ANY,
+                                         label="[%s]:" % vtype)
+                    colValue = TextCtrl(
                         parent=panel, id=wx.ID_ANY, value=value)
                         parent=panel, id=wx.ID_ANY, value=value)
                     colValue.SetName(name)
                     colValue.SetName(name)
                     if ctype == int:
                     if ctype == int:
@@ -591,7 +593,7 @@ class DisplayAttributesDialog(wx.Dialog):
         table = self.mapDBInfo.GetTable(layer)
         table = self.mapDBInfo.GetTable(layer)
         columns = self.mapDBInfo.GetTableDesc(table)
         columns = self.mapDBInfo.GetTableDesc(table)
 
 
-        for key, col in columns.iteritems():
+        for key, col in six.iteritems(columns):
             if key == column:
             if key == column:
                 col['values'] = [col['ctype'](value), ]
                 col['values'] = [col['ctype'](value), ]
                 break
                 break
@@ -614,15 +616,15 @@ class ModifyTableRecord(wx.Dialog):
 
 
         self.keyId = keyEditable[0]
         self.keyId = keyEditable[0]
 
 
-        box = wx.StaticBox(parent=self, id=wx.ID_ANY)
+        box = StaticBox(parent=self, id=wx.ID_ANY)
         box.Hide()
         box.Hide()
         self.dataPanel = scrolled.ScrolledPanel(parent=self, id=wx.ID_ANY,
         self.dataPanel = scrolled.ScrolledPanel(parent=self, id=wx.ID_ANY,
                                                 style=wx.TAB_TRAVERSAL)
                                                 style=wx.TAB_TRAVERSAL)
         self.dataPanel.SetupScrolling(scroll_x=False)
         self.dataPanel.SetupScrolling(scroll_x=False)
 
 
         # buttons
         # buttons
-        self.btnCancel = wx.Button(self, wx.ID_CANCEL)
-        self.btnSubmit = wx.Button(self, wx.ID_OK, _("&Submit"))
+        self.btnCancel = Button(self, wx.ID_CANCEL)
+        self.btnSubmit = Button(self, wx.ID_OK, _("&Submit"))
         self.btnSubmit.SetDefault()
         self.btnSubmit.SetDefault()
 
 
         # data area
         # data area
@@ -647,8 +649,8 @@ class ModifyTableRecord(wx.Dialog):
                         parent=self.dataPanel, id=wx.ID_ANY, value=value,
                         parent=self.dataPanel, id=wx.ID_ANY, value=value,
                         min=-1e9, max=1e9, size=(250, -1))
                         min=-1e9, max=1e9, size=(250, -1))
             else:
             else:
-                valueWin = wx.TextCtrl(parent=self.dataPanel, id=wx.ID_ANY,
-                                       value=value, size=(250, -1))
+                valueWin = TextCtrl(parent=self.dataPanel, id=wx.ID_ANY,
+                                    value=value, size=(250, -1))
                 if ctype == int:
                 if ctype == int:
                     valueWin.SetValidator(IntegerValidator())
                     valueWin.SetValidator(IntegerValidator())
                 elif ctype == float:
                 elif ctype == float:
@@ -657,10 +659,10 @@ class ModifyTableRecord(wx.Dialog):
                     wx.CallAfter(valueWin.SetFocus)
                     wx.CallAfter(valueWin.SetFocus)
                     winFocus = True
                     winFocus = True
 
 
-            label = wx.StaticText(parent=self.dataPanel, id=wx.ID_ANY,
-                                  label=column)
-            ctype = wx.StaticText(parent=self.dataPanel, id=wx.ID_ANY,
-                                  label="[%s]:" % ctypeStr.lower())
+            label = StaticText(parent=self.dataPanel, id=wx.ID_ANY,
+                               label=column)
+            ctype = StaticText(parent=self.dataPanel, id=wx.ID_ANY,
+                               label="[%s]:" % ctypeStr.lower())
             self.widgets.append(
             self.widgets.append(
                 (label.GetId(), ctype.GetId(), valueWin.GetId()))
                 (label.GetId(), ctype.GetId(), valueWin.GetId()))
 
 
@@ -752,7 +754,7 @@ class AddColumnDialog(wx.Dialog):
         self.CenterOnParent()
         self.CenterOnParent()
 
 
         self.data = {}
         self.data = {}
-        self.data['addColName'] = wx.TextCtrl(
+        self.data['addColName'] = TextCtrl(
             parent=self, id=wx.ID_ANY, value='', size=(
             parent=self, id=wx.ID_ANY, value='', size=(
                 150, -1), style=wx.TE_PROCESS_ENTER)
                 150, -1), style=wx.TE_PROCESS_ENTER)
 
 
@@ -770,8 +772,8 @@ class AddColumnDialog(wx.Dialog):
         self.data['addColLength'].Enable(False)
         self.data['addColLength'].Enable(False)
 
 
         # buttons
         # buttons
-        self.btnCancel = wx.Button(self, wx.ID_CANCEL)
-        self.btnOk = wx.Button(self, wx.ID_OK)
+        self.btnCancel = Button(self, wx.ID_CANCEL)
+        self.btnOk = Button(self, wx.ID_OK)
         self.btnOk.SetDefault()
         self.btnOk.SetDefault()
 
 
         self._layout()
         self._layout()
@@ -782,7 +784,7 @@ class AddColumnDialog(wx.Dialog):
         addSizer = wx.BoxSizer(wx.HORIZONTAL)
         addSizer = wx.BoxSizer(wx.HORIZONTAL)
 
 
         addSizer.Add(
         addSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 parent=self,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Column")),
                 label=_("Column")),
@@ -793,7 +795,7 @@ class AddColumnDialog(wx.Dialog):
                      border=5)
                      border=5)
 
 
         addSizer.Add(
         addSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 parent=self,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Type")),
                 label=_("Type")),
@@ -804,7 +806,7 @@ class AddColumnDialog(wx.Dialog):
                      border=5)
                      border=5)
 
 
         addSizer.Add(
         addSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 parent=self,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Length")),
                 label=_("Length")),

+ 35 - 34
gui/wxpython/dbmgr/sqlbuilder.py

@@ -28,6 +28,7 @@ from __future__ import print_function
 
 
 import os
 import os
 import sys
 import sys
+import six
 
 
 from core import globalvar
 from core import globalvar
 from core.utils import _
 from core.utils import _
@@ -37,6 +38,7 @@ from grass.pydispatch.signal import Signal
 
 
 from core.gcmd import RunCommand, GError, GMessage
 from core.gcmd import RunCommand, GError, GMessage
 from dbmgr.vinfo import CreateDbInfoDesc, VectorDBInfo, GetUnicodeValue
 from dbmgr.vinfo import CreateDbInfoDesc, VectorDBInfo, GetUnicodeValue
+from gui_core.wrap import Button, TextCtrl, StaticText, StaticBox
 
 
 import grass.script as grass
 import grass.script as grass
 
 
@@ -95,8 +97,8 @@ class SQLBuilder(wx.Frame):
 
 
         # dbInfo
         # dbInfo
         if showDbInfo:
         if showDbInfo:
-            databasebox = wx.StaticBox(parent=self.panel, id=wx.ID_ANY,
-                                   label=" %s " % _("Database connection"))
+            databasebox = StaticBox(parent=self.panel, id=wx.ID_ANY,
+                                    label=" %s " % _("Database connection"))
             databaseboxsizer = wx.StaticBoxSizer(databasebox, wx.VERTICAL)
             databaseboxsizer = wx.StaticBoxSizer(databasebox, wx.VERTICAL)
             databaseboxsizer.Add(
             databaseboxsizer.Add(
                 CreateDbInfoDesc(
                 CreateDbInfoDesc(
@@ -111,11 +113,11 @@ class SQLBuilder(wx.Frame):
         # text areas
         # text areas
         #
         #
         # sql box
         # sql box
-        sqlbox = wx.StaticBox(parent=self.panel, id=wx.ID_ANY,
-                              label=" %s " % _("Query"))
+        sqlbox = StaticBox(parent=self.panel, id=wx.ID_ANY,
+                           label=" %s " % _("Query"))
         sqlboxsizer = wx.StaticBoxSizer(sqlbox, wx.VERTICAL)
         sqlboxsizer = wx.StaticBoxSizer(sqlbox, wx.VERTICAL)
 
 
-        self.text_sql = wx.TextCtrl(parent=self.panel, id=wx.ID_ANY,
+        self.text_sql = TextCtrl(parent=self.panel, id=wx.ID_ANY,
                                     value='', size=(-1, 50),
                                     value='', size=(-1, 50),
                                     style=wx.TE_MULTILINE)
                                     style=wx.TE_MULTILINE)
 
 
@@ -127,13 +129,12 @@ class SQLBuilder(wx.Frame):
         #
         #
         # buttons
         # buttons
         #
         #
-        self.btn_clear = wx.Button(parent=self.panel, id=wx.ID_CLEAR)
-        self.btn_clear.SetToolTipString(_("Set SQL statement to default"))
-        self.btn_apply = wx.Button(parent=self.panel, id=wx.ID_APPLY)
-        self.btn_apply.SetToolTipString(
-            _("Apply SQL statement"))
-        self.btn_close = wx.Button(parent=self.panel, id=wx.ID_CLOSE)
-        self.btn_close.SetToolTipString(_("Close the dialog"))
+        self.btn_clear = Button(parent=self.panel, id=wx.ID_CLEAR)
+        self.btn_clear.SetToolTip(_("Set SQL statement to default"))
+        self.btn_apply = Button(parent=self.panel, id=wx.ID_APPLY)
+        self.btn_apply.SetToolTip(_("Apply SQL statement"))
+        self.btn_close = Button(parent=self.panel, id=wx.ID_CLOSE)
+        self.btn_close.SetToolTip(_("Close the dialog"))
 
 
         self.btn_logic = {'is': ['=', ],
         self.btn_logic = {'is': ['=', ],
                           'isnot': ['!=', ],
                           'isnot': ['!=', ],
@@ -149,8 +150,8 @@ class SQLBuilder(wx.Frame):
                           'prc': ['%', ]}
                           'prc': ['%', ]}
 
 
         self.btn_logicpanel = wx.Panel(parent=self.panel, id=wx.ID_ANY)
         self.btn_logicpanel = wx.Panel(parent=self.panel, id=wx.ID_ANY)
-        for key, value in self.btn_logic.iteritems():
-            btn = wx.Button(parent=self.btn_logicpanel, id=wx.ID_ANY,
+        for key, value in six.iteritems(self.btn_logic):
+            btn = Button(parent=self.btn_logicpanel, id=wx.ID_ANY,
                             label=value[0])
                             label=value[0])
             self.btn_logic[key].append(btn.GetId())
             self.btn_logic[key].append(btn.GetId())
 
 
@@ -219,8 +220,8 @@ class SQLBuilder(wx.Frame):
         #
         #
         self.hsizer = wx.BoxSizer(wx.HORIZONTAL)
         self.hsizer = wx.BoxSizer(wx.HORIZONTAL)
 
 
-        columnsbox = wx.StaticBox(parent=self.panel, id=wx.ID_ANY,
-                                  label=" %s " % _("Columns"))
+        columnsbox = StaticBox(parent=self.panel, id=wx.ID_ANY,
+                               label=" %s " % _("Columns"))
         columnsizer = wx.StaticBoxSizer(columnsbox, wx.VERTICAL)
         columnsizer = wx.StaticBoxSizer(columnsbox, wx.VERTICAL)
         self.list_columns = wx.ListBox(
         self.list_columns = wx.ListBox(
             parent=self.panel,
             parent=self.panel,
@@ -248,8 +249,8 @@ class SQLBuilder(wx.Frame):
         # self.list_values.SetMinSize((-1,100))
         # self.list_values.SetMinSize((-1,100))
 
 
         self.valuespanel = wx.Panel(parent=self.panel, id=wx.ID_ANY)
         self.valuespanel = wx.Panel(parent=self.panel, id=wx.ID_ANY)
-        valuesbox = wx.StaticBox(parent=self.valuespanel, id=wx.ID_ANY,
-                                 label=" %s " % _("Values"))
+        valuesbox = StaticBox(parent=self.valuespanel, id=wx.ID_ANY,
+                              label=" %s " % _("Values"))
         valuesizer = wx.StaticBoxSizer(valuesbox, wx.VERTICAL)
         valuesizer = wx.StaticBoxSizer(valuesbox, wx.VERTICAL)
         self.list_values = wx.ListBox(parent=self.valuespanel, id=wx.ID_ANY,
         self.list_values = wx.ListBox(parent=self.valuespanel, id=wx.ID_ANY,
                                       choices=self.colvalues,
                                       choices=self.colvalues,
@@ -258,14 +259,14 @@ class SQLBuilder(wx.Frame):
                        flag=wx.EXPAND)
                        flag=wx.EXPAND)
         self.valuespanel.SetSizer(valuesizer)
         self.valuespanel.SetSizer(valuesizer)
 
 
-        self.btn_unique = wx.Button(parent=self.valuespanel, id=wx.ID_ANY,
+        self.btn_unique = Button(parent=self.valuespanel, id=wx.ID_ANY,
                                     label=_("Get all values"))
                                     label=_("Get all values"))
         self.btn_unique.Enable(False)
         self.btn_unique.Enable(False)
-        self.btn_uniquesample = wx.Button(
+        self.btn_uniquesample = Button(
             parent=self.valuespanel,
             parent=self.valuespanel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_("Get sample"))
             label=_("Get sample"))
-        self.btn_uniquesample.SetToolTipString(
+        self.btn_uniquesample.SetToolTip(
             _("Get first 256 unique values as sample"))
             _("Get first 256 unique values as sample"))
         self.btn_uniquesample.Enable(False)
         self.btn_uniquesample.Enable(False)
 
 
@@ -280,12 +281,12 @@ class SQLBuilder(wx.Frame):
 
 
         # go to
         # go to
         gotosizer = wx.BoxSizer(wx.HORIZONTAL)
         gotosizer = wx.BoxSizer(wx.HORIZONTAL)
-        self.goto = wx.TextCtrl(
+        self.goto = TextCtrl(
             parent=self.valuespanel,
             parent=self.valuespanel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             style=wx.TE_PROCESS_ENTER)
             style=wx.TE_PROCESS_ENTER)
-        gotosizer.Add(wx.StaticText(parent=self.valuespanel, id=wx.ID_ANY,
-                                    label=_("Go to:")), proportion=0,
+        gotosizer.Add(StaticText(parent=self.valuespanel, id=wx.ID_ANY,
+                                 label=_("Go to:")), proportion=0,
                       flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, border=5)
                       flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, border=5)
         gotosizer.Add(self.goto, proportion=1,
         gotosizer.Add(self.goto, proportion=1,
                       flag=wx.EXPAND)
                       flag=wx.EXPAND)
@@ -339,7 +340,7 @@ class SQLBuilder(wx.Frame):
         self.btn_unique.Bind(wx.EVT_BUTTON, self.OnUniqueValues)
         self.btn_unique.Bind(wx.EVT_BUTTON, self.OnUniqueValues)
         self.btn_uniquesample.Bind(wx.EVT_BUTTON, self.OnSampleValues)
         self.btn_uniquesample.Bind(wx.EVT_BUTTON, self.OnSampleValues)
 
 
-        for key, value in self.btn_logic.iteritems():
+        for key, value in six.iteritems(self.btn_logic):
             self.FindWindowById(value[1]).Bind(wx.EVT_BUTTON, self.OnAddMark)
             self.FindWindowById(value[1]).Bind(wx.EVT_BUTTON, self.OnAddMark)
 
 
         self.btn_close.Bind(wx.EVT_BUTTON, self.OnClose)
         self.btn_close.Bind(wx.EVT_BUTTON, self.OnClose)
@@ -454,7 +455,7 @@ class SQLBuilder(wx.Frame):
                 self.btn_arithmeticpanel.IsShown():
                 self.btn_arithmeticpanel.IsShown():
             btns = self.btn_arithmetic
             btns = self.btn_arithmetic
 
 
-        for key, value in btns.iteritems():
+        for key, value in six.iteritems(btns):
             if event.GetId() == value[1]:
             if event.GetId() == value[1]:
                 mark = value[0]
                 mark = value[0]
                 break
                 break
@@ -494,13 +495,13 @@ class SQLBuilderSelect(SQLBuilder):
         SQLBuilder._doLayout(self, modeChoices)
         SQLBuilder._doLayout(self, modeChoices)
 
 
         self.text_sql.SetValue("SELECT * FROM %s" % self.tablename)
         self.text_sql.SetValue("SELECT * FROM %s" % self.tablename)
-        self.text_sql.SetToolTipString(
+        self.text_sql.SetToolTip(
             _("Example: %s") %
             _("Example: %s") %
             "SELECT * FROM roadsmajor WHERE MULTILANE = 'no' OR OBJECTID < 10")
             "SELECT * FROM roadsmajor WHERE MULTILANE = 'no' OR OBJECTID < 10")
 
 
-        self.btn_verify = wx.Button(parent=self.panel, id=wx.ID_ANY,
+        self.btn_verify = Button(parent=self.panel, id=wx.ID_ANY,
                                     label=_("Verify"))
                                     label=_("Verify"))
-        self.btn_verify.SetToolTipString(_("Verify SQL statement"))
+        self.btn_verify.SetToolTip(_("Verify SQL statement"))
 
 
         self.buttonsizer.Insert(1, self.btn_verify)
         self.buttonsizer.Insert(1, self.btn_verify)
 
 
@@ -659,8 +660,8 @@ class SQLBuilderUpdate(SQLBuilder):
 
 
         self.btn_arithmeticpanel = wx.Panel(parent=self.panel, id=wx.ID_ANY)
         self.btn_arithmeticpanel = wx.Panel(parent=self.panel, id=wx.ID_ANY)
 
 
-        for key, value in self.btn_arithmetic.iteritems():
-            btn = wx.Button(parent=self.btn_arithmeticpanel, id=wx.ID_ANY,
+        for key, value in six.iteritems(self.btn_arithmetic):
+            btn = Button(parent=self.btn_arithmeticpanel, id=wx.ID_ANY,
                             label=value[0])
                             label=value[0])
             self.btn_arithmetic[key].append(btn.GetId())
             self.btn_arithmetic[key].append(btn.GetId())
 
 
@@ -700,8 +701,8 @@ class SQLBuilderUpdate(SQLBuilder):
 
 
         self.funcpanel = wx.Panel(parent=self.panel, id=wx.ID_ANY)
         self.funcpanel = wx.Panel(parent=self.panel, id=wx.ID_ANY)
         self._initSqlFunctions()
         self._initSqlFunctions()
-        funcsbox = wx.StaticBox(parent=self.funcpanel, id=wx.ID_ANY,
-                                label=" %s " % _("Functions"))
+        funcsbox = StaticBox(parent=self.funcpanel, id=wx.ID_ANY,
+                             label=" %s " % _("Functions"))
         funcsizer = wx.StaticBoxSizer(funcsbox, wx.VERTICAL)
         funcsizer = wx.StaticBoxSizer(funcsbox, wx.VERTICAL)
         self.list_func = wx.ListBox(parent=self.funcpanel, id=wx.ID_ANY,
         self.list_func = wx.ListBox(parent=self.funcpanel, id=wx.ID_ANY,
                                     choices=self.sqlFuncs['sqlite'].keys(),
                                     choices=self.sqlFuncs['sqlite'].keys(),
@@ -716,7 +717,7 @@ class SQLBuilderUpdate(SQLBuilder):
                            proportion=1, flag=wx.EXPAND)
                            proportion=1, flag=wx.EXPAND)
 
 
         self.list_func.Bind(wx.EVT_LISTBOX, self.OnAddFunc)
         self.list_func.Bind(wx.EVT_LISTBOX, self.OnAddFunc)
-        for key, value in self.btn_arithmetic.iteritems():
+        for key, value in six.iteritems(self.btn_arithmetic):
             self.FindWindowById(value[1]).Bind(wx.EVT_BUTTON, self.OnAddMark)
             self.FindWindowById(value[1]).Bind(wx.EVT_BUTTON, self.OnAddMark)
         self.mode.SetSelection(0)
         self.mode.SetSelection(0)
         self.OnMode(None)
         self.OnMode(None)

+ 22 - 17
gui/wxpython/dbmgr/vinfo.py

@@ -16,15 +16,20 @@ This program is free software under the GNU General Public License
 
 
 import os
 import os
 import types
 import types
+import sys
+import six
 
 
 import wx
 import wx
 
 
 from gui_core.gselect import VectorDBInfo as VectorDBInfoBase
 from gui_core.gselect import VectorDBInfo as VectorDBInfoBase
+from gui_core.wrap import StaticText
 from core.gcmd import RunCommand, GError
 from core.gcmd import RunCommand, GError
 from core.settings import UserSettings
 from core.settings import UserSettings
 from core.utils import _
 from core.utils import _
 import grass.script as grass
 import grass.script as grass
 
 
+if sys.version_info.major >= 3:
+    unicode = str
 
 
 def GetUnicodeValue(value):
 def GetUnicodeValue(value):
     """Get unicode value
     """Get unicode value
@@ -33,7 +38,7 @@ def GetUnicodeValue(value):
 
 
     :return: unicode value
     :return: unicode value
     """
     """
-    if isinstance(value, types.UnicodeType):
+    if isinstance(value, unicode):
         return value
         return value
 
 
     enc = UserSettings.Get(group='atm', key='encoding', subkey='value')
     enc = UserSettings.Get(group='atm', key='encoding', subkey='value')
@@ -50,31 +55,31 @@ def CreateDbInfoDesc(panel, mapDBInfo, layer):
     infoFlexSizer = wx.FlexGridSizer(cols=2, hgap=1, vgap=1)
     infoFlexSizer = wx.FlexGridSizer(cols=2, hgap=1, vgap=1)
     infoFlexSizer.AddGrowableCol(1)
     infoFlexSizer.AddGrowableCol(1)
 
 
-    infoFlexSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label="Driver:"))
+    infoFlexSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label="Driver:"))
     infoFlexSizer.Add(
     infoFlexSizer.Add(
-        wx.StaticText(
+        StaticText(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=mapDBInfo.layers[layer]['driver']))
             label=mapDBInfo.layers[layer]['driver']))
-    infoFlexSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label="Database:"))
+    infoFlexSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label="Database:"))
     infoFlexSizer.Add(
     infoFlexSizer.Add(
-        wx.StaticText(
+        StaticText(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=mapDBInfo.layers[layer]['database']))
             label=mapDBInfo.layers[layer]['database']))
-    infoFlexSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label="Table:"))
+    infoFlexSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label="Table:"))
     infoFlexSizer.Add(
     infoFlexSizer.Add(
-        wx.StaticText(
+        StaticText(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=mapDBInfo.layers[layer]['table']))
             label=mapDBInfo.layers[layer]['table']))
-    infoFlexSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label="Key:"))
-    infoFlexSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=mapDBInfo.layers[layer]['key']))
+    infoFlexSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label="Key:"))
+    infoFlexSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=mapDBInfo.layers[layer]['key']))
 
 
     return infoFlexSizer
     return infoFlexSizer
 
 
@@ -93,7 +98,7 @@ class VectorDBInfo(VectorDBInfoBase):
         except KeyError:
         except KeyError:
             return []
             return []
 
 
-        for name, desc in self.tables[table].iteritems():
+        for name, desc in six.iteritems(self.tables[table]):
             names[desc['index']] = name
             names[desc['index']] = name
 
 
         return names
         return names
@@ -131,7 +136,7 @@ class VectorDBInfo(VectorDBInfoBase):
                 continue
                 continue
 
 
             table = record['Table']
             table = record['Table']
-            for key, value in record['Attributes'].iteritems():
+            for key, value in six.iteritems(record['Attributes']):
                 if len(value) < 1:
                 if len(value) < 1:
                     value = None
                     value = None
                 else:
                 else:
@@ -141,7 +146,7 @@ class VectorDBInfo(VectorDBInfoBase):
                         value = GetUnicodeValue(value)
                         value = GetUnicodeValue(value)
                 self.tables[table][key]['values'].append(value)
                 self.tables[table][key]['values'].append(value)
 
 
-            for key, value in record.iteritems():
+            for key, value in six.iteritems(record):
                 if key == 'Attributes':
                 if key == 'Attributes':
                     continue
                     continue
                 if key in ret:
                 if key in ret:

+ 57 - 53
gui/wxpython/gcp/manager.py

@@ -32,6 +32,7 @@ import os
 import sys
 import sys
 import shutil
 import shutil
 import time
 import time
+import six
 from copy import copy
 from copy import copy
 
 
 import wx
 import wx
@@ -40,9 +41,11 @@ import wx.lib.colourselect as csel
 
 
 from core import globalvar
 from core import globalvar
 if globalvar.wxPythonPhoenix:
 if globalvar.wxPythonPhoenix:
-    from wx.adv import Wizard as wiz
+    from wx import adv as wiz
+    from wx.adv import Wizard
 else:
 else:
-    import wx.wizard as wiz
+    from wx import wizard as wiz
+    from wx.wizard import Wizard
 
 
 import grass.script as grass
 import grass.script as grass
 
 
@@ -56,7 +59,8 @@ from core.gcmd import RunCommand, GMessage, GError, GWarning, EncodeString
 from core.settings import UserSettings
 from core.settings import UserSettings
 from gcp.mapdisplay import MapFrame
 from gcp.mapdisplay import MapFrame
 from core.giface import Notification
 from core.giface import Notification
-from gui_core.wrap import SpinCtrl
+from gui_core.wrap import SpinCtrl, Button, StaticText, StaticBox, \
+    CheckListBox, TextCtrl, Menu
 
 
 from location_wizard.wizard import TitledPage as TitledPage
 from location_wizard.wizard import TitledPage as TitledPage
 
 
@@ -371,7 +375,7 @@ class LocationPage(TitledPage):
 
 
         # location
         # location
         self.sizer.Add(
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 parent=self,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Select source location:')),
                 label=_('Select source location:')),
@@ -392,7 +396,7 @@ class LocationPage(TitledPage):
 
 
         # mapset
         # mapset
         self.sizer.Add(
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 parent=self,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Select source mapset:')),
                 label=_('Select source mapset:')),
@@ -505,7 +509,7 @@ class GroupPage(TitledPage):
         #
         #
         # group
         # group
         self.sizer.Add(
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 parent=self,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Select/create group:')),
                 label=_('Select/create group:')),
@@ -522,7 +526,7 @@ class GroupPage(TitledPage):
 
 
         # create group
         # create group
         self.sizer.Add(
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 parent=self,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Create group if none exists')),
                 label=_('Create group if none exists')),
@@ -532,11 +536,11 @@ class GroupPage(TitledPage):
                 2,
                 2,
                 1))
                 1))
         btnSizer = wx.BoxSizer(wx.HORIZONTAL)
         btnSizer = wx.BoxSizer(wx.HORIZONTAL)
-        self.btn_mkgroup = wx.Button(
+        self.btn_mkgroup = Button(
             parent=self,
             parent=self,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_("Create/edit group..."))
             label=_("Create/edit group..."))
-        self.btn_vgroup = wx.Button(
+        self.btn_vgroup = Button(
             parent=self,
             parent=self,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_("Add vector map to group..."))
             label=_("Add vector map to group..."))
@@ -556,7 +560,7 @@ class GroupPage(TitledPage):
 
 
         # extension
         # extension
         self.sizer.Add(
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 parent=self,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Extension for output maps:')),
                 label=_('Extension for output maps:')),
@@ -565,7 +569,7 @@ class GroupPage(TitledPage):
             pos=(
             pos=(
                 3,
                 3,
                 1))
                 1))
-        self.ext_txt = wx.TextCtrl(
+        self.ext_txt = TextCtrl(
             parent=self, id=wx.ID_ANY, value="", size=(
             parent=self, id=wx.ID_ANY, value="", size=(
                 350, -1))
                 350, -1))
         self.ext_txt.SetValue(self.extension)
         self.ext_txt.SetValue(self.extension)
@@ -714,7 +718,7 @@ class DispMapPage(TitledPage):
         # layout
         # layout
         #
         #
         self.sizer.Add(
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 parent=self,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Select source map to display:')),
                 label=_('Select source map to display:')),
@@ -740,7 +744,7 @@ class DispMapPage(TitledPage):
                 2))
                 2))
 
 
         self.sizer.Add(
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 parent=self,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Select target raster map to display:')),
                 label=_('Select target raster map to display:')),
@@ -763,7 +767,7 @@ class DispMapPage(TitledPage):
                 2))
                 2))
 
 
         self.sizer.Add(
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 parent=self,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Select target vector map to display:')),
                 label=_('Select target vector map to display:')),
@@ -1261,7 +1265,7 @@ class GCP(MapFrame, ColumnSorterMixin):
                    "ucolor": "unused"}
                    "ucolor": "unused"}
         wpx = UserSettings.Get(group='gcpman', key='symbol', subkey='width')
         wpx = UserSettings.Get(group='gcpman', key='symbol', subkey='width')
 
 
-        for k, v in colours.iteritems():
+        for k, v in six.iteritems(colours):
             col = UserSettings.Get(group='gcpman', key='symbol', subkey=k)
             col = UserSettings.Get(group='gcpman', key='symbol', subkey=k)
             self.pointsToDrawSrc.GetPen(v).SetColour(wx.Colour(
             self.pointsToDrawSrc.GetPen(v).SetColour(wx.Colour(
                 col[0], col[1], col[2], 255))  # TODO GetPen neni to spatne?
                 col[0], col[1], col[2], 255))  # TODO GetPen neni to spatne?
@@ -2062,7 +2066,7 @@ class GCP(MapFrame, ColumnSorterMixin):
         """Popup Zoom menu
         """Popup Zoom menu
         """
         """
         point = wx.GetMousePosition()
         point = wx.GetMousePosition()
-        zoommenu = wx.Menu()
+        zoommenu = Menu()
         # Add items to the menu
         # Add items to the menu
 
 
         zoomsource = wx.MenuItem(zoommenu, wx.ID_ANY, _(
         zoomsource = wx.MenuItem(zoommenu, wx.ID_ANY, _(
@@ -2389,17 +2393,17 @@ class VectGroup(wx.Dialog):
         #
         #
         # buttons
         # buttons
         #
         #
-        self.btnCancel = wx.Button(parent=self,
+        self.btnCancel = Button(parent=self,
                                    id=wx.ID_CANCEL)
                                    id=wx.ID_CANCEL)
-        self.btnOK = wx.Button(parent=self,
+        self.btnOK = Button(parent=self,
                                id=wx.ID_OK)
                                id=wx.ID_OK)
         self.btnOK.SetDefault()
         self.btnOK.SetDefault()
 
 
         #
         #
         # list of vector maps
         # list of vector maps
         #
         #
-        self.listMap = wx.CheckListBox(parent=self, id=wx.ID_ANY,
-                                       choices=vectlist)
+        self.listMap = CheckListBox(parent=self, id=wx.ID_ANY,
+                                    choices=vectlist)
 
 
         if os.path.isfile(self.vgrpfile):
         if os.path.isfile(self.vgrpfile):
             f = open(self.vgrpfile)
             f = open(self.vgrpfile)
@@ -2425,7 +2429,7 @@ class VectGroup(wx.Dialog):
 
 
         box = wx.BoxSizer(wx.HORIZONTAL)
         box = wx.BoxSizer(wx.HORIZONTAL)
         box.Add(
         box.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 parent=self,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Select vector map(s) to add to group:')),
                 label=_('Select vector map(s) to add to group:')),
@@ -2494,7 +2498,7 @@ class EditGCP(wx.Dialog):
 
 
         sizer = wx.BoxSizer(wx.VERTICAL)
         sizer = wx.BoxSizer(wx.VERTICAL)
 
 
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel, id=wx.ID_ANY, label=" %s %s " %
             parent=panel, id=wx.ID_ANY, label=" %s %s " %
             (_("Ground Control Point No."), str(gcpno)))
             (_("Ground Control Point No."), str(gcpno)))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
@@ -2502,10 +2506,10 @@ class EditGCP(wx.Dialog):
         # source coordinates
         # source coordinates
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
 
 
-        self.xcoord = wx.TextCtrl(parent=panel, id=wx.ID_ANY, size=(150, -1))
-        self.ycoord = wx.TextCtrl(parent=panel, id=wx.ID_ANY, size=(150, -1))
-        self.ecoord = wx.TextCtrl(parent=panel, id=wx.ID_ANY, size=(150, -1))
-        self.ncoord = wx.TextCtrl(parent=panel, id=wx.ID_ANY, size=(150, -1))
+        self.xcoord = TextCtrl(parent=panel, id=wx.ID_ANY, size=(150, -1))
+        self.ycoord = TextCtrl(parent=panel, id=wx.ID_ANY, size=(150, -1))
+        self.ecoord = TextCtrl(parent=panel, id=wx.ID_ANY, size=(150, -1))
+        self.ncoord = TextCtrl(parent=panel, id=wx.ID_ANY, size=(150, -1))
 
 
         # swap source N, target E
         # swap source N, target E
         tmp_coord = data[1]
         tmp_coord = data[1]
@@ -2519,8 +2523,8 @@ class EditGCP(wx.Dialog):
                            (_("target E:"), self.ecoord),
                            (_("target E:"), self.ecoord),
                            (_("source N:"), self.ycoord),
                            (_("source N:"), self.ycoord),
                            (_("target N:"), self.ncoord)):
                            (_("target N:"), self.ncoord)):
-            label = wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                  label=label)
+            label = StaticText(parent=panel, id=wx.ID_ANY,
+                               label=label)
             gridSizer.Add(label,
             gridSizer.Add(label,
                           flag=wx.ALIGN_CENTER_VERTICAL,
                           flag=wx.ALIGN_CENTER_VERTICAL,
                           pos=(row, col))
                           pos=(row, col))
@@ -2547,8 +2551,8 @@ class EditGCP(wx.Dialog):
         #
         #
         # buttons
         # buttons
         #
         #
-        self.btnCancel = wx.Button(panel, wx.ID_CANCEL)
-        self.btnOk = wx.Button(panel, wx.ID_OK)
+        self.btnCancel = Button(panel, wx.ID_CANCEL)
+        self.btnOk = Button(panel, wx.ID_OK)
         self.btnOk.SetDefault()
         self.btnOk.SetDefault()
 
 
         btnSizer = wx.StdDialogButtonSizer()
         btnSizer = wx.StdDialogButtonSizer()
@@ -2617,19 +2621,19 @@ class GrSettingsDialog(wx.Dialog):
         self.__CreateRectificationPage(notebook)
         self.__CreateRectificationPage(notebook)
 
 
         # buttons
         # buttons
-        btnSave = wx.Button(self, wx.ID_SAVE)
-        btnApply = wx.Button(self, wx.ID_APPLY)
-        btnClose = wx.Button(self, wx.ID_CLOSE)
+        btnSave = Button(self, wx.ID_SAVE)
+        btnApply = Button(self, wx.ID_APPLY)
+        btnClose = Button(self, wx.ID_CLOSE)
         btnApply.SetDefault()
         btnApply.SetDefault()
 
 
         # bindings
         # bindings
         btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
         btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
-        btnApply.SetToolTipString(_("Apply changes for the current session"))
+        btnApply.SetToolTip(_("Apply changes for the current session"))
         btnSave.Bind(wx.EVT_BUTTON, self.OnSave)
         btnSave.Bind(wx.EVT_BUTTON, self.OnSave)
-        btnSave.SetToolTipString(
+        btnSave.SetToolTip(
             _("Apply and save changes to user settings file (default for next sessions)"))
             _("Apply and save changes to user settings file (default for next sessions)"))
         btnClose.Bind(wx.EVT_BUTTON, self.OnClose)
         btnClose.Bind(wx.EVT_BUTTON, self.OnClose)
-        btnClose.SetToolTipString(_("Close dialog"))
+        btnClose.SetToolTip(_("Close dialog"))
 
 
         # sizers
         # sizers
         btnSizer = wx.BoxSizer(wx.HORIZONTAL)
         btnSizer = wx.BoxSizer(wx.HORIZONTAL)
@@ -2675,7 +2679,7 @@ class GrSettingsDialog(wx.Dialog):
                 0))
                 0))
 
 
         # RMS forward error threshold
         # RMS forward error threshold
-        rmslabel = wx.StaticText(
+        rmslabel = StaticText(
             parent=panel, id=wx.ID_ANY,
             parent=panel, id=wx.ID_ANY,
             label=_("Highlight RMS error > M + SD * factor:"))
             label=_("Highlight RMS error > M + SD * factor:"))
         rmslabel.SetToolTip(
         rmslabel.SetToolTip(
@@ -2692,8 +2696,8 @@ class GrSettingsDialog(wx.Dialog):
                 0))
                 0))
         sdfactor = UserSettings.Get(
         sdfactor = UserSettings.Get(
             group='gcpman', key='rms', subkey='sdfactor')
             group='gcpman', key='rms', subkey='sdfactor')
-        self.rmsWin = wx.TextCtrl(parent=panel, id=wx.ID_ANY,
-                                  size=(70, -1), style=wx.TE_NOHIDESEL)
+        self.rmsWin = TextCtrl(parent=panel, id=wx.ID_ANY,
+                               size=(70, -1), style=wx.TE_NOHIDESEL)
         self.rmsWin.SetValue("%s" % str(sdfactor))
         self.rmsWin.SetValue("%s" % str(sdfactor))
         if (self.parent.highest_only == True):
         if (self.parent.highest_only == True):
             self.rmsWin.Disable()
             self.rmsWin.Disable()
@@ -2703,8 +2707,8 @@ class GrSettingsDialog(wx.Dialog):
         rmsgridSizer.AddGrowableCol(1)
         rmsgridSizer.AddGrowableCol(1)
         sizer.Add(rmsgridSizer, flag=wx.EXPAND | wx.ALL, border=5)
         sizer.Add(rmsgridSizer, flag=wx.EXPAND | wx.ALL, border=5)
 
 
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % _("Symbol settings"))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % _("Symbol settings"))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
 
 
@@ -2712,7 +2716,7 @@ class GrSettingsDialog(wx.Dialog):
         # general symbol color
         # general symbol color
         #
         #
         row = 0
         row = 0
-        label = wx.StaticText(parent=panel, id=wx.ID_ANY, label=_("Color:"))
+        label = StaticText(parent=panel, id=wx.ID_ANY, label=_("Color:"))
         gridSizer.Add(label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0))
         gridSizer.Add(label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0))
         col = UserSettings.Get(group='gcpman', key='symbol', subkey='color')
         col = UserSettings.Get(group='gcpman', key='symbol', subkey='color')
         colWin = csel.ColourSelect(parent=panel, id=wx.ID_ANY,
         colWin = csel.ColourSelect(parent=panel, id=wx.ID_ANY,
@@ -2729,7 +2733,7 @@ class GrSettingsDialog(wx.Dialog):
         # symbol color for high forward RMS error
         # symbol color for high forward RMS error
         #
         #
         row += 1
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_("Color for high RMS error:"))
             label=_("Color for high RMS error:"))
@@ -2749,7 +2753,7 @@ class GrSettingsDialog(wx.Dialog):
         # symbol color for selected GCP
         # symbol color for selected GCP
         #
         #
         row += 1
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_("Color for selected GCP:"))
             label=_("Color for selected GCP:"))
@@ -2769,7 +2773,7 @@ class GrSettingsDialog(wx.Dialog):
         # symbol color for unused GCP
         # symbol color for unused GCP
         #
         #
         row += 1
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_("Color for unused GCPs:"))
             label=_("Color for unused GCPs:"))
@@ -2802,7 +2806,7 @@ class GrSettingsDialog(wx.Dialog):
         # symbol size
         # symbol size
         #
         #
         row += 1
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_("Symbol size:"))
             label=_("Symbol size:"))
@@ -2824,7 +2828,7 @@ class GrSettingsDialog(wx.Dialog):
         # symbol width
         # symbol width
         #
         #
         row += 1
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_("Line width:"))
             label=_("Line width:"))
@@ -2876,7 +2880,7 @@ class GrSettingsDialog(wx.Dialog):
         self.tgtvectselection.GetElementList()
         self.tgtvectselection.GetElementList()
 
 
         sizer.Add(
         sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Select source map to display:')),
                 label=_('Select source map to display:')),
@@ -2890,7 +2894,7 @@ class GrSettingsDialog(wx.Dialog):
             border=5)
             border=5)
         self.srcselection.SetValue(src_map)
         self.srcselection.SetValue(src_map)
         sizer.Add(
         sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Select target raster map to display:')),
                 label=_('Select target raster map to display:')),
@@ -2904,7 +2908,7 @@ class GrSettingsDialog(wx.Dialog):
             border=5)
             border=5)
         self.tgtrastselection.SetValue(tgt_map['raster'])
         self.tgtrastselection.SetValue(tgt_map['raster'])
         sizer.Add(
         sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Select target vector map to display:')),
                 label=_('Select target vector map to display:')),
@@ -2955,7 +2959,7 @@ class GrSettingsDialog(wx.Dialog):
         # interpolation method
         # interpolation method
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Select interpolation method:')),
                 label=_('Select interpolation method:')),
@@ -2981,14 +2985,14 @@ class GrSettingsDialog(wx.Dialog):
 
 
         # extension
         # extension
         sizer.Add(
         sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Extension for output maps:')),
                 label=_('Extension for output maps:')),
             proportion=0,
             proportion=0,
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL,
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL,
             border=5)
             border=5)
-        self.ext_txt = wx.TextCtrl(
+        self.ext_txt = TextCtrl(
             parent=panel, id=wx.ID_ANY, value="", size=(
             parent=panel, id=wx.ID_ANY, value="", size=(
                 350, -1))
                 350, -1))
         self.ext_txt.SetValue(self.parent.extension)
         self.ext_txt.SetValue(self.parent.extension)

+ 3 - 2
gui/wxpython/gcp/mapdisplay.py

@@ -30,6 +30,7 @@ from core.gcmd import GMessage
 from core.utils import _
 from core.utils import _
 from gui_core.dialogs import GetImageHandlers, ImageSizeDialog
 from gui_core.dialogs import GetImageHandlers, ImageSizeDialog
 from gui_core.mapdisp import SingleMapFrame
 from gui_core.mapdisp import SingleMapFrame
+from gui_core.wrap import Menu
 from core.settings import UserSettings
 from core.settings import UserSettings
 from mapwin.buffered import BufferedMapWindow
 from mapwin.buffered import BufferedMapWindow
 from mapwin.base import MapWindowProperties
 from mapwin.base import MapWindowProperties
@@ -421,7 +422,7 @@ class MapFrame(SingleMapFrame):
         Print options and output menu for map display
         Print options and output menu for map display
         """
         """
         point = wx.GetMousePosition()
         point = wx.GetMousePosition()
-        printmenu = wx.Menu()
+        printmenu = Menu()
         # Add items to the menu
         # Add items to the menu
         setup = wx.MenuItem(printmenu, wx.ID_ANY, _('Page setup'))
         setup = wx.MenuItem(printmenu, wx.ID_ANY, _('Page setup'))
         printmenu.AppendItem(setup)
         printmenu.AppendItem(setup)
@@ -467,7 +468,7 @@ class MapFrame(SingleMapFrame):
         """Popup Zoom menu
         """Popup Zoom menu
         """
         """
         point = wx.GetMousePosition()
         point = wx.GetMousePosition()
-        zoommenu = wx.Menu()
+        zoommenu = Menu()
         # Add items to the menu
         # Add items to the menu
 
 
         zoomwind = wx.MenuItem(zoommenu, wx.ID_ANY, _(
         zoomwind = wx.MenuItem(zoommenu, wx.ID_ANY, _(

+ 11 - 8
gui/wxpython/gis_set.py

@@ -44,8 +44,8 @@ import startup.guiutils as sgui
 from location_wizard.dialogs import RegionDef
 from location_wizard.dialogs import RegionDef
 from gui_core.dialogs import TextEntryDialog
 from gui_core.dialogs import TextEntryDialog
 from gui_core.widgets import GenericValidator, StaticWrapText
 from gui_core.widgets import GenericValidator, StaticWrapText
-from gui_core.wrap import Button
-from gui_core.wrap import ListCtrl
+from gui_core.wrap import Button, ListCtrl, StaticText, StaticBox, \
+    TextCtrl
 
 
 sys.stderr = codecs.getwriter('utf8')(sys.stderr)
 sys.stderr = codecs.getwriter('utf8')(sys.stderr)
 
 
@@ -110,17 +110,17 @@ class GRASSStartup(wx.Frame):
         # get version & revision
         # get version & revision
         grassVersion, grassRevisionStr = sgui.GetVersion()
         grassVersion, grassRevisionStr = sgui.GetVersion()
 
 
-        self.gisdbase_box = wx.StaticBox(
+        self.gisdbase_box = StaticBox(
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             _("1. Select GRASS GIS database directory"))
             _("1. Select GRASS GIS database directory"))
-        self.location_box = wx.StaticBox(
+        self.location_box = StaticBox(
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             _("2. Select GRASS Location"))
             _("2. Select GRASS Location"))
-        self.mapset_box = wx.StaticBox(
+        self.mapset_box = StaticBox(
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             _("3. Select GRASS Mapset"))
             _("3. Select GRASS Mapset"))
 
 
-        self.lmessage = wx.StaticText(parent=self.panel)
+        self.lmessage = StaticText(parent=self.panel)
         # It is not clear if all wx versions supports color, so try-except.
         # It is not clear if all wx versions supports color, so try-except.
         # The color itself may not be correct for all platforms/system settings
         # The color itself may not be correct for all platforms/system settings
         # but in http://xoomer.virgilio.it/infinity77/wxPython/Widgets/wx.SystemSettings.html
         # but in http://xoomer.virgilio.it/infinity77/wxPython/Widgets/wx.SystemSettings.html
@@ -134,7 +134,7 @@ class GRASSStartup(wx.Frame):
         self.location_panel = wx.Panel(parent=self.panel)
         self.location_panel = wx.Panel(parent=self.panel)
         self.mapset_panel = wx.Panel(parent=self.panel)
         self.mapset_panel = wx.Panel(parent=self.panel)
 
 
-        self.ldbase = wx.StaticText(
+        self.ldbase = StaticText(
             parent=self.gisdbase_panel, id=wx.ID_ANY,
             parent=self.gisdbase_panel, id=wx.ID_ANY,
             label=_("GRASS GIS database directory contains Locations."))
             label=_("GRASS GIS database directory contains Locations."))
 
 
@@ -204,7 +204,7 @@ class GRASSStartup(wx.Frame):
         self.delete_mapset_button.SetToolTip(_("Delete selected mapset"))
         self.delete_mapset_button.SetToolTip(_("Delete selected mapset"))
 
 
         # textinputs
         # textinputs
-        self.tgisdbase = wx.TextCtrl(
+        self.tgisdbase = TextCtrl(
             parent=self.gisdbase_panel, id=wx.ID_ANY, value="", size=(
             parent=self.gisdbase_panel, id=wx.ID_ANY, value="", size=(
                 300, -1), style=wx.TE_PROCESS_ENTER)
                 300, -1), style=wx.TE_PROCESS_ENTER)
 
 
@@ -1001,7 +1001,9 @@ class GRASSStartup(wx.Frame):
         mapset = self.listOfMapsets[self.lbmapsets.GetSelection()]
         mapset = self.listOfMapsets[self.lbmapsets.GetSelection()]
 
 
         lockfile = get_lockfile_if_present(dbase, location, mapset)
         lockfile = get_lockfile_if_present(dbase, location, mapset)
+        print (lockfile)
         if lockfile:
         if lockfile:
+            print ('aaaa')
             dlg = wx.MessageDialog(
             dlg = wx.MessageDialog(
                 parent=self,
                 parent=self,
                 message=_(
                 message=_(
@@ -1041,6 +1043,7 @@ class GRASSStartup(wx.Frame):
             else:
             else:
                 return
                 return
         self.SetLocation(dbase, location, mapset)
         self.SetLocation(dbase, location, mapset)
+        print ('ssssssssssssssss')
         self.ExitSuccessfully()
         self.ExitSuccessfully()
 
 
     def SetLocation(self, dbase, location, mapset):
     def SetLocation(self, dbase, location, mapset):

+ 51 - 48
gui/wxpython/gmodeler/dialogs.py

@@ -25,6 +25,7 @@ This program is free software under the GNU General Public License
 
 
 import os
 import os
 import sys
 import sys
+import six
 
 
 import wx
 import wx
 import wx.lib.mixins.listctrl as listmix
 import wx.lib.mixins.listctrl as listmix
@@ -39,6 +40,8 @@ from gui_core.prompt import GPromptSTC
 from gui_core.gselect import Select, ElementSelect
 from gui_core.gselect import Select, ElementSelect
 from gmodeler.model import *
 from gmodeler.model import *
 from lmgr.menudata import LayerManagerMenuData
 from lmgr.menudata import LayerManagerMenuData
+from gui_core.wrap import Button, StaticText, StaticBox, TextCtrl, \
+    Menu
 
 
 from grass.script import task as gtask
 from grass.script import task as gtask
 
 
@@ -99,7 +102,7 @@ class ModelDataDialog(SimpleDialog):
         """Do layout"""
         """Do layout"""
         if self.etype:
         if self.etype:
             self.dataSizer.Add(
             self.dataSizer.Add(
-                wx.StaticText(
+                StaticText(
                     parent=self.panel,
                     parent=self.panel,
                     id=wx.ID_ANY,
                     id=wx.ID_ANY,
                     label=_("Type of element:")),
                     label=_("Type of element:")),
@@ -108,8 +111,8 @@ class ModelDataDialog(SimpleDialog):
                 border=1)
                 border=1)
             self.dataSizer.Add(self.typeSelect,
             self.dataSizer.Add(self.typeSelect,
                                proportion=0, flag=wx.ALL, border=1)
                                proportion=0, flag=wx.ALL, border=1)
-        self.dataSizer.Add(wx.StaticText(parent=self.panel, id=wx.ID_ANY,
-                                         label=_("Name of element:")),
+        self.dataSizer.Add(StaticText(parent=self.panel, id=wx.ID_ANY,
+                                      label=_("Name of element:")),
                            proportion=0, flag=wx.ALL, border=1)
                            proportion=0, flag=wx.ALL, border=1)
         self.dataSizer.Add(self.element, proportion=0,
         self.dataSizer.Add(self.element, proportion=0,
                            flag=wx.EXPAND | wx.ALL, border=1)
                            flag=wx.EXPAND | wx.ALL, border=1)
@@ -188,10 +191,10 @@ class ModelSearchDialog(wx.Dialog):
         self._command = None
         self._command = None
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
 
 
-        self.cmdBox = wx.StaticBox(parent=self.panel, id=wx.ID_ANY,
-                                   label=" %s " % _("Command"))
-        self.labelBox = wx.StaticBox(parent=self.panel, id=wx.ID_ANY,
-                                     label=" %s " % _("Label and comment"))
+        self.cmdBox = StaticBox(parent=self.panel, id=wx.ID_ANY,
+                                label=" %s " % _("Command"))
+        self.labelBox = StaticBox(parent=self.panel, id=wx.ID_ANY,
+                                  label=" %s " % _("Label and comment"))
 
 
         # menu data for search widget and prompt
         # menu data for search widget and prompt
         menuModel = LayerManagerMenuData()
         menuModel = LayerManagerMenuData()
@@ -208,14 +211,14 @@ class ModelSearchDialog(wx.Dialog):
             lambda name: self.cmd_prompt.SetTextAndFocus(name + ' '))
             lambda name: self.cmd_prompt.SetTextAndFocus(name + ' '))
         wx.CallAfter(self.cmd_prompt.SetFocus)
         wx.CallAfter(self.cmd_prompt.SetFocus)
 
 
-        self.label = wx.TextCtrl(parent=self.panel, id=wx.ID_ANY)
-        self.comment = wx.TextCtrl(
+        self.label = TextCtrl(parent=self.panel, id=wx.ID_ANY)
+        self.comment = TextCtrl(
             parent=self.panel,
             parent=self.panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             style=wx.TE_MULTILINE)
             style=wx.TE_MULTILINE)
 
 
-        self.btnCancel = wx.Button(self.panel, wx.ID_CANCEL)
-        self.btnOk = wx.Button(self.panel, wx.ID_OK)
+        self.btnCancel = Button(self.panel, wx.ID_CANCEL)
+        self.btnOk = Button(self.panel, wx.ID_OK)
         self.btnOk.SetDefault()
         self.btnOk.SetDefault()
 
 
         self.Bind(wx.EVT_BUTTON, self.OnOk, self.btnOk)
         self.Bind(wx.EVT_BUTTON, self.OnOk, self.btnOk)
@@ -231,12 +234,12 @@ class ModelSearchDialog(wx.Dialog):
                      flag=wx.EXPAND)
                      flag=wx.EXPAND)
         labelSizer = wx.StaticBoxSizer(self.labelBox, wx.VERTICAL)
         labelSizer = wx.StaticBoxSizer(self.labelBox, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(hgap=5, vgap=5)
         gridSizer = wx.GridBagSizer(hgap=5, vgap=5)
-        gridSizer.Add(wx.StaticText(parent=self.panel, id=wx.ID_ANY,
-                                    label=_("Label:")),
+        gridSizer.Add(StaticText(parent=self.panel, id=wx.ID_ANY,
+                                 label=_("Label:")),
                       flag=wx.ALIGN_CENTER_VERTICAL, pos=(0, 0))
                       flag=wx.ALIGN_CENTER_VERTICAL, pos=(0, 0))
         gridSizer.Add(self.label, pos=(0, 1), flag=wx.EXPAND)
         gridSizer.Add(self.label, pos=(0, 1), flag=wx.EXPAND)
-        gridSizer.Add(wx.StaticText(parent=self.panel, id=wx.ID_ANY,
-                                    label=_("Comment:")),
+        gridSizer.Add(StaticText(parent=self.panel, id=wx.ID_ANY,
+                                 label=_("Comment:")),
                       flag=wx.ALIGN_CENTER_VERTICAL, pos=(1, 0))
                       flag=wx.ALIGN_CENTER_VERTICAL, pos=(1, 0))
         gridSizer.Add(self.comment, pos=(1, 1), flag=wx.EXPAND)
         gridSizer.Add(self.comment, pos=(1, 1), flag=wx.EXPAND)
         gridSizer.AddGrowableRow(1)
         gridSizer.AddGrowableRow(1)
@@ -353,18 +356,18 @@ class ModelRelationDialog(wx.Dialog):
 
 
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
 
 
-        self.fromBox = wx.StaticBox(parent=self.panel, id=wx.ID_ANY,
-                                    label=" %s " % _("From"))
-        self.toBox = wx.StaticBox(parent=self.panel, id=wx.ID_ANY,
-                                  label=" %s " % _("To"))
+        self.fromBox = StaticBox(parent=self.panel, id=wx.ID_ANY,
+                                 label=" %s " % _("From"))
+        self.toBox = StaticBox(parent=self.panel, id=wx.ID_ANY,
+                               label=" %s " % _("To"))
 
 
         self.option = wx.ComboBox(parent=self.panel, id=wx.ID_ANY,
         self.option = wx.ComboBox(parent=self.panel, id=wx.ID_ANY,
                                   style=wx.CB_READONLY,
                                   style=wx.CB_READONLY,
                                   choices=options)
                                   choices=options)
         self.option.Bind(wx.EVT_COMBOBOX, self.OnOption)
         self.option.Bind(wx.EVT_COMBOBOX, self.OnOption)
 
 
-        self.btnCancel = wx.Button(self.panel, wx.ID_CANCEL)
-        self.btnOk = wx.Button(self.panel, wx.ID_OK)
+        self.btnCancel = Button(self.panel, wx.ID_CANCEL)
+        self.btnOk = Button(self.panel, wx.ID_OK)
         self.btnOk.Enable(False)
         self.btnOk.Enable(False)
 
 
         self._layout()
         self._layout()
@@ -397,20 +400,20 @@ class ModelRelationDialog(wx.Dialog):
 
 
     def _layoutShape(self, shape, sizer):
     def _layoutShape(self, shape, sizer):
         if isinstance(shape, ModelData):
         if isinstance(shape, ModelData):
-            sizer.Add(wx.StaticText(parent=self.panel, id=wx.ID_ANY,
-                                    label=_("Data: %s") % shape.GetLog()),
+            sizer.Add(StaticText(parent=self.panel, id=wx.ID_ANY,
+                                 label=_("Data: %s") % shape.GetLog()),
                       proportion=1, flag=wx.EXPAND | wx.ALL,
                       proportion=1, flag=wx.EXPAND | wx.ALL,
                       border=5)
                       border=5)
         elif isinstance(shape, ModelAction):
         elif isinstance(shape, ModelAction):
             gridSizer = wx.GridBagSizer(hgap=5, vgap=5)
             gridSizer = wx.GridBagSizer(hgap=5, vgap=5)
-            gridSizer.Add(wx.StaticText(parent=self.panel, id=wx.ID_ANY,
-                                        label=_("Command:")),
+            gridSizer.Add(StaticText(parent=self.panel, id=wx.ID_ANY,
+                                     label=_("Command:")),
                           pos=(0, 0))
                           pos=(0, 0))
-            gridSizer.Add(wx.StaticText(parent=self.panel, id=wx.ID_ANY,
-                                        label=shape.GetLabel()),
+            gridSizer.Add(StaticText(parent=self.panel, id=wx.ID_ANY,
+                                     label=shape.GetLabel()),
                           pos=(0, 1))
                           pos=(0, 1))
-            gridSizer.Add(wx.StaticText(parent=self.panel, id=wx.ID_ANY,
-                                        label=_("Option:")),
+            gridSizer.Add(StaticText(parent=self.panel, id=wx.ID_ANY,
+                                     label=_("Option:")),
                           flag=wx.ALIGN_CENTER_VERTICAL,
                           flag=wx.ALIGN_CENTER_VERTICAL,
                           pos=(1, 0))
                           pos=(1, 0))
             gridSizer.Add(self.option,
             gridSizer.Add(self.option,
@@ -483,10 +486,10 @@ class ModelItemDialog(wx.Dialog):
 
 
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
 
 
-        self.condBox = wx.StaticBox(parent=self.panel, id=wx.ID_ANY,
-                                    label=" %s " % _("Condition"))
-        self.condText = wx.TextCtrl(parent=self.panel, id=wx.ID_ANY,
-                                    value=shape.GetLabel())
+        self.condBox = StaticBox(parent=self.panel, id=wx.ID_ANY,
+                                 label=" %s " % _("Condition"))
+        self.condText = TextCtrl(parent=self.panel, id=wx.ID_ANY,
+                                 value=shape.GetLabel())
 
 
         self.itemList = ItemCheckListCtrl(parent=self.panel,
         self.itemList = ItemCheckListCtrl(parent=self.panel,
                                           columns=[_("Label"),
                                           columns=[_("Label"),
@@ -496,8 +499,8 @@ class ModelItemDialog(wx.Dialog):
 
 
         self.itemList.Populate(self.parent.GetModel().GetItems())
         self.itemList.Populate(self.parent.GetModel().GetItems())
 
 
-        self.btnCancel = wx.Button(parent=self.panel, id=wx.ID_CANCEL)
-        self.btnOk = wx.Button(parent=self.panel, id=wx.ID_OK)
+        self.btnCancel = Button(parent=self.panel, id=wx.ID_CANCEL)
+        self.btnOk = Button(parent=self.panel, id=wx.ID_OK)
         self.btnOk.SetDefault()
         self.btnOk.SetDefault()
 
 
     def _layout(self):
     def _layout(self):
@@ -517,12 +520,12 @@ class ModelLoopDialog(ModelItemDialog):
         ModelItemDialog.__init__(self, parent, shape, title,
         ModelItemDialog.__init__(self, parent, shape, title,
                                  style=style, **kwargs)
                                  style=style, **kwargs)
 
 
-        self.listBox = wx.StaticBox(parent=self.panel, id=wx.ID_ANY,
-                                    label=" %s " % _("List of items in loop"))
+        self.listBox = StaticBox(parent=self.panel, id=wx.ID_ANY,
+                                 label=" %s " % _("List of items in loop"))
 
 
-        self.btnSeries = wx.Button(parent=self.panel, id=wx.ID_ANY,
+        self.btnSeries = Button(parent=self.panel, id=wx.ID_ANY,
                                    label=_("Series"))
                                    label=_("Series"))
-        self.btnSeries.SetToolTipString(
+        self.btnSeries.SetToolTip(
             _("Define map series as condition for the loop"))
             _("Define map series as condition for the loop"))
         self.btnSeries.Bind(wx.EVT_BUTTON, self.OnSeries)
         self.btnSeries.Bind(wx.EVT_BUTTON, self.OnSeries)
 
 
@@ -591,13 +594,13 @@ class ModelConditionDialog(ModelItemDialog):
         ModelItemDialog.__init__(self, parent, shape, title,
         ModelItemDialog.__init__(self, parent, shape, title,
                                  style=style, **kwargs)
                                  style=style, **kwargs)
 
 
-        self.listBoxIf = wx.StaticBox(
+        self.listBoxIf = StaticBox(
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             _("List of items in 'if' block"))
             _("List of items in 'if' block"))
         self.itemListIf = self.itemList
         self.itemListIf = self.itemList
         self.itemListIf.SetName('IfBlockList')
         self.itemListIf.SetName('IfBlockList')
 
 
-        self.listBoxElse = wx.StaticBox(
+        self.listBoxElse = StaticBox(
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             _("List of items in 'else' block"))
             _("List of items in 'else' block"))
         self.itemListElse = ItemCheckListCtrl(parent=self.panel,
         self.itemListElse = ItemCheckListCtrl(parent=self.panel,
@@ -743,7 +746,7 @@ class VariableListCtrl(ModelListCtrl):
         """Populate the list"""
         """Populate the list"""
         self.itemDataMap = dict()
         self.itemDataMap = dict()
         i = 0
         i = 0
-        for name, values in data.iteritems():
+        for name, values in six.iteritems(data):
             self.itemDataMap[i] = [name, values['type'],
             self.itemDataMap[i] = [name, values['type'],
                                    values.get('value', ''),
                                    values.get('value', ''),
                                    values.get('description', '')]
                                    values.get('description', '')]
@@ -752,7 +755,7 @@ class VariableListCtrl(ModelListCtrl):
         self.itemCount = len(self.itemDataMap.keys())
         self.itemCount = len(self.itemDataMap.keys())
         self.DeleteAllItems()
         self.DeleteAllItems()
         i = 0
         i = 0
-        for name, vtype, value, desc in self.itemDataMap.itervalues():
+        for name, vtype, value, desc in six.itervalues(self.itemDataMap):
             index = self.InsertStringItem(i, name)
             index = self.InsertStringItem(i, name)
             self.SetStringItem(index, 0, name)
             self.SetStringItem(index, 0, name)
             self.SetStringItem(index, 1, vtype)
             self.SetStringItem(index, 1, vtype)
@@ -767,7 +770,7 @@ class VariableListCtrl(ModelListCtrl):
         :return: None on success
         :return: None on success
         :return: error string
         :return: error string
         """
         """
-        for iname, ivtype, ivalue, idesc in self.itemDataMap.itervalues():
+        for iname, ivtype, ivalue, idesc in six.itervalues(self.itemDataMap):
             if iname == name:
             if iname == name:
                 return _("Variable <%s> already exists in the model. "
                 return _("Variable <%s> already exists in the model. "
                          "Adding variable failed.") % name
                          "Adding variable failed.") % name
@@ -840,7 +843,7 @@ class VariableListCtrl(ModelListCtrl):
             self.Bind(wx.EVT_MENU, self.OnReload, id=self.popupID3)
             self.Bind(wx.EVT_MENU, self.OnReload, id=self.popupID3)
 
 
         # generate popup-menu
         # generate popup-menu
-        menu = wx.Menu()
+        menu = Menu()
         menu.Append(self.popupID1, _("Delete selected"))
         menu.Append(self.popupID1, _("Delete selected"))
         menu.Append(self.popupID2, _("Delete all"))
         menu.Append(self.popupID2, _("Delete all"))
         if self.GetFirstSelected() == -1:
         if self.GetFirstSelected() == -1:
@@ -937,7 +940,7 @@ class ItemListCtrl(ModelListCtrl):
         self.DeleteAllItems()
         self.DeleteAllItems()
         i = 0
         i = 0
         if len(self.columns) == 2:
         if len(self.columns) == 2:
-            for name, desc in self.itemDataMap.itervalues():
+            for name, desc in six.itervalues(self.itemDataMap):
                 index = self.InsertStringItem(i, str(i))
                 index = self.InsertStringItem(i, str(i))
                 self.SetStringItem(index, 0, name)
                 self.SetStringItem(index, 0, name)
                 self.SetStringItem(index, 1, desc)
                 self.SetStringItem(index, 1, desc)
@@ -946,7 +949,7 @@ class ItemListCtrl(ModelListCtrl):
                     self.CheckItem(index, True)
                     self.CheckItem(index, True)
                 i += 1
                 i += 1
         else:
         else:
-            for name, inloop, param, desc in self.itemDataMap.itervalues():
+            for name, inloop, param, desc in six.itervalues(self.itemDataMap):
                 index = self.InsertStringItem(i, str(i))
                 index = self.InsertStringItem(i, str(i))
                 self.SetStringItem(index, 0, name)
                 self.SetStringItem(index, 0, name)
                 self.SetStringItem(index, 1, inloop)
                 self.SetStringItem(index, 1, inloop)
@@ -1009,7 +1012,7 @@ class ItemListCtrl(ModelListCtrl):
             self.Bind(wx.EVT_MENU, self.OnReload, id=self.popupID['reload'])
             self.Bind(wx.EVT_MENU, self.OnReload, id=self.popupID['reload'])
 
 
         # generate popup-menu
         # generate popup-menu
-        menu = wx.Menu()
+        menu = Menu()
         menu.Append(self.popupID['remove'], _("Delete selected"))
         menu.Append(self.popupID['remove'], _("Delete selected"))
         if self.GetFirstSelected() == -1:
         if self.GetFirstSelected() == -1:
             menu.Enable(self.popupID['remove'], False)
             menu.Enable(self.popupID['remove'], False)

+ 41 - 40
gui/wxpython/gmodeler/frame.py

@@ -27,6 +27,7 @@ import tempfile
 import copy
 import copy
 import re
 import re
 import random
 import random
+import six
 
 
 import wx
 import wx
 from wx.lib import ogl
 from wx.lib import ogl
@@ -51,7 +52,7 @@ from gui_core.dialogs import GetImageHandlers, TextEntryDialog
 from gui_core.ghelp import ShowAboutDialog
 from gui_core.ghelp import ShowAboutDialog
 from gui_core.preferences import PreferencesBaseDialog
 from gui_core.preferences import PreferencesBaseDialog
 from core.settings import UserSettings
 from core.settings import UserSettings
-from gui_core.menu import Menu
+from gui_core.menu import Menu as Menubar
 from gmodeler.menudata import ModelerMenuData
 from gmodeler.menudata import ModelerMenuData
 from gui_core.forms import GUI
 from gui_core.forms import GUI
 from gmodeler.preferences import PreferencesDialog, PropertiesDialog
 from gmodeler.preferences import PreferencesDialog, PropertiesDialog
@@ -61,6 +62,8 @@ from gui_core.pystc import PyStc
 from gmodeler.giface import GraphicalModelerGrassInterface
 from gmodeler.giface import GraphicalModelerGrassInterface
 from gmodeler.model import *
 from gmodeler.model import *
 from gmodeler.dialogs import *
 from gmodeler.dialogs import *
+from gui_core.wrap import Button, StaticText, StaticBox, TextCtrl, \
+    Menu, StockCursor, EmptyBitmap
 
 
 wxModelDone, EVT_MODEL_DONE = NewEvent()
 wxModelDone, EVT_MODEL_DONE = NewEvent()
 
 
@@ -89,8 +92,8 @@ class ModelFrame(wx.Frame):
         self.randomness = 40  # random layout
         self.randomness = 40  # random layout
 
 
         self.cursors = {
         self.cursors = {
-            "default": wx.StockCursor(wx.CURSOR_ARROW),
-            "cross": wx.StockCursor(wx.CURSOR_CROSS),
+            "default": StockCursor(wx.CURSOR_ARROW),
+            "cross": StockCursor(wx.CURSOR_CROSS),
         }
         }
 
 
         wx.Frame.__init__(self, parent=parent, id=id, title=title, **kwargs)
         wx.Frame.__init__(self, parent=parent, id=id, title=title, **kwargs)
@@ -102,7 +105,7 @@ class ModelFrame(wx.Frame):
                     'grass.ico'),
                     'grass.ico'),
                 wx.BITMAP_TYPE_ICO))
                 wx.BITMAP_TYPE_ICO))
 
 
-        self.menubar = Menu(
+        self.menubar = Menubar(
             parent=self,
             parent=self,
             model=ModelerMenuData().GetModel(
             model=ModelerMenuData().GetModel(
                 separators=True))
                 separators=True))
@@ -380,7 +383,7 @@ class ModelFrame(wx.Frame):
         dlg.Init(properties)
         dlg.Init(properties)
         if dlg.ShowModal() == wx.ID_OK:
         if dlg.ShowModal() == wx.ID_OK:
             self.ModelChanged()
             self.ModelChanged()
-            for key, value in dlg.GetValues().iteritems():
+            for key, value in six.iteritems(dlg.GetValues()):
                 properties[key] = value
                 properties[key] = value
             for action in self.model.GetItems(objType=ModelAction):
             for action in self.model.GetItems(objType=ModelAction):
                 action.GetTask().set_flag('overwrite', properties['overwrite'])
                 action.GetTask().set_flag('overwrite', properties['overwrite'])
@@ -698,7 +701,7 @@ class ModelFrame(wx.Frame):
                 ymaxImg = ymax
                 ymaxImg = ymax
         size = wx.Size(int(xmaxImg - xminImg) + 50,
         size = wx.Size(int(xmaxImg - xminImg) + 50,
                        int(ymaxImg - yminImg) + 50)
                        int(ymaxImg - yminImg) + 50)
-        bitmap = wx.EmptyBitmap(width=size.width, height=size.height)
+        bitmap = EmptyBitmap(width=size.width, height=size.height)
 
 
         filetype, ltype = GetImageHandlers(wx.ImageFromBitmap(bitmap))
         filetype, ltype = GetImageHandlers(wx.ImageFromBitmap(bitmap))
 
 
@@ -726,10 +729,8 @@ class ModelFrame(wx.Frame):
             dc.SetBackground(wx.WHITE_BRUSH)
             dc.SetBackground(wx.WHITE_BRUSH)
             dc.SetBackgroundMode(wx.SOLID)
             dc.SetBackgroundMode(wx.SOLID)
 
 
-            dc.BeginDrawing()
             self.canvas.GetDiagram().Clear(dc)
             self.canvas.GetDiagram().Clear(dc)
             self.canvas.GetDiagram().Redraw(dc)
             self.canvas.GetDiagram().Redraw(dc)
-            dc.EndDrawing()
 
 
             bitmap.SaveFile(path, fileType)
             bitmap.SaveFile(path, fileType)
             self.SetStatusText(_("Model exported to <%s>") % path)
             self.SetStatusText(_("Model exported to <%s>") % path)
@@ -1120,7 +1121,7 @@ class ModelFrame(wx.Frame):
         :return: False on failure
         :return: False on failure
         """
         """
         self.ModelChanged(False)
         self.ModelChanged(False)
-        tmpfile = tempfile.TemporaryFile(mode='w+b')
+        tmpfile = tempfile.TemporaryFile(mode='w+')
         try:
         try:
             WriteModelFile(fd=tmpfile, model=self.model)
             WriteModelFile(fd=tmpfile, model=self.model)
         except Exception:
         except Exception:
@@ -1495,7 +1496,7 @@ class ModelEvtHandler(ogl.ShapeEvtHandler):
         shape = self.GetShape()
         shape = self.GetShape()
         self._onSelectShape(shape)
         self._onSelectShape(shape)
 
 
-        popupMenu = wx.Menu()
+        popupMenu = Menu()
         popupMenu.Append(self.popupID['remove'], text=_('Remove'))
         popupMenu.Append(self.popupID['remove'], text=_('Remove'))
         self.frame.Bind(wx.EVT_MENU, self.OnRemove, id=self.popupID['remove'])
         self.frame.Bind(wx.EVT_MENU, self.OnRemove, id=self.popupID['remove'])
         if isinstance(shape, ModelAction) or isinstance(shape, ModelLoop):
         if isinstance(shape, ModelAction) or isinstance(shape, ModelLoop):
@@ -1721,7 +1722,7 @@ class VariablePanel(wx.Panel):
 
 
         wx.Panel.__init__(self, parent=parent, id=id, **kwargs)
         wx.Panel.__init__(self, parent=parent, id=id, **kwargs)
 
 
-        self.listBox = wx.StaticBox(
+        self.listBox = StaticBox(
             parent=self, id=wx.ID_ANY, label=" %s " %
             parent=self, id=wx.ID_ANY, label=" %s " %
             _("List of variables - right-click to delete"))
             _("List of variables - right-click to delete"))
 
 
@@ -1735,9 +1736,9 @@ class VariablePanel(wx.Panel):
             frame=self.parent)
             frame=self.parent)
 
 
         # add new category
         # add new category
-        self.addBox = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                                   label=" %s " % _("Add new variable"))
-        self.name = wx.TextCtrl(parent=self, id=wx.ID_ANY)
+        self.addBox = StaticBox(parent=self, id=wx.ID_ANY,
+                                label=" %s " % _("Add new variable"))
+        self.name = TextCtrl(parent=self, id=wx.ID_ANY)
         wx.CallAfter(self.name.SetFocus)
         wx.CallAfter(self.name.SetFocus)
         self.type = wx.Choice(parent=self, id=wx.ID_ANY,
         self.type = wx.Choice(parent=self, id=wx.ID_ANY,
                               choices=[_("integer"),
                               choices=[_("integer"),
@@ -1750,12 +1751,12 @@ class VariablePanel(wx.Panel):
                                        _("file"),
                                        _("file"),
                                        _("dir")])
                                        _("dir")])
         self.type.SetSelection(2)  # string
         self.type.SetSelection(2)  # string
-        self.value = wx.TextCtrl(parent=self, id=wx.ID_ANY)
-        self.desc = wx.TextCtrl(parent=self, id=wx.ID_ANY)
+        self.value = TextCtrl(parent=self, id=wx.ID_ANY)
+        self.desc = TextCtrl(parent=self, id=wx.ID_ANY)
 
 
         # buttons
         # buttons
-        self.btnAdd = wx.Button(parent=self, id=wx.ID_ADD)
-        self.btnAdd.SetToolTipString(_("Add new variable to the model"))
+        self.btnAdd = Button(parent=self, id=wx.ID_ADD)
+        self.btnAdd.SetToolTip(_("Add new variable to the model"))
         self.btnAdd.Enable(False)
         self.btnAdd.Enable(False)
 
 
         # bindings
         # bindings
@@ -1774,28 +1775,28 @@ class VariablePanel(wx.Panel):
 
 
         addSizer = wx.StaticBoxSizer(self.addBox, wx.VERTICAL)
         addSizer = wx.StaticBoxSizer(self.addBox, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(hgap=5, vgap=5)
         gridSizer = wx.GridBagSizer(hgap=5, vgap=5)
-        gridSizer.Add(wx.StaticText(parent=self, id=wx.ID_ANY,
-                                    label="%s:" % _("Name")),
+        gridSizer.Add(StaticText(parent=self, id=wx.ID_ANY,
+                                 label="%s:" % _("Name")),
                       flag=wx.ALIGN_CENTER_VERTICAL,
                       flag=wx.ALIGN_CENTER_VERTICAL,
                       pos=(0, 0))
                       pos=(0, 0))
         gridSizer.Add(self.name,
         gridSizer.Add(self.name,
                       pos=(0, 1),
                       pos=(0, 1),
                       flag=wx.EXPAND)
                       flag=wx.EXPAND)
-        gridSizer.Add(wx.StaticText(parent=self, id=wx.ID_ANY,
-                                    label="%s:" % _("Data type")),
+        gridSizer.Add(StaticText(parent=self, id=wx.ID_ANY,
+                                 label="%s:" % _("Data type")),
                       flag=wx.ALIGN_CENTER_VERTICAL,
                       flag=wx.ALIGN_CENTER_VERTICAL,
                       pos=(0, 2))
                       pos=(0, 2))
         gridSizer.Add(self.type,
         gridSizer.Add(self.type,
                       pos=(0, 3))
                       pos=(0, 3))
-        gridSizer.Add(wx.StaticText(parent=self, id=wx.ID_ANY,
-                                    label="%s:" % _("Default value")),
+        gridSizer.Add(StaticText(parent=self, id=wx.ID_ANY,
+                                 label="%s:" % _("Default value")),
                       flag=wx.ALIGN_CENTER_VERTICAL,
                       flag=wx.ALIGN_CENTER_VERTICAL,
                       pos=(1, 0))
                       pos=(1, 0))
         gridSizer.Add(self.value,
         gridSizer.Add(self.value,
                       pos=(1, 1), span=(1, 3),
                       pos=(1, 1), span=(1, 3),
                       flag=wx.EXPAND)
                       flag=wx.EXPAND)
-        gridSizer.Add(wx.StaticText(parent=self, id=wx.ID_ANY,
-                                    label="%s:" % _("Description")),
+        gridSizer.Add(StaticText(parent=self, id=wx.ID_ANY,
+                                 label="%s:" % _("Description")),
                       flag=wx.ALIGN_CENTER_VERTICAL,
                       flag=wx.ALIGN_CENTER_VERTICAL,
                       pos=(2, 0))
                       pos=(2, 0))
         gridSizer.Add(self.desc,
         gridSizer.Add(self.desc,
@@ -1845,7 +1846,7 @@ class VariablePanel(wx.Panel):
     def UpdateModelVariables(self):
     def UpdateModelVariables(self):
         """Update model variables"""
         """Update model variables"""
         variables = dict()
         variables = dict()
-        for values in self.list.GetData().itervalues():
+        for values in six.itervalues(self.list.GetData()):
             name = values[0]
             name = values[0]
             variables[name] = {'type': str(values[1])}
             variables[name] = {'type': str(values[1])}
             if values[2]:
             if values[2]:
@@ -1876,7 +1877,7 @@ class ItemPanel(wx.Panel):
 
 
         wx.Panel.__init__(self, parent=parent, id=id, **kwargs)
         wx.Panel.__init__(self, parent=parent, id=id, **kwargs)
 
 
-        self.listBox = wx.StaticBox(
+        self.listBox = StaticBox(
             parent=self, id=wx.ID_ANY, label=" %s " %
             parent=self, id=wx.ID_ANY, label=" %s " %
             _("List of items - right-click to delete"))
             _("List of items - right-click to delete"))
 
 
@@ -1893,9 +1894,9 @@ class ItemPanel(wx.Panel):
                 3],
                 3],
             frame=self.parent)
             frame=self.parent)
 
 
-        self.btnMoveUp = wx.Button(parent=self, id=wx.ID_UP)
-        self.btnMoveDown = wx.Button(parent=self, id=wx.ID_DOWN)
-        self.btnRefresh = wx.Button(parent=self, id=wx.ID_REFRESH)
+        self.btnMoveUp = Button(parent=self, id=wx.ID_UP)
+        self.btnMoveDown = Button(parent=self, id=wx.ID_DOWN)
+        self.btnRefresh = Button(parent=self, id=wx.ID_REFRESH)
 
 
         self.btnMoveUp.Bind(wx.EVT_BUTTON, self.OnMoveItemsUp)
         self.btnMoveUp.Bind(wx.EVT_BUTTON, self.OnMoveItemsUp)
         self.btnMoveDown.Bind(wx.EVT_BUTTON, self.OnMoveItemsDown)
         self.btnMoveDown.Bind(wx.EVT_BUTTON, self.OnMoveItemsDown)
@@ -1976,18 +1977,18 @@ class PythonPanel(wx.Panel):
 
 
         self.filename = None  # temp file to run
         self.filename = None  # temp file to run
 
 
-        self.bodyBox = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                                    label=" %s " % _("Python script"))
+        self.bodyBox = StaticBox(parent=self, id=wx.ID_ANY,
+                                 label=" %s " % _("Python script"))
         self.body = PyStc(parent=self, statusbar=self.parent.GetStatusBar())
         self.body = PyStc(parent=self, statusbar=self.parent.GetStatusBar())
 
 
-        self.btnRun = wx.Button(parent=self, id=wx.ID_ANY, label=_("&Run"))
-        self.btnRun.SetToolTipString(_("Run python script"))
+        self.btnRun = Button(parent=self, id=wx.ID_ANY, label=_("&Run"))
+        self.btnRun.SetToolTip(_("Run python script"))
         self.Bind(wx.EVT_BUTTON, self.OnRun, self.btnRun)
         self.Bind(wx.EVT_BUTTON, self.OnRun, self.btnRun)
-        self.btnSaveAs = wx.Button(parent=self, id=wx.ID_SAVEAS)
-        self.btnSaveAs.SetToolTipString(_("Save python script to file"))
+        self.btnSaveAs = Button(parent=self, id=wx.ID_SAVEAS)
+        self.btnSaveAs.SetToolTip(_("Save python script to file"))
         self.Bind(wx.EVT_BUTTON, self.OnSaveAs, self.btnSaveAs)
         self.Bind(wx.EVT_BUTTON, self.OnSaveAs, self.btnSaveAs)
-        self.btnRefresh = wx.Button(parent=self, id=wx.ID_REFRESH)
-        self.btnRefresh.SetToolTipString(_("Refresh python script based on the model.\n"
+        self.btnRefresh = Button(parent=self, id=wx.ID_REFRESH)
+        self.btnRefresh.SetToolTip(_("Refresh python script based on the model.\n"
                                            "It will discards all local changes."))
                                            "It will discards all local changes."))
         self.Bind(wx.EVT_BUTTON, self.OnRefresh, self.btnRefresh)
         self.Bind(wx.EVT_BUTTON, self.OnRefresh, self.btnRefresh)
 
 
@@ -2124,7 +2125,7 @@ class PythonPanel(wx.Panel):
             if ret == wx.ID_NO:
             if ret == wx.ID_NO:
                 return False
                 return False
 
 
-        fd = tempfile.TemporaryFile()
+        fd = tempfile.TemporaryFile(mode='r+')
         WritePythonFile(fd, self.parent.GetModel())
         WritePythonFile(fd, self.parent.GetModel())
         fd.seek(0)
         fd.seek(0)
         self.body.SetText(fd.read())
         self.body.SetText(fd.read())

+ 12 - 10
gui/wxpython/gmodeler/model.py

@@ -32,6 +32,7 @@ import copy
 import re
 import re
 import mimetypes
 import mimetypes
 import time
 import time
+import six
 try:
 try:
     import xml.etree.ElementTree as etree
     import xml.etree.ElementTree as etree
 except ImportError:
 except ImportError:
@@ -49,6 +50,7 @@ from core.gcmd import GMessage, GException, GError, RunCommand, EncodeString, GW
 from core.settings import UserSettings
 from core.settings import UserSettings
 from gui_core.forms import GUI, CmdPanel
 from gui_core.forms import GUI, CmdPanel
 from gui_core.widgets import GNotebook
 from gui_core.widgets import GNotebook
+from gui_core.wrap import Button
 from gmodeler.giface import GraphicalModelerGrassInterface
 from gmodeler.giface import GraphicalModelerGrassInterface
 
 
 from grass.script import core as grass
 from grass.script import core as grass
@@ -119,7 +121,7 @@ class Model(object):
 
 
     def ReorderItems(self, idxList):
     def ReorderItems(self, idxList):
         items = list()
         items = list()
-        for oldIdx, newIdx in idxList.iteritems():
+        for oldIdx, newIdx in six.iteritems(idxList):
             item = self.items.pop(oldIdx)
             item = self.items.pop(oldIdx)
             items.append(item)
             items.append(item)
             self.items.insert(newIdx, item)
             self.items.insert(newIdx, item)
@@ -655,7 +657,7 @@ class Model(object):
                 return
                 return
 
 
             err = list()
             err = list()
-            for key, item in params.iteritems():
+            for key, item in six.iteritems(params):
                 for p in item['params']:
                 for p in item['params']:
                     if p.get('value', '') == '':
                     if p.get('value', '') == '':
                         err.append(
                         err.append(
@@ -752,7 +754,7 @@ class Model(object):
 
 
         # discard values
         # discard values
         if params:
         if params:
-            for item in params.itervalues():
+            for item in six.itervalues(params):
                 for p in item['params']:
                 for p in item['params']:
                     p['value'] = ''
                     p['value'] = ''
 
 
@@ -821,7 +823,7 @@ class Model(object):
             result["variables"] = {'flags': list(),
             result["variables"] = {'flags': list(),
                                    'params': params,
                                    'params': params,
                                    'idx': idx}
                                    'idx': idx}
-            for name, values in self.variables.iteritems():
+            for name, values in six.iteritems(self.variables):
                 gtype = values.get('type', 'string')
                 gtype = values.get('type', 'string')
                 if gtype in ('raster', 'vector', 'mapset',
                 if gtype in ('raster', 'vector', 'mapset',
                              'file', 'region', 'dir'):
                              'file', 'region', 'dir'):
@@ -2278,7 +2280,7 @@ class WriteModelFile:
             return
             return
         self.fd.write('%s<variables>\n' % (' ' * self.indent))
         self.fd.write('%s<variables>\n' % (' ' * self.indent))
         self.indent += 4
         self.indent += 4
-        for name, values in self.variables.iteritems():
+        for name, values in six.iteritems(self.variables):
             self.fd.write(
             self.fd.write(
                 '%s<variable name="%s" type="%s">\n' %
                 '%s<variable name="%s" type="%s">\n' %
                 (' ' * self.indent, EncodeString(name), values['type']))
                 (' ' * self.indent, EncodeString(name), values['type']))
@@ -2331,7 +2333,7 @@ class WriteModelFile:
         self.indent += 4
         self.indent += 4
         if not action.IsEnabled():
         if not action.IsEnabled():
             self.fd.write('%s<disabled />\n' % (' ' * self.indent))
             self.fd.write('%s<disabled />\n' % (' ' * self.indent))
-        for key, val in action.GetParams().iteritems():
+        for key, val in six.iteritems(action.GetParams()):
             if key == 'flags':
             if key == 'flags':
                 for f in val:
                 for f in val:
                     if f.get('value', False) or f.get('parameterized', False):
                     if f.get('value', False) or f.get('parameterized', False):
@@ -2576,7 +2578,7 @@ class WritePythonFile:
 """ % (EncodeString(' '.join(properties['description'].splitlines()))))
 """ % (EncodeString(' '.join(properties['description'].splitlines()))))
 
 
         variables = self.model.GetVariables()
         variables = self.model.GetVariables()
-        for key, data in variables.iteritems():
+        for key, data in six.iteritems(variables):
             otype = self._getStandardizedOption(data['type'])
             otype = self._getStandardizedOption(data['type'])
             self.fd.write(
             self.fd.write(
                 r"""
                 r"""
@@ -2830,8 +2832,8 @@ class ModelParamDialog(wx.Dialog):
         if not rast and not vect and not rast3d:
         if not rast and not vect and not rast3d:
             self.interData.Hide()
             self.interData.Hide()
 
 
-        self.btnCancel = wx.Button(parent=self, id=wx.ID_CANCEL)
-        self.btnRun = wx.Button(parent=self, id=wx.ID_OK,
+        self.btnCancel = Button(parent=self, id=wx.ID_CANCEL)
+        self.btnRun = Button(parent=self, id=wx.ID_OK,
                                 label=_("&Run"))
                                 label=_("&Run"))
         self.btnRun.SetDefault()
         self.btnRun.SetDefault()
 
 
@@ -2870,7 +2872,7 @@ class ModelParamDialog(wx.Dialog):
     def _createPages(self):
     def _createPages(self):
         """Create for each parameterized module its own page"""
         """Create for each parameterized module its own page"""
         nameOrdered = [''] * len(self.params.keys())
         nameOrdered = [''] * len(self.params.keys())
-        for name, params in self.params.iteritems():
+        for name, params in six.iteritems(self.params):
             nameOrdered[params['idx']] = name
             nameOrdered[params['idx']] = name
         for name in nameOrdered:
         for name in nameOrdered:
             params = self.params[name]
             params = self.params[name]

+ 77 - 76
gui/wxpython/gmodeler/preferences.py

@@ -22,7 +22,8 @@ from core import globalvar
 from gui_core.preferences import PreferencesBaseDialog
 from gui_core.preferences import PreferencesBaseDialog
 from core.settings import UserSettings
 from core.settings import UserSettings
 from core.utils import _
 from core.utils import _
-from gui_core.wrap import SpinCtrl
+from gui_core.wrap import SpinCtrl, Button, StaticText, \
+    StaticBox
 
 
 
 
 class PreferencesDialog(PreferencesBaseDialog):
 class PreferencesDialog(PreferencesBaseDialog):
@@ -55,15 +56,15 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
         # colors
         # colors
         border = wx.BoxSizer(wx.VERTICAL)
         border = wx.BoxSizer(wx.VERTICAL)
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % _("Item properties"))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % _("Item properties"))
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
 
 
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
 
 
         row = 0
         row = 0
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Disabled:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Disabled:")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
                       pos=(row, 0))
@@ -103,15 +104,15 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
         # colors
         # colors
         border = wx.BoxSizer(wx.VERTICAL)
         border = wx.BoxSizer(wx.VERTICAL)
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % _("Color"))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % _("Color"))
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
 
 
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
 
 
         row = 0
         row = 0
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Valid:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Valid:")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
                       pos=(row, 0))
@@ -128,8 +129,8 @@ class PreferencesDialog(PreferencesBaseDialog):
                       pos=(row, 1))
                       pos=(row, 1))
 
 
         row += 1
         row += 1
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Invalid:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Invalid:")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
                       pos=(row, 0))
@@ -146,8 +147,8 @@ class PreferencesDialog(PreferencesBaseDialog):
                       pos=(row, 1))
                       pos=(row, 1))
 
 
         row += 1
         row += 1
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Running:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Running:")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
                       pos=(row, 0))
@@ -173,15 +174,15 @@ class PreferencesDialog(PreferencesBaseDialog):
                    wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)
                    wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)
 
 
         # size
         # size
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % _("Shape size"))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % _("Shape size"))
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
 
 
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
 
 
         row = 0
         row = 0
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Width:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Width:")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
                       pos=(row, 0))
@@ -206,8 +207,8 @@ class PreferencesDialog(PreferencesBaseDialog):
                       pos=(row, 1))
                       pos=(row, 1))
 
 
         row += 1
         row += 1
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Height:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Height:")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
                       pos=(row, 0))
@@ -251,15 +252,15 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
         # colors
         # colors
         border = wx.BoxSizer(wx.VERTICAL)
         border = wx.BoxSizer(wx.VERTICAL)
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % _("Type"))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % _("Type"))
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
 
 
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
 
 
         row = 0
         row = 0
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Raster:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Raster:")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
                       pos=(row, 0))
@@ -276,8 +277,8 @@ class PreferencesDialog(PreferencesBaseDialog):
                       pos=(row, 1))
                       pos=(row, 1))
 
 
         row += 1
         row += 1
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("3D raster:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("3D raster:")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
                       pos=(row, 0))
@@ -294,8 +295,8 @@ class PreferencesDialog(PreferencesBaseDialog):
                       pos=(row, 1))
                       pos=(row, 1))
 
 
         row += 1
         row += 1
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Vector:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Vector:")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
                       pos=(row, 0))
@@ -312,8 +313,8 @@ class PreferencesDialog(PreferencesBaseDialog):
                       pos=(row, 1))
                       pos=(row, 1))
 
 
         row += 1
         row += 1
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Table:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Table:")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
                       pos=(row, 0))
@@ -339,15 +340,15 @@ class PreferencesDialog(PreferencesBaseDialog):
                    wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)
                    wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)
 
 
         # size
         # size
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % _("Shape size"))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % _("Shape size"))
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
 
 
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
 
 
         row = 0
         row = 0
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Width:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Width:")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
                       pos=(row, 0))
@@ -372,8 +373,8 @@ class PreferencesDialog(PreferencesBaseDialog):
                       pos=(row, 1))
                       pos=(row, 1))
 
 
         row += 1
         row += 1
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Height:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Height:")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
                       pos=(row, 0))
@@ -417,15 +418,15 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
         # colors
         # colors
         border = wx.BoxSizer(wx.VERTICAL)
         border = wx.BoxSizer(wx.VERTICAL)
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % _("Color"))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % _("Color"))
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
 
 
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
 
 
         row = 0
         row = 0
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Valid:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Valid:")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
                       pos=(row, 0))
@@ -451,15 +452,15 @@ class PreferencesDialog(PreferencesBaseDialog):
                    wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)
                    wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)
 
 
         # size
         # size
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % _("Shape size"))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % _("Shape size"))
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
 
 
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
 
 
         row = 0
         row = 0
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Width:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Width:")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
                       pos=(row, 0))
@@ -484,8 +485,8 @@ class PreferencesDialog(PreferencesBaseDialog):
                       pos=(row, 1))
                       pos=(row, 1))
 
 
         row += 1
         row += 1
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Height:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Height:")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
                       pos=(row, 0))
@@ -529,15 +530,15 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
         # colors
         # colors
         border = wx.BoxSizer(wx.VERTICAL)
         border = wx.BoxSizer(wx.VERTICAL)
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % _("Color"))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % _("Color"))
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
 
 
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
 
 
         row = 0
         row = 0
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Valid:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Valid:")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
                       pos=(row, 0))
@@ -567,15 +568,15 @@ class PreferencesDialog(PreferencesBaseDialog):
                    wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)
                    wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)
 
 
         # size
         # size
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % _("Shape size"))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % _("Shape size"))
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
 
 
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
 
 
         row = 0
         row = 0
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Width:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Width:")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
                       pos=(row, 0))
@@ -600,8 +601,8 @@ class PreferencesDialog(PreferencesBaseDialog):
                       pos=(row, 1))
                       pos=(row, 1))
 
 
         row += 1
         row += 1
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Height:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Height:")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
                       pos=(row, 0))
@@ -664,18 +665,18 @@ class PropertiesDialog(wx.Dialog):
         wx.Dialog.__init__(self, parent, id, title, size=size,
         wx.Dialog.__init__(self, parent, id, title, size=size,
                            style=style)
                            style=style)
 
 
-        self.metaBox = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                                    label=" %s " % _("Metadata"))
-        self.cmdBox = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                                   label=" %s " % _("Commands"))
+        self.metaBox = StaticBox(parent=self, id=wx.ID_ANY,
+                                 label=" %s " % _("Metadata"))
+        self.cmdBox = StaticBox(parent=self, id=wx.ID_ANY,
+                                label=" %s " % _("Commands"))
 
 
-        self.name = wx.TextCtrl(parent=self, id=wx.ID_ANY,
-                                size=(300, 25))
-        self.desc = wx.TextCtrl(parent=self, id=wx.ID_ANY,
-                                style=wx.TE_MULTILINE,
-                                size=(300, 50))
-        self.author = wx.TextCtrl(parent=self, id=wx.ID_ANY,
-                                  size=(300, 25))
+        self.name = TextCtrl(parent=self, id=wx.ID_ANY,
+                             size=(300, 25))
+        self.desc = TextCtrl(parent=self, id=wx.ID_ANY,
+                             style=wx.TE_MULTILINE,
+                             size=(300, 50))
+        self.author = TextCtrl(parent=self, id=wx.ID_ANY,
+                               size=(300, 25))
 
 
         # commands
         # commands
         self.overwrite = wx.CheckBox(parent=self, id=wx.ID_ANY, label=_(
         self.overwrite = wx.CheckBox(parent=self, id=wx.ID_ANY, label=_(
@@ -687,13 +688,13 @@ class PropertiesDialog(wx.Dialog):
                 subkey='enabled'))
                 subkey='enabled'))
 
 
         # buttons
         # buttons
-        self.btnOk = wx.Button(self, wx.ID_OK)
-        self.btnCancel = wx.Button(self, wx.ID_CANCEL)
+        self.btnOk = Button(self, wx.ID_OK)
+        self.btnCancel = Button(self, wx.ID_CANCEL)
         self.btnOk.SetDefault()
         self.btnOk.SetDefault()
 
 
-        self.btnOk.SetToolTipString(_("Apply properties"))
+        self.btnOk.SetToolTip(_("Apply properties"))
         self.btnOk.SetDefault()
         self.btnOk.SetDefault()
-        self.btnCancel.SetToolTipString(_("Close dialog and ignore changes"))
+        self.btnCancel.SetToolTip(_("Close dialog and ignore changes"))
 
 
         self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
         self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
 
 
@@ -702,8 +703,8 @@ class PropertiesDialog(wx.Dialog):
     def _layout(self):
     def _layout(self):
         metaSizer = wx.StaticBoxSizer(self.metaBox, wx.VERTICAL)
         metaSizer = wx.StaticBoxSizer(self.metaBox, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
-        gridSizer.Add(wx.StaticText(parent=self, id=wx.ID_ANY,
-                                    label=_("Name:")),
+        gridSizer.Add(StaticText(parent=self, id=wx.ID_ANY,
+                                 label=_("Name:")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(0, 0))
                       pos=(0, 0))
@@ -711,8 +712,8 @@ class PropertiesDialog(wx.Dialog):
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                       wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                       pos=(0, 1))
                       pos=(0, 1))
-        gridSizer.Add(wx.StaticText(parent=self, id=wx.ID_ANY,
-                                    label=_("Description:")),
+        gridSizer.Add(StaticText(parent=self, id=wx.ID_ANY,
+                                 label=_("Description:")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(1, 0))
                       pos=(1, 0))
@@ -720,8 +721,8 @@ class PropertiesDialog(wx.Dialog):
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                       wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                       pos=(1, 1))
                       pos=(1, 1))
-        gridSizer.Add(wx.StaticText(parent=self, id=wx.ID_ANY,
-                                    label=_("Author(s):")),
+        gridSizer.Add(StaticText(parent=self, id=wx.ID_ANY,
+                                 label=_("Author(s):")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(2, 0))
                       pos=(2, 0))

+ 106 - 101
gui/wxpython/gui_core/dialogs.py

@@ -31,6 +31,7 @@ This program is free software under the GNU General Public License
 import os
 import os
 import sys
 import sys
 import re
 import re
+import six
 
 
 import wx
 import wx
 
 
@@ -47,7 +48,8 @@ from gui_core.widgets import SingleSymbolPanel, GListCtrl, SimpleValidator, MapV
 from core.utils import _
 from core.utils import _
 from core.settings import UserSettings
 from core.settings import UserSettings
 from core.debug import Debug
 from core.debug import Debug
-from gui_core.wrap import SpinCtrl, TextCtrl
+from gui_core.wrap import SpinCtrl, TextCtrl, Button, CheckListBox, \
+    StaticText, StaticBox, Menu
 
 
 
 
 class SimpleDialog(wx.Dialog):
 class SimpleDialog(wx.Dialog):
@@ -64,8 +66,8 @@ class SimpleDialog(wx.Dialog):
         self.SetExtraStyle(wx.WS_EX_VALIDATE_RECURSIVELY)
         self.SetExtraStyle(wx.WS_EX_VALIDATE_RECURSIVELY)
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
 
 
-        self.btnCancel = wx.Button(parent=self.panel, id=wx.ID_CANCEL)
-        self.btnOK = wx.Button(parent=self.panel, id=wx.ID_OK)
+        self.btnCancel = Button(parent=self.panel, id=wx.ID_CANCEL)
+        self.btnOK = Button(parent=self.panel, id=wx.ID_OK)
         self.btnOK.SetDefault()
         self.btnOK.SetDefault()
 
 
         self.__layout()
         self.__layout()
@@ -127,7 +129,7 @@ class LocationDialog(SimpleDialog):
     def _layout(self):
     def _layout(self):
         """Do layout"""
         """Do layout"""
         self.dataSizer.Add(
         self.dataSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self.panel,
                 parent=self.panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Name of GRASS location:")),
                 label=_("Name of GRASS location:")),
@@ -138,7 +140,7 @@ class LocationDialog(SimpleDialog):
                            flag=wx.EXPAND | wx.ALL, border=1)
                            flag=wx.EXPAND | wx.ALL, border=1)
 
 
         self.dataSizer.Add(
         self.dataSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self.panel,
                 parent=self.panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Name of mapset:")),
                 label=_("Name of mapset:")),
@@ -197,8 +199,8 @@ class MapsetDialog(SimpleDialog):
 
 
     def _layout(self):
     def _layout(self):
         """Do layout"""
         """Do layout"""
-        self.dataSizer.Add(wx.StaticText(parent=self.panel, id=wx.ID_ANY,
-                                         label=_("Name of mapset:")),
+        self.dataSizer.Add(StaticText(parent=self.panel, id=wx.ID_ANY,
+                                      label=_("Name of mapset:")),
                            proportion=0, flag=wx.ALL, border=1)
                            proportion=0, flag=wx.ALL, border=1)
         self.dataSizer.Add(self.element, proportion=0,
         self.dataSizer.Add(self.element, proportion=0,
                            flag=wx.EXPAND | wx.ALL, border=1)
                            flag=wx.EXPAND | wx.ALL, border=1)
@@ -236,8 +238,8 @@ class VectorDialog(SimpleDialog):
 
 
     def _layout(self):
     def _layout(self):
         """Do layout"""
         """Do layout"""
-        self.dataSizer.Add(wx.StaticText(parent=self.panel, id=wx.ID_ANY,
-                                         label=_("Name of vector map:")),
+        self.dataSizer.Add(StaticText(parent=self.panel, id=wx.ID_ANY,
+                                      label=_("Name of vector map:")),
                            proportion=0, flag=wx.ALL, border=1)
                            proportion=0, flag=wx.ALL, border=1)
         self.dataSizer.Add(self.element, proportion=0,
         self.dataSizer.Add(self.element, proportion=0,
                            flag=wx.EXPAND | wx.ALL, border=1)
                            flag=wx.EXPAND | wx.ALL, border=1)
@@ -292,8 +294,8 @@ class NewVectorDialog(VectorDialog):
         if showType:
         if showType:
             self.keycol = None
             self.keycol = None
         else:
         else:
-            self.keycol = wx.TextCtrl(parent=self.panel, id=wx.ID_ANY,
-                                      size=globalvar.DIALOG_SPIN_SIZE)
+            self.keycol = TextCtrl(parent=self.panel, id=wx.ID_ANY,
+                                   size=globalvar.DIALOG_SPIN_SIZE)
             self.keycol.SetValue(
             self.keycol.SetValue(
                 UserSettings.Get(
                 UserSettings.Get(
                     group='atm',
                     group='atm',
@@ -327,7 +329,7 @@ class NewVectorDialog(VectorDialog):
     def _layout(self):
     def _layout(self):
         """Do layout"""
         """Do layout"""
         self.dataSizer.Add(
         self.dataSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self.panel,
                 parent=self.panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Name for new vector map:")),
                 label=_("Name for new vector map:")),
@@ -347,7 +349,7 @@ class NewVectorDialog(VectorDialog):
         if self.keycol:
         if self.keycol:
             keySizer = wx.BoxSizer(wx.HORIZONTAL)
             keySizer = wx.BoxSizer(wx.HORIZONTAL)
             keySizer.Add(
             keySizer.Add(
-                wx.StaticText(
+                StaticText(
                     parent=self.panel,
                     parent=self.panel,
                     label=_("Key column:")),
                     label=_("Key column:")),
                 proportion=0,
                 proportion=0,
@@ -552,7 +554,7 @@ class SavedRegion(wx.Dialog):
         sizer = wx.BoxSizer(wx.VERTICAL)
         sizer = wx.BoxSizer(wx.VERTICAL)
 
 
         box = wx.BoxSizer(wx.HORIZONTAL)
         box = wx.BoxSizer(wx.HORIZONTAL)
-        label = wx.StaticText(parent=self, id=wx.ID_ANY)
+        label = StaticText(parent=self, id=wx.ID_ANY)
         box.Add(
         box.Add(
             label,
             label,
             proportion=0,
             proportion=0,
@@ -593,11 +595,11 @@ class SavedRegion(wx.Dialog):
 
 
         btnsizer = wx.StdDialogButtonSizer()
         btnsizer = wx.StdDialogButtonSizer()
 
 
-        btn = wx.Button(parent=self, id=wx.ID_OK)
+        btn = Button(parent=self, id=wx.ID_OK)
         btn.SetDefault()
         btn.SetDefault()
         btnsizer.AddButton(btn)
         btnsizer.AddButton(btn)
 
 
-        btn = wx.Button(parent=self, id=wx.ID_CANCEL)
+        btn = Button(parent=self, id=wx.ID_CANCEL)
         btnsizer.AddButton(btn)
         btnsizer.AddButton(btn)
         btnsizer.Realize()
         btnsizer.Realize()
 
 
@@ -662,14 +664,14 @@ class GroupDialog(wx.Dialog):
         self.bodySizer = self._createDialogBody()
         self.bodySizer = self._createDialogBody()
 
 
         # buttons
         # buttons
-        btnOk = wx.Button(parent=self, id=wx.ID_OK)
-        btnApply = wx.Button(parent=self, id=wx.ID_APPLY)
-        btnClose = wx.Button(parent=self, id=wx.ID_CANCEL)
+        btnOk = Button(parent=self, id=wx.ID_OK)
+        btnApply = Button(parent=self, id=wx.ID_APPLY)
+        btnClose = Button(parent=self, id=wx.ID_CANCEL)
 
 
-        btnOk.SetToolTipString(
+        btnOk.SetToolTip(
             _("Apply changes to selected group and close dialog"))
             _("Apply changes to selected group and close dialog"))
-        btnApply.SetToolTipString(_("Apply changes to selected group"))
-        btnClose.SetToolTipString(_("Close dialog, changes are not applied"))
+        btnApply.SetToolTip(_("Apply changes to selected group"))
+        btnClose.SetToolTip(_("Close dialog, changes are not applied"))
 
 
         # btnOk.SetDefault()
         # btnOk.SetDefault()
 
 
@@ -716,8 +718,8 @@ class GroupDialog(wx.Dialog):
                            " and '$' for the end.")
                            " and '$' for the end.")
 
 
         # group selection
         # group selection
-        bodySizer.Add(wx.StaticText(parent=self, id=wx.ID_ANY,
-                                    label=_("Select existing group or "
+        bodySizer.Add(StaticText(parent=self, id=wx.ID_ANY,
+                                 label=_("Select existing group or "
                                             "enter name of new group:")),
                                             "enter name of new group:")),
                       flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP, border=10)
                       flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP, border=10)
         self.groupSelect = Select(parent=self, type='group',
         self.groupSelect = Select(parent=self, type='group',
@@ -737,7 +739,7 @@ class GroupDialog(wx.Dialog):
         subg_sizer = wx.BoxSizer(wx.VERTICAL)
         subg_sizer = wx.BoxSizer(wx.VERTICAL)
 
 
         subg_sizer.Add(
         subg_sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self.subg_panel,
                 parent=self.subg_panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_(
                 label=_(
@@ -773,7 +775,7 @@ class GroupDialog(wx.Dialog):
                        pos=(0, 1))
                        pos=(0, 1))
 
 
         gListSizer.Add(
         gListSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self.gListPanel,
                 parent=self.gListPanel,
                 label=_("Pattern:")),
                 label=_("Pattern:")),
             flag=wx.ALIGN_CENTER_VERTICAL,
             flag=wx.ALIGN_CENTER_VERTICAL,
@@ -781,17 +783,17 @@ class GroupDialog(wx.Dialog):
                 1,
                 1,
                 0))
                 0))
 
 
-        self.gfilter = wx.TextCtrl(parent=self.gListPanel, id=wx.ID_ANY,
+        self.gfilter = TextCtrl(parent=self.gListPanel, id=wx.ID_ANY,
                                    value="",
                                    value="",
                                    size=(250, -1))
                                    size=(250, -1))
-        self.gfilter.SetToolTipString(filter_tooltip)
+        self.gfilter.SetToolTip(filter_tooltip)
 
 
         gListSizer.Add(self.gfilter,
         gListSizer.Add(self.gfilter,
                        flag=wx.EXPAND,
                        flag=wx.EXPAND,
                        pos=(1, 1))
                        pos=(1, 1))
 
 
         gListSizer.Add(
         gListSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self.gListPanel,
                 parent=self.gListPanel,
                 label=_("List of maps:")),
                 label=_("List of maps:")),
             flag=wx.ALIGN_CENTER_VERTICAL | wx.BOTTOM,
             flag=wx.ALIGN_CENTER_VERTICAL | wx.BOTTOM,
@@ -807,13 +809,13 @@ class GroupDialog(wx.Dialog):
             style=wx.LB_MULTIPLE | wx.LB_NEEDED_SB)
             style=wx.LB_MULTIPLE | wx.LB_NEEDED_SB)
         sizer.Add(self.gLayerBox, proportion=1, flag=wx.EXPAND)
         sizer.Add(self.gLayerBox, proportion=1, flag=wx.EXPAND)
 
 
-        self.addLayer = wx.Button(self.gListPanel, id=wx.ID_ADD)
-        self.addLayer.SetToolTipString(
+        self.addLayer = Button(self.gListPanel, id=wx.ID_ADD)
+        self.addLayer.SetToolTip(
             _("Select map layers and add them to the list."))
             _("Select map layers and add them to the list."))
         buttonSizer.Add(self.addLayer, flag=wx.BOTTOM, border=10)
         buttonSizer.Add(self.addLayer, flag=wx.BOTTOM, border=10)
 
 
-        self.removeLayer = wx.Button(self.gListPanel, id=wx.ID_REMOVE)
-        self.removeLayer.SetToolTipString(
+        self.removeLayer = Button(self.gListPanel, id=wx.ID_REMOVE)
+        self.removeLayer.SetToolTip(
             _("Remove selected layer(s) from list."))
             _("Remove selected layer(s) from list."))
         buttonSizer.Add(self.removeLayer)
         buttonSizer.Add(self.removeLayer)
         sizer.Add(buttonSizer, flag=wx.LEFT, border=5)
         sizer.Add(buttonSizer, flag=wx.LEFT, border=5)
@@ -841,7 +843,7 @@ class GroupDialog(wx.Dialog):
                           pos=(0, 1))
                           pos=(0, 1))
 
 
         subgListSizer.Add(
         subgListSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self.subgListPanel,
                 parent=self.subgListPanel,
                 label=_("Pattern:")),
                 label=_("Pattern:")),
             flag=wx.ALIGN_CENTER_VERTICAL,
             flag=wx.ALIGN_CENTER_VERTICAL,
@@ -849,17 +851,17 @@ class GroupDialog(wx.Dialog):
                 1,
                 1,
                 0))
                 0))
 
 
-        self.subgfilter = wx.TextCtrl(parent=self.subgListPanel, id=wx.ID_ANY,
+        self.subgfilter = TextCtrl(parent=self.subgListPanel, id=wx.ID_ANY,
                                       value="",
                                       value="",
                                       size=(250, -1))
                                       size=(250, -1))
-        self.subgfilter.SetToolTipString(filter_tooltip)
+        self.subgfilter.SetToolTip(filter_tooltip)
 
 
         subgListSizer.Add(self.subgfilter,
         subgListSizer.Add(self.subgfilter,
                           flag=wx.EXPAND,
                           flag=wx.EXPAND,
                           pos=(1, 1))
                           pos=(1, 1))
 
 
         subgListSizer.Add(
         subgListSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self.subgListPanel,
                 parent=self.subgListPanel,
                 label=_("List of maps:")),
                 label=_("List of maps:")),
             flag=wx.ALIGN_CENTER_VERTICAL | wx.BOTTOM,
             flag=wx.ALIGN_CENTER_VERTICAL | wx.BOTTOM,
@@ -868,9 +870,9 @@ class GroupDialog(wx.Dialog):
                 2,
                 2,
                 0))
                 0))
 
 
-        self.subgListBox = wx.CheckListBox(
+        self.subgListBox = CheckListBox(
             parent=self.subgListPanel, id=wx.ID_ANY, size=(250, 100))
             parent=self.subgListPanel, id=wx.ID_ANY, size=(250, 100))
-        self.subgListBox.SetToolTipString(
+        self.subgListBox.SetToolTip(
             _("Check maps from group to be included into subgroup."))
             _("Check maps from group to be included into subgroup."))
 
 
         subgListSizer.Add(self.subgListBox, flag=wx.EXPAND, pos=(2, 1))
         subgListSizer.Add(self.subgListBox, flag=wx.EXPAND, pos=(2, 1))
@@ -880,7 +882,7 @@ class GroupDialog(wx.Dialog):
         self.subgListPanel.SetSizer(subgListSizer)
         self.subgListPanel.SetSizer(subgListSizer)
         bodySizer.Add(self.subgListPanel, proportion=1, flag=wx.EXPAND)
         bodySizer.Add(self.subgListPanel, proportion=1, flag=wx.EXPAND)
 
 
-        self.infoLabel = wx.StaticText(parent=self, id=wx.ID_ANY)
+        self.infoLabel = StaticText(parent=self, id=wx.ID_ANY)
         bodySizer.Add(
         bodySizer.Add(
             self.infoLabel,
             self.infoLabel,
             flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP | wx.BOTTOM,
             flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP | wx.BOTTOM,
@@ -1061,7 +1063,7 @@ class GroupDialog(wx.Dialog):
         """Get layers"""
         """Get layers"""
         if self.edit_subg:
         if self.edit_subg:
             layers = []
             layers = []
-            for maps, sel in self.subgmaps.iteritems():
+            for maps, sel in six.iteritems(self.subgmaps):
                 if sel:
                 if sel:
                     layers.append(maps)
                     layers.append(maps)
         else:
         else:
@@ -1106,7 +1108,7 @@ class GroupDialog(wx.Dialog):
         self.subgListBox.Set(maps)
         self.subgListBox.Set(maps)
 
 
         for i, m in enumerate(maps):
         for i, m in enumerate(maps):
-            if m in self.subgmaps.iterkeys() and self.subgmaps[m]:
+            if m in six.iterkeys(self.subgmaps) and self.subgmaps[m]:
                 self.subgListBox.Check(i)
                 self.subgListBox.Check(i)
 
 
         self._checkSubGSellAll()
         self._checkSubGSellAll()
@@ -1397,8 +1399,8 @@ class MapLayersDialogBase(wx.Dialog):
         self._modelerDSeries()
         self._modelerDSeries()
 
 
         # buttons
         # buttons
-        btnCancel = wx.Button(parent=self, id=wx.ID_CANCEL)
-        btnOk = wx.Button(parent=self, id=wx.ID_OK)
+        btnCancel = Button(parent=self, id=wx.ID_CANCEL)
+        btnOk = Button(parent=self, id=wx.ID_OK)
         btnOk.SetDefault()
         btnOk.SetDefault()
 
 
         # sizers & do layout
         # sizers & do layout
@@ -1460,7 +1462,7 @@ class MapLayersDialogBase(wx.Dialog):
         bodySizer = wx.GridBagSizer(vgap=3, hgap=3)
         bodySizer = wx.GridBagSizer(vgap=3, hgap=3)
 
 
         # layer type
         # layer type
-        bodySizer.Add(wx.StaticText(parent=self, label=_("Map type:")),
+        bodySizer.Add(StaticText(parent=self, label=_("Map type:")),
                       flag=wx.ALIGN_CENTER_VERTICAL,
                       flag=wx.ALIGN_CENTER_VERTICAL,
                       pos=(0, 0))
                       pos=(0, 0))
 
 
@@ -1482,7 +1484,7 @@ class MapLayersDialogBase(wx.Dialog):
                       pos=(0, 2))
                       pos=(0, 2))
 
 
         # mapset filter
         # mapset filter
-        bodySizer.Add(wx.StaticText(parent=self, label=_("Mapset:")),
+        bodySizer.Add(StaticText(parent=self, label=_("Mapset:")),
                       flag=wx.ALIGN_CENTER_VERTICAL,
                       flag=wx.ALIGN_CENTER_VERTICAL,
                       pos=(1, 0))
                       pos=(1, 0))
 
 
@@ -1492,7 +1494,7 @@ class MapLayersDialogBase(wx.Dialog):
                       pos=(1, 1), span=(1, 2))
                       pos=(1, 1), span=(1, 2))
 
 
         # map name filter
         # map name filter
-        bodySizer.Add(wx.StaticText(parent=self, label=_("Pattern:")),
+        bodySizer.Add(StaticText(parent=self, label=_("Pattern:")),
                       flag=wx.ALIGN_CENTER_VERTICAL,
                       flag=wx.ALIGN_CENTER_VERTICAL,
                       pos=(2, 0))
                       pos=(2, 0))
 
 
@@ -1514,16 +1516,16 @@ class MapLayersDialogBase(wx.Dialog):
 
 
         # layer list
         # layer list
         bodySizer.Add(
         bodySizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 parent=self,
                 label=_("List of maps:")),
                 label=_("List of maps:")),
             flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_TOP,
             flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_TOP,
             pos=(
             pos=(
                 3,
                 3,
                 0))
                 0))
-        self.layers = wx.CheckListBox(parent=self, id=wx.ID_ANY,
-                                      size=(250, 100),
-                                      choices=[])
+        self.layers = CheckListBox(parent=self, id=wx.ID_ANY,
+                                   size=(250, 100),
+                                   choices=[])
         bodySizer.Add(self.layers,
         bodySizer.Add(self.layers,
                       flag=wx.EXPAND,
                       flag=wx.EXPAND,
                       pos=(3, 1), span=(1, 2))
                       pos=(3, 1), span=(1, 2))
@@ -1574,7 +1576,7 @@ class MapLayersDialogBase(wx.Dialog):
             self.Bind(wx.EVT_MENU, self.OnDeselectAll, id=self.popupDataID3)
             self.Bind(wx.EVT_MENU, self.OnDeselectAll, id=self.popupDataID3)
 
 
         # generate popup-menu
         # generate popup-menu
-        menu = wx.Menu()
+        menu = Menu()
         menu.Append(self.popupDataID1, _("Select all"))
         menu.Append(self.popupDataID1, _("Select all"))
         menu.Append(self.popupDataID2, _("Invert selection"))
         menu.Append(self.popupDataID2, _("Invert selection"))
         menu.Append(self.popupDataID3, _("Deselect all"))
         menu.Append(self.popupDataID3, _("Deselect all"))
@@ -1676,7 +1678,7 @@ class MapLayersDialog(MapLayersDialogBase):
             self, parent=parent, title=title, **kwargs)
             self, parent=parent, title=title, **kwargs)
 
 
     def _addApplyButton(self):
     def _addApplyButton(self):
-        btnApply = wx.Button(parent=self, id=wx.ID_APPLY)
+        btnApply = Button(parent=self, id=wx.ID_APPLY)
         self.btnSizer.AddButton(btnApply)
         self.btnSizer.AddButton(btnApply)
         btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
         btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
 
 
@@ -1776,11 +1778,11 @@ class SetOpacityDialog(wx.Dialog):
 
 
         box.Add(self.value,
         box.Add(self.value,
                 flag=wx.ALIGN_CENTRE, pos=(0, 0), span=(1, 2))
                 flag=wx.ALIGN_CENTRE, pos=(0, 0), span=(1, 2))
-        box.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                              label=_("transparent")),
+        box.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                           label=_("transparent")),
                 pos=(1, 0))
                 pos=(1, 0))
-        box.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                              label=_("opaque")),
+        box.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                           label=_("opaque")),
                 flag=wx.ALIGN_RIGHT,
                 flag=wx.ALIGN_RIGHT,
                 pos=(1, 1))
                 pos=(1, 1))
 
 
@@ -1795,14 +1797,14 @@ class SetOpacityDialog(wx.Dialog):
         # buttons
         # buttons
         btnsizer = wx.StdDialogButtonSizer()
         btnsizer = wx.StdDialogButtonSizer()
 
 
-        btnOK = wx.Button(parent=panel, id=wx.ID_OK)
+        btnOK = Button(parent=panel, id=wx.ID_OK)
         btnOK.SetDefault()
         btnOK.SetDefault()
         btnsizer.AddButton(btnOK)
         btnsizer.AddButton(btnOK)
 
 
-        btnCancel = wx.Button(parent=panel, id=wx.ID_CANCEL)
+        btnCancel = Button(parent=panel, id=wx.ID_CANCEL)
         btnsizer.AddButton(btnCancel)
         btnsizer.AddButton(btnCancel)
 
 
-        btnApply = wx.Button(parent=panel, id=wx.ID_APPLY)
+        btnApply = Button(parent=panel, id=wx.ID_APPLY)
         btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
         btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
         btnsizer.AddButton(btnApply)
         btnsizer.AddButton(btnApply)
         btnsizer.Realize()
         btnsizer.Realize()
@@ -1831,8 +1833,11 @@ def GetImageHandlers(image):
     """Get list of supported image handlers"""
     """Get list of supported image handlers"""
     lext = list()
     lext = list()
     ltype = list()
     ltype = list()
-    for h in image.GetHandlers():
-        lext.append(h.GetExtension())
+    try:
+        for h in image.GetHandlers():
+            lext.append(h.GetExtension())
+    except AttributeError:
+        lext = {'png', 'gif', 'jpg', 'pcx', 'pnm', 'tif', 'xpm'}
 
 
     filetype = ''
     filetype = ''
     if 'png' in lext:
     if 'png' in lext:
@@ -1892,8 +1897,8 @@ class ImageSizeDialog(wx.Dialog):
 
 
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
 
 
-        self.box = wx.StaticBox(parent=self.panel, id=wx.ID_ANY,
-                                label=' % s' % _("Image size"))
+        self.box = StaticBox(parent=self.panel, id=wx.ID_ANY,
+                             label=' % s' % _("Image size"))
 
 
         size = self.parent.GetWindow().GetClientSize()
         size = self.parent.GetWindow().GetClientSize()
         self.width = SpinCtrl(parent=self.panel, id=wx.ID_ANY,
         self.width = SpinCtrl(parent=self.panel, id=wx.ID_ANY,
@@ -1915,9 +1920,9 @@ class ImageSizeDialog(wx.Dialog):
                                            "1600x1200",
                                            "1600x1200",
                                            "1920x1440"])
                                            "1920x1440"])
 
 
-        self.btnOK = wx.Button(parent=self.panel, id=wx.ID_OK)
+        self.btnOK = Button(parent=self.panel, id=wx.ID_OK)
         self.btnOK.SetDefault()
         self.btnOK.SetDefault()
-        self.btnCancel = wx.Button(parent=self.panel, id=wx.ID_CANCEL)
+        self.btnCancel = Button(parent=self.panel, id=wx.ID_CANCEL)
 
 
         self.template.Bind(wx.EVT_CHOICE, self.OnTemplate)
         self.template.Bind(wx.EVT_CHOICE, self.OnTemplate)
 
 
@@ -1931,16 +1936,16 @@ class ImageSizeDialog(wx.Dialog):
         # body
         # body
         box = wx.StaticBoxSizer(self.box, wx.HORIZONTAL)
         box = wx.StaticBoxSizer(self.box, wx.HORIZONTAL)
         fbox = wx.FlexGridSizer(cols=2, vgap=5, hgap=5)
         fbox = wx.FlexGridSizer(cols=2, vgap=5, hgap=5)
-        fbox.Add(wx.StaticText(parent=self.panel, id=wx.ID_ANY,
-                               label=_("Width:")),
+        fbox.Add(StaticText(parent=self.panel, id=wx.ID_ANY,
+                            label=_("Width:")),
                  flag=wx.ALIGN_CENTER_VERTICAL)
                  flag=wx.ALIGN_CENTER_VERTICAL)
         fbox.Add(self.width)
         fbox.Add(self.width)
-        fbox.Add(wx.StaticText(parent=self.panel, id=wx.ID_ANY,
-                               label=_("Height:")),
+        fbox.Add(StaticText(parent=self.panel, id=wx.ID_ANY,
+                            label=_("Height:")),
                  flag=wx.ALIGN_CENTER_VERTICAL)
                  flag=wx.ALIGN_CENTER_VERTICAL)
         fbox.Add(self.height)
         fbox.Add(self.height)
-        fbox.Add(wx.StaticText(parent=self.panel, id=wx.ID_ANY,
-                               label=_("Template:")),
+        fbox.Add(StaticText(parent=self.panel, id=wx.ID_ANY,
+                            label=_("Template:")),
                  flag=wx.ALIGN_CENTER_VERTICAL)
                  flag=wx.ALIGN_CENTER_VERTICAL)
         fbox.Add(self.template)
         fbox.Add(self.template)
 
 
@@ -1995,13 +2000,13 @@ class SqlQueryFrame(wx.Frame):
                 wx.BITMAP_TYPE_ICO))
                 wx.BITMAP_TYPE_ICO))
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
 
 
-        self.sqlBox = wx.StaticBox(parent=self.panel, id=wx.ID_ANY,
-                                   label=_(" SQL statement "))
-        self.sql = wx.TextCtrl(parent=self.panel, id=wx.ID_ANY,
-                               style=wx.TE_MULTILINE)
+        self.sqlBox = StaticBox(parent=self.panel, id=wx.ID_ANY,
+                                label=_(" SQL statement "))
+        self.sql = TextCtrl(parent=self.panel, id=wx.ID_ANY,
+                            style=wx.TE_MULTILINE)
 
 
-        self.btnApply = wx.Button(parent=self.panel, id=wx.ID_APPLY)
-        self.btnCancel = wx.Button(parent=self.panel, id=wx.ID_CANCEL)
+        self.btnApply = Button(parent=self.panel, id=wx.ID_APPLY)
+        self.btnCancel = Button(parent=self.panel, id=wx.ID_CANCEL)
         self.Bind(wx.EVT_BUTTON, self.OnCloseWindow, self.btnCancel)
         self.Bind(wx.EVT_BUTTON, self.OnCloseWindow, self.btnCancel)
 
 
         self._layout()
         self._layout()
@@ -2076,7 +2081,7 @@ class SymbolDialog(wx.Dialog):
         self.folderChoice.Bind(wx.EVT_CHOICE, self.OnFolderSelect)
         self.folderChoice.Bind(wx.EVT_CHOICE, self.OnFolderSelect)
 
 
         fgSizer.Add(
         fgSizer.Add(
-            wx.StaticText(
+            StaticText(
                 mainPanel,
                 mainPanel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Symbol directory:")),
                 label=_("Symbol directory:")),
@@ -2086,9 +2091,9 @@ class SymbolDialog(wx.Dialog):
         fgSizer.Add(self.folderChoice, proportion=0,
         fgSizer.Add(self.folderChoice, proportion=0,
                     flag=wx.ALIGN_CENTER, border=0)
                     flag=wx.ALIGN_CENTER, border=0)
 
 
-        self.infoLabel = wx.StaticText(mainPanel, id=wx.ID_ANY)
+        self.infoLabel = StaticText(mainPanel, id=wx.ID_ANY)
         fgSizer.Add(
         fgSizer.Add(
-            wx.StaticText(
+            StaticText(
                 mainPanel,
                 mainPanel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Symbol name:")),
                 label=_("Symbol name:")),
@@ -2102,8 +2107,8 @@ class SymbolDialog(wx.Dialog):
             vSizer.Add(panel, proportion=0, flag=wx.ALL | wx.EXPAND, border=5)
             vSizer.Add(panel, proportion=0, flag=wx.ALL | wx.EXPAND, border=5)
 
 
         mainSizer.Add(vSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=5)
         mainSizer.Add(vSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=5)
-        self.btnCancel = wx.Button(parent=mainPanel, id=wx.ID_CANCEL)
-        self.btnOK = wx.Button(parent=mainPanel, id=wx.ID_OK)
+        self.btnCancel = Button(parent=mainPanel, id=wx.ID_CANCEL)
+        self.btnOK = Button(parent=mainPanel, id=wx.ID_OK)
         self.btnOK.SetDefault()
         self.btnOK.SetDefault()
         self.btnOK.Enable(False)
         self.btnOK.Enable(False)
 
 
@@ -2246,10 +2251,10 @@ class TextEntryDialog(wx.Dialog):
 
 
         vbox = wx.BoxSizer(wx.VERTICAL)
         vbox = wx.BoxSizer(wx.VERTICAL)
 
 
-        stline = wx.StaticText(self, id=wx.ID_ANY, label=message)
+        stline = StaticText(self, id=wx.ID_ANY, label=message)
         vbox.Add(stline, proportion=0, flag=wx.EXPAND | wx.ALL, border=10)
         vbox.Add(stline, proportion=0, flag=wx.EXPAND | wx.ALL, border=10)
 
 
-        self._textCtrl = wx.TextCtrl(
+        self._textCtrl = TextCtrl(
             self,
             self,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             value=defaultValue,
             value=defaultValue,
@@ -2296,7 +2301,7 @@ class HyperlinkDialog(wx.Dialog):
 
 
         sizer = wx.BoxSizer(wx.VERTICAL)
         sizer = wx.BoxSizer(wx.VERTICAL)
 
 
-        label = wx.StaticText(self, label=message)
+        label = StaticText(self, label=message)
         sizer.Add(
         sizer.Add(
             label,
             label,
             proportion=0,
             proportion=0,
@@ -2340,15 +2345,15 @@ class QuitDialog(wx.Dialog):
                 wx.ART_QUESTION,
                 wx.ART_QUESTION,
                 client=wx.ART_MESSAGE_BOX))
                 client=wx.ART_MESSAGE_BOX))
 
 
-        self.informLabel = wx.StaticText(
+        self.informLabel = StaticText(
             parent=self.panel, id=wx.ID_ANY, label=_(
             parent=self.panel, id=wx.ID_ANY, label=_(
                 "Do you want to quit GRASS including shell "
                 "Do you want to quit GRASS including shell "
                 "prompt or just close the GUI?"))
                 "prompt or just close the GUI?"))
-        self.btnCancel = wx.Button(parent=self.panel, id=wx.ID_CANCEL)
-        self.btnClose = wx.Button(parent=self.panel, id=wx.ID_NO,
+        self.btnCancel = Button(parent=self.panel, id=wx.ID_CANCEL)
+        self.btnClose = Button(parent=self.panel, id=wx.ID_NO,
                                   label=_("Close GUI"))
                                   label=_("Close GUI"))
         self.btnClose.SetFocus()
         self.btnClose.SetFocus()
-        self.btnQuit = wx.Button(parent=self.panel, id=wx.ID_YES,
+        self.btnQuit = Button(parent=self.panel, id=wx.ID_YES,
                                  label=_("Quit GRASS GIS"))
                                  label=_("Quit GRASS GIS"))
         self.btnQuit.SetForegroundColour(wx.Colour(35, 142, 35))
         self.btnQuit.SetForegroundColour(wx.Colour(35, 142, 35))
 
 
@@ -2409,7 +2414,7 @@ class DefaultFontDialog(wx.Dialog):
         self.fontdict, fontdict_reverse, self.fontlist = self.GetFonts()
         self.fontdict, fontdict_reverse, self.fontlist = self.GetFonts()
 
 
         border = wx.BoxSizer(wx.VERTICAL)
         border = wx.BoxSizer(wx.VERTICAL)
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=" %s " %
             label=" %s " %
@@ -2418,8 +2423,8 @@ class DefaultFontDialog(wx.Dialog):
 
 
         gridSizer = wx.GridBagSizer(hgap=5, vgap=5)
         gridSizer = wx.GridBagSizer(hgap=5, vgap=5)
 
 
-        label = wx.StaticText(parent=panel, id=wx.ID_ANY,
-                              label=_("Select font:"))
+        label = StaticText(parent=panel, id=wx.ID_ANY,
+                           label=_("Select font:"))
         gridSizer.Add(label,
         gridSizer.Add(label,
                       flag=wx.ALIGN_TOP,
                       flag=wx.ALIGN_TOP,
                       pos=(0, 0))
                       pos=(0, 0))
@@ -2449,14 +2454,14 @@ class DefaultFontDialog(wx.Dialog):
             self.encoding = self.settings.Get(group='display',
             self.encoding = self.settings.Get(group='display',
                                               key='font', subkey='encoding')
                                               key='font', subkey='encoding')
 
 
-            label = wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                  label=_("Character encoding:"))
+            label = StaticText(parent=panel, id=wx.ID_ANY,
+                               label=_("Character encoding:"))
             gridSizer.Add(label,
             gridSizer.Add(label,
                           flag=wx.ALIGN_CENTER_VERTICAL,
                           flag=wx.ALIGN_CENTER_VERTICAL,
                           pos=(3, 0))
                           pos=(3, 0))
 
 
-            self.textentry = wx.TextCtrl(parent=panel, id=wx.ID_ANY,
-                                         value=self.encoding)
+            self.textentry = TextCtrl(parent=panel, id=wx.ID_ANY,
+                                      value=self.encoding)
             gridSizer.Add(self.textentry,
             gridSizer.Add(self.textentry,
                           flag=wx.EXPAND, pos=(4, 0))
                           flag=wx.EXPAND, pos=(4, 0))
 
 
@@ -2467,8 +2472,8 @@ class DefaultFontDialog(wx.Dialog):
                                           key='outputfont', subkey='type')
                                           key='outputfont', subkey='type')
             self.fontsize = self.settings.Get(group='appearance',
             self.fontsize = self.settings.Get(group='appearance',
                                               key='outputfont', subkey='size')
                                               key='outputfont', subkey='size')
-            label = wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                  label=_("Font size:"))
+            label = StaticText(parent=panel, id=wx.ID_ANY,
+                               label=_("Font size:"))
             gridSizer.Add(label,
             gridSizer.Add(label,
                           flag=wx.ALIGN_CENTER_VERTICAL,
                           flag=wx.ALIGN_CENTER_VERTICAL,
                           pos=(3, 0))
                           pos=(3, 0))
@@ -2503,11 +2508,11 @@ class DefaultFontDialog(wx.Dialog):
 
 
         btnsizer = wx.StdDialogButtonSizer()
         btnsizer = wx.StdDialogButtonSizer()
 
 
-        btn = wx.Button(parent=panel, id=wx.ID_OK)
+        btn = Button(parent=panel, id=wx.ID_OK)
         btn.SetDefault()
         btn.SetDefault()
         btnsizer.AddButton(btn)
         btnsizer.AddButton(btn)
 
 
-        btn = wx.Button(parent=panel, id=wx.ID_CANCEL)
+        btn = Button(parent=panel, id=wx.ID_CANCEL)
         btnsizer.AddButton(btn)
         btnsizer.AddButton(btn)
         btnsizer.Realize()
         btnsizer.Realize()
 
 

+ 44 - 39
gui/wxpython/gui_core/forms.py

@@ -49,12 +49,18 @@ COPYING coming with GRASS for details.
 from __future__ import print_function
 from __future__ import print_function
 
 
 import sys
 import sys
-import string
 import textwrap
 import textwrap
 import os
 import os
 import copy
 import copy
 import locale
 import locale
-import Queue
+import six
+
+if sys.version_info.major == 2:
+    import Queue
+else:
+    import queue as Queue
+    unicode = str
+
 import re
 import re
 import codecs
 import codecs
 
 
@@ -100,7 +106,8 @@ from core.settings import UserSettings
 from gui_core.widgets import FloatValidator, GNotebook, FormNotebook, FormListbook
 from gui_core.widgets import FloatValidator, GNotebook, FormNotebook, FormListbook
 from core.giface import Notification
 from core.giface import Notification
 from gui_core.widgets import LayersList
 from gui_core.widgets import LayersList
-from gui_core.wrap import BitmapFromImage, Button, StaticText, StaticBox, SpinCtrl
+from gui_core.wrap import BitmapFromImage, Button, StaticText, StaticBox, SpinCtrl, \
+    CheckBox, BitmapButton, TextCtrl
 from core.debug import Debug
 from core.debug import Debug
 
 
 wxUpdateDialog, EVT_DIALOG_UPDATE = NewEvent()
 wxUpdateDialog, EVT_DIALOG_UPDATE = NewEvent()
@@ -120,20 +127,18 @@ def text_beautify(someString, width=70):
     """
     """
     if width > 0:
     if width > 0:
         return escape_ampersand(
         return escape_ampersand(
-            string.strip(
-                os.linesep.join(
-                    textwrap.wrap(
-                        utils.normalize_whitespace(someString),
-                        width)),
-                ".,;:"))
+            os.linesep.join(
+                textwrap.wrap(
+                    utils.normalize_whitespace(someString),
+                    width)).strip(".,;:"))
     else:
     else:
-        return escape_ampersand(string.strip(
-            utils.normalize_whitespace(someString), ".,;:"))
+        return escape_ampersand(
+            utils.normalize_whitespace(someString).strip(".,;:"))
 
 
 
 
 def escape_ampersand(text):
 def escape_ampersand(text):
     """Escapes ampersands with additional ampersand for GUI"""
     """Escapes ampersands with additional ampersand for GUI"""
-    return string.replace(text, "&", "&&")
+    return text.replace("&", "&&")
 
 
 
 
 class UpdateThread(Thread):
 class UpdateThread(Thread):
@@ -691,7 +696,7 @@ class TaskFrame(wx.Frame):
 
 
         if self.get_dcmd is None and hasNew:
         if self.get_dcmd is None and hasNew:
             # close dialog when command is terminated
             # close dialog when command is terminated
-            self.closebox = wx.CheckBox(
+            self.closebox = CheckBox(
                 parent=self.panel,
                 parent=self.panel,
                 label=_('Close dialog on finish'),
                 label=_('Close dialog on finish'),
                 style=wx.NO_BORDER)
                 style=wx.NO_BORDER)
@@ -700,7 +705,7 @@ class TaskFrame(wx.Frame):
                     group='cmd',
                     group='cmd',
                     key='closeDlg',
                     key='closeDlg',
                     subkey='enabled'))
                     subkey='enabled'))
-            self.closebox.SetToolTipString(
+            self.closebox.SetToolTip(
                 _(
                 _(
                     "Close dialog when command is successfully finished. "
                     "Close dialog when command is successfully finished. "
                     "Change this settings in Preferences dialog ('Command' tab)."))
                     "Change this settings in Preferences dialog ('Command' tab)."))
@@ -1046,13 +1051,13 @@ class CmdPanel(wx.Panel):
             title_sizer = wx.BoxSizer(wx.HORIZONTAL)
             title_sizer = wx.BoxSizer(wx.HORIZONTAL)
             rtitle_txt = StaticText(parent=which_panel,
             rtitle_txt = StaticText(parent=which_panel,
                                     label='(' + f['name'] + ')')
                                     label='(' + f['name'] + ')')
-            chk = wx.CheckBox(
+            chk = CheckBox(
                 parent=which_panel,
                 parent=which_panel,
                 label=title,
                 label=title,
                 style=wx.NO_BORDER)
                 style=wx.NO_BORDER)
             self.label_id.append(chk.GetId())
             self.label_id.append(chk.GetId())
             if tooltip:
             if tooltip:
-                chk.SetToolTipString(tooltip)
+                chk.SetToolTip(tooltip)
             chk.SetValue(f.get('value', False))
             chk.SetValue(f.get('value', False))
             title_sizer.Add(chk, proportion=1,
             title_sizer.Add(chk, proportion=1,
                             flag=wx.EXPAND)
                             flag=wx.EXPAND)
@@ -1164,8 +1169,8 @@ class CmdPanel(wx.Panel):
                     p['value'] = p.get('default', '')
                     p['value'] = p.get('default', '')
 
 
             if (len(p.get('values', [])) > 0):
             if (len(p.get('values', [])) > 0):
-                valuelist = map(str, p.get('values', []))
-                valuelist_desc = map(unicode, p.get('values_desc', []))
+                valuelist = list(map(str, p.get('values', [])))
+                valuelist_desc = list(map(unicode, p.get('values_desc', [])))
                 required_text = "*" if p.get('required', False) else ""
                 required_text = "*" if p.get('required', False) else ""
                 if p.get('multiple', False) and \
                 if p.get('multiple', False) and \
                         p.get('gisprompt', False) == False and \
                         p.get('gisprompt', False) == False and \
@@ -1225,8 +1230,8 @@ class CmdPanel(wx.Panel):
                             # for multiple integers use textctrl instead of
                             # for multiple integers use textctrl instead of
                             # spinsctrl
                             # spinsctrl
                             try:
                             try:
-                                minValue, maxValue = map(
-                                    int, valuelist[0].rsplit('-', 1))
+                                minValue, maxValue = list(map(
+                                    int, valuelist[0].rsplit('-', 1)))
                             except ValueError:
                             except ValueError:
                                 minValue = -1e6
                                 minValue = -1e6
                                 maxValue = 1e6
                                 maxValue = 1e6
@@ -1238,7 +1243,7 @@ class CmdPanel(wx.Panel):
                                 max=maxValue)
                                 max=maxValue)
                             style = wx.BOTTOM | wx.LEFT
                             style = wx.BOTTOM | wx.LEFT
                         else:
                         else:
-                            txt2 = wx.TextCtrl(
+                            txt2 = TextCtrl(
                                 parent=which_panel, value=p.get(
                                 parent=which_panel, value=p.get(
                                     'default', ''))
                                     'default', ''))
                             style = wx.EXPAND | wx.BOTTOM | wx.LEFT
                             style = wx.EXPAND | wx.BOTTOM | wx.LEFT
@@ -1266,7 +1271,7 @@ class CmdPanel(wx.Panel):
                                 os.path.join(
                                 os.path.join(
                                     globalvar.SYMBDIR,
                                     globalvar.SYMBDIR,
                                     value) + '.png')
                                     value) + '.png')
-                            bb = wx.BitmapButton(
+                            bb = BitmapButton(
                                 parent=which_panel, id=wx.ID_ANY, bitmap=bitmap)
                                 parent=which_panel, id=wx.ID_ANY, bitmap=bitmap)
                             iconLabel = StaticText(
                             iconLabel = StaticText(
                                 parent=which_panel, id=wx.ID_ANY)
                                 parent=which_panel, id=wx.ID_ANY)
@@ -1315,7 +1320,7 @@ class CmdPanel(wx.Panel):
                 if p.get('multiple', False) or \
                 if p.get('multiple', False) or \
                         p.get('type', 'string') == 'string' or \
                         p.get('type', 'string') == 'string' or \
                         len(p.get('key_desc', [])) > 1:
                         len(p.get('key_desc', [])) > 1:
-                    win = wx.TextCtrl(
+                    win = TextCtrl(
                         parent=which_panel, value=p.get(
                         parent=which_panel, value=p.get(
                             'default', ''))
                             'default', ''))
 
 
@@ -1363,7 +1368,7 @@ class CmdPanel(wx.Panel):
                     which_sizer.Add(win, proportion=0,
                     which_sizer.Add(win, proportion=0,
                                     flag=style, border=5)
                                     flag=style, border=5)
                 else:  # float
                 else:  # float
-                    win = wx.TextCtrl(
+                    win = TextCtrl(
                         parent=which_panel, value=p.get(
                         parent=which_panel, value=p.get(
                             'default', ''), validator=FloatValidator())
                             'default', ''), validator=FloatValidator())
                     style = wx.EXPAND | wx.BOTTOM | wx.LEFT | wx.RIGHT
                     style = wx.EXPAND | wx.BOTTOM | wx.LEFT | wx.RIGHT
@@ -1555,10 +1560,10 @@ class CmdPanel(wx.Panel):
                                 os.path.join(
                                 os.path.join(
                                     globalvar.ICONDIR, iconTheme,
                                     globalvar.ICONDIR, iconTheme,
                                     'map-info.png'))
                                     'map-info.png'))
-                            bb = wx.BitmapButton(
+                            bb = BitmapButton(
                                 parent=which_panel, bitmap=bitmap)
                                 parent=which_panel, bitmap=bitmap)
                             bb.Bind(wx.EVT_BUTTON, self.OnTimelineTool)
                             bb.Bind(wx.EVT_BUTTON, self.OnTimelineTool)
-                            bb.SetToolTipString(
+                            bb.SetToolTip(
                                 _("Show graphical representation of temporal extent of dataset(s) ."))
                                 _("Show graphical representation of temporal extent of dataset(s) ."))
                             p['wxId'].append(bb.GetId())
                             p['wxId'].append(bb.GetId())
 
 
@@ -1630,7 +1635,7 @@ class CmdPanel(wx.Panel):
                                 'mapset',
                                 'mapset',
                                 'dbase'):
                                 'dbase'):
                     if p.get('multiple', 'no') == 'yes':
                     if p.get('multiple', 'no') == 'yes':
-                        win = wx.TextCtrl(
+                        win = TextCtrl(
                             parent=which_panel, value=p.get(
                             parent=which_panel, value=p.get(
                                 'default', ''), size=globalvar.DIALOG_TEXTCTRL_SIZE)
                                 'default', ''), size=globalvar.DIALOG_TEXTCTRL_SIZE)
                         win.Bind(wx.EVT_TEXT, self.OnSetValue)
                         win.Bind(wx.EVT_TEXT, self.OnSetValue)
@@ -1679,7 +1684,7 @@ class CmdPanel(wx.Panel):
                                     wx.EVT_COMBOBOX, self.OnUpdateSelection)
                                     wx.EVT_COMBOBOX, self.OnUpdateSelection)
                                 win.Bind(wx.EVT_COMBOBOX, self.OnSetValue)
                                 win.Bind(wx.EVT_COMBOBOX, self.OnSetValue)
                             else:
                             else:
-                                win = wx.TextCtrl(
+                                win = TextCtrl(
                                     parent=which_panel, value=p.get(
                                     parent=which_panel, value=p.get(
                                         'default', ''),
                                         'default', ''),
                                     size=globalvar.DIALOG_TEXTCTRL_SIZE)
                                     size=globalvar.DIALOG_TEXTCTRL_SIZE)
@@ -1757,7 +1762,7 @@ class CmdPanel(wx.Panel):
                     # and either a "transparent" checkbox or None
                     # and either a "transparent" checkbox or None
                     p['wxId'] = [None] * 3
                     p['wxId'] = [None] * 3
                     if p.get('multiple', False):
                     if p.get('multiple', False):
-                        txt = wx.TextCtrl(parent=which_panel, id=wx.ID_ANY)
+                        txt = TextCtrl(parent=which_panel, id=wx.ID_ANY)
                         this_sizer.Add(
                         this_sizer.Add(
                             txt,
                             txt,
                             proportion=1,
                             proportion=1,
@@ -1846,9 +1851,9 @@ class CmdPanel(wx.Panel):
                             'element', '') == 'file' and UserSettings.Get(
                             'element', '') == 'file' and UserSettings.Get(
                             group='cmd', key='interactiveInput', subkey='enabled'):
                             group='cmd', key='interactiveInput', subkey='enabled'):
                         # widget for interactive input
                         # widget for interactive input
-                        ifbb = wx.TextCtrl(parent=which_panel, id=wx.ID_ANY,
-                                           style=wx.TE_MULTILINE,
-                                           size=(-1, 75))
+                        ifbb = TextCtrl(parent=which_panel, id=wx.ID_ANY,
+                                        style=wx.TE_MULTILINE,
+                                        size=(-1, 75))
                         if p.get('value', '') and os.path.isfile(p['value']):
                         if p.get('value', '') and os.path.isfile(p['value']):
                             ifbb.Clear()
                             ifbb.Clear()
                             enc = locale.getdefaultlocale()[1]
                             enc = locale.getdefaultlocale()[1]
@@ -1949,7 +1954,7 @@ class CmdPanel(wx.Panel):
 
 
                     # normal text field
                     # normal text field
                     else:
                     else:
-                        win = wx.TextCtrl(parent=which_panel)
+                        win = TextCtrl(parent=which_panel)
                         p['wxId'] = [win.GetId()]
                         p['wxId'] = [win.GetId()]
                         win.Bind(wx.EVT_TEXT, self.OnSetValue)
                         win.Bind(wx.EVT_TEXT, self.OnSetValue)
 
 
@@ -1974,7 +1979,7 @@ class CmdPanel(wx.Panel):
                             self.parent.dialogClosing.connect(win.OnClose)
                             self.parent.dialogClosing.connect(win.OnClose)
                     # normal text field
                     # normal text field
                     else:
                     else:
-                        win = wx.TextCtrl(parent=which_panel)
+                        win = TextCtrl(parent=which_panel)
                         value = self._getValue(p)
                         value = self._getValue(p)
                         win.SetValue(value)
                         win.SetValue(value)
                         p['wxId'] = [win.GetId()]
                         p['wxId'] = [win.GetId()]
@@ -2242,7 +2247,7 @@ class CmdPanel(wx.Panel):
             tabsizer[section].Fit(tab[section])
             tabsizer[section].Fit(tab[section])
             tab[section].Layout()
             tab[section].Layout()
             minsecsizes = tabsizer[section].GetSize()
             minsecsizes = tabsizer[section].GetSize()
-            maxsizes = map(lambda x: max(maxsizes[x], minsecsizes[x]), (0, 1))
+            maxsizes = list(map(lambda x: max(maxsizes[x], minsecsizes[x]), (0, 1)))
 
 
         # TODO: be less arbitrary with these 600
         # TODO: be less arbitrary with these 600
         self.panelMinHeight = 100
         self.panelMinHeight = 100
@@ -2489,7 +2494,7 @@ class CmdPanel(wx.Panel):
         self.OnUpdateSelection(event)
         self.OnUpdateSelection(event)
 
 
     def OnUpdateDialog(self, event):
     def OnUpdateDialog(self, event):
-        for fn, kwargs in event.data.iteritems():
+        for fn, kwargs in six.iteritems(event.data):
             fn(**kwargs)
             fn(**kwargs)
 
 
         self.parent.updateValuesHook()
         self.parent.updateValuesHook()
@@ -2559,7 +2564,7 @@ class CmdPanel(wx.Panel):
                     colorchooser = wx.FindWindowById(p['wxId'][0])
                     colorchooser = wx.FindWindowById(p['wxId'][0])
                     new_color = colorchooser.GetValue()[:]
                     new_color = colorchooser.GetValue()[:]
                     new_label = utils.rgb2str.get(
                     new_label = utils.rgb2str.get(
-                        new_color, ':'.join(map(str, new_color)))
+                        new_color, ':'.join(list(map(str, new_color))))
                     textCtrl = wx.FindWindowById(p['wxId'][1])
                     textCtrl = wx.FindWindowById(p['wxId'][1])
                     val = textCtrl.GetValue()
                     val = textCtrl.GetValue()
                     sep = ','
                     sep = ','
@@ -2576,7 +2581,7 @@ class CmdPanel(wx.Panel):
                     # This is weird: new_color is a 4-tuple and new_color[:] is a 3-tuple
                     # This is weird: new_color is a 4-tuple and new_color[:] is a 3-tuple
                     # under wx2.8.1
                     # under wx2.8.1
                     new_label = utils.rgb2str.get(
                     new_label = utils.rgb2str.get(
-                        new_color, ':'.join(map(str, new_color)))
+                        new_color, ':'.join(list(map(str, new_color))))
                     colorchooser.SetLabel(new_label)
                     colorchooser.SetLabel(new_label)
                     colorchooser.SetColour(new_color)
                     colorchooser.SetColour(new_color)
                     colorchooser.Refresh()
                     colorchooser.Refresh()
@@ -3110,7 +3115,7 @@ if __name__ == "__main__":
                 "gisprompt": False,
                 "gisprompt": False,
                 "multiple": "yes",
                 "multiple": "yes",
                 # values must be an array of strings
                 # values must be an array of strings
-                "values": utils.str2rgb.keys() + map(str, utils.str2rgb.values()),
+                "values": utils.str2rgb.keys() + list(map(str, utils.str2rgb.values())),
                 "key_desc": ["value"],
                 "key_desc": ["value"],
                 "values_desc": []
                 "values_desc": []
             }, {
             }, {

+ 68 - 66
gui/wxpython/gui_core/ghelp.py

@@ -23,6 +23,7 @@ import platform
 import re
 import re
 import textwrap
 import textwrap
 import sys
 import sys
+import six
 
 
 import wx
 import wx
 from wx.html import HtmlWindow
 from wx.html import HtmlWindow
@@ -42,6 +43,7 @@ from core import globalvar
 from core.utils import _
 from core.utils import _
 from core.gcmd import GError, DecodeString
 from core.gcmd import GError, DecodeString
 from gui_core.widgets import FormNotebook, ScrolledPanel
 from gui_core.widgets import FormNotebook, ScrolledPanel
+from gui_core.wrap import Button, StaticText, TextCtrl
 from core.debug import Debug
 from core.debug import Debug
 
 
 
 
@@ -86,7 +88,7 @@ class AboutWindow(wx.Frame):
         wx.CallAfter(self.aboutNotebook.Refresh)
         wx.CallAfter(self.aboutNotebook.Refresh)
 
 
         # buttons
         # buttons
-        self.btnClose = wx.Button(parent=self.panel, id=wx.ID_CLOSE)
+        self.btnClose = Button(parent=self.panel, id=wx.ID_CLOSE)
         self.btnClose.Bind(wx.EVT_BUTTON, self.OnCloseWindow)
         self.btnClose.Bind(wx.EVT_BUTTON, self.OnCloseWindow)
 
 
         self._doLayout()
         self._doLayout()
@@ -131,20 +133,20 @@ class AboutWindow(wx.Frame):
         infoLabel = 'GRASS GIS %s' % vInfo.get('version', _('unknown version'))
         infoLabel = 'GRASS GIS %s' % vInfo.get('version', _('unknown version'))
         if 'x86_64' in vInfo.get('build_platform', ''):
         if 'x86_64' in vInfo.get('build_platform', ''):
             infoLabel += ' (64bit)'
             infoLabel += ' (64bit)'
-        info = wx.StaticText(parent=infoTxt, id=wx.ID_ANY,
-                             label=infoLabel + os.linesep)
+        info = StaticText(parent=infoTxt, id=wx.ID_ANY,
+                          label=infoLabel + os.linesep)
         info.SetFont(wx.Font(13, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
         info.SetFont(wx.Font(13, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
         info.SetForegroundColour(wx.Colour(35, 142, 35))
         info.SetForegroundColour(wx.Colour(35, 142, 35))
         infoSizer.Add(info, proportion=0,
         infoSizer.Add(info, proportion=0,
                       flag=wx.BOTTOM | wx.ALIGN_CENTER, border=1)
                       flag=wx.BOTTOM | wx.ALIGN_CENTER, border=1)
 
 
-        team = wx.StaticText(parent=infoTxt, label=_grassDevTeam(1999) + '\n')
+        team = StaticText(parent=infoTxt, label=_grassDevTeam(1999) + '\n')
         infoSizer.Add(team, proportion=0,
         infoSizer.Add(team, proportion=0,
                       flag=wx.BOTTOM | wx.ALIGN_CENTER, border=1)
                       flag=wx.BOTTOM | wx.ALIGN_CENTER, border=1)
 
 
         row = 0
         row = 0
-        infoGridSizer.Add(wx.StaticText(parent=infoTxt, id=wx.ID_ANY,
-                                        label=_('Official GRASS site:')),
+        infoGridSizer.Add(StaticText(parent=infoTxt, id=wx.ID_ANY,
+                                     label=_('Official GRASS site:')),
                           pos=(row, 0),
                           pos=(row, 0),
                           flag=wx.ALIGN_RIGHT)
                           flag=wx.ALIGN_RIGHT)
 
 
@@ -154,24 +156,24 @@ class AboutWindow(wx.Frame):
                           flag=wx.ALIGN_LEFT)
                           flag=wx.ALIGN_LEFT)
 
 
         row += 2
         row += 2
-        infoGridSizer.Add(wx.StaticText(parent=infoTxt, id=wx.ID_ANY,
-                                        label='%s:' % _('Code Revision')),
+        infoGridSizer.Add(StaticText(parent=infoTxt, id=wx.ID_ANY,
+                                     label='%s:' % _('Code Revision')),
                           pos=(row, 0),
                           pos=(row, 0),
                           flag=wx.ALIGN_RIGHT)
                           flag=wx.ALIGN_RIGHT)
 
 
-        infoGridSizer.Add(wx.StaticText(parent=infoTxt, id=wx.ID_ANY,
-                                        label=vInfo.get('revision', '?')),
+        infoGridSizer.Add(StaticText(parent=infoTxt, id=wx.ID_ANY,
+                                     label=vInfo.get('revision', '?')),
                           pos=(row, 1),
                           pos=(row, 1),
                           flag=wx.ALIGN_LEFT)
                           flag=wx.ALIGN_LEFT)
 
 
         row += 1
         row += 1
-        infoGridSizer.Add(wx.StaticText(parent=infoTxt, id=wx.ID_ANY,
-                                        label='%s:' % _('Build Date')),
+        infoGridSizer.Add(StaticText(parent=infoTxt, id=wx.ID_ANY,
+                                     label='%s:' % _('Build Date')),
                           pos=(row, 0),
                           pos=(row, 0),
                           flag=wx.ALIGN_RIGHT)
                           flag=wx.ALIGN_RIGHT)
 
 
         infoGridSizer.Add(
         infoGridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=infoTxt, id=wx.ID_ANY, label=vInfo.get(
                 parent=infoTxt, id=wx.ID_ANY, label=vInfo.get(
                     'build_date', '?')), pos=(
                     'build_date', '?')), pos=(
                 row, 1), flag=wx.ALIGN_LEFT)
                 row, 1), flag=wx.ALIGN_LEFT)
@@ -190,24 +192,24 @@ class AboutWindow(wx.Frame):
         #                   flag = wx.ALIGN_LEFT)
         #                   flag = wx.ALIGN_LEFT)
 
 
         row += 2
         row += 2
-        infoGridSizer.Add(wx.StaticText(parent=infoTxt, id=wx.ID_ANY,
-                                        label='Python:'),
+        infoGridSizer.Add(StaticText(parent=infoTxt, id=wx.ID_ANY,
+                                     label='Python:'),
                           pos=(row, 0),
                           pos=(row, 0),
                           flag=wx.ALIGN_RIGHT)
                           flag=wx.ALIGN_RIGHT)
 
 
-        infoGridSizer.Add(wx.StaticText(parent=infoTxt, id=wx.ID_ANY,
-                                        label=platform.python_version()),
+        infoGridSizer.Add(StaticText(parent=infoTxt, id=wx.ID_ANY,
+                                     label=platform.python_version()),
                           pos=(row, 1),
                           pos=(row, 1),
                           flag=wx.ALIGN_LEFT)
                           flag=wx.ALIGN_LEFT)
 
 
         row += 1
         row += 1
-        infoGridSizer.Add(wx.StaticText(parent=infoTxt, id=wx.ID_ANY,
-                                        label='wxPython:'),
+        infoGridSizer.Add(StaticText(parent=infoTxt, id=wx.ID_ANY,
+                                     label='wxPython:'),
                           pos=(row, 0),
                           pos=(row, 0),
                           flag=wx.ALIGN_RIGHT)
                           flag=wx.ALIGN_RIGHT)
 
 
-        infoGridSizer.Add(wx.StaticText(parent=infoTxt, id=wx.ID_ANY,
-                                        label=wx.__version__),
+        infoGridSizer.Add(StaticText(parent=infoTxt, id=wx.ID_ANY,
+                                     label=wx.__version__),
                           pos=(row, 1),
                           pos=(row, 1),
                           flag=wx.ALIGN_LEFT)
                           flag=wx.ALIGN_LEFT)
 
 
@@ -219,8 +221,8 @@ class AboutWindow(wx.Frame):
             flag=wx.EXPAND | wx.ALIGN_CENTER | wx.ALIGN_CENTER_VERTICAL)
             flag=wx.EXPAND | wx.ALIGN_CENTER | wx.ALIGN_CENTER_VERTICAL)
 
 
         row += 2
         row += 2
-        infoGridSizer.Add(wx.StaticText(parent=infoTxt, id=wx.ID_ANY,
-                                        label="%s:" % _('Language')),
+        infoGridSizer.Add(StaticText(parent=infoTxt, id=wx.ID_ANY,
+                                     label="%s:" % _('Language')),
                           pos=(row, 0),
                           pos=(row, 0),
                           flag=wx.ALIGN_RIGHT)
                           flag=wx.ALIGN_RIGHT)
         self.langUsed = grass.gisenv().get('LANG', None)
         self.langUsed = grass.gisenv().get('LANG', None)
@@ -231,8 +233,8 @@ class AboutWindow(wx.Frame):
                 self.langUsed = _('unknown')
                 self.langUsed = _('unknown')
             else:
             else:
                 self.langUsed = u'%s.%s' % (loc[0], loc[1])
                 self.langUsed = u'%s.%s' % (loc[0], loc[1])
-        infoGridSizer.Add(wx.StaticText(parent=infoTxt, id=wx.ID_ANY,
-                                        label=self.langUsed),
+        infoGridSizer.Add(StaticText(parent=infoTxt, id=wx.ID_ANY,
+                                     label=self.langUsed),
                           pos=(row, 1),
                           pos=(row, 1),
                           flag=wx.ALIGN_LEFT)
                           flag=wx.ALIGN_LEFT)
 
 
@@ -253,7 +255,7 @@ class AboutWindow(wx.Frame):
 
 
         # put text into a scrolling panel
         # put text into a scrolling panel
         copyrightwin = ScrolledPanel(self.aboutNotebook)
         copyrightwin = ScrolledPanel(self.aboutNotebook)
-        copyrighttxt = wx.TextCtrl(
+        copyrighttxt = TextCtrl(
             copyrightwin, id=wx.ID_ANY, value=copytext,
             copyrightwin, id=wx.ID_ANY, value=copytext,
         style=wx.TE_MULTILINE | wx.TE_READONLY)
         style=wx.TE_MULTILINE | wx.TE_READONLY)
         copyrightwin.SetAutoLayout(True)
         copyrightwin.SetAutoLayout(True)
@@ -277,7 +279,7 @@ class AboutWindow(wx.Frame):
             license = _('%s file missing') % 'GPL.TXT'
             license = _('%s file missing') % 'GPL.TXT'
         # put text into a scrolling panel
         # put text into a scrolling panel
         licensewin = ScrolledPanel(self.aboutNotebook)
         licensewin = ScrolledPanel(self.aboutNotebook)
-        licensetxt = wx.TextCtrl(
+        licensetxt = TextCtrl(
             licensewin, id=wx.ID_ANY, value=license,
             licensewin, id=wx.ID_ANY, value=license,
         style=wx.TE_MULTILINE | wx.TE_READONLY)
         style=wx.TE_MULTILINE | wx.TE_READONLY)
         licensewin.SetAutoLayout(True)
         licensewin.SetAutoLayout(True)
@@ -303,7 +305,7 @@ class AboutWindow(wx.Frame):
 
 
         # put text into a scrolling panel
         # put text into a scrolling panel
         window = ScrolledPanel(self.aboutNotebook)
         window = ScrolledPanel(self.aboutNotebook)
-        stat_text = wx.TextCtrl(
+        stat_text = TextCtrl(
             window, id=wx.ID_ANY, value=text,
             window, id=wx.ID_ANY, value=text,
         style=wx.TE_MULTILINE | wx.TE_READONLY)
         style=wx.TE_MULTILINE | wx.TE_READONLY)
         window.SetAutoLayout(True)
         window.SetAutoLayout(True)
@@ -327,7 +329,7 @@ class AboutWindow(wx.Frame):
         else:
         else:
             authors = _('%s file missing') % 'AUTHORS'
             authors = _('%s file missing') % 'AUTHORS'
         authorwin = ScrolledPanel(self.aboutNotebook)
         authorwin = ScrolledPanel(self.aboutNotebook)
-        authortxt = wx.TextCtrl(
+        authortxt = TextCtrl(
             authorwin, id=wx.ID_ANY, value=authors,
             authorwin, id=wx.ID_ANY, value=authors,
         style=wx.TE_MULTILINE | wx.TE_READONLY)
         style=wx.TE_MULTILINE | wx.TE_READONLY)
         authorwin.SetAutoLayout(True)
         authorwin.SetAutoLayout(True)
@@ -385,7 +387,7 @@ class AboutWindow(wx.Frame):
         contribwin.sizer = wx.BoxSizer(wx.VERTICAL)
         contribwin.sizer = wx.BoxSizer(wx.VERTICAL)
 
 
         if not contribs:
         if not contribs:
-            contribtxt = wx.StaticText(
+            contribtxt = StaticText(
                 contribwin,
                 contribwin,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('%s file missing') %
                 label=_('%s file missing') %
@@ -399,8 +401,8 @@ class AboutWindow(wx.Frame):
                 items = (_('Name'), _('E-mail'), _('Country'), _('OSGeo_ID'))
                 items = (_('Name'), _('E-mail'), _('Country'), _('OSGeo_ID'))
             contribBox = wx.FlexGridSizer(cols=len(items), vgap=5, hgap=5)
             contribBox = wx.FlexGridSizer(cols=len(items), vgap=5, hgap=5)
             for item in items:
             for item in items:
-                text = wx.StaticText(parent=contribwin, id=wx.ID_ANY,
-                                     label=item)
+                text = StaticText(parent=contribwin, id=wx.ID_ANY,
+                                  label=item)
                 text.SetFont(
                 text.SetFont(
                     wx.Font(
                     wx.Font(
                         10,
                         10,
@@ -413,7 +415,7 @@ class AboutWindow(wx.Frame):
             for vals in sorted(contribs, key=lambda x: x[0]):
             for vals in sorted(contribs, key=lambda x: x[0]):
                 for item in vals:
                 for item in vals:
                     contribBox.Add(
                     contribBox.Add(
-                        wx.StaticText(
+                        StaticText(
                             parent=contribwin,
                             parent=contribwin,
                             id=wx.ID_ANY,
                             id=wx.ID_ANY,
                             label=item))
                             label=item))
@@ -459,7 +461,7 @@ class AboutWindow(wx.Frame):
         translatorswin.sizer = wx.BoxSizer(wx.VERTICAL)
         translatorswin.sizer = wx.BoxSizer(wx.VERTICAL)
 
 
         if not translators:
         if not translators:
-            translatorstxt = wx.StaticText(
+            translatorstxt = StaticText(
                 translatorswin,
                 translatorswin,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('%s file missing') %
                 label=_('%s file missing') %
@@ -469,39 +471,39 @@ class AboutWindow(wx.Frame):
         else:
         else:
             translatorsBox = wx.FlexGridSizer(cols=4, vgap=5, hgap=5)
             translatorsBox = wx.FlexGridSizer(cols=4, vgap=5, hgap=5)
             languages = sorted(translators.keys())
             languages = sorted(translators.keys())
-            tname = wx.StaticText(parent=translatorswin, id=wx.ID_ANY,
-                                  label=_('Name'))
+            tname = StaticText(parent=translatorswin, id=wx.ID_ANY,
+                               label=_('Name'))
             tname.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
             tname.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
             translatorsBox.Add(tname)
             translatorsBox.Add(tname)
-            temail = wx.StaticText(parent=translatorswin, id=wx.ID_ANY,
-                                   label=_('E-mail'))
+            temail = StaticText(parent=translatorswin, id=wx.ID_ANY,
+                                label=_('E-mail'))
             temail.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
             temail.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
             translatorsBox.Add(temail)
             translatorsBox.Add(temail)
-            tlang = wx.StaticText(parent=translatorswin, id=wx.ID_ANY,
-                                  label=_('Language'))
+            tlang = StaticText(parent=translatorswin, id=wx.ID_ANY,
+                               label=_('Language'))
             tlang.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
             tlang.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
             translatorsBox.Add(tlang)
             translatorsBox.Add(tlang)
-            tnat = wx.StaticText(parent=translatorswin, id=wx.ID_ANY,
-                                 label=_('Nation'))
+            tnat = StaticText(parent=translatorswin, id=wx.ID_ANY,
+                              label=_('Nation'))
             tnat.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
             tnat.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
             translatorsBox.Add(tnat)
             translatorsBox.Add(tnat)
             for lang in languages:
             for lang in languages:
                 for translator in translators[lang]:
                 for translator in translators[lang]:
                     name, email = translator
                     name, email = translator
                     translatorsBox.Add(
                     translatorsBox.Add(
-                        wx.StaticText(
+                        StaticText(
                             parent=translatorswin,
                             parent=translatorswin,
                             id=wx.ID_ANY,
                             id=wx.ID_ANY,
                             label=unicode(
                             label=unicode(
                                 name,
                                 name,
                                 "utf-8")))
                                 "utf-8")))
                     translatorsBox.Add(
                     translatorsBox.Add(
-                        wx.StaticText(
+                        StaticText(
                             parent=translatorswin,
                             parent=translatorswin,
                             id=wx.ID_ANY,
                             id=wx.ID_ANY,
                             label=email))
                             label=email))
                     translatorsBox.Add(
                     translatorsBox.Add(
-                        wx.StaticText(
+                        StaticText(
                             parent=translatorswin,
                             parent=translatorswin,
                             id=wx.ID_ANY,
                             id=wx.ID_ANY,
                             label=lang))
                             label=lang))
@@ -514,7 +516,7 @@ class AboutWindow(wx.Frame):
                         translatorsBox.Add(flagBitmap)
                         translatorsBox.Add(flagBitmap)
                     else:
                     else:
                         translatorsBox.Add(
                         translatorsBox.Add(
-                            wx.StaticText(
+                            StaticText(
                                 parent=translatorswin,
                                 parent=translatorswin,
                                 id=wx.ID_ANY,
                                 id=wx.ID_ANY,
                                 label=lang))
                                 label=lang))
@@ -547,35 +549,35 @@ class AboutWindow(wx.Frame):
     def _langBox(self, par, k, v):
     def _langBox(self, par, k, v):
         """Return box"""
         """Return box"""
         langBox = wx.FlexGridSizer(cols=4, vgap=5, hgap=5)
         langBox = wx.FlexGridSizer(cols=4, vgap=5, hgap=5)
-        tkey = wx.StaticText(parent=par, id=wx.ID_ANY,
-                             label=k.upper())
+        tkey = StaticText(parent=par, id=wx.ID_ANY,
+                          label=k.upper())
         langBox.Add(tkey)
         langBox.Add(tkey)
         try:
         try:
-            tgood = wx.StaticText(parent=par, id=wx.ID_ANY,
-                                  label=_("%d translated" % v['good']))
+            tgood = StaticText(parent=par, id=wx.ID_ANY,
+                               label=_("%d translated" % v['good']))
             tgood.SetForegroundColour(wx.Colour(35, 142, 35))
             tgood.SetForegroundColour(wx.Colour(35, 142, 35))
             langBox.Add(tgood)
             langBox.Add(tgood)
         except:
         except:
-            tgood = wx.StaticText(parent=par, id=wx.ID_ANY,
-                                  label="")
+            tgood = StaticText(parent=par, id=wx.ID_ANY,
+                               label="")
             langBox.Add(tgood)
             langBox.Add(tgood)
         try:
         try:
-            tfuzzy = wx.StaticText(parent=par, id=wx.ID_ANY,
-                                   label=_("   %d fuzzy" % v['fuzzy']))
+            tfuzzy = StaticText(parent=par, id=wx.ID_ANY,
+                                label=_("   %d fuzzy" % v['fuzzy']))
             tfuzzy.SetForegroundColour(wx.Colour(255, 142, 0))
             tfuzzy.SetForegroundColour(wx.Colour(255, 142, 0))
             langBox.Add(tfuzzy)
             langBox.Add(tfuzzy)
         except:
         except:
-            tfuzzy = wx.StaticText(parent=par, id=wx.ID_ANY,
-                                   label="")
+            tfuzzy = StaticText(parent=par, id=wx.ID_ANY,
+                                label="")
             langBox.Add(tfuzzy)
             langBox.Add(tfuzzy)
         try:
         try:
-            tbad = wx.StaticText(parent=par, id=wx.ID_ANY,
-                                 label=_("   %d untranslated" % v['bad']))
+            tbad = StaticText(parent=par, id=wx.ID_ANY,
+                              label=_("   %d untranslated" % v['bad']))
             tbad.SetForegroundColour(wx.Colour(255, 0, 0))
             tbad.SetForegroundColour(wx.Colour(255, 0, 0))
             langBox.Add(tbad)
             langBox.Add(tbad)
         except:
         except:
-            tbad = wx.StaticText(parent=par, id=wx.ID_ANY,
-                                 label="")
+            tbad = StaticText(parent=par, id=wx.ID_ANY,
+                              label="")
             langBox.Add(tbad)
             langBox.Add(tbad)
         return langBox
         return langBox
 
 
@@ -593,7 +595,7 @@ class AboutWindow(wx.Frame):
         # else:
         # else:
         # panel.Collapse(True)
         # panel.Collapse(True)
         pageSizer = wx.BoxSizer(wx.VERTICAL)
         pageSizer = wx.BoxSizer(wx.VERTICAL)
-        for k, v in js.iteritems():
+        for k, v in six.iteritems(js):
             if k != 'total' and k != 'name':
             if k != 'total' and k != 'name':
                 box = self._langBox(win, k, v)
                 box = self._langBox(win, k, v)
                 pageSizer.Add(box, proportion=1,
                 pageSizer.Add(box, proportion=1,
@@ -626,8 +628,8 @@ class AboutWindow(wx.Frame):
         if not jsStats:
         if not jsStats:
             Debug.msg(5, _("File <%s> not found") % fname)
             Debug.msg(5, _("File <%s> not found") % fname)
             statsSizer = wx.BoxSizer(wx.VERTICAL)
             statsSizer = wx.BoxSizer(wx.VERTICAL)
-            statstext = wx.StaticText(self.statswin, id=wx.ID_ANY,
-                                      label=_('%s file missing') % fname)
+            statstext = StaticText(self.statswin, id=wx.ID_ANY,
+                                   label=_('%s file missing') % fname)
             statsSizer.Add(statstext, proportion=1,
             statsSizer.Add(statstext, proportion=1,
                            flag=wx.EXPAND | wx.ALL, border=3)
                            flag=wx.EXPAND | wx.ALL, border=3)
         else:
         else:
@@ -753,7 +755,7 @@ class HelpWindow(HtmlWindow):
         try:
         try:
             contents = []
             contents = []
             skip = False
             skip = False
-            for l in file(htmlFile, "rb").readlines():
+            for l in open(htmlFile, "rb").readlines():
                 if "DESCRIPTION" in l:
                 if "DESCRIPTION" in l:
                     skip = False
                     skip = False
                 if not skip:
                 if not skip:
@@ -796,10 +798,10 @@ class HelpPanel(wx.Panel):
 
 
         self.content = HelpWindow(self, command, text, skipDescription)
         self.content = HelpWindow(self, command, text, skipDescription)
 
 
-        self.btnNext = wx.Button(parent=self, id=wx.ID_ANY,
+        self.btnNext = Button(parent=self, id=wx.ID_ANY,
                                  label=_("&Next"))
                                  label=_("&Next"))
         self.btnNext.Enable(False)
         self.btnNext.Enable(False)
-        self.btnPrev = wx.Button(parent=self, id=wx.ID_ANY,
+        self.btnPrev = Button(parent=self, id=wx.ID_ANY,
                                  label=_("&Previous"))
                                  label=_("&Previous"))
         self.btnPrev.Enable(False)
         self.btnPrev.Enable(False)
 
 

+ 7 - 6
gui/wxpython/gui_core/goutput.py

@@ -37,7 +37,8 @@ from core.gconsole   import GConsole, \
     EVT_CMD_OUTPUT, EVT_CMD_PROGRESS, EVT_CMD_RUN, EVT_CMD_DONE, \
     EVT_CMD_OUTPUT, EVT_CMD_PROGRESS, EVT_CMD_RUN, EVT_CMD_DONE, \
     Notification
     Notification
 from gui_core.prompt import GPromptSTC
 from gui_core.prompt import GPromptSTC
-from gui_core.wrap import Button, ToggleButton
+from gui_core.wrap import Button, ToggleButton, StaticText, \
+    StaticBox
 from core.settings import UserSettings
 from core.settings import UserSettings
 from core.utils import _
 from core.utils import _
 from gui_core.widgets import SearchModuleWidget
 from gui_core.widgets import SearchModuleWidget
@@ -145,14 +146,14 @@ class GConsoleWindow(wx.SplitterWindow):
 
 
         if self._gcstyle & GC_PROMPT:
         if self._gcstyle & GC_PROMPT:
             cmdLabel = _("Command prompt")
             cmdLabel = _("Command prompt")
-            self.outputBox = wx.StaticBox(
+            self.outputBox = StaticBox(
                 parent=self.panelOutput,
                 parent=self.panelOutput,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=" %s " %
                 label=" %s " %
                 _("Output window"))
                 _("Output window"))
 
 
-            self.cmdBox = wx.StaticBox(parent=self.panelOutput, id=wx.ID_ANY,
-                                       label=" %s " % cmdLabel)
+            self.cmdBox = StaticBox(parent=self.panelOutput, id=wx.ID_ANY,
+                                    label=" %s " % cmdLabel)
 
 
         # buttons
         # buttons
         self.btnOutputClear = Button(
         self.btnOutputClear = Button(
@@ -202,7 +203,7 @@ class GConsoleWindow(wx.SplitterWindow):
             promptSizer.Add(self.cmdPrompt, proportion=1,
             promptSizer.Add(self.cmdPrompt, proportion=1,
                             flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP,
                             flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP,
                             border=3)
                             border=3)
-            helpText = wx.StaticText(
+            helpText = StaticText(
                 self.panelPrompt, id=wx.ID_ANY,
                 self.panelPrompt, id=wx.ID_ANY,
                 label="Press Tab to display command help, Ctrl+Space to autocomplete")
                 label="Press Tab to display command help, Ctrl+Space to autocomplete")
             helpText.SetForegroundColour(
             helpText.SetForegroundColour(
@@ -629,7 +630,7 @@ class GStc(stc.StyledTextCtrl):
             group='appearance',
             group='appearance',
             key='outputfont',
             key='outputfont',
             subkey='size')
             subkey='size')
-        if typesize is None or typesize <= 0:
+        if typesize is None or int(typesize) <= 0:
             typesize = 10
             typesize = 10
         typesize = float(typesize)
         typesize = float(typesize)
 
 

+ 51 - 49
gui/wxpython/gui_core/gselect.py

@@ -47,6 +47,7 @@ import os
 import sys
 import sys
 import glob
 import glob
 import copy
 import copy
+import six
 
 
 import wx
 import wx
 
 
@@ -83,7 +84,8 @@ from core.utils import GetVectorNumberOfLayers, _
 from core.settings import UserSettings
 from core.settings import UserSettings
 from core.debug import Debug
 from core.debug import Debug
 from gui_core.vselect import VectorSelectBase
 from gui_core.vselect import VectorSelectBase
-from gui_core.wrap import TreeCtrl
+from gui_core.wrap import TreeCtrl, Button, StaticText, StaticBox, \
+    TextCtrl
 
 
 from grass.pydispatch.signal import Signal
 from grass.pydispatch.signal import Signal
 
 
@@ -526,7 +528,7 @@ class TreeCtrlComboPopup(ListCtrlComboPopup):
 
 
         # add extra items first
         # add extra items first
         if self.extraItems:
         if self.extraItems:
-            for group, items in self.extraItems.iteritems():
+            for group, items in six.iteritems(self.extraItems):
                 node = self.AddItem(group, node=True)
                 node = self.AddItem(group, node=True)
                 self.seltree.SetItemTextColour(node, wx.Colour(50, 50, 200))
                 self.seltree.SetItemTextColour(node, wx.Colour(50, 50, 200))
                 for item in items:
                 for item in items:
@@ -804,7 +806,7 @@ class VectorDBInfo:
 
 
     def _CheckDBConnection(self):
     def _CheckDBConnection(self):
         """Check DB connection"""
         """Check DB connection"""
-        nuldev = file(os.devnull, 'w+')
+        nuldev = open(os.devnull, 'w+')
         # if map is not defined (happens with vnet initialization) or it
         # if map is not defined (happens with vnet initialization) or it
         # doesn't exist
         # doesn't exist
         try:
         try:
@@ -989,7 +991,7 @@ class DriverSelect(wx.ComboBox):
         self.SetStringSelection(value)
         self.SetStringSelection(value)
 
 
 
 
-class DatabaseSelect(wx.TextCtrl):
+class DatabaseSelect(TextCtrl):
     """Creates combo box for selecting database driver.
     """Creates combo box for selecting database driver.
     """
     """
 
 
@@ -1124,16 +1126,16 @@ class ColumnSelect(ComboCtrl):
             columnchoices = dbInfo.GetTableDesc(table)
             columnchoices = dbInfo.GetTableDesc(table)
             keyColumn = dbInfo.GetKeyColumn(layer)
             keyColumn = dbInfo.GetKeyColumn(layer)
             self.columns = len(columnchoices.keys()) * ['']
             self.columns = len(columnchoices.keys()) * ['']
-            for key, val in columnchoices.iteritems():
+            for key, val in six.iteritems(columnchoices):
                 self.columns[val['index']] = key
                 self.columns[val['index']] = key
             if excludeKey:  # exclude key column
             if excludeKey:  # exclude key column
                 self.columns.remove(keyColumn)
                 self.columns.remove(keyColumn)
             if excludeCols:  # exclude key column
             if excludeCols:  # exclude key column
-                for key in columnchoices.iterkeys():
+                for key in six.iterkeys(columnchoices):
                     if key in excludeCols:
                     if key in excludeCols:
                         self.columns.remove(key)
                         self.columns.remove(key)
             if type:  # only selected column types
             if type:  # only selected column types
-                for key, value in columnchoices.iteritems():
+                for key, value in six.iteritems(columnchoices):
                     if value['type'] not in type:
                     if value['type'] not in type:
                         try:
                         try:
                             self.columns.remove(key)
                             self.columns.remove(key)
@@ -1398,7 +1400,7 @@ class GdalSelect(wx.Panel):
 
 
         self.reloadDataRequired = Signal('GdalSelect.reloadDataRequired')
         self.reloadDataRequired = Signal('GdalSelect.reloadDataRequired')
 
 
-        self.inputBox = wx.StaticBox(parent=self)
+        self.inputBox = StaticBox(parent=self)
         if dest:
         if dest:
             self.inputBox.SetLabel(" %s " % _("Output settings"))
             self.inputBox.SetLabel(" %s " % _("Output settings"))
         else:
         else:
@@ -1502,7 +1504,7 @@ class GdalSelect(wx.Panel):
             fileMask=fileMask)
             fileMask=fileMask)
         browse.GetChildren()[1].SetName('GdalSelectDataSource')
         browse.GetChildren()[1].SetName('GdalSelectDataSource')
         self.fileWidgets['browse'] = browse
         self.fileWidgets['browse'] = browse
-        self.fileWidgets['options'] = wx.TextCtrl(parent=self.filePanel)
+        self.fileWidgets['options'] = TextCtrl(parent=self.filePanel)
 
 
         # directory
         # directory
         self.dirPanel = wx.Panel(parent=self)
         self.dirPanel = wx.Panel(parent=self)
@@ -1527,11 +1529,11 @@ class GdalSelect(wx.Panel):
                 self.dirWidgets['format'].GetStringSelection()))
                 self.dirWidgets['format'].GetStringSelection()))
         formatSelect.Bind(wx.EVT_CHOICE, self.OnUpdate)
         formatSelect.Bind(wx.EVT_CHOICE, self.OnUpdate)
 
 
-        self.dirWidgets['extensionLabel'] = wx.StaticText(
+        self.dirWidgets['extensionLabel'] = StaticText(
             parent=self.dirPanel, label=_("Extension:"))
             parent=self.dirPanel, label=_("Extension:"))
-        self.dirWidgets['extension'] = wx.TextCtrl(parent=self.dirPanel)
+        self.dirWidgets['extension'] = TextCtrl(parent=self.dirPanel)
         self.dirWidgets['extension'].Bind(wx.EVT_TEXT, self.ExtensionChanged)
         self.dirWidgets['extension'].Bind(wx.EVT_TEXT, self.ExtensionChanged)
-        self.dirWidgets['options'] = wx.TextCtrl(parent=self.dirPanel)
+        self.dirWidgets['options'] = TextCtrl(parent=self.dirPanel)
         if self.ogr:
         if self.ogr:
             shapefile = 'ESRI Shapefile'
             shapefile = 'ESRI Shapefile'
             if shapefile in fileFormats:
             if shapefile in fileFormats:
@@ -1568,12 +1570,12 @@ class GdalSelect(wx.Panel):
         self.dbWidgets['choice'] = wx.Choice(
         self.dbWidgets['choice'] = wx.Choice(
             parent=self.dbPanel, name='GdalSelectDataSource')
             parent=self.dbPanel, name='GdalSelectDataSource')
         self.dbWidgets['choice'].Bind(wx.EVT_CHOICE, self.OnUpdate)
         self.dbWidgets['choice'].Bind(wx.EVT_CHOICE, self.OnUpdate)
-        self.dbWidgets['text'] = wx.TextCtrl(
+        self.dbWidgets['text'] = TextCtrl(
             parent=self.dbPanel, name='GdalSelectDataSource')
             parent=self.dbPanel, name='GdalSelectDataSource')
         self.dbWidgets['text'].Bind(wx.EVT_TEXT, self.OnUpdate)
         self.dbWidgets['text'].Bind(wx.EVT_TEXT, self.OnUpdate)
-        self.dbWidgets['textLabel1'] = wx.StaticText(
+        self.dbWidgets['textLabel1'] = StaticText(
             parent=self.dbPanel, label=_("Name:"))
             parent=self.dbPanel, label=_("Name:"))
-        self.dbWidgets['textLabel2'] = wx.StaticText(
+        self.dbWidgets['textLabel2'] = StaticText(
             parent=self.dbPanel, label=_("Name:"))
             parent=self.dbPanel, label=_("Name:"))
         self.dbWidgets['featType'] = wx.RadioBox(
         self.dbWidgets['featType'] = wx.RadioBox(
             parent=self.dbPanel,
             parent=self.dbPanel,
@@ -1599,7 +1601,7 @@ class GdalSelect(wx.Panel):
             startDirectory=os.getcwd(),
             startDirectory=os.getcwd(),
             changeCallback=self.OnUpdate)
             changeCallback=self.OnUpdate)
         self.dbWidgets['dirbrowse'] = browse
         self.dbWidgets['dirbrowse'] = browse
-        self.dbWidgets['options'] = wx.TextCtrl(parent=self.dbPanel)
+        self.dbWidgets['options'] = TextCtrl(parent=self.dbPanel)
 
 
         # protocol
         # protocol
         self.protocolPanel = wx.Panel(parent=self)
         self.protocolPanel = wx.Panel(parent=self)
@@ -1609,9 +1611,9 @@ class GdalSelect(wx.Panel):
             choices=protocolFormats)
             choices=protocolFormats)
         self.protocolWidgets['format'] = protocolChoice
         self.protocolWidgets['format'] = protocolChoice
 
 
-        self.protocolWidgets['text'] = wx.TextCtrl(parent=self.protocolPanel)
+        self.protocolWidgets['text'] = TextCtrl(parent=self.protocolPanel)
         self.protocolWidgets['text'].Bind(wx.EVT_TEXT, self.OnUpdate)
         self.protocolWidgets['text'].Bind(wx.EVT_TEXT, self.OnUpdate)
-        self.protocolWidgets['options'] = wx.TextCtrl(
+        self.protocolWidgets['options'] = TextCtrl(
             parent=self.protocolPanel)
             parent=self.protocolPanel)
 
 
         # native
         # native
@@ -1647,7 +1649,7 @@ class GdalSelect(wx.Panel):
                     dsn = v
                     dsn = v
                     break
                     break
             optList = list()
             optList = list()
-            for k, v in data.iteritems():
+            for k, v in six.iteritems(data):
                 if k in ('format', 'conninfo', 'topology'):
                 if k in ('format', 'conninfo', 'topology'):
                     continue
                     continue
                 optList.append('%s=%s' % (k, v))
                 optList.append('%s=%s' % (k, v))
@@ -1692,8 +1694,8 @@ class GdalSelect(wx.Panel):
         sizer.Add(paddingSizer, flag=wx.EXPAND, pos=(0, 0), span=(1, 2))
         sizer.Add(paddingSizer, flag=wx.EXPAND, pos=(0, 0), span=(1, 2))
         sizer.AddGrowableCol(0)
         sizer.AddGrowableCol(0)
         if self.dest:
         if self.dest:
-            sizer.Add(wx.StaticText(parent=self.filePanel,
-                                    label=_("Creation options:")),
+            sizer.Add(StaticText(parent=self.filePanel,
+                                 label=_("Creation options:")),
                       flag=wx.ALIGN_CENTER_VERTICAL,
                       flag=wx.ALIGN_CENTER_VERTICAL,
                       pos=(1, 0))
                       pos=(1, 0))
             sizer.Add(self.fileWidgets['options'],
             sizer.Add(self.fileWidgets['options'],
@@ -1706,8 +1708,8 @@ class GdalSelect(wx.Panel):
 
 
         # directory
         # directory
         sizer = wx.GridBagSizer(vgap=3, hgap=10)
         sizer = wx.GridBagSizer(vgap=3, hgap=10)
-        sizer.Add(wx.StaticText(parent=self.dirPanel,
-                                label=_("Format:")),
+        sizer.Add(StaticText(parent=self.dirPanel,
+                             label=_("Format:")),
                   flag=wx.ALIGN_CENTER_VERTICAL,
                   flag=wx.ALIGN_CENTER_VERTICAL,
                   pos=(0, 0))
                   pos=(0, 0))
         sizer.Add(self.dirWidgets['format'],
         sizer.Add(self.dirWidgets['format'],
@@ -1723,14 +1725,14 @@ class GdalSelect(wx.Panel):
                   flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                   flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                   pos=(1, 0), span=(1, 4))
                   pos=(1, 0), span=(1, 4))
         if self.dest:
         if self.dest:
-            sizer.Add(wx.StaticText(parent=self.dirPanel,
-                                    label=_("Creation options:")),
+            sizer.Add(StaticText(parent=self.dirPanel,
+                                 label=_("Creation options:")),
                       flag=wx.ALIGN_CENTER_VERTICAL,
                       flag=wx.ALIGN_CENTER_VERTICAL,
                       pos=(2, 0))
                       pos=(2, 0))
             sizer.Add(self.dirWidgets['options'],
             sizer.Add(self.dirWidgets['options'],
                       flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                       flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                       pos=(2, 1))
                       pos=(2, 1))
-            helpBtn = wx.Button(parent=self.dirPanel, id=wx.ID_HELP)
+            helpBtn = Button(parent=self.dirPanel, id=wx.ID_HELP)
             helpBtn.Bind(wx.EVT_BUTTON, self.OnHelp)
             helpBtn.Bind(wx.EVT_BUTTON, self.OnHelp)
             sizer.Add(helpBtn,
             sizer.Add(helpBtn,
                       flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                       flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
@@ -1745,8 +1747,8 @@ class GdalSelect(wx.Panel):
 
 
         # database
         # database
         sizer = wx.GridBagSizer(vgap=1, hgap=5)
         sizer = wx.GridBagSizer(vgap=1, hgap=5)
-        sizer.Add(wx.StaticText(parent=self.dbPanel,
-                                label=_("Format:")),
+        sizer.Add(StaticText(parent=self.dbPanel,
+                             label=_("Format:")),
                   flag=wx.ALIGN_CENTER_VERTICAL,
                   flag=wx.ALIGN_CENTER_VERTICAL,
                   pos=(0, 0))
                   pos=(0, 0))
         sizer.Add(self.dbWidgets['format'],
         sizer.Add(self.dbWidgets['format'],
@@ -1774,8 +1776,8 @@ class GdalSelect(wx.Panel):
             sizer.Add(self.dbWidgets['featType'],
             sizer.Add(self.dbWidgets['featType'],
                       pos=(0, 2), flag=wx.EXPAND)
                       pos=(0, 2), flag=wx.EXPAND)
 
 
-            sizer.Add(wx.StaticText(parent=self.dbPanel,
-                                    label=_("Creation options:")),
+            sizer.Add(StaticText(parent=self.dbPanel,
+                                 label=_("Creation options:")),
                       flag=wx.ALIGN_CENTER_VERTICAL,
                       flag=wx.ALIGN_CENTER_VERTICAL,
                       pos=(5, 0))
                       pos=(5, 0))
             sizer.Add(self.dbWidgets['options'],
             sizer.Add(self.dbWidgets['options'],
@@ -1783,7 +1785,7 @@ class GdalSelect(wx.Panel):
                       pos=(5, 1), span=(1, 2))
                       pos=(5, 1), span=(1, 2))
 
 
             # help button
             # help button
-            helpBtn = wx.Button(parent=self.dbPanel, id=wx.ID_HELP)
+            helpBtn = Button(parent=self.dbPanel, id=wx.ID_HELP)
             helpBtn.Bind(wx.EVT_BUTTON, self.OnHelp)
             helpBtn.Bind(wx.EVT_BUTTON, self.OnHelp)
             sizer.Add(helpBtn,
             sizer.Add(helpBtn,
                       pos=(5, 3))
                       pos=(5, 3))
@@ -1797,23 +1799,23 @@ class GdalSelect(wx.Panel):
 
 
         # protocol
         # protocol
         sizer = wx.GridBagSizer(vgap=3, hgap=3)
         sizer = wx.GridBagSizer(vgap=3, hgap=3)
-        sizer.Add(wx.StaticText(parent=self.protocolPanel,
-                                label=_("Format:")),
+        sizer.Add(StaticText(parent=self.protocolPanel,
+                             label=_("Format:")),
                   flag=wx.ALIGN_CENTER_VERTICAL,
                   flag=wx.ALIGN_CENTER_VERTICAL,
                   pos=(0, 0))
                   pos=(0, 0))
         sizer.Add(self.protocolWidgets['format'],
         sizer.Add(self.protocolWidgets['format'],
                   flag=wx.ALIGN_CENTER_VERTICAL,
                   flag=wx.ALIGN_CENTER_VERTICAL,
                   pos=(0, 1))
                   pos=(0, 1))
-        sizer.Add(wx.StaticText(parent=self.protocolPanel,
-                                label=_("Protocol:")),
+        sizer.Add(StaticText(parent=self.protocolPanel,
+                             label=_("Protocol:")),
                   flag=wx.ALIGN_CENTER_VERTICAL,
                   flag=wx.ALIGN_CENTER_VERTICAL,
                   pos=(1, 0))
                   pos=(1, 0))
         sizer.Add(self.protocolWidgets['text'],
         sizer.Add(self.protocolWidgets['text'],
                   flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                   flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                   pos=(1, 1))
                   pos=(1, 1))
         if self.dest:
         if self.dest:
-            sizer.Add(wx.StaticText(parent=self.protocolPanel,
-                                    label=_("Creation options:")),
+            sizer.Add(StaticText(parent=self.protocolPanel,
+                                 label=_("Creation options:")),
                       flag=wx.ALIGN_CENTER_VERTICAL,
                       flag=wx.ALIGN_CENTER_VERTICAL,
                       pos=(2, 0))
                       pos=(2, 0))
             sizer.Add(self.protocolWidgets['options'],
             sizer.Add(self.protocolWidgets['options'],
@@ -1827,8 +1829,8 @@ class GdalSelect(wx.Panel):
 
 
         # native
         # native
         sizer = wx.BoxSizer(wx.VERTICAL)
         sizer = wx.BoxSizer(wx.VERTICAL)
-        sizer.Add(wx.StaticText(parent=self.nativePanel,
-                                label=_("No settings available")),
+        sizer.Add(StaticText(parent=self.nativePanel,
+                             label=_("No settings available")),
                   flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.EXPAND, border=5)
                   flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.EXPAND, border=5)
         self.nativePanel.SetSizer(sizer)
         self.nativePanel.SetSizer(sizer)
 
 
@@ -2337,9 +2339,9 @@ class OgrTypeSelect(wx.Panel):
     def _layout(self):
     def _layout(self):
         """Do layout"""
         """Do layout"""
         sizer = wx.BoxSizer(wx.HORIZONTAL)
         sizer = wx.BoxSizer(wx.HORIZONTAL)
-        sizer.Add(wx.StaticText(parent=self,
-                                id=wx.ID_ANY,
-                                label=_("Feature type:")),
+        sizer.Add(StaticText(parent=self,
+                             id=wx.ID_ANY,
+                             label=_("Feature type:")),
                   proportion=1,
                   proportion=1,
                   flag=wx.ALIGN_CENTER_VERTICAL,
                   flag=wx.ALIGN_CENTER_VERTICAL,
                   border=5)
                   border=5)
@@ -2380,9 +2382,9 @@ class CoordinatesSelect(wx.Panel):
 
 
         super(CoordinatesSelect, self).__init__(parent=parent, id=wx.ID_ANY)
         super(CoordinatesSelect, self).__init__(parent=parent, id=wx.ID_ANY)
 
 
-        self.coordsField = wx.TextCtrl(parent=self, id=wx.ID_ANY,
-                                       size=globalvar.DIALOG_TEXTCTRL_SIZE,
-                                       validator=CoordinatesValidator())
+        self.coordsField = TextCtrl(parent=self, id=wx.ID_ANY,
+                                    size=globalvar.DIALOG_TEXTCTRL_SIZE,
+                                    validator=CoordinatesValidator())
 
 
         icon = wx.Bitmap(
         icon = wx.Bitmap(
             os.path.join(
             os.path.join(
@@ -2522,8 +2524,8 @@ class VectorCategorySelect(wx.Panel):
 
 
         self.mapdisp = self.giface.GetMapDisplay()
         self.mapdisp = self.giface.GetMapDisplay()
 
 
-        self.catsField = wx.TextCtrl(parent=self, id=wx.ID_ANY,
-                                     size=globalvar.DIALOG_TEXTCTRL_SIZE)
+        self.catsField = TextCtrl(parent=self, id=wx.ID_ANY,
+                                  size=globalvar.DIALOG_TEXTCTRL_SIZE)
 
 
         icon = wx.Bitmap(
         icon = wx.Bitmap(
             os.path.join(
             os.path.join(
@@ -2713,8 +2715,8 @@ class SqlWhereSelect(wx.Panel):
         self.parent = parent
         self.parent = parent
         self.vector_map = None
         self.vector_map = None
 
 
-        self.sqlField = wx.TextCtrl(parent=self, id=wx.ID_ANY,
-                                    size=globalvar.DIALOG_TEXTCTRL_SIZE)
+        self.sqlField = TextCtrl(parent=self, id=wx.ID_ANY,
+                                 size=globalvar.DIALOG_TEXTCTRL_SIZE)
         self.GetChildren()[0].SetName("SqlWhereSelect")
         self.GetChildren()[0].SetName("SqlWhereSelect")
         icon = wx.Bitmap(
         icon = wx.Bitmap(
             os.path.join(
             os.path.join(

+ 2 - 1
gui/wxpython/gui_core/mapdisp.py

@@ -21,6 +21,7 @@ This program is free software under the GNU General Public License
 
 
 import os
 import os
 import sys
 import sys
+import six
 
 
 import wx
 import wx
 
 
@@ -333,7 +334,7 @@ class MapFrameBase(wx.Frame):
 
 
     def StatusbarEnableLongHelp(self, enable=True):
     def StatusbarEnableLongHelp(self, enable=True):
         """Enable/disable toolbars long help"""
         """Enable/disable toolbars long help"""
-        for toolbar in self.toolbars.itervalues():
+        for toolbar in six.itervalues(self.toolbars):
             toolbar.EnableLongHelp(enable)
             toolbar.EnableLongHelp(enable)
 
 
     def IsStandalone(self):
     def IsStandalone(self):

+ 3 - 3
gui/wxpython/gui_core/menu.py

@@ -27,7 +27,7 @@ from core.gcmd import EncodeString
 from core.utils import _
 from core.utils import _
 from gui_core.widgets import SearchModuleWidget
 from gui_core.widgets import SearchModuleWidget
 from gui_core.treeview import CTreeView
 from gui_core.treeview import CTreeView
-from gui_core.wrap import Button
+from gui_core.wrap import Button, StaticText
 from gui_core.wrap import Menu as MenuWidget
 from gui_core.wrap import Menu as MenuWidget
 from icons.icon import MetaIcon
 from icons.icon import MetaIcon
 
 
@@ -149,7 +149,7 @@ class SearchModuleWindow(wx.Panel):
 
 
         # tree
         # tree
         self._tree = CTreeView(model=model, parent=self)
         self._tree = CTreeView(model=model, parent=self)
-        self._tree.SetToolTipString(
+        self._tree.SetToolTip(
             _("Double-click or Ctrl-Enter to run selected module"))
             _("Double-click or Ctrl-Enter to run selected module"))
 
 
 #        self._dataBox = wx.StaticBox(parent = self, id = wx.ID_ANY,
 #        self._dataBox = wx.StaticBox(parent = self, id = wx.ID_ANY,
@@ -163,7 +163,7 @@ class SearchModuleWindow(wx.Panel):
             lambda result: self._tree.Select(result))
             lambda result: self._tree.Select(result))
         self._search.showNotification.connect(self.showNotification)
         self._search.showNotification.connect(self.showNotification)
 
 
-        self._helpText = wx.StaticText(
+        self._helpText = StaticText(
             parent=self, id=wx.ID_ANY,
             parent=self, id=wx.ID_ANY,
             label="Press Enter for next match, Ctrl+Enter to run command")
             label="Press Enter for next match, Ctrl+Enter to run command")
         self._helpText.SetForegroundColour(
         self._helpText.SetForegroundColour(

+ 87 - 86
gui/wxpython/gui_core/preferences.py

@@ -50,7 +50,8 @@ from core.settings import UserSettings
 from gui_core.dialogs import SymbolDialog, DefaultFontDialog
 from gui_core.dialogs import SymbolDialog, DefaultFontDialog
 from gui_core.widgets import IntegerValidator, ColorTablesComboBox
 from gui_core.widgets import IntegerValidator, ColorTablesComboBox
 from core.debug import Debug
 from core.debug import Debug
-from gui_core.wrap import SpinCtrl, Button
+from gui_core.wrap import SpinCtrl, Button, BitmapButton, StaticText, \
+    StaticBox, TextCtrl
 
 
 
 
 class PreferencesBaseDialog(wx.Dialog):
 class PreferencesBaseDialog(wx.Dialog):
@@ -275,7 +276,7 @@ class PreferencesDialog(PreferencesBaseDialog):
         #
         #
         # Layer Manager settings
         # Layer Manager settings
         #
         #
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=" %s " %
             label=" %s " %
@@ -378,7 +379,7 @@ class PreferencesDialog(PreferencesBaseDialog):
         #
         #
         # workspace
         # workspace
         #
         #
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=" %s " %
             label=" %s " %
@@ -447,7 +448,7 @@ class PreferencesDialog(PreferencesBaseDialog):
         #
         #
         # region
         # region
         #
         #
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=" %s " %
             label=" %s " %
@@ -491,7 +492,7 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
         border = wx.BoxSizer(wx.VERTICAL)
         border = wx.BoxSizer(wx.VERTICAL)
 
 
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=" %s " %
             label=" %s " %
@@ -511,12 +512,12 @@ class PreferencesDialog(PreferencesBaseDialog):
         border.Add(sizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=3)
         border.Add(sizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=3)
 
 
         row = 0
         row = 0
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Font for command output:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Font for command output:")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
                       pos=(row, 0))
-        outfontButton = wx.Button(parent=panel, id=wx.ID_ANY,
+        outfontButton = Button(parent=panel, id=wx.ID_ANY,
                                   label=_("Set font"))
                                   label=_("Set font"))
         gridSizer.Add(outfontButton,
         gridSizer.Add(outfontButton,
                       flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL,
                       flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL,
@@ -526,7 +527,7 @@ class PreferencesDialog(PreferencesBaseDialog):
         #
         #
         # languages
         # languages
         #
         #
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=" %s " %
             label=" %s " %
@@ -543,7 +544,7 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
         row = 0
         row = 0
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Choose language (requires to save and GRASS restart):")),
                 label=_("Choose language (requires to save and GRASS restart):")),
@@ -576,7 +577,7 @@ class PreferencesDialog(PreferencesBaseDialog):
         #
         #
         # appearence
         # appearence
         #
         #
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=" %s " %
             label=" %s " %
@@ -589,8 +590,8 @@ class PreferencesDialog(PreferencesBaseDialog):
         # element list
         # element list
         #
         #
         row = 0
         row = 0
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Element list:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Element list:")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
                       pos=(row, 0))
@@ -617,7 +618,7 @@ class PreferencesDialog(PreferencesBaseDialog):
         #
         #
         row += 1
         row += 1
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Menu style (requires to save and GUI restart):")),
                 label=_("Menu style (requires to save and GUI restart):")),
@@ -652,7 +653,7 @@ class PreferencesDialog(PreferencesBaseDialog):
         row += 1
         row += 1
 
 
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Height of map selection popup window (in pixels):")),
                 label=_("Height of map selection popup window (in pixels):")),
@@ -692,7 +693,7 @@ class PreferencesDialog(PreferencesBaseDialog):
         #
         #
         row += 1
         row += 1
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Icon theme (requires GUI restart):")),
                 label=_("Icon theme (requires GUI restart):")),
@@ -721,8 +722,8 @@ class PreferencesDialog(PreferencesBaseDialog):
         # command dialog style
         # command dialog style
         #
         #
         row += 1
         row += 1
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Module dialog style:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Module dialog style:")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
                       pos=(row, 0))
@@ -772,7 +773,7 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
         border = wx.BoxSizer(wx.VERTICAL)
         border = wx.BoxSizer(wx.VERTICAL)
 
 
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=" %s " %
             label=" %s " %
@@ -786,7 +787,7 @@ class PreferencesDialog(PreferencesBaseDialog):
         #
         #
         row = 0
         row = 0
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Default font for GRASS displays:")),
                 label=_("Default font for GRASS displays:")),
@@ -794,7 +795,7 @@ class PreferencesDialog(PreferencesBaseDialog):
             pos=(
             pos=(
                 row,
                 row,
                 0))
                 0))
-        fontButton = wx.Button(parent=panel, id=wx.ID_ANY,
+        fontButton = Button(parent=panel, id=wx.ID_ANY,
                                label=_("Set font"))
                                label=_("Set font"))
         gridSizer.Add(fontButton,
         gridSizer.Add(fontButton,
                       flag=wx.ALIGN_RIGHT |
                       flag=wx.ALIGN_RIGHT |
@@ -812,7 +813,7 @@ class PreferencesDialog(PreferencesBaseDialog):
         #
         #
         # display settings
         # display settings
         #
         #
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=" %s " %
             label=" %s " %
@@ -825,8 +826,8 @@ class PreferencesDialog(PreferencesBaseDialog):
         # display driver
         # display driver
         #
         #
         row = 0
         row = 0
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Display driver:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Display driver:")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
                       pos=(row, 0))
@@ -851,8 +852,8 @@ class PreferencesDialog(PreferencesBaseDialog):
         # Statusbar mode
         # Statusbar mode
         #
         #
         row += 1
         row += 1
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Statusbar mode:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Statusbar mode:")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
                       pos=(row, 0))
@@ -879,8 +880,8 @@ class PreferencesDialog(PreferencesBaseDialog):
         # Background color
         # Background color
         #
         #
         row += 1
         row += 1
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Background color:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Background color:")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
                       pos=(row, 0))
@@ -984,8 +985,8 @@ class PreferencesDialog(PreferencesBaseDialog):
         # mouse wheel zoom
         # mouse wheel zoom
         #
         #
         row += 1
         row += 1
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Mouse wheel action:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Mouse wheel action:")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
                       pos=(row, 0))
@@ -1008,7 +1009,7 @@ class PreferencesDialog(PreferencesBaseDialog):
                       pos=(row, 1))
                       pos=(row, 1))
         row += 1
         row += 1
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Mouse scrolling direction:")),
                 label=_("Mouse scrolling direction:")),
@@ -1050,7 +1051,7 @@ class PreferencesDialog(PreferencesBaseDialog):
         # see initialization of nviz GLWindow
         # see initialization of nviz GLWindow
         if globalvar.CheckWxVersion(version=[2, 8, 11]) and \
         if globalvar.CheckWxVersion(version=[2, 8, 11]) and \
            sys.platform not in ('win32', 'darwin'):
            sys.platform not in ('win32', 'darwin'):
-            box = wx.StaticBox(
+            box = StaticBox(
                 parent=panel, id=wx.ID_ANY, label=" %s " %
                 parent=panel, id=wx.ID_ANY, label=" %s " %
                 _("Advanced display settings"))
                 _("Advanced display settings"))
             sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
             sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
@@ -1058,7 +1059,7 @@ class PreferencesDialog(PreferencesBaseDialog):
             gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
             gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
             row = 0
             row = 0
             gridSizer.Add(
             gridSizer.Add(
-                wx.StaticText(
+                StaticText(
                     parent=panel,
                     parent=panel,
                     id=wx.ID_ANY,
                     id=wx.ID_ANY,
                     label=_("3D view depth buffer (possible values are 16, 24, 32):")),
                     label=_("3D view depth buffer (possible values are 16, 24, 32):")),
@@ -1070,7 +1071,7 @@ class PreferencesDialog(PreferencesBaseDialog):
                 group='display',
                 group='display',
                 key='nvizDepthBuffer',
                 key='nvizDepthBuffer',
                 subkey='value')
                 subkey='value')
-            textCtrl = wx.TextCtrl(
+            textCtrl = TextCtrl(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 value=str(value),
                 value=str(value),
@@ -1112,7 +1113,7 @@ class PreferencesDialog(PreferencesBaseDialog):
         notebook.AddPage(page=panel, text=_("Modules"))
         notebook.AddPage(page=panel, text=_("Modules"))
 
 
         border = wx.BoxSizer(wx.VERTICAL)
         border = wx.BoxSizer(wx.VERTICAL)
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=" %s " %
             label=" %s " %
@@ -1183,8 +1184,8 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
         row += 1
         row += 1
         # verbosity
         # verbosity
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Verbosity level:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Verbosity level:")),
                       flag=wx.ALIGN_LEFT |
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL,
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
                       pos=(row, 0))
@@ -1226,7 +1227,7 @@ class PreferencesDialog(PreferencesBaseDialog):
         #
         #
         # raster settings
         # raster settings
         #
         #
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=" %s " %
             label=" %s " %
@@ -1297,7 +1298,7 @@ class PreferencesDialog(PreferencesBaseDialog):
         #
         #
         # vector settings
         # vector settings
         #
         #
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=" %s " %
             label=" %s " %
@@ -1306,8 +1307,8 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
         gridSizer = wx.FlexGridSizer(cols=7, hgap=10, vgap=3)
         gridSizer = wx.FlexGridSizer(cols=7, hgap=10, vgap=3)
 
 
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Display:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Display:")),
                       flag=wx.ALIGN_CENTER_VERTICAL)
                       flag=wx.ALIGN_CENTER_VERTICAL)
 
 
         for type in ('point', 'line', 'centroid', 'boundary',
         for type in ('point', 'line', 'centroid', 'boundary',
@@ -1331,8 +1332,8 @@ class PreferencesDialog(PreferencesBaseDialog):
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
 
 
         # feature color
         # feature color
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Feature color:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Feature color:")),
                       flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0))
                       flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0))
         featureColor = csel.ColourSelect(
         featureColor = csel.ColourSelect(
             parent=panel,
             parent=panel,
@@ -1371,8 +1372,8 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
         # area fill color
         # area fill color
         row += 1
         row += 1
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Area fill color:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Area fill color:")),
                       flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, col))
                       flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, col))
         fillColor = csel.ColourSelect(
         fillColor = csel.ColourSelect(
             parent=panel,
             parent=panel,
@@ -1403,8 +1404,8 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
         # line
         # line
         row += 1
         row += 1
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Line width:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Line width:")),
                       flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, col))
                       flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, col))
         hlWidth = SpinCtrl(
         hlWidth = SpinCtrl(
             parent=panel, id=wx.ID_ANY, size=(50, -1),
             parent=panel, id=wx.ID_ANY, size=(50, -1),
@@ -1435,8 +1436,8 @@ class PreferencesDialog(PreferencesBaseDialog):
         # symbol
         # symbol
         row = 0
         row = 0
         col = 4
         col = 4
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Symbol size:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Symbol size:")),
                       flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, col))
                       flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, col))
         ptSize = SpinCtrl(
         ptSize = SpinCtrl(
             parent=panel, id=wx.ID_ANY, size=(50, -1),
             parent=panel, id=wx.ID_ANY, size=(50, -1),
@@ -1447,13 +1448,13 @@ class PreferencesDialog(PreferencesBaseDialog):
         gridSizer.Add(ptSize, pos=(row, col + 2), flag=wx.ALIGN_RIGHT)
         gridSizer.Add(ptSize, pos=(row, col + 2), flag=wx.ALIGN_RIGHT)
 
 
         row += 1
         row += 1
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Symbol:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Symbol:")),
                       flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, col))
                       flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, col))
         symbolPath = self.settings.Get(
         symbolPath = self.settings.Get(
             group='vectorLayer', key='point', subkey='symbol')
             group='vectorLayer', key='point', subkey='symbol')
-        symbolLabel = wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=symbolPath, name='GetLabel')
+        symbolLabel = StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=symbolPath, name='GetLabel')
         symbolLabel.SetMinSize((150, -1))
         symbolLabel.SetMinSize((150, -1))
         self.winId['vectorLayer:point:symbol'] = symbolLabel.GetId()
         self.winId['vectorLayer:point:symbol'] = symbolLabel.GetId()
         gridSizer.Add(
         gridSizer.Add(
@@ -1467,7 +1468,7 @@ class PreferencesDialog(PreferencesBaseDialog):
             os.path.join(
             os.path.join(
                 globalvar.SYMBDIR,
                 globalvar.SYMBDIR,
                 symbolPath) + '.png')
                 symbolPath) + '.png')
-        bb = wx.BitmapButton(
+        bb = BitmapButton(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             bitmap=bitmap,
             bitmap=bitmap,
@@ -1500,7 +1501,7 @@ class PreferencesDialog(PreferencesBaseDialog):
         #
         #
         # highlighting
         # highlighting
         #
         #
-        highlightBox = wx.StaticBox(
+        highlightBox = StaticBox(
             parent=panel, id=wx.ID_ANY, label=" %s " %
             parent=panel, id=wx.ID_ANY, label=" %s " %
             _("Highlight selected features"))
             _("Highlight selected features"))
         highlightSizer = wx.StaticBoxSizer(highlightBox, wx.VERTICAL)
         highlightSizer = wx.StaticBoxSizer(highlightBox, wx.VERTICAL)
@@ -1509,7 +1510,7 @@ class PreferencesDialog(PreferencesBaseDialog):
         flexSizer.AddGrowableCol(0)
         flexSizer.AddGrowableCol(0)
 
 
         # color
         # color
-        label = wx.StaticText(parent=panel, id=wx.ID_ANY, label=_("Color:"))
+        label = StaticText(parent=panel, id=wx.ID_ANY, label=_("Color:"))
         hlColor = csel.ColourSelect(
         hlColor = csel.ColourSelect(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
@@ -1528,7 +1529,7 @@ class PreferencesDialog(PreferencesBaseDialog):
             flag=wx.ALIGN_RIGHT | wx.FIXED_MINSIZE)
             flag=wx.ALIGN_RIGHT | wx.FIXED_MINSIZE)
 
 
         # width
         # width
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_("Line width (in pixels):"))
             label=_("Line width (in pixels):"))
@@ -1570,13 +1571,13 @@ class PreferencesDialog(PreferencesBaseDialog):
         #
         #
         # data browser related settings
         # data browser related settings
         #
         #
-        dataBrowserBox = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                                      label=" %s " % _("Data browser"))
+        dataBrowserBox = StaticBox(parent=panel, id=wx.ID_ANY,
+                                   label=" %s " % _("Data browser"))
         dataBrowserSizer = wx.StaticBoxSizer(dataBrowserBox, wx.VERTICAL)
         dataBrowserSizer = wx.StaticBoxSizer(dataBrowserBox, wx.VERTICAL)
 
 
         flexSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5)
         flexSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5)
         flexSizer.AddGrowableCol(0)
         flexSizer.AddGrowableCol(0)
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_("Left mouse double click:"))
             label=_("Left mouse double click:"))
@@ -1603,9 +1604,9 @@ class PreferencesDialog(PreferencesBaseDialog):
             flag=wx.ALIGN_RIGHT | wx.FIXED_MINSIZE)
             flag=wx.ALIGN_RIGHT | wx.FIXED_MINSIZE)
 
 
         # encoding
         # encoding
-        label = wx.StaticText(parent=panel, id=wx.ID_ANY, label=_(
+        label = StaticText(parent=panel, id=wx.ID_ANY, label=_(
             "Encoding (e.g. utf-8, ascii, iso8859-1, koi8-r):"))
             "Encoding (e.g. utf-8, ascii, iso8859-1, koi8-r):"))
-        encoding = wx.TextCtrl(
+        encoding = TextCtrl(
             parent=panel, id=wx.ID_ANY, value=self.settings.Get(
             parent=panel, id=wx.ID_ANY, value=self.settings.Get(
                 group='atm', key='encoding', subkey='value'), name="GetValue", size=(
                 group='atm', key='encoding', subkey='value'), name="GetValue", size=(
                 200, -1))
                 200, -1))
@@ -1642,17 +1643,17 @@ class PreferencesDialog(PreferencesBaseDialog):
         #
         #
         # create table
         # create table
         #
         #
-        createTableBox = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                                      label=" %s " % _("Create table"))
+        createTableBox = StaticBox(parent=panel, id=wx.ID_ANY,
+                                   label=" %s " % _("Create table"))
         createTableSizer = wx.StaticBoxSizer(createTableBox, wx.VERTICAL)
         createTableSizer = wx.StaticBoxSizer(createTableBox, wx.VERTICAL)
 
 
         flexSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5)
         flexSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5)
         flexSizer.AddGrowableCol(0)
         flexSizer.AddGrowableCol(0)
 
 
-        label = wx.StaticText(parent=panel, id=wx.ID_ANY,
-                              label=_("Key column:"))
-        keyColumn = wx.TextCtrl(parent=panel, id=wx.ID_ANY,
-                                size=(250, -1))
+        label = StaticText(parent=panel, id=wx.ID_ANY,
+                           label=_("Key column:"))
+        keyColumn = TextCtrl(parent=panel, id=wx.ID_ANY,
+                             size=(250, -1))
         keyColumn.SetValue(
         keyColumn.SetValue(
             self.settings.Get(
             self.settings.Get(
                 group='atm',
                 group='atm',
@@ -1691,7 +1692,7 @@ class PreferencesDialog(PreferencesBaseDialog):
         #
         #
         # projections statusbar settings
         # projections statusbar settings
         #
         #
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel, id=wx.ID_ANY, label=" %s " %
             parent=panel, id=wx.ID_ANY, label=" %s " %
             _("Projection statusbar settings"))
             _("Projection statusbar settings"))
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
@@ -1700,7 +1701,7 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
         # note for users expecting on-the-fly data reprojection
         # note for users expecting on-the-fly data reprojection
         row = 0
         row = 0
-        note0 = wx.StaticText(
+        note0 = StaticText(
             parent=panel, id=wx.ID_ANY, label=_(
             parent=panel, id=wx.ID_ANY, label=_(
                 "\nNote: This only controls the coordinates "
                 "\nNote: This only controls the coordinates "
                 "displayed in the lower-left of the Map "
                 "displayed in the lower-left of the Map "
@@ -1716,8 +1717,8 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
         # epsg
         # epsg
         row += 1
         row += 1
-        label = wx.StaticText(parent=panel, id=wx.ID_ANY,
-                              label=_("EPSG code:"))
+        label = StaticText(parent=panel, id=wx.ID_ANY,
+                           label=_("EPSG code:"))
         epsgCode = wx.ComboBox(parent=panel, id=wx.ID_ANY,
         epsgCode = wx.ComboBox(parent=panel, id=wx.ID_ANY,
                                name="GetValue",
                                name="GetValue",
                                size=(150, -1))
                                size=(150, -1))
@@ -1734,9 +1735,9 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
         # proj
         # proj
         row += 1
         row += 1
-        label = wx.StaticText(parent=panel, id=wx.ID_ANY,
-                              label=_("Proj.4 string (required):"))
-        projString = wx.TextCtrl(
+        label = StaticText(parent=panel, id=wx.ID_ANY,
+                           label=_("Proj.4 string (required):"))
+        projString = TextCtrl(
             parent=panel, id=wx.ID_ANY, value=self.settings.Get(
             parent=panel, id=wx.ID_ANY, value=self.settings.Get(
                 group='projection', key='statusbar', subkey='proj4'), name="GetValue", size=(
                 group='projection', key='statusbar', subkey='proj4'), name="GetValue", size=(
                 400, -1))
                 400, -1))
@@ -1751,9 +1752,9 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
         # epsg file
         # epsg file
         row += 1
         row += 1
-        label = wx.StaticText(parent=panel, id=wx.ID_ANY,
-                              label=_("EPSG file:"))
-        projFile = wx.TextCtrl(
+        label = StaticText(parent=panel, id=wx.ID_ANY,
+                           label=_("EPSG file:"))
+        projFile = TextCtrl(
             parent=panel, id=wx.ID_ANY, value=self.settings.Get(
             parent=panel, id=wx.ID_ANY, value=self.settings.Get(
                 group='projection', key='statusbar', subkey='projFile'),
                 group='projection', key='statusbar', subkey='projFile'),
             name="GetValue", size=(400, -1))
             name="GetValue", size=(400, -1))
@@ -1767,7 +1768,7 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
         # note + button
         # note + button
         row += 1
         row += 1
-        note = wx.StaticText(
+        note = StaticText(
             parent=panel, id=wx.ID_ANY, label=_(
             parent=panel, id=wx.ID_ANY, label=_(
                 "Load EPSG codes (be patient), enter EPSG code or "
                 "Load EPSG codes (be patient), enter EPSG code or "
                 "insert Proj.4 string directly."))
                 "insert Proj.4 string directly."))
@@ -1776,7 +1777,7 @@ class PreferencesDialog(PreferencesBaseDialog):
                       pos=(row, 0))
                       pos=(row, 0))
 
 
         row += 1
         row += 1
-        epsgLoad = wx.Button(parent=panel, id=wx.ID_ANY,
+        epsgLoad = Button(parent=panel, id=wx.ID_ANY,
                              label=_("&Load EPSG codes"))
                              label=_("&Load EPSG codes"))
         gridSizer.Add(epsgLoad,
         gridSizer.Add(epsgLoad,
                       flag=wx.ALIGN_RIGHT,
                       flag=wx.ALIGN_RIGHT,
@@ -1793,7 +1794,7 @@ class PreferencesDialog(PreferencesBaseDialog):
         #
         #
         # format
         # format
         #
         #
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=" %s " %
             label=" %s " %
@@ -1825,8 +1826,8 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
         gridSizer.Add(ll,
         gridSizer.Add(ll,
                       pos=(row, 0))
                       pos=(row, 0))
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Precision:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Precision:")),
                       flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.LEFT,
                       flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.LEFT,
                       border=20,
                       border=20,
                       pos=(row, 1))
                       pos=(row, 1))
@@ -2114,7 +2115,7 @@ class MapsetAccess(wx.Dialog):
         # active
         # active
         sizer = wx.BoxSizer(wx.VERTICAL)
         sizer = wx.BoxSizer(wx.VERTICAL)
 
 
-        label = wx.StaticText(
+        label = StaticText(
             parent=self, id=wx.ID_ANY, label=_(
             parent=self, id=wx.ID_ANY, label=_(
                 "Check a mapset to make it accessible, uncheck it to hide it.\n"
                 "Check a mapset to make it accessible, uncheck it to hide it.\n"
                 "  Notes:\n"
                 "  Notes:\n"
@@ -2145,11 +2146,11 @@ class MapsetAccess(wx.Dialog):
                   flag=wx.EXPAND | wx.ALIGN_CENTRE | wx.ALL, border=5)
                   flag=wx.EXPAND | wx.ALIGN_CENTRE | wx.ALL, border=5)
 
 
         btnsizer = wx.StdDialogButtonSizer()
         btnsizer = wx.StdDialogButtonSizer()
-        okbtn = wx.Button(self, wx.ID_OK)
+        okbtn = Button(self, wx.ID_OK)
         okbtn.SetDefault()
         okbtn.SetDefault()
         btnsizer.AddButton(okbtn)
         btnsizer.AddButton(okbtn)
 
 
-        cancelbtn = wx.Button(self, wx.ID_CANCEL)
+        cancelbtn = Button(self, wx.ID_CANCEL)
         btnsizer.AddButton(cancelbtn)
         btnsizer.AddButton(cancelbtn)
         btnsizer.Realize()
         btnsizer.Realize()
 
 

+ 4 - 1
gui/wxpython/gui_core/pyedit.py

@@ -13,7 +13,10 @@ for details.
 import sys
 import sys
 import os
 import os
 import stat
 import stat
-from StringIO import StringIO
+try:
+    from StringIO import StringIO
+except ImportError:
+    from io import StringIO
 import time
 import time
 
 
 import wx
 import wx

+ 8 - 6
gui/wxpython/gui_core/query.py

@@ -15,10 +15,12 @@ This program is free software under the GNU General Public License
 """
 """
 import os
 import os
 import wx
 import wx
+import six
 
 
 from core.utils import _
 from core.utils import _
 from core.gcmd import DecodeString
 from core.gcmd import DecodeString
 from gui_core.treeview import TreeListView
 from gui_core.treeview import TreeListView
+from gui_core.wrap import Button, StaticText, Menu
 from core.treemodel import TreeModel, DictNode
 from core.treemodel import TreeModel, DictNode
 
 
 from grass.pydispatch.signal import Signal
 from grass.pydispatch.signal import Signal
@@ -39,7 +41,7 @@ class QueryDialog(wx.Dialog):
         self.panel = wx.Panel(self, id=wx.ID_ANY)
         self.panel = wx.Panel(self, id=wx.ID_ANY)
         self.mainSizer = wx.BoxSizer(wx.VERTICAL)
         self.mainSizer = wx.BoxSizer(wx.VERTICAL)
 
 
-        helpText = wx.StaticText(self.panel, wx.ID_ANY, label=_(
+        helpText = StaticText(self.panel, wx.ID_ANY, label=_(
             "Right click to copy selected values to clipboard."))
             "Right click to copy selected values to clipboard."))
         helpText.SetForegroundColour(
         helpText.SetForegroundColour(
             wx.SystemSettings.GetColour(
             wx.SystemSettings.GetColour(
@@ -63,9 +65,9 @@ class QueryDialog(wx.Dialog):
             flag=wx.EXPAND | wx.ALL,
             flag=wx.EXPAND | wx.ALL,
             border=5)
             border=5)
 
 
-        close = wx.Button(self.panel, id=wx.ID_CLOSE)
+        close = Button(self.panel, id=wx.ID_CLOSE)
         close.Bind(wx.EVT_BUTTON, lambda event: self.Close())
         close.Bind(wx.EVT_BUTTON, lambda event: self.Close())
-        copy = wx.Button(
+        copy = Button(
             self.panel,
             self.panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_("Copy all to clipboard"))
             label=_("Copy all to clipboard"))
@@ -121,7 +123,7 @@ class QueryDialog(wx.Dialog):
         if not nodes:
         if not nodes:
             return
             return
 
 
-        menu = wx.Menu()
+        menu = Menu()
         texts = []
         texts = []
         if len(nodes) > 1:
         if len(nodes) > 1:
             values = []
             values = []
@@ -217,14 +219,14 @@ def QueryTreeBuilder(data, column):
     :return: tree model
     :return: tree model
     """
     """
     def addNode(parent, data, model):
     def addNode(parent, data, model):
-        for k, v in data.iteritems():
+        for k, v in six.iteritems(data):
             if isinstance(v, str):
             if isinstance(v, str):
                 k = DecodeString(k)
                 k = DecodeString(k)
             if isinstance(v, dict):
             if isinstance(v, dict):
                 node = model.AppendNode(parent=parent, label=k)
                 node = model.AppendNode(parent=parent, label=k)
                 addNode(parent=node, data=v, model=model)
                 addNode(parent=node, data=v, model=model)
             else:
             else:
-                if not isinstance(v, basestring):
+                if not isinstance(v, str):
                     v = str(v)
                     v = str(v)
                 elif isinstance(v, str):
                 elif isinstance(v, str):
                     v = DecodeString(v)
                     v = DecodeString(v)

+ 3 - 2
gui/wxpython/gui_core/simplelmgr.py

@@ -31,6 +31,7 @@ from gui_core.toolbars import BaseToolbar, BaseIcons
 from icons.icon import MetaIcon
 from icons.icon import MetaIcon
 from gui_core.forms import GUI
 from gui_core.forms import GUI
 from gui_core.dialogs import SetOpacityDialog
 from gui_core.dialogs import SetOpacityDialog
+from gui_core.wrap import CheckListBox, Menu
 from core.utils import GetLayerNameFromCmd
 from core.utils import GetLayerNameFromCmd
 from core.gcmd import GError
 from core.gcmd import GError
 from core.layerlist import LayerList
 from core.layerlist import LayerList
@@ -59,7 +60,7 @@ class SimpleLayerManager(wx.Panel):
 
 
         self._style = lmgrStyle
         self._style = lmgrStyle
         self._layerList = layerList
         self._layerList = layerList
-        self._checkList = wx.CheckListBox(self, style=wx.LB_EXTENDED)
+        self._checkList = CheckListBox(self, style=wx.LB_EXTENDED)
         if not toolbarCls:
         if not toolbarCls:
             toolbarCls = SimpleLmgrToolbar
             toolbarCls = SimpleLmgrToolbar
         self._toolbar = toolbarCls(self, lmgrStyle=self._style)
         self._toolbar = toolbarCls(self, lmgrStyle=self._style)
@@ -139,7 +140,7 @@ class SimpleLayerManager(wx.Panel):
             event.Skip()
             event.Skip()
             return
             return
 
 
-        menu = wx.Menu()
+        menu = Menu()
         llist = [layer.name for layer in self._layerList]
         llist = [layer.name for layer in self._layerList]
         texts = [','.join(llist), ','.join(reversed(llist))]
         texts = [','.join(llist), ','.join(reversed(llist))]
         labels = [_("Copy map names to clipboard (top to bottom)"),
         labels = [_("Copy map names to clipboard (top to bottom)"),

+ 3 - 3
gui/wxpython/gui_core/toolbars.py

@@ -27,7 +27,7 @@ from core.utils import _
 from icons.icon import MetaIcon
 from icons.icon import MetaIcon
 from collections import defaultdict
 from collections import defaultdict
 from core.globalvar import IMGDIR
 from core.globalvar import IMGDIR
-from gui_core.wrap import ToolBar, Menu
+from gui_core.wrap import ToolBar, Menu, BitmapButton
 
 
 from grass.pydispatch.signal import Signal
 from grass.pydispatch.signal import Signal
 
 
@@ -268,9 +268,9 @@ class BaseToolbar(ToolBar):
         else:
         else:
             bitmap = wx.ArtProvider.GetBitmap(
             bitmap = wx.ArtProvider.GetBitmap(
                 id=wx.ART_MISSING_IMAGE, client=wx.ART_TOOLBAR)
                 id=wx.ART_MISSING_IMAGE, client=wx.ART_TOOLBAR)
-        button = wx.BitmapButton(parent=self, id=wx.ID_ANY, size=(
+        button = BitmapButton(parent=self, id=wx.ID_ANY, size=(
             (-1, self.GetToolSize()[1])), bitmap=bitmap, style=wx.NO_BORDER)
             (-1, self.GetToolSize()[1])), bitmap=bitmap, style=wx.NO_BORDER)
-        button.SetToolTipString(tooltip)
+        button.SetToolTip(tooltip)
 
 
         return button
         return button
 
 

+ 2 - 1
gui/wxpython/gui_core/treeview.py

@@ -40,6 +40,7 @@ if __name__ == '__main__':
 
 
 from core.treemodel import TreeModel, DictNode
 from core.treemodel import TreeModel, DictNode
 from core.utils import _
 from core.utils import _
+from gui_core.wrap import CustomTreeCtrl
 
 
 from grass.pydispatch.signal import Signal
 from grass.pydispatch.signal import Signal
 
 
@@ -183,7 +184,7 @@ class TreeView(AbstractTreeViewMixin, wx.TreeCtrl):
         self.RefreshItems()
         self.RefreshItems()
 
 
 
 
-class CTreeView(AbstractTreeViewMixin, CT.CustomTreeCtrl):
+class CTreeView(AbstractTreeViewMixin, CustomTreeCtrl):
     """Tree view class inheriting from wx.TreeCtrl"""
     """Tree view class inheriting from wx.TreeCtrl"""
 
 
     def __init__(self, model, parent, **kw):
     def __init__(self, model, parent, **kw):

+ 2 - 1
gui/wxpython/gui_core/vselect.py

@@ -28,6 +28,7 @@ import wx.lib.mixins.listctrl as listmix
 from core.utils import _
 from core.utils import _
 from core.gcmd import GMessage, GError, GWarning
 from core.gcmd import GMessage, GError, GWarning
 from core.gcmd import RunCommand
 from core.gcmd import RunCommand
+from gui_core.wrap import Button
 
 
 import grass.script as grass
 import grass.script as grass
 from grass.pydispatch.signal import Signal
 from grass.pydispatch.signal import Signal
@@ -132,7 +133,7 @@ class VectorSelectBase():
         self._dialog = VectorSelectDialog(parent=self.parent)
         self._dialog = VectorSelectDialog(parent=self.parent)
         self._dialog.Bind(wx.EVT_CLOSE, self.OnCloseDialog)
         self._dialog.Bind(wx.EVT_CLOSE, self.OnCloseDialog)
         if createButton:
         if createButton:
-            createMap = wx.Button(
+            createMap = Button(
                 self._dialog, wx.ID_ANY, _("Create a new map"))
                 self._dialog, wx.ID_ANY, _("Create a new map"))
             createMap.Bind(wx.EVT_BUTTON, self.OnExportMap)
             createMap.Bind(wx.EVT_BUTTON, self.OnExportMap)
             self._dialog.AddWidget(createMap, proportion=0.1)
             self._dialog.AddWidget(createMap, proportion=0.1)

+ 11 - 9
gui/wxpython/gui_core/widgets.py

@@ -48,6 +48,7 @@ import os
 import sys
 import sys
 import string
 import string
 import re
 import re
+import six
 from bisect import bisect
 from bisect import bisect
 from datetime import datetime
 from datetime import datetime
 from core.globalvar import wxPythonPhoenix
 from core.globalvar import wxPythonPhoenix
@@ -89,7 +90,8 @@ from core import globalvar
 from core.utils import _
 from core.utils import _
 from core.gcmd import GMessage, GError
 from core.gcmd import GMessage, GError
 from core.debug import Debug
 from core.debug import Debug
-from gui_core.wrap import Button, SearchCtrl
+from gui_core.wrap import Button, SearchCtrl, StaticText, StaticBox, \
+    TextCtrl, Menu, Rect, EmptyBitmap
 
 
 
 
 class NotebookController:
 class NotebookController:
@@ -477,7 +479,7 @@ class SymbolButton(BitmapTextButton):
         :param label: displayed label
         :param label: displayed label
         """
         """
         size = (15, 15)
         size = (15, 15)
-        buffer = wx.EmptyBitmap(*size)
+        buffer = EmptyBitmap(*size)
         BitmapTextButton.__init__(self, parent=parent, label=" " + label,
         BitmapTextButton.__init__(self, parent=parent, label=" " + label,
                                   bitmap=buffer, **kwargs)
                                   bitmap=buffer, **kwargs)
 
 
@@ -964,7 +966,7 @@ class GListCtrl(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin,
             self.Bind(wx.EVT_MENU, self.OnSelectNone, id=self.popupDataID2)
             self.Bind(wx.EVT_MENU, self.OnSelectNone, id=self.popupDataID2)
 
 
         # generate popup-menu
         # generate popup-menu
-        menu = wx.Menu()
+        menu = Menu()
         menu.Append(self.popupDataID1, _("Select all"))
         menu.Append(self.popupDataID1, _("Select all"))
         menu.Append(self.popupDataID2, _("Deselect all"))
         menu.Append(self.popupDataID2, _("Deselect all"))
 
 
@@ -1072,7 +1074,7 @@ class SearchModuleWidget(wx.Panel):
 # label = " %s " % _("Find module - (press Enter for next match)"))
 # label = " %s " % _("Find module - (press Enter for next match)"))
 
 
         if sys.platform == 'win32':
         if sys.platform == 'win32':
-            self._search = wx.TextCtrl(
+            self._search = TextCtrl(
                 parent=self, id=wx.ID_ANY, size=(-1, 25),
                 parent=self, id=wx.ID_ANY, size=(-1, 25),
                 style=wx.TE_PROCESS_ENTER)
                 style=wx.TE_PROCESS_ENTER)
         else:
         else:
@@ -1226,8 +1228,8 @@ class ManageSettingsWidget(wx.Panel):
 
 
         wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)
         wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)
 
 
-        self.settingsBox = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                                        label=" %s " % _("Profiles"))
+        self.settingsBox = StaticBox(parent=self, id=wx.ID_ANY,
+                                     label=" %s " % _("Profiles"))
 
 
         self.settingsChoice = wx.Choice(parent=self, id=wx.ID_ANY)
         self.settingsChoice = wx.Choice(parent=self, id=wx.ID_ANY)
         self.settingsChoice.Bind(wx.EVT_CHOICE, self.OnSettingsChanged)
         self.settingsChoice.Bind(wx.EVT_CHOICE, self.OnSettingsChanged)
@@ -1257,7 +1259,7 @@ class ManageSettingsWidget(wx.Panel):
 
 
         self.settingsSizer = wx.StaticBoxSizer(self.settingsBox, wx.HORIZONTAL)
         self.settingsSizer = wx.StaticBoxSizer(self.settingsBox, wx.HORIZONTAL)
         self.settingsSizer.Add(
         self.settingsSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 parent=self,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Load:")),
                 label=_("Load:")),
@@ -1376,7 +1378,7 @@ class ManageSettingsWidget(wx.Panel):
         try:
         try:
             fd = open(self.settingsFile, 'w')
             fd = open(self.settingsFile, 'w')
             fd.write('format_version=2.0\n')
             fd.write('format_version=2.0\n')
-            for key, values in self._settings.iteritems():
+            for key, values in six.iteritems(self._settings):
                 first = True
                 first = True
                 for v in values:
                 for v in values:
                     # escaping characters
                     # escaping characters
@@ -1542,7 +1544,7 @@ class PictureComboBox(OwnerDrawnComboBox):
             # painting the control, but there is no valid item selected yet
             # painting the control, but there is no valid item selected yet
             return
             return
 
 
-        r = wx.Rect(*rect)  # make a copy
+        r = Rect(*rect)  # make a copy
         r.Deflate(3, 5)
         r.Deflate(3, 5)
 
 
         # for painting the items in the popup
         # for painting the items in the popup

+ 69 - 0
gui/wxpython/gui_core/wrap.py

@@ -17,6 +17,10 @@ This program is free software under the GNU General Public License
 
 
 import wx
 import wx
 import wx.lib.buttons as buttons
 import wx.lib.buttons as buttons
+try:
+    import wx.lib.agw.customtreectrl as CT
+except ImportError:
+    import wx.lib.customtreectrl as CT
 
 
 from core.globalvar import gtk3, wxPythonPhoenix
 from core.globalvar import gtk3, wxPythonPhoenix
 if wxPythonPhoenix:
 if wxPythonPhoenix:
@@ -99,6 +103,32 @@ class Button(wx.Button):
             wx.Button.SetToolTipString(self, tip)
             wx.Button.SetToolTipString(self, tip)
 
 
 
 
+class RadioButton(wx.RadioButton):
+    """Wrapper around wx.RadioButton to have more control
+    over the widget on different platforms/wxpython versions"""
+    def __init__(self, *args, **kwargs):
+        wx.RadioButton.__init__(self, *args, **kwargs)
+
+    def SetToolTip(self, tip):
+        if wxPythonPhoenix:
+            wx.RadioButton.SetToolTip(self, tipString=tip)
+        else:
+            wx.RadioButton.SetToolTipString(self, tip)
+
+
+class BitmapButton(wx.BitmapButton):
+    """Wrapper around wx.BitmapButton to have more control
+    over the widget on different platforms/wxpython versions"""
+    def __init__(self, *args, **kwargs):
+        wx.BitmapButton.__init__(self, *args, **kwargs)
+
+    def SetToolTip(self, tip):
+        if wxPythonPhoenix:
+            wx.BitmapButton.SetToolTip(self, tipString=tip)
+        else:
+            wx.BitmapButton.SetToolTipString(self, tip)
+
+
 class GenBitmapButton(buttons.GenBitmapButton):
 class GenBitmapButton(buttons.GenBitmapButton):
     """Wrapper around GenBitmapButton to have more control
     """Wrapper around GenBitmapButton to have more control
     over the widget on different platforms/wxpython versions"""
     over the widget on different platforms/wxpython versions"""
@@ -151,6 +181,19 @@ class StaticBox(wx.StaticBox):
             wx.StaticBox.SetToolTipString(self, tip)
             wx.StaticBox.SetToolTipString(self, tip)
 
 
 
 
+class CheckListBox(wx.CheckListBox):
+    """Wrapper around wx.CheckListBox to have more control
+    over the widget on different platforms/wxpython versions"""
+    def __init__(self, *args, **kwargs):
+        wx.CheckListBox.__init__(self, *args, **kwargs)
+
+    def SetToolTip(self, tip):
+        if wxPythonPhoenix:
+            wx.CheckListBox.SetToolTip(self, tipString=tip)
+        else:
+            wx.CheckListBox.SetToolTipString(self, tip)
+
+
 class TextCtrl(wx.TextCtrl):
 class TextCtrl(wx.TextCtrl):
     """Wrapper around wx.TextCtrl to have more control
     """Wrapper around wx.TextCtrl to have more control
     over the widget on different platforms/wxpython versions"""
     over the widget on different platforms/wxpython versions"""
@@ -215,6 +258,19 @@ class TreeCtrl(wx.TreeCtrl):
             return wx.TreeCtrl.GetPyData(self, item)
             return wx.TreeCtrl.GetPyData(self, item)
 
 
 
 
+class CustomTreeCtrl(CT.CustomTreeCtrl):
+    """Wrapper around wx.lib.agw.customtreectrl to have more control
+    over the widget on different platforms/wxpython versions"""
+    def __init__(self, *args, **kwargs):
+        CT.CustomTreeCtrl.__init__(self, *args, **kwargs)
+
+    def SetToolTip(self, tip):
+        if wxPythonPhoenix:
+            CT.CustomTreeCtrl.SetToolTip(self, tipString=tip)
+        else:
+            CT.CustomTreeCtrl.SetToolTipString(self, tip)
+
+
 class ToolBar(wx.ToolBar):
 class ToolBar(wx.ToolBar):
     """Wrapper around wx.ToolBar to have more control
     """Wrapper around wx.ToolBar to have more control
     over the widget on different platforms/wxpython versions"""
     over the widget on different platforms/wxpython versions"""
@@ -319,3 +375,16 @@ class CheckBox(wx.CheckBox):
             wx.CheckBox.SetToolTip(self, tipString=tip)
             wx.CheckBox.SetToolTip(self, tipString=tip)
         else:
         else:
             wx.CheckBox.SetToolTipString(self, tip)
             wx.CheckBox.SetToolTipString(self, tip)
+
+
+class Choice(wx.Choice):
+    """Wrapper around wx.Choice to have more control
+    over the widget on different platforms/wxpython versions"""
+    def __init__(self, *args, **kwargs):
+        wx.Choice.__init__(self, *args, **kwargs)
+
+    def SetToolTip(self, tip):
+        if wxPythonPhoenix:
+            wx.Choice.SetToolTip(self, tipString=tip)
+        else:
+            wx.Choice.SetToolTipString(self, tip)

+ 7 - 5
gui/wxpython/gui_core/wxlibplot.py

@@ -120,6 +120,8 @@ import wx
 # Needs NumPy
 # Needs NumPy
 import numpy as np
 import numpy as np
 
 
+from gui_core.wrap import Menu, EmptyBitmap
+
 from core.globalvar import CheckWxVersion
 from core.globalvar import CheckWxVersion
 if CheckWxVersion([3, 0, 0]):
 if CheckWxVersion([3, 0, 0]):
     from wx import PENSTYLE_SOLID
     from wx import PENSTYLE_SOLID
@@ -1538,7 +1540,7 @@ class PlotCanvas(wx.Panel):
         # Make new offscreen bitmap: this bitmap will always have the
         # Make new offscreen bitmap: this bitmap will always have the
         # current drawing in it, so it can be used to save the image to
         # current drawing in it, so it can be used to save the image to
         # a file, or whatever.
         # a file, or whatever.
-        self._Buffer = wx.EmptyBitmap(Size.width, Size.height)
+        self._Buffer = EmptyBitmap(Size.width, Size.height)
         self._setSize()
         self._setSize()
 
 
         if not self._isWindowCreated:
         if not self._isWindowCreated:
@@ -1606,7 +1608,7 @@ class PlotCanvas(wx.Panel):
         width = self._Buffer.GetWidth()
         width = self._Buffer.GetWidth()
         height = self._Buffer.GetHeight()
         height = self._Buffer.GetHeight()
         if sys.platform != "darwin":
         if sys.platform != "darwin":
-            tmp_Buffer = wx.EmptyBitmap(width, height)
+            tmp_Buffer = EmptyBitmap(width, height)
             dcs = wx.MemoryDC()
             dcs = wx.MemoryDC()
             dcs.SelectObject(tmp_Buffer)
             dcs.SelectObject(tmp_Buffer)
             dcs.Clear()
             dcs.Clear()
@@ -2234,7 +2236,7 @@ class TestFrame(wx.Frame):
         # Now Create the menu bar and items
         # Now Create the menu bar and items
         self.mainmenu = wx.MenuBar()
         self.mainmenu = wx.MenuBar()
 
 
-        menu = wx.Menu()
+        menu = Menu()
         menu.Append(200, 'Page Setup...', 'Setup the printer page')
         menu.Append(200, 'Page Setup...', 'Setup the printer page')
         self.Bind(wx.EVT_MENU, self.OnFilePageSetup, id=200)
         self.Bind(wx.EVT_MENU, self.OnFilePageSetup, id=200)
 
 
@@ -2251,7 +2253,7 @@ class TestFrame(wx.Frame):
         self.Bind(wx.EVT_MENU, self.OnFileExit, id=205)
         self.Bind(wx.EVT_MENU, self.OnFileExit, id=205)
         self.mainmenu.Append(menu, '&File')
         self.mainmenu.Append(menu, '&File')
 
 
-        menu = wx.Menu()
+        menu = Menu()
         menu.Append(206, 'Draw1', 'Draw plots1')
         menu.Append(206, 'Draw1', 'Draw plots1')
         self.Bind(wx.EVT_MENU, self.OnPlotDraw1, id=206)
         self.Bind(wx.EVT_MENU, self.OnPlotDraw1, id=206)
         menu.Append(207, 'Draw2', 'Draw plots2')
         menu.Append(207, 'Draw2', 'Draw plots2')
@@ -2324,7 +2326,7 @@ class TestFrame(wx.Frame):
 
 
         self.mainmenu.Append(menu, '&Plot')
         self.mainmenu.Append(menu, '&Plot')
 
 
-        menu = wx.Menu()
+        menu = Menu()
         menu.Append(300, '&About', 'About this thing...')
         menu.Append(300, '&About', 'About this thing...')
         self.Bind(wx.EVT_MENU, self.OnHelpAbout, id=300)
         self.Bind(wx.EVT_MENU, self.OnHelpAbout, id=300)
         self.mainmenu.Append(menu, '&Help')
         self.mainmenu.Append(menu, '&Help')

+ 27 - 25
gui/wxpython/iclass/dialogs.py

@@ -33,6 +33,8 @@ from gui_core.dialogs import SimpleDialog, GroupDialog
 from gui_core import gselect
 from gui_core import gselect
 from gui_core.widgets import SimpleValidator
 from gui_core.widgets import SimpleValidator
 from iclass.statistics import Statistics, BandStatistics
 from iclass.statistics import Statistics, BandStatistics
+from gui_core.wrap import CheckBox, Button, StaticText, \
+    StaticBox, TextCtrl, Menu
 
 
 import grass.script as grass
 import grass.script as grass
 
 
@@ -74,7 +76,7 @@ class IClassGroupDialog(SimpleDialog):
         if subgroup:
         if subgroup:
             self.subGroupSelect.SetValue(subgroup)
             self.subGroupSelect.SetValue(subgroup)
 
 
-        self.editGroup = wx.Button(parent=self.panel, id=wx.ID_ANY,
+        self.editGroup = Button(parent=self.panel, id=wx.ID_ANY,
                                    label=_("Create/edit group..."))
                                    label=_("Create/edit group..."))
 
 
         self.editGroup.Bind(wx.EVT_BUTTON, self.OnEditGroup)
         self.editGroup.Bind(wx.EVT_BUTTON, self.OnEditGroup)
@@ -88,8 +90,8 @@ class IClassGroupDialog(SimpleDialog):
 
 
     def _layout(self):
     def _layout(self):
         """Do layout"""
         """Do layout"""
-        self.dataSizer.Add(wx.StaticText(self.panel, id=wx.ID_ANY,
-                                         label=_("Name of imagery group:")),
+        self.dataSizer.Add(StaticText(self.panel, id=wx.ID_ANY,
+                                      label=_("Name of imagery group:")),
                            proportion=0,
                            proportion=0,
                            flag=wx.EXPAND | wx.BOTTOM | wx.LEFT | wx.RIGHT,
                            flag=wx.EXPAND | wx.BOTTOM | wx.LEFT | wx.RIGHT,
                            border=5)
                            border=5)
@@ -101,7 +103,7 @@ class IClassGroupDialog(SimpleDialog):
         # flag = wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, border = 5)
         # flag = wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, border = 5)
 
 
         self.dataSizer.Add(
         self.dataSizer.Add(
-            wx.StaticText(
+            StaticText(
                 self.panel,
                 self.panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Name of imagery subgroup:")),
                 label=_("Name of imagery subgroup:")),
@@ -257,8 +259,8 @@ class IClassMapDialog(SimpleDialog):
             label = _("Name of raster map:")
             label = _("Name of raster map:")
         elif self.elementType == 'vector':
         elif self.elementType == 'vector':
             label = _("Name of vector map:")
             label = _("Name of vector map:")
-        self.dataSizer.Add(wx.StaticText(self.panel, id=wx.ID_ANY,
-                                         label=label),
+        self.dataSizer.Add(StaticText(self.panel, id=wx.ID_ANY,
+                                      label=label),
                            proportion=0, flag=wx.EXPAND | wx.ALL, border=5)
                            proportion=0, flag=wx.EXPAND | wx.ALL, border=5)
         self.dataSizer.Add(self.element, proportion=0,
         self.dataSizer.Add(self.element, proportion=0,
                            flag=wx.EXPAND | wx.ALL, border=5)
                            flag=wx.EXPAND | wx.ALL, border=5)
@@ -291,14 +293,14 @@ class IClassCategoryManagerDialog(wx.Dialog):
         panel = wx.Panel(parent=self, id=wx.ID_ANY)
         panel = wx.Panel(parent=self, id=wx.ID_ANY)
 
 
         mainSizer = wx.BoxSizer(wx.VERTICAL)
         mainSizer = wx.BoxSizer(wx.VERTICAL)
-        box = wx.StaticBox(panel, id=wx.ID_ANY,
-                           label=" %s " % _("Classes"))
+        box = StaticBox(panel, id=wx.ID_ANY,
+                        label=" %s " % _("Classes"))
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(hgap=5, vgap=5)
         gridSizer = wx.GridBagSizer(hgap=5, vgap=5)
         self.catList = CategoryListCtrl(panel, mapwindow=parent,
         self.catList = CategoryListCtrl(panel, mapwindow=parent,
                                         stats_data=parent.stats_data)
                                         stats_data=parent.stats_data)
-        addButton = wx.Button(panel, id=wx.ID_ADD)
-        deleteButton = wx.Button(panel, id=wx.ID_DELETE)
+        addButton = Button(panel, id=wx.ID_ADD)
+        deleteButton = Button(panel, id=wx.ID_DELETE)
 
 
         gridSizer.Add(
         gridSizer.Add(
             self.catList, pos=(
             self.catList, pos=(
@@ -321,7 +323,7 @@ class IClassCategoryManagerDialog(wx.Dialog):
             border=5)
             border=5)
 
 
         btnSizer = wx.BoxSizer(wx.HORIZONTAL)
         btnSizer = wx.BoxSizer(wx.HORIZONTAL)
-        closeButton = wx.Button(panel, id=wx.ID_CLOSE)
+        closeButton = Button(panel, id=wx.ID_CLOSE)
         btnSizer.Add(wx.Size(-1, -1), proportion=1, flag=wx.EXPAND)
         btnSizer.Add(wx.Size(-1, -1), proportion=1, flag=wx.EXPAND)
         btnSizer.Add(closeButton, proportion=0, flag=wx.ALIGN_RIGHT)
         btnSizer.Add(closeButton, proportion=0, flag=wx.ALIGN_RIGHT)
         mainSizer.Add(
         mainSizer.Add(
@@ -539,7 +541,7 @@ class CategoryListCtrl(wx.ListCtrl,
                 id=self.popupZoomtoAreas)
                 id=self.popupZoomtoAreas)
 
 
         # generate popup-menu
         # generate popup-menu
-        menu = wx.Menu()
+        menu = Menu()
         menu.Append(
         menu.Append(
             self.popupZoomtoAreas,
             self.popupZoomtoAreas,
             _("Zoom to training areas of selected class"))
             _("Zoom to training areas of selected class"))
@@ -631,8 +633,8 @@ class IClassSignatureFileDialog(wx.Dialog):
                                          'sig')
                                          'sig')
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
 
 
-        self.btnCancel = wx.Button(parent=self.panel, id=wx.ID_CANCEL)
-        self.btnOK = wx.Button(parent=self.panel, id=wx.ID_OK)
+        self.btnCancel = Button(parent=self.panel, id=wx.ID_CANCEL)
+        self.btnOK = Button(parent=self.panel, id=wx.ID_OK)
         self.btnOK.SetDefault()
         self.btnOK.SetDefault()
         self.btnOK.Enable(False)
         self.btnOK.Enable(False)
 
 
@@ -662,28 +664,28 @@ class IClassSignatureFileDialog(wx.Dialog):
         dataSizer = wx.BoxSizer(wx.VERTICAL)
         dataSizer = wx.BoxSizer(wx.VERTICAL)
 
 
         dataSizer.Add(
         dataSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self.panel,
                 parent=self.panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Enter name of signature file:")),
                 label=_("Enter name of signature file:")),
             proportion=0,
             proportion=0,
             flag=wx.ALL,
             flag=wx.ALL,
             border=3)
             border=3)
-        self.fileNameCtrl = wx.TextCtrl(
+        self.fileNameCtrl = TextCtrl(
             parent=self.panel, id=wx.ID_ANY, size=(400, -1))
             parent=self.panel, id=wx.ID_ANY, size=(400, -1))
         if self.fileName:
         if self.fileName:
             self.fileNameCtrl.SetValue(self.fileName)
             self.fileNameCtrl.SetValue(self.fileName)
         dataSizer.Add(self.fileNameCtrl,
         dataSizer.Add(self.fileNameCtrl,
                       proportion=0, flag=wx.ALL | wx.EXPAND, border=3)
                       proportion=0, flag=wx.ALL | wx.EXPAND, border=3)
 
 
-        dataSizer.Add(wx.StaticText(parent=self.panel, id=wx.ID_ANY,
-                                    label=_("Signature file path:")),
+        dataSizer.Add(StaticText(parent=self.panel, id=wx.ID_ANY,
+                                 label=_("Signature file path:")),
                       proportion=0, flag=wx.ALL, border=3)
                       proportion=0, flag=wx.ALL, border=3)
 
 
         self.pathPanel = scrolled.ScrolledPanel(self.panel, size=(-1, 40))
         self.pathPanel = scrolled.ScrolledPanel(self.panel, size=(-1, 40))
         pathSizer = wx.BoxSizer()
         pathSizer = wx.BoxSizer()
-        self.filePathText = wx.StaticText(parent=self.pathPanel, id=wx.ID_ANY,
-                                          label=self.baseFilePath)
+        self.filePathText = StaticText(parent=self.pathPanel, id=wx.ID_ANY,
+                                       label=self.baseFilePath)
         pathSizer.Add(
         pathSizer.Add(
             self.filePathText,
             self.filePathText,
             proportion=1,
             proportion=1,
@@ -741,8 +743,8 @@ class IClassExportAreasDialog(wx.Dialog):
         self.vectorName = vectorName
         self.vectorName = vectorName
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
 
 
-        self.btnCancel = wx.Button(parent=self.panel, id=wx.ID_CANCEL)
-        self.btnOK = wx.Button(parent=self.panel, id=wx.ID_OK)
+        self.btnCancel = Button(parent=self.panel, id=wx.ID_CANCEL)
+        self.btnOK = Button(parent=self.panel, id=wx.ID_OK)
         self.btnOK.SetDefault()
         self.btnOK.SetDefault()
         self.btnOK.Enable(False)
         self.btnOK.Enable(False)
         self.btnOK.Bind(wx.EVT_BUTTON, self.OnOK)
         self.btnOK.Bind(wx.EVT_BUTTON, self.OnOK)
@@ -771,7 +773,7 @@ class IClassExportAreasDialog(wx.Dialog):
         dataSizer = wx.BoxSizer(wx.VERTICAL)
         dataSizer = wx.BoxSizer(wx.VERTICAL)
 
 
         dataSizer.Add(
         dataSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self.panel,
                 parent=self.panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Enter name of new vector map:")),
                 label=_("Enter name of new vector map:")),
@@ -786,10 +788,10 @@ class IClassExportAreasDialog(wx.Dialog):
             self.vectorNameCtrl.SetValue(self.vectorName)
             self.vectorNameCtrl.SetValue(self.vectorName)
         dataSizer.Add(self.vectorNameCtrl,
         dataSizer.Add(self.vectorNameCtrl,
                       proportion=0, flag=wx.ALL | wx.EXPAND, border=3)
                       proportion=0, flag=wx.ALL | wx.EXPAND, border=3)
-        self.withTableCtrl = wx.CheckBox(parent=self.panel, id=wx.ID_ANY,
+        self.withTableCtrl = CheckBox(parent=self.panel, id=wx.ID_ANY,
                                          label=_("Export attribute table"))
                                          label=_("Export attribute table"))
         self.withTableCtrl.SetValue(True)
         self.withTableCtrl.SetValue(True)
-        self.withTableCtrl.SetToolTipString(
+        self.withTableCtrl.SetToolTip(
             _("Export attribute table containing" " computed statistical data"))
             _("Export attribute table containing" " computed statistical data"))
 
 
         dataSizer.Add(self.withTableCtrl,
         dataSizer.Add(self.withTableCtrl,

+ 5 - 3
gui/wxpython/iclass/frame.py

@@ -19,6 +19,7 @@ for details.
 
 
 import os
 import os
 import sys
 import sys
+import six
 import copy
 import copy
 import tempfile
 import tempfile
 import types
 import types
@@ -47,6 +48,7 @@ from gui_core.mapdisp import DoubleMapFrame
 from core.render import Map, MapLayer
 from core.render import Map, MapLayer
 from core.gcmd import RunCommand, GMessage, GError, GWarning
 from core.gcmd import RunCommand, GMessage, GError, GWarning
 from gui_core.dialogs import SetOpacityDialog
 from gui_core.dialogs import SetOpacityDialog
+from gui_core.wrap import Menu
 from mapwin.base import MapWindowProperties
 from mapwin.base import MapWindowProperties
 from dbmgr.vinfo import VectorDBInfo
 from dbmgr.vinfo import VectorDBInfo
 import grass.script as grass
 import grass.script as grass
@@ -223,7 +225,7 @@ class IClassMapFrame(DoubleMapFrame):
         self.GetFirstWindow().GetDigit().CloseMap()
         self.GetFirstWindow().GetDigit().CloseMap()
         self.plotPanel.CloseWindow()
         self.plotPanel.CloseWindow()
         self._cleanup()
         self._cleanup()
-
+        self._mgr.UnInit()
         self.Destroy()
         self.Destroy()
 
 
     def _cleanup(self):
     def _cleanup(self):
@@ -477,7 +479,7 @@ class IClassMapFrame(DoubleMapFrame):
 
 
     def OnZoomMenu(self, event):
     def OnZoomMenu(self, event):
         """Popup Zoom menu """
         """Popup Zoom menu """
-        zoommenu = wx.Menu()
+        zoommenu = Menu()
         # Add items to the menu
         # Add items to the menu
 
 
         i = 0
         i = 0
@@ -1462,7 +1464,7 @@ class MapManager:
 
 
     def GetAlias(self, name):
     def GetAlias(self, name):
         """Returns alias for layer"""
         """Returns alias for layer"""
-        name = [k for k, v in self.layerName.iteritems() if v == name]
+        name = [k for k, v in six.iteritems(self.layerName) if v == name]
         if name:
         if name:
             return name[0]
             return name[0]
         return None
         return None

+ 2 - 1
gui/wxpython/iclass/statistics.py

@@ -18,6 +18,7 @@ for details.
 """
 """
 
 
 import os
 import os
+import six
 from ctypes import *
 from ctypes import *
 
 
 import grass.script as grass
 import grass.script as grass
@@ -176,7 +177,7 @@ class Statistics:
 
 
     def SetStatistics(self, stats):
     def SetStatistics(self, stats):
 
 
-        for st, val in stats.iteritems():
+        for st, val in six.iteritems(stats):
             setattr(self, st, val)
             setattr(self, st, val)
 
 
         self.statisticsSet.emit(stats=stats)
         self.statisticsSet.emit(stats=stats)

+ 2 - 1
gui/wxpython/iclass/toolbars.py

@@ -27,6 +27,7 @@ from gui_core.toolbars import BaseToolbar, BaseIcons
 from icons.icon import MetaIcon
 from icons.icon import MetaIcon
 from iclass.dialogs import IClassMapDialog, ContrastColor
 from iclass.dialogs import IClassMapDialog, ContrastColor
 from gui_core.forms import GUI
 from gui_core.forms import GUI
+from gui_core.wrap import StaticText
 
 
 import grass.script as grass
 import grass.script as grass
 
 
@@ -154,7 +155,7 @@ class IClassToolbar(BaseToolbar):
         self.choice.Bind(wx.EVT_CHOICE, self.OnSelectCategory)
         self.choice.Bind(wx.EVT_CHOICE, self.OnSelectCategory)
 
 
         # stupid workaround to insert small space between controls
         # stupid workaround to insert small space between controls
-        self.InsertControl(4, wx.StaticText(self, id=wx.ID_ANY, label=' '))
+        self.InsertControl(4, StaticText(self, id=wx.ID_ANY, label=' '))
 
 
         self.combo = wx.ComboBox(self, id=wx.ID_ANY, size=(130, -1),
         self.combo = wx.ComboBox(self, id=wx.ID_ANY, size=(130, -1),
                                  style=wx.TE_PROCESS_ENTER)
                                  style=wx.TE_PROCESS_ENTER)

+ 6 - 4
gui/wxpython/icons/icon.py

@@ -18,6 +18,7 @@ This program is free software under the GNU General Public License
 import os
 import os
 import sys
 import sys
 import copy
 import copy
+import six
 
 
 import wx
 import wx
 
 
@@ -25,9 +26,10 @@ from core.settings import UserSettings
 from core.utils import _
 from core.utils import _
 
 
 # default icon set
 # default icon set
-import grass_icons
-iconSetDefault = grass_icons.iconSet
-iconPathDefault = grass_icons.iconPath
+from .grass_icons import iconSet as g_iconSet
+from .grass_icons import iconPath as g_iconPath
+iconSetDefault = g_iconSet
+iconPathDefault = g_iconPath
 
 
 iconTheme = UserSettings.Get(
 iconTheme = UserSettings.Get(
     group='appearance',
     group='appearance',
@@ -46,7 +48,7 @@ try:
     if iconPath and not os.path.exists(iconPath):
     if iconPath and not os.path.exists(iconPath):
         raise OSError
         raise OSError
 
 
-    for key, img in iconSet.iteritems():
+    for key, img in six.iteritems(iconSet):
         if key not in iconSet or \
         if key not in iconSet or \
                 iconSet[key] is None:  # add key
                 iconSet[key] is None:  # add key
             iconSet[key] = img
             iconSet[key] = img

+ 8 - 8
gui/wxpython/image2target/ii2t_gis_set.py

@@ -40,8 +40,8 @@ from core.utils import GetListOfLocations, GetListOfMapsets
 from location_wizard.dialogs import RegionDef
 from location_wizard.dialogs import RegionDef
 from gui_core.dialogs import TextEntryDialog
 from gui_core.dialogs import TextEntryDialog
 from gui_core.widgets import GenericValidator, StaticWrapText
 from gui_core.widgets import GenericValidator, StaticWrapText
-from gui_core.wrap import Button
-from gui_core.wrap import ListCtrl
+from gui_core.wrap import Button, ListCtrl, StaticText, \
+    StaticBox, TextCtrl
 
 
 sys.stderr = codecs.getwriter('utf8')(sys.stderr)
 sys.stderr = codecs.getwriter('utf8')(sys.stderr)
 
 
@@ -117,17 +117,17 @@ class GRASSStartup(wx.Frame):
             grassVersion = versionLine
             grassVersion = versionLine
             grassRevisionStr = ''
             grassRevisionStr = ''
 
 
-        self.gisdbase_box = wx.StaticBox(
+        self.gisdbase_box = StaticBox(
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             _("1. Select GRASS GIS database directory"))
             _("1. Select GRASS GIS database directory"))
-        self.location_box = wx.StaticBox(
+        self.location_box = StaticBox(
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             _("2. Select GRASS Location"))
             _("2. Select GRASS Location"))
-        self.mapset_box = wx.StaticBox(
+        self.mapset_box = StaticBox(
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             _("3. Select GRASS Mapset"))
             _("3. Select GRASS Mapset"))
 
 
-        self.lmessage = wx.StaticText(parent=self.panel)
+        self.lmessage = StaticText(parent=self.panel)
         # It is not clear if all wx versions supports color, so try-except.
         # It is not clear if all wx versions supports color, so try-except.
         # The color itself may not be correct for all platforms/system settings
         # The color itself may not be correct for all platforms/system settings
         # but in http://xoomer.virgilio.it/infinity77/wxPython/Widgets/wx.SystemSettings.html
         # but in http://xoomer.virgilio.it/infinity77/wxPython/Widgets/wx.SystemSettings.html
@@ -141,7 +141,7 @@ class GRASSStartup(wx.Frame):
         self.location_panel = wx.Panel(parent=self.panel)
         self.location_panel = wx.Panel(parent=self.panel)
         self.mapset_panel = wx.Panel(parent=self.panel)
         self.mapset_panel = wx.Panel(parent=self.panel)
 
 
-        self.ldbase = wx.StaticText(
+        self.ldbase = StaticText(
             parent=self.gisdbase_panel, id=wx.ID_ANY,
             parent=self.gisdbase_panel, id=wx.ID_ANY,
             label=_("GRASS GIS database directory contains Locations."))
             label=_("GRASS GIS database directory contains Locations."))
 
 
@@ -207,7 +207,7 @@ class GRASSStartup(wx.Frame):
         self.delete_mapset_button.SetToolTip(_("Delete selected mapset"))
         self.delete_mapset_button.SetToolTip(_("Delete selected mapset"))
 
 
         # textinputs
         # textinputs
-        self.tgisdbase = wx.TextCtrl(
+        self.tgisdbase = TextCtrl(
             parent=self.gisdbase_panel, id=wx.ID_ANY, value="", size=(
             parent=self.gisdbase_panel, id=wx.ID_ANY, value="", size=(
                 300, -1), style=wx.TE_PROCESS_ENTER)
                 300, -1), style=wx.TE_PROCESS_ENTER)
 
 

+ 57 - 55
gui/wxpython/image2target/ii2t_manager.py

@@ -35,6 +35,7 @@ from __future__ import print_function
 
 
 import os
 import os
 import sys
 import sys
+import six
 import shutil
 import shutil
 import time
 import time
 from copy import copy
 from copy import copy
@@ -61,7 +62,8 @@ from core.gcmd import RunCommand, GMessage, GError, GWarning, EncodeString
 from core.settings import UserSettings
 from core.settings import UserSettings
 from gcp.mapdisplay import MapFrame
 from gcp.mapdisplay import MapFrame
 from core.giface import Notification
 from core.giface import Notification
-from gui_core.wrap import SpinCtrl
+from gui_core.wrap import SpinCtrl, Button, StaticText, StaticBox, \
+    CheckListBox, TextCtrl, Menu
 
 
 from location_wizard.wizard import TitledPage as TitledPage
 from location_wizard.wizard import TitledPage as TitledPage
 
 
@@ -400,7 +402,7 @@ class LocationPage(TitledPage):
 
 
         # location
         # location
         self.sizer.Add(
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 parent=self,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Select source location:')),
                 label=_('Select source location:')),
@@ -421,7 +423,7 @@ class LocationPage(TitledPage):
 
 
         # mapset
         # mapset
         self.sizer.Add(
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 parent=self,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Select source mapset:')),
                 label=_('Select source mapset:')),
@@ -534,7 +536,7 @@ class GroupPage(TitledPage):
         #
         #
         # group
         # group
         self.sizer.Add(
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 parent=self,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Select group:')),
                 label=_('Select group:')),
@@ -551,7 +553,7 @@ class GroupPage(TitledPage):
 
 
         # create group
         # create group
         self.sizer.Add(
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 parent=self,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Create group if none exists')),
                 label=_('Create group if none exists')),
@@ -561,11 +563,11 @@ class GroupPage(TitledPage):
                 2,
                 2,
                 1))
                 1))
         btnSizer = wx.BoxSizer(wx.HORIZONTAL)
         btnSizer = wx.BoxSizer(wx.HORIZONTAL)
-        self.btn_mkgroup = wx.Button(
+        self.btn_mkgroup = Button(
             parent=self,
             parent=self,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_("Create/edit group..."))
             label=_("Create/edit group..."))
-        self.btn_vgroup = wx.Button(
+        self.btn_vgroup = Button(
             parent=self,
             parent=self,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_("Add vector map to group..."))
             label=_("Add vector map to group..."))
@@ -585,7 +587,7 @@ class GroupPage(TitledPage):
 
 
         # extension
         # extension
         self.sizer.Add(
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 parent=self,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Extension for output maps:')),
                 label=_('Extension for output maps:')),
@@ -594,7 +596,7 @@ class GroupPage(TitledPage):
             pos=(
             pos=(
                 3,
                 3,
                 1))
                 1))
-        self.ext_txt = wx.TextCtrl(
+        self.ext_txt = TextCtrl(
             parent=self, id=wx.ID_ANY, value="", size=(
             parent=self, id=wx.ID_ANY, value="", size=(
                 350, -1))
                 350, -1))
         self.ext_txt.SetValue(self.extension)
         self.ext_txt.SetValue(self.extension)
@@ -737,7 +739,7 @@ class DispMapPage(TitledPage):
         # layout
         # layout
         #
         #
         self.sizer.Add(
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 parent=self,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Select source map to display:')),
                 label=_('Select source map to display:')),
@@ -763,7 +765,7 @@ class DispMapPage(TitledPage):
                 2))
                 2))
 
 
         self.sizer.Add(
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 parent=self,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Select target raster map to display:')),
                 label=_('Select target raster map to display:')),
@@ -786,7 +788,7 @@ class DispMapPage(TitledPage):
                 2))
                 2))
 
 
         self.sizer.Add(
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 parent=self,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Select target vector map to display:')),
                 label=_('Select target vector map to display:')),
@@ -1293,7 +1295,7 @@ class GCP(MapFrame, ColumnSorterMixin):
                    "ucolor": "unused"}
                    "ucolor": "unused"}
         wpx = UserSettings.Get(group='gcpman', key='symbol', subkey='width')
         wpx = UserSettings.Get(group='gcpman', key='symbol', subkey='width')
 
 
-        for k, v in colours.iteritems():
+        for k, v in six.iteritems(colours):
             col = UserSettings.Get(group='gcpman', key='symbol', subkey=k)
             col = UserSettings.Get(group='gcpman', key='symbol', subkey=k)
             self.pointsToDrawSrc.GetPen(v).SetColour(wx.Colour(
             self.pointsToDrawSrc.GetPen(v).SetColour(wx.Colour(
                 col[0], col[1], col[2], 255))  # TODO GetPen neni to spatne?
                 col[0], col[1], col[2], 255))  # TODO GetPen neni to spatne?
@@ -2126,7 +2128,7 @@ class GCP(MapFrame, ColumnSorterMixin):
         """Popup Zoom menu
         """Popup Zoom menu
         """
         """
         point = wx.GetMousePosition()
         point = wx.GetMousePosition()
-        zoommenu = wx.Menu()
+        zoommenu = Menu()
         # Add items to the menu
         # Add items to the menu
 
 
         zoomsource = wx.MenuItem(zoommenu, wx.ID_ANY, _(
         zoomsource = wx.MenuItem(zoommenu, wx.ID_ANY, _(
@@ -2461,17 +2463,17 @@ class VectGroup(wx.Dialog):
         #
         #
         # buttons
         # buttons
         #
         #
-        self.btnCancel = wx.Button(parent=self,
-                                   id=wx.ID_CANCEL)
-        self.btnOK = wx.Button(parent=self,
-                               id=wx.ID_OK)
+        self.btnCancel = Button(parent=self,
+                                id=wx.ID_CANCEL)
+        self.btnOK = Button(parent=self,
+                            id=wx.ID_OK)
         self.btnOK.SetDefault()
         self.btnOK.SetDefault()
 
 
         #
         #
         # list of vector maps
         # list of vector maps
         #
         #
-        self.listMap = wx.CheckListBox(parent=self, id=wx.ID_ANY,
-                                       choices=vectlist)
+        self.listMap = CheckListBox(parent=self, id=wx.ID_ANY,
+                                    choices=vectlist)
 
 
         if os.path.isfile(self.vgrpfile):
         if os.path.isfile(self.vgrpfile):
             f = open(self.vgrpfile)
             f = open(self.vgrpfile)
@@ -2497,7 +2499,7 @@ class VectGroup(wx.Dialog):
 
 
         box = wx.BoxSizer(wx.HORIZONTAL)
         box = wx.BoxSizer(wx.HORIZONTAL)
         box.Add(
         box.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 parent=self,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Select vector map(s) to add to group:')),
                 label=_('Select vector map(s) to add to group:')),
@@ -2561,19 +2563,19 @@ class EditGCP(wx.Dialog):
 
 
         sizer = wx.BoxSizer(wx.VERTICAL)
         sizer = wx.BoxSizer(wx.VERTICAL)
 
 
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel, id=wx.ID_ANY, label=" %s %s " %
             parent=panel, id=wx.ID_ANY, label=" %s %s " %
             (_("Ground Control Point No."), str(gcpno)))
             (_("Ground Control Point No."), str(gcpno)))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
 
 
         # source coordinates
         # source coordinates
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
-        self.xcoord = wx.TextCtrl(parent=panel, id=wx.ID_ANY, size=(150, -1))
-        self.ycoord = wx.TextCtrl(parent=panel, id=wx.ID_ANY, size=(150, -1))
-        self.zcoord = wx.TextCtrl(parent=panel, id=wx.ID_ANY, size=(150, -1))
-        self.ecoord = wx.TextCtrl(parent=panel, id=wx.ID_ANY, size=(150, -1))
-        self.ncoord = wx.TextCtrl(parent=panel, id=wx.ID_ANY, size=(150, -1))
-        self.hcoord = wx.TextCtrl(parent=panel, id=wx.ID_ANY, size=(150, -1))
+        self.xcoord = TextCtrl(parent=panel, id=wx.ID_ANY, size=(150, -1))
+        self.ycoord = TextCtrl(parent=panel, id=wx.ID_ANY, size=(150, -1))
+        self.zcoord = TextCtrl(parent=panel, id=wx.ID_ANY, size=(150, -1))
+        self.ecoord = TextCtrl(parent=panel, id=wx.ID_ANY, size=(150, -1))
+        self.ncoord = TextCtrl(parent=panel, id=wx.ID_ANY, size=(150, -1))
+        self.hcoord = TextCtrl(parent=panel, id=wx.ID_ANY, size=(150, -1))
 
 
         # swap source N, target E
         # swap source N, target E
         tmp_coord = data[1]
         tmp_coord = data[1]
@@ -2589,8 +2591,8 @@ class EditGCP(wx.Dialog):
                            (_("target N:"), self.ncoord),
                            (_("target N:"), self.ncoord),
                            (_("source Z:"), self.zcoord),
                            (_("source Z:"), self.zcoord),
                            (_("target Z:"), self.hcoord)):
                            (_("target Z:"), self.hcoord)):
-            label = wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                  label=label)
+            label = StaticText(parent=panel, id=wx.ID_ANY,
+                               label=label)
             gridSizer.Add(label,
             gridSizer.Add(label,
                           flag=wx.ALIGN_CENTER_VERTICAL,
                           flag=wx.ALIGN_CENTER_VERTICAL,
                           pos=(row, col))
                           pos=(row, col))
@@ -2617,8 +2619,8 @@ class EditGCP(wx.Dialog):
         #
         #
         # buttons
         # buttons
         #
         #
-        self.btnCancel = wx.Button(panel, wx.ID_CANCEL)
-        self.btnOk = wx.Button(panel, wx.ID_OK)
+        self.btnCancel = Button(panel, wx.ID_CANCEL)
+        self.btnOk = Button(panel, wx.ID_OK)
         self.btnOk.SetDefault()
         self.btnOk.SetDefault()
 
 
         btnSizer = wx.StdDialogButtonSizer()
         btnSizer = wx.StdDialogButtonSizer()
@@ -2691,19 +2693,19 @@ class GrSettingsDialog(wx.Dialog):
         self.__CreateRectificationPage(notebook)
         self.__CreateRectificationPage(notebook)
 
 
         # buttons
         # buttons
-        btnSave = wx.Button(self, wx.ID_SAVE)
-        btnApply = wx.Button(self, wx.ID_APPLY)
-        btnClose = wx.Button(self, wx.ID_CLOSE)
+        btnSave = Button(self, wx.ID_SAVE)
+        btnApply = Button(self, wx.ID_APPLY)
+        btnClose = Button(self, wx.ID_CLOSE)
         btnApply.SetDefault()
         btnApply.SetDefault()
 
 
         # bindings
         # bindings
         btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
         btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
-        btnApply.SetToolTipString(_("Apply changes for the current session"))
+        btnApply.SetToolTip(_("Apply changes for the current session"))
         btnSave.Bind(wx.EVT_BUTTON, self.OnSave)
         btnSave.Bind(wx.EVT_BUTTON, self.OnSave)
-        btnSave.SetToolTipString(
+        btnSave.SetToolTip(
             _("Apply and save changes to user settings file (default for next sessions)"))
             _("Apply and save changes to user settings file (default for next sessions)"))
         btnClose.Bind(wx.EVT_BUTTON, self.OnClose)
         btnClose.Bind(wx.EVT_BUTTON, self.OnClose)
-        btnClose.SetToolTipString(_("Close dialog"))
+        btnClose.SetToolTip(_("Close dialog"))
 
 
         # sizers
         # sizers
         btnSizer = wx.BoxSizer(wx.HORIZONTAL)
         btnSizer = wx.BoxSizer(wx.HORIZONTAL)
@@ -2749,7 +2751,7 @@ class GrSettingsDialog(wx.Dialog):
                 0))
                 0))
 
 
         # RMS forward error threshold
         # RMS forward error threshold
-        rmslabel = wx.StaticText(
+        rmslabel = StaticText(
             parent=panel, id=wx.ID_ANY,
             parent=panel, id=wx.ID_ANY,
             label=_("Highlight RMS error > M + SD * factor:"))
             label=_("Highlight RMS error > M + SD * factor:"))
         rmslabel.SetToolTip(
         rmslabel.SetToolTip(
@@ -2766,8 +2768,8 @@ class GrSettingsDialog(wx.Dialog):
                 0))
                 0))
         sdfactor = UserSettings.Get(
         sdfactor = UserSettings.Get(
             group='gcpman', key='rms', subkey='sdfactor')
             group='gcpman', key='rms', subkey='sdfactor')
-        self.rmsWin = wx.TextCtrl(parent=panel, id=wx.ID_ANY,
-                                  size=(70, -1), style=wx.TE_NOHIDESEL)
+        self.rmsWin = TextCtrl(parent=panel, id=wx.ID_ANY,
+                               size=(70, -1), style=wx.TE_NOHIDESEL)
         self.rmsWin.SetValue("%s" % str(sdfactor))
         self.rmsWin.SetValue("%s" % str(sdfactor))
         if (self.parent.highest_only == True):
         if (self.parent.highest_only == True):
             self.rmsWin.Disable()
             self.rmsWin.Disable()
@@ -2777,8 +2779,8 @@ class GrSettingsDialog(wx.Dialog):
         rmsgridSizer.AddGrowableCol(1)
         rmsgridSizer.AddGrowableCol(1)
         sizer.Add(rmsgridSizer, flag=wx.EXPAND | wx.ALL, border=5)
         sizer.Add(rmsgridSizer, flag=wx.EXPAND | wx.ALL, border=5)
 
 
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % _("Symbol settings"))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % _("Symbol settings"))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
 
 
@@ -2786,7 +2788,7 @@ class GrSettingsDialog(wx.Dialog):
         # general symbol color
         # general symbol color
         #
         #
         row = 0
         row = 0
-        label = wx.StaticText(parent=panel, id=wx.ID_ANY, label=_("Color:"))
+        label = StaticText(parent=panel, id=wx.ID_ANY, label=_("Color:"))
         gridSizer.Add(label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0))
         gridSizer.Add(label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0))
         col = UserSettings.Get(group='gcpman', key='symbol', subkey='color')
         col = UserSettings.Get(group='gcpman', key='symbol', subkey='color')
         colWin = csel.ColourSelect(parent=panel, id=wx.ID_ANY,
         colWin = csel.ColourSelect(parent=panel, id=wx.ID_ANY,
@@ -2803,7 +2805,7 @@ class GrSettingsDialog(wx.Dialog):
         # symbol color for high forward RMS error
         # symbol color for high forward RMS error
         #
         #
         row += 1
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_("Color for high RMS error:"))
             label=_("Color for high RMS error:"))
@@ -2823,7 +2825,7 @@ class GrSettingsDialog(wx.Dialog):
         # symbol color for selected GCP
         # symbol color for selected GCP
         #
         #
         row += 1
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_("Color for selected GCP:"))
             label=_("Color for selected GCP:"))
@@ -2843,7 +2845,7 @@ class GrSettingsDialog(wx.Dialog):
         # symbol color for unused GCP
         # symbol color for unused GCP
         #
         #
         row += 1
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_("Color for unused GCPs:"))
             label=_("Color for unused GCPs:"))
@@ -2876,7 +2878,7 @@ class GrSettingsDialog(wx.Dialog):
         # symbol size
         # symbol size
         #
         #
         row += 1
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_("Symbol size:"))
             label=_("Symbol size:"))
@@ -2898,7 +2900,7 @@ class GrSettingsDialog(wx.Dialog):
         # symbol width
         # symbol width
         #
         #
         row += 1
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_("Line width:"))
             label=_("Line width:"))
@@ -2950,7 +2952,7 @@ class GrSettingsDialog(wx.Dialog):
         self.tgtvectselection.GetElementList()
         self.tgtvectselection.GetElementList()
 
 
         sizer.Add(
         sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Select source map to display:')),
                 label=_('Select source map to display:')),
@@ -2964,7 +2966,7 @@ class GrSettingsDialog(wx.Dialog):
             border=5)
             border=5)
         self.srcselection.SetValue(src_map)
         self.srcselection.SetValue(src_map)
         sizer.Add(
         sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Select target raster map to display:')),
                 label=_('Select target raster map to display:')),
@@ -2978,7 +2980,7 @@ class GrSettingsDialog(wx.Dialog):
             border=5)
             border=5)
         self.tgtrastselection.SetValue(tgt_map['raster'])
         self.tgtrastselection.SetValue(tgt_map['raster'])
         sizer.Add(
         sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Select target vector map to display:')),
                 label=_('Select target vector map to display:')),
@@ -3029,7 +3031,7 @@ class GrSettingsDialog(wx.Dialog):
         # interpolation method
         # interpolation method
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Select interpolation method:')),
                 label=_('Select interpolation method:')),
@@ -3055,14 +3057,14 @@ class GrSettingsDialog(wx.Dialog):
 
 
         # extension
         # extension
         sizer.Add(
         sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Extension for output maps:')),
                 label=_('Extension for output maps:')),
             proportion=0,
             proportion=0,
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL,
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL,
             border=5)
             border=5)
-        self.ext_txt = wx.TextCtrl(
+        self.ext_txt = TextCtrl(
             parent=panel, id=wx.ID_ANY, value="", size=(
             parent=panel, id=wx.ID_ANY, value="", size=(
                 350, -1))
                 350, -1))
         self.ext_txt.SetValue(self.parent.extension)
         self.ext_txt.SetValue(self.parent.extension)

+ 3 - 2
gui/wxpython/image2target/ii2t_mapdisplay.py

@@ -30,6 +30,7 @@ from core.gcmd import GMessage
 from core.utils import _
 from core.utils import _
 from gui_core.dialogs import GetImageHandlers, ImageSizeDialog
 from gui_core.dialogs import GetImageHandlers, ImageSizeDialog
 from gui_core.mapdisp import SingleMapFrame
 from gui_core.mapdisp import SingleMapFrame
+from gui_core.wrap import Menu
 from core.settings import UserSettings
 from core.settings import UserSettings
 from mapwin.buffered import BufferedMapWindow
 from mapwin.buffered import BufferedMapWindow
 from mapwin.base import MapWindowProperties
 from mapwin.base import MapWindowProperties
@@ -421,7 +422,7 @@ class MapFrame(SingleMapFrame):
         Print options and output menu for map display
         Print options and output menu for map display
         """
         """
         point = wx.GetMousePosition()
         point = wx.GetMousePosition()
-        printmenu = wx.Menu()
+        printmenu = Menu()
         # Add items to the menu
         # Add items to the menu
         setup = wx.MenuItem(printmenu, wx.ID_ANY, _('Page setup'))
         setup = wx.MenuItem(printmenu, wx.ID_ANY, _('Page setup'))
         printmenu.AppendItem(setup)
         printmenu.AppendItem(setup)
@@ -467,7 +468,7 @@ class MapFrame(SingleMapFrame):
         """Popup Zoom menu
         """Popup Zoom menu
         """
         """
         point = wx.GetMousePosition()
         point = wx.GetMousePosition()
-        zoommenu = wx.Menu()
+        zoommenu = Menu()
         # Add items to the menu
         # Add items to the menu
 
 
         zoomwind = wx.MenuItem(zoommenu, wx.ID_ANY, _(
         zoomwind = wx.MenuItem(zoommenu, wx.ID_ANY, _(

+ 8 - 7
gui/wxpython/iscatt/controllers.py

@@ -23,6 +23,7 @@ import os
 import sys
 import sys
 from copy import deepcopy
 from copy import deepcopy
 import wx
 import wx
+import six
 
 
 
 
 from core.gcmd import GException, GError, GMessage, RunCommand, GWarning
 from core.gcmd import GException, GError, GMessage, RunCommand, GWarning
@@ -366,7 +367,7 @@ class ScattsManager:
     def SetPlotsMode(self, mode):
     def SetPlotsMode(self, mode):
 
 
         self.plot_mode = mode
         self.plot_mode = mode
-        for scatt in self.plots.itervalues():
+        for scatt in six.itervalues(self.plots):
             if scatt['scatt']:
             if scatt['scatt']:
                 scatt['scatt'].SetMode(mode)
                 scatt['scatt'].SetMode(mode)
 
 
@@ -374,7 +375,7 @@ class ScattsManager:
 
 
     def ActivateSelectionPolygonMode(self, activate):
     def ActivateSelectionPolygonMode(self, activate):
         self.pol_sel_mode[0] = activate
         self.pol_sel_mode[0] = activate
-        for scatt in self.plots.itervalues():
+        for scatt in six.itervalues(self.plots):
             if not scatt['scatt']:
             if not scatt['scatt']:
                 continue
                 continue
             scatt['scatt'].SetSelectionPolygonMode(activate)
             scatt['scatt'].SetSelectionPolygonMode(activate)
@@ -387,7 +388,7 @@ class ScattsManager:
 
 
     def ProcessSelectionPolygons(self, process_mode):
     def ProcessSelectionPolygons(self, process_mode):
         scatts_polygons = {}
         scatts_polygons = {}
-        for scatt_id, scatt in self.plots.iteritems():
+        for scatt_id, scatt in six.iteritems(self.plots):
             if not scatt['scatt']:
             if not scatt['scatt']:
                 continue
                 continue
             coords = scatt['scatt'].GetCoords()
             coords = scatt['scatt'].GetCoords()
@@ -419,7 +420,7 @@ class ScattsManager:
         if not sel_cat_id:
         if not sel_cat_id:
             return
             return
 
 
-        for scatt in self.plots.itervalues():
+        for scatt in six.itervalues(self.plots):
             if scatt['scatt']:
             if scatt['scatt']:
                 scatt['scatt'].SetEmpty()
                 scatt['scatt'].SetEmpty()
 
 
@@ -544,7 +545,7 @@ class PlotsRenderingManager:
             else:
             else:
                 ellipses_dt = {}
                 ellipses_dt = {}
 
 
-            for c in scatt_dt.iterkeys():
+            for c in six.iterkeys(scatt_dt):
                 try:
                 try:
                     self.cat_ids.remove(c)
                     self.cat_ids.remove(c)
                     scatt_dt[c]['render'] = True
                     scatt_dt[c]['render'] = True
@@ -700,7 +701,7 @@ class CategoriesManager:
         render = False
         render = False
         update_cat_rast = []
         update_cat_rast = []
 
 
-        for k, v in attrs_dict.iteritems():
+        for k, v in six.iteritems(attrs_dict):
             if not render and k in ['color', 'opacity', 'show', 'nstd']:
             if not render and k in ['color', 'opacity', 'show', 'nstd']:
                 render = True
                 render = True
             if k in ['color', 'name']:
             if k in ['color', 'name']:
@@ -975,7 +976,7 @@ class IMapDispConnection:
 
 
     def RenderCatRast(self, cat_id):
     def RenderCatRast(self, cat_id):
 
 
-        if not cat_id in self.added_cats_rasts.iterkeys():
+        if not cat_id in six.iterkeys(self.added_cats_rasts):
             cat_rast = self.scatt_mgr.core.GetCatRast(cat_id)
             cat_rast = self.scatt_mgr.core.GetCatRast(cat_id)
 
 
             cat_name = self.cats_mgr.GetCategoryAttrs(cat_id)['name']
             cat_name = self.cats_mgr.GetCategoryAttrs(cat_id)['name']

+ 6 - 5
gui/wxpython/iscatt/core_c.py

@@ -12,6 +12,7 @@ This program is free software under the GNU General Public License
 """
 """
 
 
 import sys
 import sys
+import six
 import numpy as np
 import numpy as np
 from multiprocessing import Process, Queue
 from multiprocessing import Process, Queue
 
 
@@ -107,13 +108,13 @@ def ComputeScatts(region, scatt_conds, bands, n_bands,
 
 
 def _memmapToFileNames(data):
 def _memmapToFileNames(data):
 
 
-    for k, v in data.iteritems():
+    for k, v in six.iteritems(data):
         if 'np_vals' in v:
         if 'np_vals' in v:
             data[k]['np_vals'] = v['np_vals'].filename()
             data[k]['np_vals'] = v['np_vals'].filename()
 
 
 
 
 def _fileNamesToMemmap(data):
 def _fileNamesToMemmap(data):
-    for k, v in data.iteritems():
+    for k, v in six.iteritems(data):
         if 'np_vals' in v:
         if 'np_vals' in v:
             data[k]['np_vals'] = np.memmap(filename=v['np_vals'])
             data[k]['np_vals'] = np.memmap(filename=v['np_vals'])
 
 
@@ -186,7 +187,7 @@ def _regionToCellHead(region):
                     'nsres': 'ns_res',
                     'nsres': 'ns_res',
                     'ewres': 'ew_res'}
                     'ewres': 'ew_res'}
 
 
-    for k, v in region.iteritems():
+    for k, v in six.iteritems(region):
         if k in ["rows", "cols", "cells", "zone"]:  # zone added in r65224
         if k in ["rows", "cols", "cells", "zone"]:  # zone added in r65224
             v = int(v)
             v = int(v)
         else:
         else:
@@ -221,11 +222,11 @@ def _getComputationStruct(cats, cats_rasts, cats_type, n_bands):
     refs = []
     refs = []
     cats_rasts_core = []
     cats_rasts_core = []
 
 
-    for cat_id, scatt_ids in cats.iteritems():
+    for cat_id, scatt_ids in six.iteritems(cats):
         cat_c_id = I_sc_add_cat(pointer(sccats))
         cat_c_id = I_sc_add_cat(pointer(sccats))
         cats_rasts_core.append(cats_rasts[cat_id])
         cats_rasts_core.append(cats_rasts[cat_id])
 
 
-        for scatt_id, dt in scatt_ids.iteritems():
+        for scatt_id, dt in six.iteritems(scatt_ids):
             # if key is missing condition is always True (full scatter plor is
             # if key is missing condition is always True (full scatter plor is
             # computed)
             # computed)
             vals = dt['np_vals']
             vals = dt['np_vals']

+ 30 - 28
gui/wxpython/iscatt/dialogs.py

@@ -19,6 +19,7 @@ This program is free software under the GNU General Public License
 """
 """
 import os
 import os
 import sys
 import sys
+import six
 
 
 import wx
 import wx
 from iscatt.iscatt_core import idBandsToidScatt
 from iscatt.iscatt_core import idBandsToidScatt
@@ -31,7 +32,8 @@ from core import globalvar
 from core.gcmd import GMessage
 from core.gcmd import GMessage
 from core.settings import UserSettings
 from core.settings import UserSettings
 from gui_core.dialogs import SimpleDialog
 from gui_core.dialogs import SimpleDialog
-from gui_core.wrap import SpinCtrl
+from gui_core.wrap import SpinCtrl, Button, StaticText, \
+    StaticBox, TextCtrl
 
 
 
 
 class AddScattPlotDialog(wx.Dialog):
 class AddScattPlotDialog(wx.Dialog):
@@ -55,14 +57,14 @@ class AddScattPlotDialog(wx.Dialog):
         self.labels = {}
         self.labels = {}
         self.params = {}
         self.params = {}
 
 
-        self.band_1_label = wx.StaticText(
+        self.band_1_label = StaticText(
             parent=self, id=wx.ID_ANY, label=_("x axis:"))
             parent=self, id=wx.ID_ANY, label=_("x axis:"))
 
 
         self.band_1_ch = wx.ComboBox(parent=self, id=wx.ID_ANY,
         self.band_1_ch = wx.ComboBox(parent=self, id=wx.ID_ANY,
                                      choices=self.bands,
                                      choices=self.bands,
                                      style=wx.CB_READONLY, size=(350, 30))
                                      style=wx.CB_READONLY, size=(350, 30))
 
 
-        self.band_2_label = wx.StaticText(
+        self.band_2_label = StaticText(
             parent=self, id=wx.ID_ANY, label=_("y axis:"))
             parent=self, id=wx.ID_ANY, label=_("y axis:"))
 
 
         self.band_2_ch = wx.ComboBox(parent=self, id=wx.ID_ANY,
         self.band_2_ch = wx.ComboBox(parent=self, id=wx.ID_ANY,
@@ -73,11 +75,11 @@ class AddScattPlotDialog(wx.Dialog):
                                     style=wx.LB_MULTIPLE | wx.LB_NEEDED_SB)
                                     style=wx.LB_MULTIPLE | wx.LB_NEEDED_SB)
 
 
         # buttons
         # buttons
-        self.btn_add = wx.Button(parent=self, id=wx.ID_ADD)
-        self.btn_remove = wx.Button(parent=self, id=wx.ID_REMOVE)
+        self.btn_add = Button(parent=self, id=wx.ID_ADD)
+        self.btn_remove = Button(parent=self, id=wx.ID_REMOVE)
 
 
-        self.btn_close = wx.Button(parent=self, id=wx.ID_CANCEL)
-        self.btn_ok = wx.Button(parent=self, id=wx.ID_OK)
+        self.btn_close = Button(parent=self, id=wx.ID_CANCEL)
+        self.btn_ok = Button(parent=self, id=wx.ID_OK)
 
 
         self._layout()
         self._layout()
 
 
@@ -100,7 +102,7 @@ class AddScattPlotDialog(wx.Dialog):
             flag=wx.TOP | wx.ALIGN_RIGHT,
             flag=wx.TOP | wx.ALIGN_RIGHT,
             border=5)
             border=5)
 
 
-        box = wx.StaticBox(
+        box = StaticBox(
             self, id=wx.ID_ANY, label=" %s " %
             self, id=wx.ID_ANY, label=" %s " %
             _("Bands of scatter plots to be added (x y):"))
             _("Bands of scatter plots to be added (x y):"))
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
@@ -245,8 +247,8 @@ class ExportCategoryRaster(wx.Dialog):
         self.rasterName = rasterName
         self.rasterName = rasterName
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
 
 
-        self.btnCancel = wx.Button(parent=self.panel, id=wx.ID_CANCEL)
-        self.btnOK = wx.Button(parent=self.panel, id=wx.ID_OK)
+        self.btnCancel = Button(parent=self.panel, id=wx.ID_CANCEL)
+        self.btnOK = Button(parent=self.panel, id=wx.ID_OK)
         self.btnOK.SetDefault()
         self.btnOK.SetDefault()
         self.btnOK.Enable(False)
         self.btnOK.Enable(False)
         self.btnOK.Bind(wx.EVT_BUTTON, self.OnOK)
         self.btnOK.Bind(wx.EVT_BUTTON, self.OnOK)
@@ -275,7 +277,7 @@ class ExportCategoryRaster(wx.Dialog):
         dataSizer = wx.BoxSizer(wx.VERTICAL)
         dataSizer = wx.BoxSizer(wx.VERTICAL)
 
 
         dataSizer.Add(
         dataSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self.panel,
                 parent=self.panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Enter name of new vector map:")),
                 label=_("Enter name of new vector map:")),
@@ -360,8 +362,8 @@ class SettingsDialog(wx.Dialog):
                 "selection", _("Color of selection polygon vertex:")], "sel_area": [
                 "selection", _("Color of selection polygon vertex:")], "sel_area": [
                 "selection", _("Selected area color:")]}
                 "selection", _("Selected area color:")]}
 
 
-        for settKey, sett in self.colorsSetts.iteritems():
-            settsLabels[settKey] = wx.StaticText(
+        for settKey, sett in six.iteritems(self.colorsSetts):
+            settsLabels[settKey] = StaticText(
                 parent=self, id=wx.ID_ANY, label=sett[1])
                 parent=self, id=wx.ID_ANY, label=sett[1])
             col = UserSettings.Get(group='scatt', key=sett[0], subkey=settKey)
             col = UserSettings.Get(group='scatt', key=sett[0], subkey=settKey)
             self.settings[settKey] = csel.ColourSelect(
             self.settings[settKey] = csel.ColourSelect(
@@ -373,8 +375,8 @@ class SettingsDialog(wx.Dialog):
             "sel_area_opacty": ["selection", _("Selected area opacity:")]
             "sel_area_opacty": ["selection", _("Selected area opacity:")]
         }
         }
 
 
-        for settKey, sett in self.sizeSetts.iteritems():
-            settsLabels[settKey] = wx.StaticText(
+        for settKey, sett in six.iteritems(self.sizeSetts):
+            settsLabels[settKey] = StaticText(
                 parent=self, id=wx.ID_ANY, label=sett[1])
                 parent=self, id=wx.ID_ANY, label=sett[1])
             self.settings[settKey] = SpinCtrl(
             self.settings[settKey] = SpinCtrl(
                 parent=self, id=wx.ID_ANY, min=0, max=100)
                 parent=self, id=wx.ID_ANY, min=0, max=100)
@@ -386,20 +388,20 @@ class SettingsDialog(wx.Dialog):
             self.settings[settKey].SetValue(size)
             self.settings[settKey].SetValue(size)
 
 
         # buttons
         # buttons
-        self.btnSave = wx.Button(self, wx.ID_SAVE)
-        self.btnApply = wx.Button(self, wx.ID_APPLY)
-        self.btnClose = wx.Button(self, wx.ID_CLOSE)
+        self.btnSave = Button(self, wx.ID_SAVE)
+        self.btnApply = Button(self, wx.ID_APPLY)
+        self.btnClose = Button(self, wx.ID_CLOSE)
         self.btnApply.SetDefault()
         self.btnApply.SetDefault()
 
 
         # bindings
         # bindings
         self.btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
         self.btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
-        self.btnApply.SetToolTipString(
+        self.btnApply.SetToolTip(
             _("Apply changes for the current session"))
             _("Apply changes for the current session"))
         self.btnSave.Bind(wx.EVT_BUTTON, self.OnSave)
         self.btnSave.Bind(wx.EVT_BUTTON, self.OnSave)
-        self.btnSave.SetToolTipString(
+        self.btnSave.SetToolTip(
             _("Apply and save changes to user settings file (default for next sessions)"))
             _("Apply and save changes to user settings file (default for next sessions)"))
         self.btnClose.Bind(wx.EVT_BUTTON, self.OnClose)
         self.btnClose.Bind(wx.EVT_BUTTON, self.OnClose)
-        self.btnClose.SetToolTipString(_("Close dialog"))
+        self.btnClose.SetToolTip(_("Close dialog"))
 
 
         # Layout
         # Layout
 
 
@@ -408,8 +410,8 @@ class SettingsDialog(wx.Dialog):
 
 
         sizer = wx.BoxSizer(wx.VERTICAL)
         sizer = wx.BoxSizer(wx.VERTICAL)
 
 
-        sel_pol_box = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                                   label=" %s " % _("Selection style:"))
+        sel_pol_box = StaticBox(parent=self, id=wx.ID_ANY,
+                                label=" %s " % _("Selection style:"))
         selPolBoxSizer = wx.StaticBoxSizer(sel_pol_box, wx.VERTICAL)
         selPolBoxSizer = wx.StaticBoxSizer(sel_pol_box, wx.VERTICAL)
 
 
         gridSizer = wx.GridBagSizer(vgap=1, hgap=1)
         gridSizer = wx.GridBagSizer(vgap=1, hgap=1)
@@ -435,8 +437,8 @@ class SettingsDialog(wx.Dialog):
         gridSizer.AddGrowableCol(1)
         gridSizer.AddGrowableCol(1)
         selPolBoxSizer.Add(gridSizer, flag=wx.EXPAND)
         selPolBoxSizer.Add(gridSizer, flag=wx.EXPAND)
 
 
-        ell_box = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                               label=" %s " % _("Ellipses settings:"))
+        ell_box = StaticBox(parent=self, id=wx.ID_ANY,
+                            label=" %s " % _("Ellipses settings:"))
         ellPolBoxSizer = wx.StaticBoxSizer(ell_box, wx.VERTICAL)
         ellPolBoxSizer = wx.StaticBoxSizer(ell_box, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(vgap=1, hgap=1)
         gridSizer = wx.GridBagSizer(vgap=1, hgap=1)
 
 
@@ -480,7 +482,7 @@ class SettingsDialog(wx.Dialog):
     def UpdateSettings(self):
     def UpdateSettings(self):
 
 
         chanaged_setts = []
         chanaged_setts = []
-        for settKey, sett in self.colorsSetts.iteritems():
+        for settKey, sett in six.iteritems(self.colorsSetts):
             col = tuple(self.settings[settKey].GetColour())
             col = tuple(self.settings[settKey].GetColour())
             col_s = UserSettings.Get(
             col_s = UserSettings.Get(
                 group='scatt', key=sett[0], subkey=settKey)
                 group='scatt', key=sett[0], subkey=settKey)
@@ -491,7 +493,7 @@ class SettingsDialog(wx.Dialog):
                                  value=col)
                                  value=col)
                 chanaged_setts.append([settKey, sett[0]])
                 chanaged_setts.append([settKey, sett[0]])
 
 
-        for settKey, sett in self.sizeSetts.iteritems():
+        for settKey, sett in six.iteritems(self.sizeSetts):
             val = self.settings[settKey].GetValue()
             val = self.settings[settKey].GetValue()
             val_s = UserSettings.Get(
             val_s = UserSettings.Get(
                 group='scatt', key=sett[0], subkey=settKey)
                 group='scatt', key=sett[0], subkey=settKey)
@@ -562,7 +564,7 @@ class RenameClassDialog(SimpleDialog):
     def __init__(self, parent, old_name, title=("Change class name")):
     def __init__(self, parent, old_name, title=("Change class name")):
         SimpleDialog.__init__(self, parent, title)
         SimpleDialog.__init__(self, parent, title)
 
 
-        self.name = wx.TextCtrl(self.panel, id=wx.ID_ANY)
+        self.name = TextCtrl(self.panel, id=wx.ID_ANY)
         self.name.SetValue(old_name)
         self.name.SetValue(old_name)
 
 
         self.dataSizer.Add(self.name, proportion=0,
         self.dataSizer.Add(self.name, proportion=0,

+ 6 - 4
gui/wxpython/iscatt/frame.py

@@ -22,6 +22,7 @@ from __future__ import print_function
 
 
 import os
 import os
 import sys
 import sys
+import six
 
 
 import wx
 import wx
 import wx.lib.scrolledpanel as scrolled
 import wx.lib.scrolledpanel as scrolled
@@ -32,6 +33,7 @@ from core.gcmd import GException, GError, RunCommand
 
 
 from gui_core.gselect import Select
 from gui_core.gselect import Select
 from gui_core.dialogs import SetOpacityDialog
 from gui_core.dialogs import SetOpacityDialog
+from gui_core.wrap import StaticBox, Menu
 from iscatt.controllers import ScattsManager
 from iscatt.controllers import ScattsManager
 from iscatt.toolbars import MainToolbar, EditingToolbar, CategoryToolbar
 from iscatt.toolbars import MainToolbar, EditingToolbar, CategoryToolbar
 from iscatt.iscatt_core import idScattToidBands
 from iscatt.iscatt_core import idScattToidBands
@@ -139,8 +141,8 @@ class IClassIScattPanel(wx.Panel, ManageBusyCursorMixin):
         self.catsPanel.SetMinSize((-1, 100))
         self.catsPanel.SetMinSize((-1, 100))
         self.catsPanel.SetInitialSize((-1, 150))
         self.catsPanel.SetInitialSize((-1, 150))
 
 
-        box_capt = wx.StaticBox(parent=self.catsPanel, id=wx.ID_ANY,
-                                label=' %s ' % _("Classes"),)
+        box_capt = StaticBox(parent=self.catsPanel, id=wx.ID_ANY,
+                             label=' %s ' % _("Classes"),)
         catsSizer = wx.StaticBoxSizer(box_capt, wx.VERTICAL)
         catsSizer = wx.StaticBoxSizer(box_capt, wx.VERTICAL)
 
 
         self.toolbars['categoryToolbar'] = self._createCategoryToolbar(
         self.toolbars['categoryToolbar'] = self._createCategoryToolbar(
@@ -260,7 +262,7 @@ class ScatterPlotsPanel(scrolled.ScrolledPanel):
         self.scatt_mgr.cursorPlotMove.connect(self.CursorPlotMove)
         self.scatt_mgr.cursorPlotMove.connect(self.CursorPlotMove)
 
 
     def SetBusy(self, busy):
     def SetBusy(self, busy):
-        for scatt in self.scatts.itervalues():
+        for scatt in six.itervalues(self.scatts):
             scatt.UpdateCur(busy)
             scatt.UpdateCur(busy)
 
 
     def CursorPlotMove(self, x, y, scatt_id):
     def CursorPlotMove(self, x, y, scatt_id):
@@ -569,7 +571,7 @@ class CategoryListCtrl(wx.ListCtrl,
         cat_id = cats[cat_idx]
         cat_id = cats[cat_idx]
         showed = self.cats_mgr.GetCategoryAttrs(cat_id)['show']
         showed = self.cats_mgr.GetCategoryAttrs(cat_id)['show']
 
 
-        menu = wx.Menu()
+        menu = Menu()
 
 
         item_id = wx.NewId()
         item_id = wx.NewId()
         menu.Append(item_id, text=_("Rename class"))
         menu.Append(item_id, text=_("Rename class"))

+ 14 - 13
gui/wxpython/iscatt/iscatt_core.py

@@ -19,6 +19,7 @@ This program is free software under the GNU General Public License
 """
 """
 import os
 import os
 import sys
 import sys
+import six
 
 
 import time
 import time
 
 
@@ -114,7 +115,7 @@ class Core:
 
 
         arr = self.scatt_conds_dt.GetValuesArr(cat_id, scatt_id)
         arr = self.scatt_conds_dt.GetValuesArr(cat_id, scatt_id)
 
 
-        for k, v in bbox.iteritems():
+        for k, v in six.iteritems(bbox):
             bbox[k] = self._validExtend(v)
             bbox[k] = self._validExtend(v)
 
 
         arr[bbox['btm_y']: bbox['up_y'], bbox['btm_x']: bbox['up_x']] = value
         arr[bbox['btm_y']: bbox['up_y'], bbox['btm_x']: bbox['up_x']] = value
@@ -159,7 +160,7 @@ class Core:
         if cat_id not in self.scatts_dt.GetCategories():
         if cat_id not in self.scatts_dt.GetCategories():
             raise GException(_("Select category for editing."))
             raise GException(_("Select category for editing."))
 
 
-        for scatt_id, coords in scatts_pols.iteritems():
+        for scatt_id, coords in six.iteritems(scatts_pols):
 
 
             if self.scatt_conds_dt.AddScattPlot(cat_id, scatt_id) < 0:
             if self.scatt_conds_dt.AddScattPlot(cat_id, scatt_id) < 0:
                 return False
                 return False
@@ -471,7 +472,7 @@ class ScattPlotsCondsData:
         if cat_id not in self.cats.keys():
         if cat_id not in self.cats.keys():
             return False
             return False
 
 
-        for scatt in self.cats[cat_id].itervalues():
+        for scatt in six.itervalues(self.cats[cat_id]):
             grass.try_remove(scatt['np_vals'])
             grass.try_remove(scatt['np_vals'])
             del scatt['np_vals']
             del scatt['np_vals']
 
 
@@ -552,7 +553,7 @@ class ScattPlotsCondsData:
     def GetData(self, requested_dt):
     def GetData(self, requested_dt):
 
 
         cats = {}
         cats = {}
-        for cat_id, scatt_ids in requested_dt.iteritems():
+        for cat_id, scatt_ids in six.iteritems(requested_dt):
             if cat_id not in cats:
             if cat_id not in cats:
                 cats[cat_id] = {}
                 cats[cat_id] = {}
             for scatt_id in scatt_ids:
             for scatt_id in scatt_ids:
@@ -567,7 +568,7 @@ class ScattPlotsCondsData:
 
 
     def SetData(self, cats):
     def SetData(self, cats):
 
 
-        for cat_id, scatt_ids in cats.iteritems():
+        for cat_id, scatt_ids in six.iteritems(cats):
             for scatt_id in scatt_ids:
             for scatt_id in scatt_ids:
                 # if key is missing condition is always True (full scatter plor
                 # if key is missing condition is always True (full scatter plor
                 # is computed)
                 # is computed)
@@ -577,7 +578,7 @@ class ScattPlotsCondsData:
 
 
     def GetScatt(self, scatt_id, cats_ids=None):
     def GetScatt(self, scatt_id, cats_ids=None):
         scatts = {}
         scatts = {}
-        for cat_id in self.cats.iterkeys():
+        for cat_id in six.iterkeys(self.cats):
             if cats_ids and cat_id not in cats_ids:
             if cats_ids and cat_id not in cats_ids:
                 continue
                 continue
             if scatt_id not in self.cats[cat_id]:
             if scatt_id not in self.cats[cat_id]:
@@ -644,7 +645,7 @@ class ScattPlotsData(ScattPlotsCondsData):
             return False
             return False
 
 
         self.scatts_ids.append(scatt_id)
         self.scatts_ids.append(scatt_id)
-        for cat_id in self.cats.iterkeys():
+        for cat_id in six.iterkeys(self.cats):
             ScattPlotsCondsData.AddScattPlot(self, cat_id, scatt_id)
             ScattPlotsCondsData.AddScattPlot(self, cat_id, scatt_id)
             self.cats[cat_id][scatt_id]['ellipse'] = None
             self.cats[cat_id][scatt_id]['ellipse'] = None
 
 
@@ -657,7 +658,7 @@ class ScattPlotsData(ScattPlotsCondsData):
 
 
         self.scatts_ids.remove(scatt_id)
         self.scatts_ids.remove(scatt_id)
 
 
-        for cat_id in self.cats.iterkeys():
+        for cat_id in six.iterkeys(self.cats):
             ScattPlotsCondsData.DeleteScattPlot(self, cat_id, scatt_id)
             ScattPlotsCondsData.DeleteScattPlot(self, cat_id, scatt_id)
 
 
         return True
         return True
@@ -667,7 +668,7 @@ class ScattPlotsData(ScattPlotsCondsData):
             return False
             return False
 
 
         scatts = {}
         scatts = {}
-        for cat_id in self.cats.iterkeys():
+        for cat_id in six.iterkeys(self.cats):
             if cat_id == 0:
             if cat_id == 0:
                 continue
                 continue
             nstd = styles[cat_id]['nstd']
             nstd = styles[cat_id]['nstd']
@@ -740,9 +741,9 @@ class ScattPlotsData(ScattPlotsCondsData):
     def CleanUp(self):
     def CleanUp(self):
 
 
         ScattPlotsCondsData.CleanUp(self)
         ScattPlotsCondsData.CleanUp(self)
-        for tmp in self.cats_rasts_conds.itervalues():
+        for tmp in six.itervalues(self.cats_rasts_conds):
             grass.try_remove(tmp)
             grass.try_remove(tmp)
-        for tmp in self.cats_rasts.itervalues():
+        for tmp in six.itervalues(self.cats_rasts):
             RunCommand("g.remove", flags='f',
             RunCommand("g.remove", flags='f',
                        type='raster', name=tmp,
                        type='raster', name=tmp,
                        getErrorMsg=True)
                        getErrorMsg=True)
@@ -762,7 +763,7 @@ class ScattPlotsData(ScattPlotsCondsData):
         max_cat_id = max(self.cats_rasts_conds.keys())
         max_cat_id = max(self.cats_rasts_conds.keys())
 
 
         cats_rasts_conds = [''] * (max_cat_id + 1)
         cats_rasts_conds = [''] * (max_cat_id + 1)
-        for i_cat_id, i_rast in self.cats_rasts_conds.iteritems():
+        for i_cat_id, i_rast in six.iteritems(self.cats_rasts_conds):
             cats_rasts_conds[i_cat_id] = i_rast
             cats_rasts_conds[i_cat_id] = i_rast
 
 
         return cats_rasts_conds
         return cats_rasts_conds
@@ -771,7 +772,7 @@ class ScattPlotsData(ScattPlotsCondsData):
         max_cat_id = max(self.cats_rasts.keys())
         max_cat_id = max(self.cats_rasts.keys())
 
 
         cats_rasts = [''] * (max_cat_id + 1)
         cats_rasts = [''] * (max_cat_id + 1)
-        for i_cat_id, i_rast in self.cats_rasts.iteritems():
+        for i_cat_id, i_rast in six.iteritems(self.cats_rasts):
             cats_rasts[i_cat_id] = i_rast
             cats_rasts[i_cat_id] = i_rast
 
 
         return cats_rasts
         return cats_rasts

+ 5 - 3
gui/wxpython/iscatt/plots.py

@@ -16,6 +16,7 @@ This program is free software under the GNU General Public License
 @author Stepan Turek <stepan.turek seznam.cz> (mentor: Martin Landa)
 @author Stepan Turek <stepan.turek seznam.cz> (mentor: Martin Landa)
 """
 """
 import wx
 import wx
+import six
 import numpy as np
 import numpy as np
 from math import ceil
 from math import ceil
 from multiprocessing import Process, Queue
 from multiprocessing import Process, Queue
@@ -24,6 +25,7 @@ from copy import deepcopy
 from iscatt.core_c import MergeArrays, ApplyColormap
 from iscatt.core_c import MergeArrays, ApplyColormap
 from iscatt.dialogs import ManageBusyCursorMixin
 from iscatt.dialogs import ManageBusyCursorMixin
 from core.settings import UserSettings
 from core.settings import UserSettings
+from gui_core.wrap import Menu
 
 
 try:
 try:
     import matplotlib
     import matplotlib
@@ -550,7 +552,7 @@ def MergeImg(cats_order, scatts, styles, rend_dt, output_queue):
 
 
 def _rendDtMemmapsToFiles(rend_dt):
 def _rendDtMemmapsToFiles(rend_dt):
 
 
-    for k, v in rend_dt.iteritems():
+    for k, v in six.iteritems(rend_dt):
         if 'dt' in v:
         if 'dt' in v:
             rend_dt[k]['sh'] = v['dt'].shape
             rend_dt[k]['sh'] = v['dt'].shape
             rend_dt[k]['dt'] = v['dt'].filename
             rend_dt[k]['dt'] = v['dt'].filename
@@ -558,7 +560,7 @@ def _rendDtMemmapsToFiles(rend_dt):
 
 
 def _rendDtFilesToMemmaps(rend_dt):
 def _rendDtFilesToMemmaps(rend_dt):
 
 
-    for k, v in rend_dt.iteritems():
+    for k, v in six.iteritems(rend_dt):
         if 'dt' in v:
         if 'dt' in v:
             rend_dt[k]['dt'] = np.memmap(filename=v['dt'], shape=v['sh'])
             rend_dt[k]['dt'] = np.memmap(filename=v['dt'], shape=v['sh'])
             del rend_dt[k]['sh']
             del rend_dt[k]['sh']
@@ -613,7 +615,7 @@ class ScatterPlotContextMenu:
             return
             return
 
 
         if event.button == 3:
         if event.button == 3:
-            menu = wx.Menu()
+            menu = Menu()
             menu_items = [["zoom_to_extend", _("Zoom to scatter plot extend"),
             menu_items = [["zoom_to_extend", _("Zoom to scatter plot extend"),
                            lambda event: self.plot.ZoomToExtend()]]
                            lambda event: self.plot.ZoomToExtend()]]
 
 

+ 2 - 2
gui/wxpython/lmgr/layertree.py

@@ -47,7 +47,7 @@ from core.gcmd import GWarning, GError, RunCommand
 from icons.icon import MetaIcon
 from icons.icon import MetaIcon
 from web_services.dialogs import SaveWMSLayerDialog
 from web_services.dialogs import SaveWMSLayerDialog
 from gui_core.widgets import MapValidator
 from gui_core.widgets import MapValidator
-from gui_core.wrap import Menu, GenBitmapButton
+from gui_core.wrap import Menu, GenBitmapButton, TextCtrl
 from lmgr.giface import LayerManagerGrassInterfaceForMapDisplay
 from lmgr.giface import LayerManagerGrassInterfaceForMapDisplay
 from core.giface import Notification
 from core.giface import Notification
 
 
@@ -2255,6 +2255,6 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
         height = 25
         height = 25
         if sys.platform in ('win32', 'darwin'):
         if sys.platform in ('win32', 'darwin'):
             height = 40
             height = 40
-        ctrl = wx.TextCtrl(self, id=wx.ID_ANY, value='', pos=wx.DefaultPosition, size=(
+        ctrl = TextCtrl(self, id=wx.ID_ANY, value='', pos=wx.DefaultPosition, size=(
             self.GetSize()[0] - 100, height), style=wx.TE_PROCESS_ENTER | wx.TE_DONTWRAP)
             self.GetSize()[0] - 100, height), style=wx.TE_PROCESS_ENTER | wx.TE_DONTWRAP)
         return ctrl
         return ctrl

+ 9 - 8
gui/wxpython/location_wizard/base.py

@@ -17,6 +17,7 @@ This program is free software under the GNU General Public License
 """
 """
 
 
 import wx
 import wx
+from gui_core.wrap import StaticText, TextCtrl, Button, CheckBox
 
 
 
 
 class BaseClass(wx.Object):
 class BaseClass(wx.Object):
@@ -30,10 +31,10 @@ class BaseClass(wx.Object):
         """Make aligned label"""
         """Make aligned label"""
         if not parent:
         if not parent:
             parent = self
             parent = self
-        label = wx.StaticText(parent=parent, id=wx.ID_ANY, label=text,
+        label = StaticText(parent=parent, id=wx.ID_ANY, label=text,
                               style=style)
                               style=style)
         if tooltip:
         if tooltip:
-            label.SetToolTipString(tooltip)
+            label.SetToolTip(tooltip)
         return label
         return label
 
 
     def MakeTextCtrl(self, text='', size=(100, -1),
     def MakeTextCtrl(self, text='', size=(100, -1),
@@ -41,10 +42,10 @@ class BaseClass(wx.Object):
         """Generic text control"""
         """Generic text control"""
         if not parent:
         if not parent:
             parent = self
             parent = self
-        textCtrl = wx.TextCtrl(parent=parent, id=wx.ID_ANY, value=text,
+        textCtrl = TextCtrl(parent=parent, id=wx.ID_ANY, value=text,
                                size=size, style=style)
                                size=size, style=style)
         if tooltip:
         if tooltip:
-            textCtrl.SetToolTipString(tooltip)
+            textCtrl.SetToolTip(tooltip)
         return textCtrl
         return textCtrl
 
 
     def MakeButton(self, text, id=wx.ID_ANY, size=(-1, -1),
     def MakeButton(self, text, id=wx.ID_ANY, size=(-1, -1),
@@ -52,10 +53,10 @@ class BaseClass(wx.Object):
         """Generic button"""
         """Generic button"""
         if not parent:
         if not parent:
             parent = self
             parent = self
-        button = wx.Button(parent=parent, id=id, label=text,
+        button = Button(parent=parent, id=id, label=text,
                            size=size)
                            size=size)
         if tooltip:
         if tooltip:
-            button.SetToolTipString(tooltip)
+            button.SetToolTip(tooltip)
         return button
         return button
 
 
     def MakeCheckBox(self, text, id=wx.ID_ANY, size=(-1, -1),
     def MakeCheckBox(self, text, id=wx.ID_ANY, size=(-1, -1),
@@ -63,8 +64,8 @@ class BaseClass(wx.Object):
         """Generic checkbox"""
         """Generic checkbox"""
         if not parent:
         if not parent:
             parent = self
             parent = self
-        chbox = wx.CheckBox(parent=parent, id=id, label=text,
+        chbox = CheckBox(parent=parent, id=id, label=text,
                              size=size)
                              size=size)
         if tooltip:
         if tooltip:
-            chbox.SetToolTipString(tooltip)
+            chbox.SetToolTip(tooltip)
         return chbox
         return chbox

+ 15 - 13
gui/wxpython/location_wizard/dialogs.py

@@ -26,6 +26,8 @@ from core import globalvar
 from core.gcmd import RunCommand
 from core.gcmd import RunCommand
 from core.utils import _
 from core.utils import _
 from location_wizard.base import BaseClass
 from location_wizard.base import BaseClass
+from gui_core.wrap import Button, StaticText, StaticBox, \
+    TextCtrl
 
 
 from grass.script import core as grass
 from grass.script import core as grass
 
 
@@ -108,7 +110,7 @@ class RegionDef(BaseClass, wx.Dialog):
         self.bset = self.MakeButton(
         self.bset = self.MakeButton(
             text=_("&Set region"),
             text=_("&Set region"),
             id=wx.ID_OK, parent=panel)
             id=wx.ID_OK, parent=panel)
-        self.bcancel = wx.Button(panel, id=wx.ID_CANCEL)
+        self.bcancel = Button(panel, id=wx.ID_CANCEL)
         self.bset.SetDefault()
         self.bset.SetDefault()
 
 
         #
         #
@@ -247,13 +249,13 @@ class RegionDef(BaseClass, wx.Dialog):
         gridSizer = wx.GridBagSizer(vgap=0, hgap=0)
         gridSizer = wx.GridBagSizer(vgap=0, hgap=0)
 
 
         # inputs
         # inputs
-        self.ttop = wx.TextCtrl(parent=pane, id=wx.ID_ANY, value=str(self.top),
-                                size=(150, -1))
-        self.tbottom = wx.TextCtrl(
+        self.ttop = TextCtrl(parent=pane, id=wx.ID_ANY, value=str(self.top),
+                             size=(150, -1))
+        self.tbottom = TextCtrl(
             parent=pane, id=wx.ID_ANY, value=str(
             parent=pane, id=wx.ID_ANY, value=str(
                 self.bottom), size=(
                 self.bottom), size=(
                 150, -1))
                 150, -1))
-        self.ttbres = wx.TextCtrl(
+        self.ttbres = TextCtrl(
             parent=pane, id=wx.ID_ANY, value=str(
             parent=pane, id=wx.ID_ANY, value=str(
                 self.tbres), size=(
                 self.tbres), size=(
                 150, -1))
                 150, -1))
@@ -263,17 +265,17 @@ class RegionDef(BaseClass, wx.Dialog):
         #                                    size = (150, -1))
         #                                    size = (150, -1))
 
 
         # labels
         # labels
-        self.ldepth = wx.StaticText(
+        self.ldepth = StaticText(
             parent=pane,
             parent=pane,
             label=_("Depth: %d") %
             label=_("Depth: %d") %
             self.depth)
             self.depth)
-        self.lcells3 = wx.StaticText(
+        self.lcells3 = StaticText(
             parent=pane,
             parent=pane,
             label=_("3D Cells: %d") %
             label=_("3D Cells: %d") %
             self.cells3)
             self.cells3)
 
 
         # top
         # top
-        gridSizer.Add(wx.StaticText(parent=pane, label=_("Top")),
+        gridSizer.Add(StaticText(parent=pane, label=_("Top")),
                       flag=wx.ALIGN_CENTER |
                       flag=wx.ALIGN_CENTER |
                       wx.LEFT | wx.RIGHT | wx.TOP, border=5,
                       wx.LEFT | wx.RIGHT | wx.TOP, border=5,
                       pos=(0, 1))
                       pos=(0, 1))
@@ -281,7 +283,7 @@ class RegionDef(BaseClass, wx.Dialog):
                       flag=wx.ALIGN_CENTER_HORIZONTAL |
                       flag=wx.ALIGN_CENTER_HORIZONTAL |
                       wx.ALL, border=5, pos=(1, 1))
                       wx.ALL, border=5, pos=(1, 1))
         # bottom
         # bottom
-        gridSizer.Add(wx.StaticText(parent=pane, label=_("Bottom")),
+        gridSizer.Add(StaticText(parent=pane, label=_("Bottom")),
                       flag=wx.ALIGN_CENTER |
                       flag=wx.ALIGN_CENTER |
                       wx.LEFT | wx.RIGHT | wx.TOP, border=5,
                       wx.LEFT | wx.RIGHT | wx.TOP, border=5,
                       pos=(0, 2))
                       pos=(0, 2))
@@ -290,7 +292,7 @@ class RegionDef(BaseClass, wx.Dialog):
                       wx.ALL, border=5, pos=(1, 2))
                       wx.ALL, border=5, pos=(1, 2))
         # tbres
         # tbres
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=pane,
                 parent=pane,
                 label=_("T-B resolution")),
                 label=_("T-B resolution")),
             flag=wx.ALIGN_CENTER | wx.LEFT | wx.RIGHT | wx.TOP,
             flag=wx.ALIGN_CENTER | wx.LEFT | wx.RIGHT | wx.TOP,
@@ -607,7 +609,7 @@ class SelectTransformDialog(wx.Dialog):
         #
         #
         # dialog body
         # dialog body
         #
         #
-        bodyBox = wx.StaticBox(
+        bodyBox = StaticBox(
             parent=panel, id=wx.ID_ANY, label=" %s " %
             parent=panel, id=wx.ID_ANY, label=" %s " %
             _("Select from list of datum transformations"))
             _("Select from list of datum transformations"))
         bodySizer = wx.StaticBoxSizer(bodyBox)
         bodySizer = wx.StaticBoxSizer(bodyBox)
@@ -655,11 +657,11 @@ class SelectTransformDialog(wx.Dialog):
         #
         #
         btnsizer = wx.StdDialogButtonSizer()
         btnsizer = wx.StdDialogButtonSizer()
 
 
-        btn = wx.Button(parent=panel, id=wx.ID_OK)
+        btn = Button(parent=panel, id=wx.ID_OK)
         btn.SetDefault()
         btn.SetDefault()
         btnsizer.AddButton(btn)
         btnsizer.AddButton(btn)
 
 
-        btn = wx.Button(parent=panel, id=wx.ID_CANCEL)
+        btn = Button(parent=panel, id=wx.ID_CANCEL)
         btnsizer.AddButton(btn)
         btnsizer.AddButton(btn)
         btnsizer.Realize()
         btnsizer.Realize()
 
 

+ 24 - 21
gui/wxpython/location_wizard/wizard.py

@@ -35,6 +35,7 @@ This program is free software under the GNU General Public License
 import os
 import os
 import sys
 import sys
 import locale
 import locale
+import six
 
 
 import wx
 import wx
 import wx.lib.mixins.listctrl as listmix
 import wx.lib.mixins.listctrl as listmix
@@ -51,9 +52,11 @@ import wx.lib.scrolledpanel as scrolled
 
 
 from core import utils
 from core import utils
 from core.utils import _
 from core.utils import _
+from core.utils import cmp
 from core.gcmd import RunCommand, GError, GMessage, GWarning
 from core.gcmd import RunCommand, GError, GMessage, GWarning
 from gui_core.widgets import GenericValidator
 from gui_core.widgets import GenericValidator
-from gui_core.wrap import SpinCtrl, SearchCtrl
+from gui_core.wrap import SpinCtrl, SearchCtrl, StaticText, \
+    TextCtrl, Button, CheckBox, StaticBox
 from location_wizard.base import BaseClass
 from location_wizard.base import BaseClass
 from location_wizard.dialogs import SelectTransformDialog
 from location_wizard.dialogs import SelectTransformDialog
 
 
@@ -80,7 +83,7 @@ class TitledPage(WizardPageSimple):
         self.page = WizardPageSimple.__init__(self, parent)
         self.page = WizardPageSimple.__init__(self, parent)
 
 
         # page title
         # page title
-        self.title = wx.StaticText(parent=self, id=wx.ID_ANY, label=title)
+        self.title = StaticText(parent=self, id=wx.ID_ANY, label=title)
         self.title.SetFont(wx.Font(13, wx.SWISS, wx.NORMAL, wx.BOLD))
         self.title.SetFont(wx.Font(13, wx.SWISS, wx.NORMAL, wx.BOLD))
         # main sizers
         # main sizers
         self.pagesizer = wx.BoxSizer(wx.VERTICAL)
         self.pagesizer = wx.BoxSizer(wx.VERTICAL)
@@ -108,10 +111,10 @@ class TitledPage(WizardPageSimple):
         """Make aligned label"""
         """Make aligned label"""
         if not parent:
         if not parent:
             parent = self
             parent = self
-        label = wx.StaticText(parent=parent, id=wx.ID_ANY, label=text,
+        label = StaticText(parent=parent, id=wx.ID_ANY, label=text,
                               style=style)
                               style=style)
         if tooltip:
         if tooltip:
-            label.SetToolTipString(tooltip)
+            label.SetToolTip(tooltip)
         return label
         return label
 
 
     def MakeTextCtrl(self, text='', size=(100, -1),
     def MakeTextCtrl(self, text='', size=(100, -1),
@@ -119,10 +122,10 @@ class TitledPage(WizardPageSimple):
         """Generic text control"""
         """Generic text control"""
         if not parent:
         if not parent:
             parent = self
             parent = self
-        textCtrl = wx.TextCtrl(parent=parent, id=wx.ID_ANY, value=text,
+        textCtrl = TextCtrl(parent=parent, id=wx.ID_ANY, value=text,
                                size=size, style=style)
                                size=size, style=style)
         if tooltip:
         if tooltip:
-            textCtrl.SetToolTipString(tooltip)
+            textCtrl.SetToolTip(tooltip)
         return textCtrl
         return textCtrl
 
 
     def MakeButton(self, text, id=wx.ID_ANY, size=(-1, -1),
     def MakeButton(self, text, id=wx.ID_ANY, size=(-1, -1),
@@ -130,10 +133,10 @@ class TitledPage(WizardPageSimple):
         """Generic button"""
         """Generic button"""
         if not parent:
         if not parent:
             parent = self
             parent = self
-        button = wx.Button(parent=parent, id=id, label=text,
+        button = Button(parent=parent, id=id, label=text,
                            size=size)
                            size=size)
         if tooltip:
         if tooltip:
-            button.SetToolTipString(tooltip)
+            button.SetToolTip(tooltip)
         return button
         return button
 
 
     def MakeCheckBox(self, text, id=wx.ID_ANY, size=(-1, -1),
     def MakeCheckBox(self, text, id=wx.ID_ANY, size=(-1, -1),
@@ -141,10 +144,10 @@ class TitledPage(WizardPageSimple):
         """Generic checkbox"""
         """Generic checkbox"""
         if not parent:
         if not parent:
             parent = self
             parent = self
-        chbox = wx.CheckBox(parent=parent, id=id, label=text,
+        chbox = CheckBox(parent=parent, id=id, label=text,
                             size=size)
                             size=size)
         if tooltip:
         if tooltip:
-            chbox.SetToolTipString(tooltip)
+            chbox.SetToolTip(tooltip)
         return chbox
         return chbox
 
 
 
 
@@ -349,7 +352,7 @@ class CoordinateSystemPage(TitledPage):
 
 
         # layout
         # layout
         self.sizer.SetVGap(10)
         self.sizer.SetVGap(10)
-        self.sizer.Add(wx.StaticText(parent=self, label=_("Simple methods:")),
+        self.sizer.Add(StaticText(parent=self, label=_("Simple methods:")),
                        flag=wx.ALIGN_LEFT, pos=(1, 1))
                        flag=wx.ALIGN_LEFT, pos=(1, 1))
         self.sizer.Add(self.radioEpsg,
         self.sizer.Add(self.radioEpsg,
                        flag=wx.ALIGN_LEFT, pos=(2, 1))
                        flag=wx.ALIGN_LEFT, pos=(2, 1))
@@ -361,7 +364,7 @@ class CoordinateSystemPage(TitledPage):
                        flag=wx.ALIGN_LEFT, pos=(4, 1))
                        flag=wx.ALIGN_LEFT, pos=(4, 1))
         self.sizer.Add(self.radioXy,
         self.sizer.Add(self.radioXy,
                        flag=wx.ALIGN_LEFT, pos=(5, 1))
                        flag=wx.ALIGN_LEFT, pos=(5, 1))
-        self.sizer.Add(wx.StaticText(parent=self, label=_("Advanced methods:")),
+        self.sizer.Add(StaticText(parent=self, label=_("Advanced methods:")),
                        flag=wx.ALIGN_LEFT, pos=(6, 1))
                        flag=wx.ALIGN_LEFT, pos=(6, 1))
         self.sizer.Add(self.radioSrs,
         self.sizer.Add(self.radioSrs,
                        flag=wx.ALIGN_LEFT, pos=(7, 1))
                        flag=wx.ALIGN_LEFT, pos=(7, 1))
@@ -788,7 +791,7 @@ class ProjParamsPage(TitledPage):
         self.p4projparams = ''
         self.p4projparams = ''
         self.projdesc = ''
         self.projdesc = ''
 
 
-        radioSBox = wx.StaticBox(
+        radioSBox = StaticBox(
             parent=self, id=wx.ID_ANY, label=" %s " %
             parent=self, id=wx.ID_ANY, label=" %s " %
             _("Select datum or ellipsoid (next page)"))
             _("Select datum or ellipsoid (next page)"))
         radioSBSizer = wx.StaticBoxSizer(radioSBox)
         radioSBSizer = wx.StaticBoxSizer(radioSBox)
@@ -849,7 +852,7 @@ class ProjParamsPage(TitledPage):
         """Go to next page"""
         """Go to next page"""
         if event.GetDirection():
         if event.GetDirection():
             self.p4projparams = ''
             self.p4projparams = ''
-            for id, param in self.pparam.iteritems():
+            for id, param in six.iteritems(self.pparam):
                 if param['type'] == 'bool':
                 if param['type'] == 'bool':
                     if param['value'] == False:
                     if param['value'] == False:
                         continue
                         continue
@@ -875,7 +878,7 @@ class ProjParamsPage(TitledPage):
         self.projdesc = self.parent.projections[self.parent.projpage.proj][0]
         self.projdesc = self.parent.projections[self.parent.projpage.proj][0]
         if self.prjParamSizer is None:
         if self.prjParamSizer is None:
             # entering page for the first time
             # entering page for the first time
-            self.paramSBox = wx.StaticBox(
+            self.paramSBox = StaticBox(
                 parent=self,
                 parent=self,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_(" Enter parameters for %s projection ") %
                 label=_(" Enter parameters for %s projection ") %
@@ -922,7 +925,7 @@ class ProjParamsPage(TitledPage):
                 else:
                 else:
                     param['value'] = paramgrp[2]
                     param['value'] = paramgrp[2]
 
 
-                label = wx.StaticText(
+                label = StaticText(
                     parent=self.panel,
                     parent=self.panel,
                     id=wx.ID_ANY,
                     id=wx.ID_ANY,
                     label=param['desc'],
                     label=param['desc'],
@@ -941,9 +944,9 @@ class ProjParamsPage(TitledPage):
                     win.Bind(wx.EVT_SPINCTRL, self.OnParamEntry)
                     win.Bind(wx.EVT_SPINCTRL, self.OnParamEntry)
                     win.Bind(wx.EVT_TEXT, self.OnParamEntry)
                     win.Bind(wx.EVT_TEXT, self.OnParamEntry)
                 else:
                 else:
-                    win = wx.TextCtrl(parent=self.panel, id=id,
-                                      value=param['value'],
-                                      size=(100, -1))
+                    win = TextCtrl(parent=self.panel, id=id,
+                                   value=param['value'],
+                                   size=(100, -1))
                     win.Bind(wx.EVT_TEXT, self.OnParamEntry)
                     win.Bind(wx.EVT_TEXT, self.OnParamEntry)
                     if paramgrp[1] == 'noask':
                     if paramgrp[1] == 'noask':
                         win.Enable(False)
                         win.Enable(False)
@@ -1699,7 +1702,7 @@ class EPSGPage(TitledPage):
             return
             return
 
 
         data = list()
         data = list()
-        for code, val in self.epsgCodeDict.iteritems():
+        for code, val in six.iteritems(self.epsgCodeDict):
             if code is not None:
             if code is not None:
                 data.append((code, val[0], val[1]))
                 data.append((code, val[0], val[1]))
 
 
@@ -1946,7 +1949,7 @@ class IAUPage(TitledPage):
             return
             return
 
 
         data = list()
         data = list()
-        for code, val in self.epsgCodeDict.iteritems():
+        for code, val in six.iteritems(self.epsgCodeDict):
             if code is not None:
             if code is not None:
                 data.append((code, val[0], val[1]))
                 data.append((code, val[0], val[1]))
 
 

+ 3 - 2
gui/wxpython/mapdisp/frame.py

@@ -48,6 +48,7 @@ from mapwin.analysis import ProfileController, MeasureDistanceController, \
 from gui_core.forms import GUI
 from gui_core.forms import GUI
 from core.giface import Notification
 from core.giface import Notification
 from gui_core.vselect import VectorSelectBase, VectorSelectHighlighter
 from gui_core.vselect import VectorSelectBase, VectorSelectHighlighter
+from gui_core.wrap import Menu
 from mapdisp import statusbar as sb
 from mapdisp import statusbar as sb
 
 
 import grass.script as grass
 import grass.script as grass
@@ -806,7 +807,7 @@ class MapFrame(SingleMapFrame):
         """
         """
         Print options and output menu for map display
         Print options and output menu for map display
         """
         """
-        printmenu = wx.Menu()
+        printmenu = Menu()
         # Add items to the menu
         # Add items to the menu
         setup = wx.MenuItem(printmenu, wx.ID_ANY, _('Page setup'))
         setup = wx.MenuItem(printmenu, wx.ID_ANY, _('Page setup'))
         printmenu.AppendItem(setup)
         printmenu.AppendItem(setup)
@@ -1383,7 +1384,7 @@ class MapFrame(SingleMapFrame):
     def OnZoomMenu(self, event):
     def OnZoomMenu(self, event):
         """Popup Zoom menu
         """Popup Zoom menu
         """
         """
-        zoommenu = wx.Menu()
+        zoommenu = Menu()
 
 
         for label, handler in (
         for label, handler in (
             (_('Zoom to default region'),
             (_('Zoom to default region'),

+ 2 - 1
gui/wxpython/mapdisp/main.py

@@ -30,6 +30,7 @@ from __future__ import print_function
 
 
 import os
 import os
 import sys
 import sys
+import six
 import time
 import time
 import shutil
 import shutil
 import fileinput
 import fileinput
@@ -562,7 +563,7 @@ class MapApp(wx.App):
             # stop the timer
             # stop the timer
             # self.timer.Stop()
             # self.timer.Stop()
             # terminate thread
             # terminate thread
-            for f in monFile.itervalues():
+            for f in six.itervalues(monFile):
                 try_remove(f)
                 try_remove(f)
 
 
     def watcher(self):
     def watcher(self):

+ 7 - 5
gui/wxpython/mapdisp/statusbar.py

@@ -38,16 +38,18 @@ from core import utils
 from core.gcmd import GMessage, RunCommand
 from core.gcmd import GMessage, RunCommand
 from core.settings import UserSettings
 from core.settings import UserSettings
 from core.utils import _
 from core.utils import _
+from gui_core.wrap import StaticText, TextCtrl
 
 
 from grass.script import core as grass
 from grass.script import core as grass
 
 
 from grass.pydispatch.signal import Signal
 from grass.pydispatch.signal import Signal
 
 
 
 
-class SbException:
+class SbException(Exception):
     """Exception class used in SbManager and SbItems"""
     """Exception class used in SbManager and SbItems"""
 
 
     def __init__(self, message):
     def __init__(self, message):
+#        Exception.__init__(self, message)
         self.message = message
         self.message = message
 
 
     def __str__(self):
     def __str__(self):
@@ -676,9 +678,9 @@ class SbGoTo(SbItem):
         self.name = 'goto'
         self.name = 'goto'
         self.label = _("Go to")
         self.label = _("Go to")
 
 
-        self.widget = wx.TextCtrl(parent=self.statusbar, id=wx.ID_ANY,
-                                  value="", style=wx.TE_PROCESS_ENTER,
-                                  size=(300, -1))
+        self.widget = TextCtrl(parent=self.statusbar, id=wx.ID_ANY,
+                               value="", style=wx.TE_PROCESS_ENTER,
+                               size=(300, -1))
 
 
         self.widget.Hide()
         self.widget.Hide()
 
 
@@ -867,7 +869,7 @@ class SbMask(SbItem):
         SbItem.__init__(self, mapframe, statusbar, position)
         SbItem.__init__(self, mapframe, statusbar, position)
         self.name = 'mask'
         self.name = 'mask'
 
 
-        self.widget = wx.StaticText(
+        self.widget = StaticText(
             parent=self.statusbar,
             parent=self.statusbar,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_('MASK'))
             label=_('MASK'))

+ 3 - 2
gui/wxpython/mapdisp/test_mapdisp.py

@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 
 ############################################################################
 ############################################################################
 #
 #
@@ -67,6 +67,7 @@ from mapwin.buffered import BufferedMapWindow
 from core.render import Map
 from core.render import Map
 from rlisetup.sampling_frame import RLiSetupMapPanel
 from rlisetup.sampling_frame import RLiSetupMapPanel
 from mapdisp.main import LayerList
 from mapdisp.main import LayerList
+from gui_core.wrap import StaticText
 
 
 
 
 class MapdispGrassInterface(StandaloneGrassInterface):
 class MapdispGrassInterface(StandaloneGrassInterface):
@@ -102,7 +103,7 @@ class TextShower(object):
         self._cf = wx.Frame(parent=parent, title=title)
         self._cf = wx.Frame(parent=parent, title=title)
         self._cp = wx.Panel(parent=self._cf, id=wx.ID_ANY)
         self._cp = wx.Panel(parent=self._cf, id=wx.ID_ANY)
         self._cs = wx.BoxSizer(wx.VERTICAL)
         self._cs = wx.BoxSizer(wx.VERTICAL)
-        self._cl = wx.StaticText(
+        self._cl = StaticText(
             parent=self._cp,
             parent=self._cp,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label="No text set yet")
             label="No text set yet")

+ 12 - 12
gui/wxpython/mapswipe/dialogs.py

@@ -27,7 +27,7 @@ from gui_core.preferences import PreferencesBaseDialog
 from core.gcmd import GMessage
 from core.gcmd import GMessage
 from core.layerlist import LayerList
 from core.layerlist import LayerList
 from core.settings import UserSettings
 from core.settings import UserSettings
-from gui_core.wrap import SpinCtrl
+from gui_core.wrap import SpinCtrl, Button, StaticText, StaticBox
 from gui_core.simplelmgr import SimpleLayerManager, SIMPLE_LMGR_RASTER, \
 from gui_core.simplelmgr import SimpleLayerManager, SIMPLE_LMGR_RASTER, \
     SIMPLE_LMGR_VECTOR, SIMPLE_LMGR_RGB, SIMPLE_LMGR_TB_LEFT, SIMPLE_LMGR_TB_RIGHT
     SIMPLE_LMGR_VECTOR, SIMPLE_LMGR_RGB, SIMPLE_LMGR_TB_LEFT, SIMPLE_LMGR_TB_RIGHT
 
 
@@ -60,10 +60,10 @@ class SwipeMapDialog(wx.Dialog):
         self._firstPanel = self._createSimplePanel()
         self._firstPanel = self._createSimplePanel()
         self._secondPanel = self._createAdvancedPanel()
         self._secondPanel = self._createAdvancedPanel()
 
 
-        self.btnSwitch = wx.Button(self)
-        self.btnCancel = wx.Button(self, id=wx.ID_CANCEL)
-        self.btnApply = wx.Button(self, id=wx.ID_APPLY)
-        self.btnOK = wx.Button(self, id=wx.ID_OK)
+        self.btnSwitch = Button(self)
+        self.btnCancel = Button(self, id=wx.ID_CANCEL)
+        self.btnApply = Button(self, id=wx.ID_APPLY)
+        self.btnOK = Button(self, id=wx.ID_OK)
         self.btnOK.SetDefault()
         self.btnOK.SetDefault()
 
 
         self.btnSwitch.Bind(wx.EVT_BUTTON, self.OnSwitchMode)
         self.btnSwitch.Bind(wx.EVT_BUTTON, self.OnSwitchMode)
@@ -125,7 +125,7 @@ class SwipeMapDialog(wx.Dialog):
             validator=SimpleValidator(
             validator=SimpleValidator(
                 callback=self.ValidatorCallback))
                 callback=self.ValidatorCallback))
         sizer.Add(
         sizer.Add(
-            wx.StaticText(
+            StaticText(
                 panel,
                 panel,
                 label=_("Name of top/left raster map:")),
                 label=_("Name of top/left raster map:")),
             proportion=0,
             proportion=0,
@@ -134,7 +134,7 @@ class SwipeMapDialog(wx.Dialog):
         sizer.Add(self._firstRaster, proportion=0,
         sizer.Add(self._firstRaster, proportion=0,
                   flag=wx.EXPAND | wx.ALL, border=1)
                   flag=wx.EXPAND | wx.ALL, border=1)
         sizer.Add(
         sizer.Add(
-            wx.StaticText(
+            StaticText(
                 panel,
                 panel,
                 label=_("Name of bottom/right raster map:")),
                 label=_("Name of bottom/right raster map:")),
             proportion=0,
             proportion=0,
@@ -269,13 +269,13 @@ class PreferencesDialog(PreferencesBaseDialog):
         notebook.AddPage(page=panel, text=_("Mirror mode"))
         notebook.AddPage(page=panel, text=_("Mirror mode"))
 
 
         border = wx.BoxSizer(wx.VERTICAL)
         border = wx.BoxSizer(wx.VERTICAL)
-        box = wx.StaticBox(parent=panel, label=" %s " % _("Mirrored cursor"))
+        box = StaticBox(parent=panel, label=" %s " % _("Mirrored cursor"))
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
 
 
         row = 0
         row = 0
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 label=_("Color:")),
                 label=_("Color:")),
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,
@@ -296,7 +296,7 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
         row += 1
         row += 1
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 label=_("Shape:")),
                 label=_("Shape:")),
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,
@@ -322,7 +322,7 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
         row += 1
         row += 1
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 label=_("Line width:")),
                 label=_("Line width:")),
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,
@@ -345,7 +345,7 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
         row += 1
         row += 1
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 label=_("Size:")),
                 label=_("Size:")),
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,

+ 1 - 0
gui/wxpython/mapswipe/frame.py

@@ -766,6 +766,7 @@ class SwipeMapFrame(DoubleMapFrame):
     def OnCloseWindow(self, event):
     def OnCloseWindow(self, event):
         self.GetFirstMap().Clean()
         self.GetFirstMap().Clean()
         self.GetSecondMap().Clean()
         self.GetSecondMap().Clean()
+        self._mgr.UnInit()
         self.Destroy()
         self.Destroy()
 
 
 
 

+ 4 - 3
gui/wxpython/mapswipe/mapwindow.py

@@ -23,6 +23,7 @@ from core.debug import Debug
 from core.utils import _
 from core.utils import _
 from core.settings import UserSettings
 from core.settings import UserSettings
 from mapwin.buffered import BufferedMapWindow
 from mapwin.buffered import BufferedMapWindow
+from gui_core.wrap import Rect
 
 
 
 
 EVT_MY_MOUSE_EVENTS = wx.NewEventType()
 EVT_MY_MOUSE_EVENTS = wx.NewEventType()
@@ -52,8 +53,8 @@ class SwipeBufferedWindow(BufferedMapWindow):
 
 
     def _bindMouseEvents(self):
     def _bindMouseEvents(self):
         """Binds wx mouse events and custom mouse events"""
         """Binds wx mouse events and custom mouse events"""
-        wx.EVT_MOUSE_EVENTS(self, self._mouseActions)
-        wx.EVT_MOTION(self, self._mouseMotion)
+        self.Bind(wx.EVT_MOUSE_EVENTS, self._mouseActions)
+        self.Bind(wx.EVT_MOTION, self._mouseMotion)
         self.Bind(EVT_MOTION, self.OnMotion)
         self.Bind(EVT_MOTION, self.OnMotion)
         self.Bind(EVT_MOUSE_EVENTS, self.MouseActions)
         self.Bind(EVT_MOUSE_EVENTS, self.MouseActions)
         self.Bind(wx.EVT_CONTEXT_MENU, self.OnContextMenu)
         self.Bind(wx.EVT_CONTEXT_MENU, self.OnContextMenu)
@@ -174,7 +175,7 @@ class SwipeBufferedWindow(BufferedMapWindow):
 
 
     def SetRasterNameText(self, name, textId):
     def SetRasterNameText(self, name, textId):
         """Sets text label with map name."""
         """Sets text label with map name."""
-        self.textdict[textId] = {'bbox': wx.Rect(), 'coords': [10, 10],
+        self.textdict[textId] = {'bbox': Rect(), 'coords': [10, 10],
                                  'font': self.GetFont(), 'color': wx.BLACK,
                                  'font': self.GetFont(), 'color': wx.BLACK,
                                  'background': wx.LIGHT_GREY,
                                  'background': wx.LIGHT_GREY,
                                  'rotation': 0, 'text': name,
                                  'rotation': 0, 'text': name,

+ 2 - 1
gui/wxpython/mapswipe/toolbars.py

@@ -19,6 +19,7 @@ This program is free software under the GNU General Public License
 import wx
 import wx
 
 
 from gui_core.toolbars import BaseToolbar, BaseIcons
 from gui_core.toolbars import BaseToolbar, BaseIcons
+from gui_core.wrap import Menu
 from icons.icon import MetaIcon
 from icons.icon import MetaIcon
 from core.utils import _
 from core.utils import _
 
 
@@ -148,7 +149,7 @@ class SwipeMainToolbar(BaseToolbar):
 
 
     def OnToolMenu(self, event):
     def OnToolMenu(self, event):
         """Menu for additional tools"""
         """Menu for additional tools"""
-        toolMenu = wx.Menu()
+        toolMenu = Menu()
 
 
         for label, itype, handler, desc in (
         for label, itype, handler, desc in (
             (_("Switch orientation"),
             (_("Switch orientation"),

+ 5 - 4
gui/wxpython/mapwin/base.py

@@ -20,6 +20,7 @@ This program is free software under the GNU General Public License
 """
 """
 
 
 import wx
 import wx
+import six
 
 
 from core.settings import UserSettings
 from core.settings import UserSettings
 from core.gcmd import GError
 from core.gcmd import GError
@@ -185,7 +186,7 @@ class MapWindowBase(object):
         """Binds helper functions, which calls all handlers
         """Binds helper functions, which calls all handlers
            registered to events with the events
            registered to events with the events
         """
         """
-        for ev, handlers in self.handlersContainer.iteritems():
+        for ev, handlers in six.iteritems(self.handlersContainer):
             self.Bind(ev, self.EventTypeHandler(handlers))
             self.Bind(ev, self.EventTypeHandler(handlers))
 
 
     def EventTypeHandler(self, evHandlers):
     def EventTypeHandler(self, evHandlers):
@@ -255,7 +256,7 @@ class MapWindowBase(object):
         """
         """
         self.mouseHandlerRegistered.emit()
         self.mouseHandlerRegistered.emit()
         # inserts handler into list
         # inserts handler into list
-        for containerEv, handlers in self.handlersContainer.iteritems():
+        for containerEv, handlers in six.iteritems(self.handlersContainer):
             if event == containerEv:
             if event == containerEv:
                 handlers.append(handler)
                 handlers.append(handler)
 
 
@@ -276,7 +277,7 @@ class MapWindowBase(object):
         Before each handler is unregistered it is called with string
         Before each handler is unregistered it is called with string
         value "unregistered" of event parameter.
         value "unregistered" of event parameter.
         """
         """
-        for containerEv, handlers in self.handlersContainer.iteritems():
+        for containerEv, handlers in six.iteritems(self.handlersContainer):
             for handler in handlers:
             for handler in handlers:
                 try:
                 try:
                     handler("unregistered")
                     handler("unregistered")
@@ -304,7 +305,7 @@ class MapWindowBase(object):
         :return: False if event cannot be unbind
         :return: False if event cannot be unbind
         """
         """
         # removes handler from list
         # removes handler from list
-        for containerEv, handlers in self.handlersContainer.iteritems():
+        for containerEv, handlers in six.iteritems(self.handlersContainer):
             if event != containerEv:
             if event != containerEv:
                 continue
                 continue
             try:
             try:

+ 24 - 23
gui/wxpython/mapwin/buffered.py

@@ -37,7 +37,8 @@ from core.globalvar import wxPythonPhoenix
 import grass.script as grass
 import grass.script as grass
 
 
 from gui_core.dialogs import SavedRegion
 from gui_core.dialogs import SavedRegion
-from gui_core.wrap import DragImage, PseudoDC, EmptyBitmap, BitmapFromImage, Window
+from gui_core.wrap import DragImage, PseudoDC, EmptyBitmap, BitmapFromImage, \
+    Window, Menu, Rect
 from core.gcmd import RunCommand, GException, GError, GMessage
 from core.gcmd import RunCommand, GException, GError, GMessage
 from core.debug import Debug
 from core.debug import Debug
 from core.settings import UserSettings
 from core.settings import UserSettings
@@ -243,7 +244,7 @@ class BufferedMapWindow(MapWindowBase, Window):
             return
             return
 
 
         # generate popup-menu
         # generate popup-menu
-        menu = wx.Menu()
+        menu = Menu()
 
 
         if not hasattr(self, "popupCopyCoordinates"):
         if not hasattr(self, "popupCopyCoordinates"):
             self.popupCopyCoordinates = wx.NewId()
             self.popupCopyCoordinates = wx.NewId()
@@ -275,7 +276,7 @@ class BufferedMapWindow(MapWindowBase, Window):
 
 
         pos = self.ScreenToClient(event.GetPosition())
         pos = self.ScreenToClient(event.GetPosition())
         idlist = self.pdc.FindObjects(pos[0], pos[1], self.hitradius)
         idlist = self.pdc.FindObjects(pos[0], pos[1], self.hitradius)
-        if self.overlays and idlist and [i for i in idlist if i in self.overlays.keys()]:  # legend, scale bar, north arrow, dtext
+        if self.overlays and idlist and [i for i in idlist if i in list(self.overlays.keys())]:  # legend, scale bar, north arrow, dtext
             menu.AppendSeparator()
             menu.AppendSeparator()
             removeId = wx.NewId()
             removeId = wx.NewId()
             self.Bind(wx.EVT_MENU,
             self.Bind(wx.EVT_MENU,
@@ -349,7 +350,7 @@ class BufferedMapWindow(MapWindowBase, Window):
                 bitmap, coords[0],
                 bitmap, coords[0],
                 coords[1],
                 coords[1],
                 True)  # draw the composite map
                 True)  # draw the composite map
-            pdc.SetIdBounds(drawid, wx.Rect(coords[0], coords[1], w, h))
+            pdc.SetIdBounds(drawid, Rect(coords[0], coords[1], w, h))
 
 
         elif pdctype == 'box':  # draw a box on top of the map
         elif pdctype == 'box':  # draw a box on top of the map
             if pen:
             if pen:
@@ -363,7 +364,7 @@ class BufferedMapWindow(MapWindowBase, Window):
                 y1 = min(coords[1], coords[3])
                 y1 = min(coords[1], coords[3])
                 rwidth = x2 - x1
                 rwidth = x2 - x1
                 rheight = y2 - y1
                 rheight = y2 - y1
-                rect = wx.Rect(x1, y1, rwidth, rheight)
+                rect = Rect(x1, y1, rwidth, rheight)
                 pdc.DrawRectangleRect(rect)
                 pdc.DrawRectangleRect(rect)
                 pdc.SetIdBounds(drawid, rect)
                 pdc.SetIdBounds(drawid, rect)
 
 
@@ -376,7 +377,7 @@ class BufferedMapWindow(MapWindowBase, Window):
                         coords[0], coords[1]), wx.Point(
                         coords[0], coords[1]), wx.Point(
                         coords[2], coords[3]))
                         coords[2], coords[3]))
                 pdc.SetIdBounds(
                 pdc.SetIdBounds(
-                    drawid, wx.Rect(
+                    drawid, Rect(
                         coords[0],
                         coords[0],
                         coords[1],
                         coords[1],
                         coords[2],
                         coords[2],
@@ -426,7 +427,7 @@ class BufferedMapWindow(MapWindowBase, Window):
                     x2 = max(xlist)
                     x2 = max(xlist)
                     y1 = min(ylist)
                     y1 = min(ylist)
                     y2 = max(ylist)
                     y2 = max(ylist)
-                    pdc.SetIdBounds(drawid, wx.Rect(x1, y1, x2, y2))
+                    pdc.SetIdBounds(drawid, Rect(x1, y1, x2, y2))
 
 
         elif pdctype == 'polygon':
         elif pdctype == 'polygon':
             if pen:
             if pen:
@@ -439,7 +440,7 @@ class BufferedMapWindow(MapWindowBase, Window):
                 y = min(coords, key=lambda x: x[1])[1]
                 y = min(coords, key=lambda x: x[1])[1]
                 w = max(coords, key=lambda x: x[0])[0] - x
                 w = max(coords, key=lambda x: x[0])[0] - x
                 h = max(coords, key=lambda x: x[1])[1] - y
                 h = max(coords, key=lambda x: x[1])[1] - y
-                pdc.SetIdBounds(drawid, wx.Rect(x, y, w, h))
+                pdc.SetIdBounds(drawid, Rect(x, y, w, h))
 
 
         elif pdctype == 'circle':  # draw circle
         elif pdctype == 'circle':  # draw circle
             if pen:
             if pen:
@@ -454,7 +455,7 @@ class BufferedMapWindow(MapWindowBase, Window):
                                                  coords[3]) - radius,
                                                  coords[3]) - radius,
                     radius=radius)
                     radius=radius)
                 pdc.SetIdBounds(
                 pdc.SetIdBounds(
-                    drawid, wx.Rect(
+                    drawid, Rect(
                         coords[0],
                         coords[0],
                         coords[1],
                         coords[1],
                         coords[2],
                         coords[2],
@@ -468,7 +469,7 @@ class BufferedMapWindow(MapWindowBase, Window):
                                coords[1] - 5,
                                coords[1] - 5,
                                coords[0] + 5,
                                coords[0] + 5,
                                coords[1] + 5)
                                coords[1] + 5)
-                pdc.SetIdBounds(drawid, wx.Rect(coordsBound))
+                pdc.SetIdBounds(drawid, Rect(coordsBound))
 
 
         elif pdctype == 'text':  # draw text on top of map
         elif pdctype == 'text':  # draw text on top of map
             if not img['active']:
             if not img['active']:
@@ -516,7 +517,7 @@ class BufferedMapWindow(MapWindowBase, Window):
             rotation = 0.0
             rotation = 0.0
 
 
         coords = textinfo['coords']
         coords = textinfo['coords']
-        bbox = wx.Rect(coords[0], coords[1], 0, 0)
+        bbox = Rect(coords[0], coords[1], 0, 0)
         relCoords = (0, 0)
         relCoords = (0, 0)
         Debug.msg(4, "BufferedWindow.TextBounds(): text=%s, rotation=%f" %
         Debug.msg(4, "BufferedWindow.TextBounds(): text=%s, rotation=%f" %
                   (textinfo['text'], rotation))
                   (textinfo['text'], rotation))
@@ -612,7 +613,7 @@ class BufferedMapWindow(MapWindowBase, Window):
                 # store buffered image
                 # store buffered image
                 # self.bufferLast = wx.BitmapFromImage(self.buffer.ConvertToImage())
                 # self.bufferLast = wx.BitmapFromImage(self.buffer.ConvertToImage())
                 self.bufferLast = dc.GetAsBitmap(
                 self.bufferLast = dc.GetAsBitmap(
-                    wx.Rect(0, 0, self.Map.width, self.Map.height))
+                    Rect(0, 0, self.Map.width, self.Map.height))
 
 
             self.pdc.DrawBitmap(self.bufferLast, 0, 0, False)
             self.pdc.DrawBitmap(self.bufferLast, 0, 0, False)
             self.pdc.DrawToDC(dc)
             self.pdc.DrawToDC(dc)
@@ -715,7 +716,7 @@ class BufferedMapWindow(MapWindowBase, Window):
         renderMgr = self.Map.GetRenderMgr()
         renderMgr = self.Map.GetRenderMgr()
         renderMgr.renderDone.disconnect(self._saveToFileDone)
         renderMgr.renderDone.disconnect(self._saveToFileDone)
 
 
-        ibuffer = wx.EmptyBitmap(
+        ibuffer = EmptyBitmap(
             max(1, self.Map.width),
             max(1, self.Map.width),
             max(1, self.Map.height))
             max(1, self.Map.height))
 
 
@@ -739,7 +740,7 @@ class BufferedMapWindow(MapWindowBase, Window):
                           pdctype=self.overlays[id].pdcType, coords=coords)
                           pdctype=self.overlays[id].pdcType, coords=coords)
 
 
         # redraw text labels
         # redraw text labels
-        for id in self.textdict.keys():
+        for id in list(self.textdict.keys()):
             textinfo = self.textdict[id]
             textinfo = self.textdict[id]
             oldCoords = textinfo['coords']
             oldCoords = textinfo['coords']
             textinfo['coords'] = ratio[0] * textinfo['coords'][0],\
             textinfo['coords'] = ratio[0] * textinfo['coords'][0],\
@@ -783,7 +784,7 @@ class BufferedMapWindow(MapWindowBase, Window):
                     overlay.mapfile):
                     overlay.mapfile):
                 img = utils.autoCropImageFromFile(overlay.mapfile)
                 img = utils.autoCropImageFromFile(overlay.mapfile)
 
 
-                for key in self.imagedict.keys():
+                for key in list(self.imagedict.keys()):
                     if self.imagedict[key]['id'] == overlay.id:
                     if self.imagedict[key]['id'] == overlay.id:
                         del self.imagedict[key]
                         del self.imagedict[key]
 
 
@@ -807,7 +808,7 @@ class BufferedMapWindow(MapWindowBase, Window):
         else:
         else:
             img = None
             img = None
 
 
-        for key in self.imagedict.keys():
+        for key in list(self.imagedict.keys()):
             if self.imagedict[key]['id'] == imgId:
             if self.imagedict[key]['id'] == imgId:
                 del self.imagedict[key]
                 del self.imagedict[key]
 
 
@@ -967,7 +968,7 @@ class BufferedMapWindow(MapWindowBase, Window):
                           pdctype=self.overlays[id].pdcType,
                           pdctype=self.overlays[id].pdcType,
                           coords=self.overlays[id].coords)
                           coords=self.overlays[id].coords)
 
 
-        for id in self.textdict.keys():
+        for id in list(self.textdict.keys()):
             self.Draw(self.pdc, img=self.textdict[id], drawid=id,
             self.Draw(self.pdc, img=self.textdict[id], drawid=id,
                       pdctype='text', coords=[10, 10, 10, 10])
                       pdctype='text', coords=[10, 10, 10, 10])
 
 
@@ -1072,7 +1073,7 @@ class BufferedMapWindow(MapWindowBase, Window):
         r = self.pdc.GetIdBounds(id)
         r = self.pdc.GetIdBounds(id)
 
 
         if isinstance(r, list):
         if isinstance(r, list):
-            r = wx.Rect(r[0], r[1], r[2], r[3])
+            r = Rect(r[0], r[1], r[2], r[3])
         if id in self.textdict:  # text dragging
         if id in self.textdict:  # text dragging
             rtop = (r[0], r[1] - r[3], r[2], r[3])
             rtop = (r[0], r[1] - r[3], r[2], r[3])
             r = r.Union(rtop)
             r = r.Union(rtop)
@@ -1083,7 +1084,7 @@ class BufferedMapWindow(MapWindowBase, Window):
 
 
         r2 = self.pdc.GetIdBounds(id)
         r2 = self.pdc.GetIdBounds(id)
         if isinstance(r2, list):
         if isinstance(r2, list):
-            r2 = wx.Rect(r[0], r[1], r[2], r[3])
+            r2 = Rect(r[0], r[1], r[2], r[3])
         if id in self.textdict:  # text
         if id in self.textdict:  # text
             self.textdict[id]['bbox'] = r2
             self.textdict[id]['bbox'] = r2
             self.textdict[id]['coords'][0] += dx
             self.textdict[id]['coords'][0] += dx
@@ -1117,7 +1118,7 @@ class BufferedMapWindow(MapWindowBase, Window):
                            end[0], end[1]]
                            end[0], end[1]]
             r = pdc.GetIdBounds(boxid)
             r = pdc.GetIdBounds(boxid)
             if isinstance(r, list):
             if isinstance(r, list):
-                r = wx.Rect(r[0], r[1], r[2], r[3])
+                r = Rect(r[0], r[1], r[2], r[3])
             r.Inflate(4, 4)
             r.Inflate(4, 4)
             try:
             try:
                 pdc.ClearId(boxid)
                 pdc.ClearId(boxid)
@@ -1135,7 +1136,7 @@ class BufferedMapWindow(MapWindowBase, Window):
             x2 = max(begin[0], end[0])
             x2 = max(begin[0], end[0])
             y1 = min(begin[1], end[1])
             y1 = min(begin[1], end[1])
             y2 = max(begin[1], end[1])
             y2 = max(begin[1], end[1])
-            r = wx.Rect(x1, y1, x2 - x1, y2 - y1)
+            r = Rect(x1, y1, x2 - x1, y2 - y1)
             r.Inflate(4, 4)
             r.Inflate(4, 4)
             try:
             try:
                 pdc.ClearId(self.lineid)
                 pdc.ClearId(self.lineid)
@@ -1563,7 +1564,7 @@ class BufferedMapWindow(MapWindowBase, Window):
             self._onLeftUp(event)
             self._onLeftUp(event)
 
 
         elif (self.mouse['use'] == 'pointer' and
         elif (self.mouse['use'] == 'pointer' and
-                self.dragid >= 0):
+                self.dragid and int(self.dragid) >= 0):
             # end drag of overlay decoration
             # end drag of overlay decoration
 
 
             if self.overlays and self.dragid in self.overlays:
             if self.overlays and self.dragid in self.overlays:
@@ -1695,7 +1696,7 @@ class BufferedMapWindow(MapWindowBase, Window):
 
 
         pos = event.GetPosition()
         pos = event.GetPosition()
         idlist = self.pdc.FindObjects(pos[0], pos[1], self.hitradius)
         idlist = self.pdc.FindObjects(pos[0], pos[1], self.hitradius)
-        if self.overlays and idlist and [i for i in idlist if i in self.overlays.keys()]:  # legend, scale bar, north arrow, dtext
+        if self.overlays and idlist and [i for i in idlist if i in list(self.overlays.keys())]:  # legend, scale bar, north arrow, dtext
             self.SetToolTip("Double click in Pointer mode to set object"
             self.SetToolTip("Double click in Pointer mode to set object"
                             " properties,\nright click to remove")
                             " properties,\nright click to remove")
         else:
         else:

+ 41 - 39
gui/wxpython/modules/colorrules.py

@@ -26,6 +26,7 @@ import os
 import shutil
 import shutil
 import copy
 import copy
 import tempfile
 import tempfile
+import six
 
 
 import wx
 import wx
 import wx.lib.colourselect as csel
 import wx.lib.colourselect as csel
@@ -45,7 +46,8 @@ from gui_core.forms import GUI
 from core.debug import Debug as Debug
 from core.debug import Debug as Debug
 from core.settings import UserSettings
 from core.settings import UserSettings
 from gui_core.widgets import ColorTablesComboBox
 from gui_core.widgets import ColorTablesComboBox
-from gui_core.wrap import SpinCtrl, PseudoDC
+from gui_core.wrap import SpinCtrl, PseudoDC, TextCtrl, Button, StaticText, \
+    StaticBox, EmptyBitmap
 
 
 
 
 class RulesPanel:
 class RulesPanel:
@@ -79,12 +81,12 @@ class RulesPanel:
         self.checkAll = wx.CheckBox(parent, id=wx.ID_ANY, label=_("Check all"))
         self.checkAll = wx.CheckBox(parent, id=wx.ID_ANY, label=_("Check all"))
         self.checkAll.SetValue(True)
         self.checkAll.SetValue(True)
         # clear button
         # clear button
-        self.clearAll = wx.Button(parent, id=wx.ID_ANY, label=_("Clear all"))
+        self.clearAll = Button(parent, id=wx.ID_ANY, label=_("Clear all"))
         #  determines how many rules should be added
         #  determines how many rules should be added
         self.numRules = SpinCtrl(parent, id=wx.ID_ANY,
         self.numRules = SpinCtrl(parent, id=wx.ID_ANY,
                                  min=1, max=1e6, initial=1)
                                  min=1, max=1e6, initial=1)
         # add rules
         # add rules
-        self.btnAdd = wx.Button(parent, id=wx.ID_ADD)
+        self.btnAdd = Button(parent, id=wx.ID_ADD)
 
 
         self.btnAdd.Bind(wx.EVT_BUTTON, self.OnAddRules)
         self.btnAdd.Bind(wx.EVT_BUTTON, self.OnAddRules)
         self.checkAll.Bind(wx.EVT_CHECKBOX, self.OnCheckAll)
         self.checkAll.Bind(wx.EVT_CHECKBOX, self.OnCheckAll)
@@ -133,11 +135,11 @@ class RulesPanel:
             enable.SetName('enable')
             enable.SetName('enable')
             enable.Bind(wx.EVT_CHECKBOX, self.OnRuleEnable)
             enable.Bind(wx.EVT_CHECKBOX, self.OnRuleEnable)
             # value
             # value
-            txt_ctrl = wx.TextCtrl(parent=self.mainPanel, id=1000 + num,
+            txt_ctrl = TextCtrl(parent=self.mainPanel, id=1000 + num,
                                    size=(80, -1),
                                    size=(80, -1),
                                    style=wx.TE_NOHIDESEL)
                                    style=wx.TE_NOHIDESEL)
             if self.mapType == 'vector':
             if self.mapType == 'vector':
-                txt_ctrl.SetToolTipString(_("Enter vector attribute values"))
+                txt_ctrl.SetToolTip(_("Enter vector attribute values"))
             txt_ctrl.Bind(wx.EVT_TEXT, self.OnRuleValue)
             txt_ctrl.Bind(wx.EVT_TEXT, self.OnRuleValue)
             txt_ctrl.SetName('source')
             txt_ctrl.SetName('source')
             if self.attributeType == 'color':
             if self.attributeType == 'color':
@@ -413,8 +415,8 @@ class ColorTable(wx.Frame):
             maplabel = _('Select raster map:')
             maplabel = _('Select raster map:')
         else:
         else:
             maplabel = _('Select vector map:')
             maplabel = _('Select vector map:')
-        inputBox = wx.StaticBox(parent, id=wx.ID_ANY,
-                                label=" %s " % maplabel)
+        inputBox = StaticBox(parent, id=wx.ID_ANY,
+                             label=" %s " % maplabel)
         inputSizer = wx.StaticBoxSizer(inputBox, wx.VERTICAL)
         inputSizer = wx.StaticBoxSizer(inputBox, wx.VERTICAL)
 
 
         self.selectionInput = Select(parent=parent, id=wx.ID_ANY,
         self.selectionInput = Select(parent=parent, id=wx.ID_ANY,
@@ -430,7 +432,7 @@ class ColorTable(wx.Frame):
 
 
     def _createFileSelection(self, parent):
     def _createFileSelection(self, parent):
         """Create file (open/save rules) selection part of dialog"""
         """Create file (open/save rules) selection part of dialog"""
-        inputBox = wx.StaticBox(
+        inputBox = StaticBox(
             parent, id=wx.ID_ANY, label=" %s " %
             parent, id=wx.ID_ANY, label=" %s " %
             _("Import or export color table:"))
             _("Import or export color table:"))
         inputSizer = wx.StaticBoxSizer(inputBox, wx.HORIZONTAL)
         inputSizer = wx.StaticBoxSizer(inputBox, wx.HORIZONTAL)
@@ -459,7 +461,7 @@ class ColorTable(wx.Frame):
             size=globalvar.DIALOG_COMBOBOX_SIZE,
             size=globalvar.DIALOG_COMBOBOX_SIZE,
             choices=utils.GetColorTables(),
             choices=utils.GetColorTables(),
             name="colorTableChoice")
             name="colorTableChoice")
-        self.btnSet = wx.Button(
+        self.btnSet = Button(
             parent=parent,
             parent=parent,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_("&Set"),
             label=_("&Set"),
@@ -470,12 +472,12 @@ class ColorTable(wx.Frame):
         # layout
         # layout
         gridSizer = wx.GridBagSizer(hgap=2, vgap=2)
         gridSizer = wx.GridBagSizer(hgap=2, vgap=2)
 
 
-        gridSizer.Add(wx.StaticText(parent, label=_("Load color table:")),
+        gridSizer.Add(StaticText(parent, label=_("Load color table:")),
                       pos=(0, 0), flag=wx.ALIGN_CENTER_VERTICAL)
                       pos=(0, 0), flag=wx.ALIGN_CENTER_VERTICAL)
         gridSizer.Add(colorTable, pos=(0, 1))
         gridSizer.Add(colorTable, pos=(0, 1))
         gridSizer.Add(self.btnSet, pos=(0, 2), flag=wx.ALIGN_RIGHT)
         gridSizer.Add(self.btnSet, pos=(0, 2), flag=wx.ALIGN_RIGHT)
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent, label=_('Load color table from file:')), pos=(
                 parent, label=_('Load color table from file:')), pos=(
                 1, 0), flag=wx.ALIGN_CENTER_VERTICAL)
                 1, 0), flag=wx.ALIGN_CENTER_VERTICAL)
         gridSizer.Add(
         gridSizer.Add(
@@ -483,7 +485,7 @@ class ColorTable(wx.Frame):
                 1, 1), span=(
                 1, 1), span=(
                 1, 2), flag=wx.EXPAND)
                 1, 2), flag=wx.EXPAND)
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent, label=_('Save color table to file:')), pos=(
                 parent, label=_('Save color table to file:')), pos=(
                 2, 0), flag=wx.ALIGN_CENTER_VERTICAL)
                 2, 0), flag=wx.ALIGN_CENTER_VERTICAL)
         gridSizer.Add(
         gridSizer.Add(
@@ -511,12 +513,12 @@ class ColorTable(wx.Frame):
 
 
     def _createButtons(self, parent):
     def _createButtons(self, parent):
         """Create buttons for leaving dialog"""
         """Create buttons for leaving dialog"""
-        self.btnHelp = wx.Button(parent, id=wx.ID_HELP)
-        self.btnCancel = wx.Button(parent, id=wx.ID_CANCEL)
-        self.btnApply = wx.Button(parent, id=wx.ID_APPLY)
-        self.btnOK = wx.Button(parent, id=wx.ID_OK)
-        self.btnDefault = wx.Button(parent, id=wx.ID_ANY,
-                                    label=_("Reload default table"))
+        self.btnHelp = Button(parent, id=wx.ID_HELP)
+        self.btnCancel = Button(parent, id=wx.ID_CANCEL)
+        self.btnApply = Button(parent, id=wx.ID_APPLY)
+        self.btnOK = Button(parent, id=wx.ID_OK)
+        self.btnDefault = Button(parent, id=wx.ID_ANY,
+                                 label=_("Reload default table"))
 
 
         self.btnOK.SetDefault()
         self.btnOK.SetDefault()
         self.btnOK.Enable(False)
         self.btnOK.Enable(False)
@@ -545,7 +547,7 @@ class ColorTable(wx.Frame):
 
 
         row = 0
         row = 0
         # label with range
         # label with range
-        self.cr_label = wx.StaticText(parent, id=wx.ID_ANY)
+        self.cr_label = StaticText(parent, id=wx.ID_ANY)
         bodySizer.Add(self.cr_label, pos=(row, 0), span=(1, 3),
         bodySizer.Add(self.cr_label, pos=(row, 0), span=(1, 3),
                       flag=wx.ALL, border=5)
                       flag=wx.ALL, border=5)
 
 
@@ -578,12 +580,12 @@ class ColorTable(wx.Frame):
         bodySizer.Add(self.rulesPanel.clearAll, pos=(row, 1))
         bodySizer.Add(self.rulesPanel.clearAll, pos=(row, 1))
 
 
         # preview button
         # preview button
-        self.btnPreview = wx.Button(parent, id=wx.ID_ANY,
+        self.btnPreview = Button(parent, id=wx.ID_ANY,
                                     label=_("Preview"))
                                     label=_("Preview"))
         bodySizer.Add(self.btnPreview, pos=(row, 2),
         bodySizer.Add(self.btnPreview, pos=(row, 2),
                       flag=wx.ALIGN_RIGHT)
                       flag=wx.ALIGN_RIGHT)
         self.btnPreview.Enable(False)
         self.btnPreview.Enable(False)
-        self.btnPreview.SetToolTipString(
+        self.btnPreview.SetToolTip(
             _("Show preview of map " "(current Map Display extent is used)."))
             _("Show preview of map " "(current Map Display extent is used)."))
 
 
         row += 1
         row += 1
@@ -682,7 +684,7 @@ class ColorTable(wx.Frame):
                 return
                 return
 
 
         rulestxt = ''
         rulestxt = ''
-        for rule in self.rulesPanel.ruleslines.itervalues():
+        for rule in six.itervalues(self.rulesPanel.ruleslines):
             if 'value' not in rule:
             if 'value' not in rule:
                 continue
                 continue
             rulestxt += rule['value'] + ' ' + rule['color'] + '\n'
             rulestxt += rule['value'] + ' ' + rule['color'] + '\n'
@@ -793,7 +795,7 @@ class ColorTable(wx.Frame):
         """
         """
         rulestxt = ''
         rulestxt = ''
 
 
-        for rule in self.rulesPanel.ruleslines.itervalues():
+        for rule in six.itervalues(self.rulesPanel.ruleslines):
             if 'value' not in rule:  # skip empty rules
             if 'value' not in rule:  # skip empty rules
                 continue
                 continue
 
 
@@ -1105,12 +1107,12 @@ class VectorColorTable(ColorTable):
 
 
     def _createVectorAttrb(self, parent):
     def _createVectorAttrb(self, parent):
         """Create part of dialog with layer/column selection"""
         """Create part of dialog with layer/column selection"""
-        inputBox = wx.StaticBox(parent=parent, id=wx.ID_ANY,
-                                label=" %s " % _("Select vector columns"))
-        cb_vl_label = wx.StaticText(parent, id=wx.ID_ANY,
-                                    label=_('Layer:'))
-        cb_vc_label = wx.StaticText(parent, id=wx.ID_ANY,
-                                    label=_('Attribute column:'))
+        inputBox = StaticBox(parent=parent, id=wx.ID_ANY,
+                             label=" %s " % _("Select vector columns"))
+        cb_vl_label = StaticText(parent, id=wx.ID_ANY,
+                                 label=_('Layer:'))
+        cb_vc_label = StaticText(parent, id=wx.ID_ANY,
+                                 label=_('Attribute column:'))
 
 
         if self.attributeType == 'color':
         if self.attributeType == 'color':
             labels = [_("Load color from column:"), _("Save color to column:")]
             labels = [_("Load color from column:"), _("Save color to column:")]
@@ -1125,19 +1127,19 @@ class VectorColorTable(ColorTable):
                 label=_("Use color column instead of color table:"))
                 label=_("Use color column instead of color table:"))
             self.useColumn.Bind(wx.EVT_CHECKBOX, self.OnCheckColumn)
             self.useColumn.Bind(wx.EVT_CHECKBOX, self.OnCheckColumn)
 
 
-        fromColumnLabel = wx.StaticText(parent, id=wx.ID_ANY,
-                                        label=labels[0])
-        toColumnLabel = wx.StaticText(parent, id=wx.ID_ANY,
-                                      label=labels[1])
+        fromColumnLabel = StaticText(parent, id=wx.ID_ANY,
+                                     label=labels[0])
+        toColumnLabel = StaticText(parent, id=wx.ID_ANY,
+                                   label=labels[1])
 
 
-        self.rgb_range_label = wx.StaticText(parent, id=wx.ID_ANY)
+        self.rgb_range_label = StaticText(parent, id=wx.ID_ANY)
         self.layerSelect = LayerSelect(parent)
         self.layerSelect = LayerSelect(parent)
         self.sourceColumn = ColumnSelect(parent)
         self.sourceColumn = ColumnSelect(parent)
         self.fromColumn = ColumnSelect(parent)
         self.fromColumn = ColumnSelect(parent)
         self.toColumn = ColumnSelect(parent)
         self.toColumn = ColumnSelect(parent)
-        self.addColumn = wx.Button(parent, id=wx.ID_ANY,
+        self.addColumn = Button(parent, id=wx.ID_ANY,
                                    label=_('Add column'))
                                    label=_('Add column'))
-        self.addColumn.SetToolTipString(
+        self.addColumn.SetToolTip(
             _("Add GRASSRGB column to current attribute table."))
             _("Add GRASSRGB column to current attribute table."))
 
 
         # layout
         # layout
@@ -1808,7 +1810,7 @@ class VectorColorTable(ColorTable):
         """
         """
         rulestxt = ''
         rulestxt = ''
 
 
-        for rule in self.rulesPanel.ruleslines.itervalues():
+        for rule in six.itervalues(self.rulesPanel.ruleslines):
             if 'value' not in rule:  # skip empty rules
             if 'value' not in rule:  # skip empty rules
                 break
                 break
 
 
@@ -1991,7 +1993,7 @@ class BufferedWindow(wx.Window):
 
 
     def OnPaint(self, event):
     def OnPaint(self, event):
         """Draw pseudo DC to buffer"""
         """Draw pseudo DC to buffer"""
-        self._Buffer = wx.EmptyBitmap(self.Map.width, self.Map.height)
+        self._Buffer = EmptyBitmap(self.Map.width, self.Map.height)
         dc = wx.BufferedPaintDC(self, self._Buffer)
         dc = wx.BufferedPaintDC(self, self._Buffer)
 
 
         # use PrepareDC to set position correctly
         # use PrepareDC to set position correctly
@@ -2019,7 +2021,7 @@ class BufferedWindow(wx.Window):
         # Make new off screen bitmap: this bitmap will always have the
         # Make new off screen bitmap: this bitmap will always have the
         # current drawing in it, so it can be used to save the image to
         # current drawing in it, so it can be used to save the image to
         # a file, or whatever.
         # a file, or whatever.
-        self._Buffer = wx.EmptyBitmap(self.Map.width, self.Map.height)
+        self._Buffer = EmptyBitmap(self.Map.width, self.Map.height)
 
 
         # get the image to be rendered
         # get the image to be rendered
         self.img = self.GetImage()
         self.img = self.GetImage()

+ 23 - 22
gui/wxpython/modules/extensions.py

@@ -33,6 +33,7 @@ from core.menutree import TreeModel, ModuleNode
 from gui_core.widgets import GListCtrl, SearchModuleWidget
 from gui_core.widgets import GListCtrl, SearchModuleWidget
 from gui_core.treeview import CTreeView
 from gui_core.treeview import CTreeView
 from core.toolboxes import toolboxesOutdated
 from core.toolboxes import toolboxesOutdated
+from gui_core.wrap import Button, StaticBox, TextCtrl, Menu
 
 
 
 
 class InstallExtensionWindow(wx.Frame):
 class InstallExtensionWindow(wx.Frame):
@@ -53,14 +54,14 @@ class InstallExtensionWindow(wx.Frame):
 
 
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
 
 
-        self.repoBox = wx.StaticBox(
+        self.repoBox = StaticBox(
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             _("Repository (leave empty to use the official one)"))
             _("Repository (leave empty to use the official one)"))
-        self.treeBox = wx.StaticBox(
+        self.treeBox = StaticBox(
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             _("List of extensions - double-click to install"))
             _("List of extensions - double-click to install"))
 
 
-        self.repo = wx.TextCtrl(parent=self.panel, id=wx.ID_ANY)
+        self.repo = TextCtrl(parent=self.panel, id=wx.ID_ANY)
 
 
         # modelBuilder loads data into tree model
         # modelBuilder loads data into tree model
         self.modelBuilder = ExtensionTreeModelBuilder()
         self.modelBuilder = ExtensionTreeModelBuilder()
@@ -81,8 +82,8 @@ class InstallExtensionWindow(wx.Frame):
         # load data in different thread
         # load data in different thread
         self.thread = gThread()
         self.thread = gThread()
 
 
-        self.optionBox = wx.StaticBox(parent=self.panel, id=wx.ID_ANY,
-                                      label=" %s " % _("Options"))
+        self.optionBox = StaticBox(parent=self.panel, id=wx.ID_ANY,
+                                   label=" %s " % _("Options"))
         task = gtask.parse_interface('g.extension')
         task = gtask.parse_interface('g.extension')
         ignoreFlags = ['l', 'c', 'g', 'a', 'f', 't', 'help', 'quiet']
         ignoreFlags = ['l', 'c', 'g', 'a', 'f', 't', 'help', 'quiet']
         if sys.platform == 'win32':
         if sys.platform == 'win32':
@@ -109,18 +110,18 @@ class InstallExtensionWindow(wx.Frame):
 
 
         self.statusbar = self.CreateStatusBar(number=1)
         self.statusbar = self.CreateStatusBar(number=1)
 
 
-        self.btnFetch = wx.Button(parent=self.panel, id=wx.ID_ANY,
-                                  label=_("&Fetch"))
-        self.btnFetch.SetToolTipString(_("Fetch list of available modules "
-                                         "from GRASS Addons SVN repository"))
-        self.btnClose = wx.Button(parent=self.panel, id=wx.ID_CLOSE)
-        self.btnInstall = wx.Button(parent=self.panel, id=wx.ID_ANY,
-                                    label=_("&Install"))
-        self.btnInstall.SetToolTipString(
+        self.btnFetch = Button(parent=self.panel, id=wx.ID_ANY,
+                               label=_("&Fetch"))
+        self.btnFetch.SetToolTip(_("Fetch list of available modules "
+                                   "from GRASS Addons SVN repository"))
+        self.btnClose = Button(parent=self.panel, id=wx.ID_CLOSE)
+        self.btnInstall = Button(parent=self.panel, id=wx.ID_ANY,
+                                 label=_("&Install"))
+        self.btnInstall.SetToolTip(
             _("Install selected add-ons GRASS module"))
             _("Install selected add-ons GRASS module"))
         self.btnInstall.Enable(False)
         self.btnInstall.Enable(False)
-        self.btnHelp = wx.Button(parent=self.panel, id=wx.ID_HELP)
-        self.btnHelp.SetToolTipString(_("Show g.extension manual page"))
+        self.btnHelp = Button(parent=self.panel, id=wx.ID_HELP)
+        self.btnHelp.SetToolTip(_("Show g.extension manual page"))
 
 
         self.btnClose.Bind(wx.EVT_BUTTON, lambda evt: self.Close())
         self.btnClose.Bind(wx.EVT_BUTTON, lambda evt: self.Close())
         self.btnFetch.Bind(wx.EVT_BUTTON, self.OnFetch)
         self.btnFetch.Bind(wx.EVT_BUTTON, self.OnFetch)
@@ -234,7 +235,7 @@ class InstallExtensionWindow(wx.Frame):
 
 
         data = node.data
         data = node.data
         if data and 'command' in data:
         if data and 'command' in data:
-            self.popupMenu = wx.Menu()
+            self.popupMenu = Menu()
             self.popupMenu.Append(self.popupID['install'], text=_("Install"))
             self.popupMenu.Append(self.popupID['install'], text=_("Install"))
             self.Bind(wx.EVT_MENU, self.OnInstall, id=self.popupID['install'])
             self.Bind(wx.EVT_MENU, self.OnInstall, id=self.popupID['install'])
             self.popupMenu.AppendSeparator()
             self.popupMenu.AppendSeparator()
@@ -401,27 +402,27 @@ class ManageExtensionWindow(wx.Frame):
 
 
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
 
 
-        self.extBox = wx.StaticBox(
+        self.extBox = StaticBox(
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             _("List of installed extensions"))
             _("List of installed extensions"))
 
 
         self.extList = CheckListExtension(parent=self.panel)
         self.extList = CheckListExtension(parent=self.panel)
 
 
         # buttons
         # buttons
-        self.btnUninstall = wx.Button(
+        self.btnUninstall = Button(
             parent=self.panel,
             parent=self.panel,
             id=wx.ID_REMOVE,
             id=wx.ID_REMOVE,
             label=_("Uninstall"))
             label=_("Uninstall"))
-        self.btnUninstall.SetToolTipString(
+        self.btnUninstall.SetToolTip(
             _("Uninstall selected Addons extensions"))
             _("Uninstall selected Addons extensions"))
-        self.btnUpdate = wx.Button(
+        self.btnUpdate = Button(
             parent=self.panel,
             parent=self.panel,
             id=wx.ID_REFRESH,
             id=wx.ID_REFRESH,
             label=_("Reinstall"))
             label=_("Reinstall"))
-        self.btnUpdate.SetToolTipString(
+        self.btnUpdate.SetToolTip(
             _("Reinstall selected Addons extensions"))
             _("Reinstall selected Addons extensions"))
 
 
-        self.btnClose = wx.Button(parent=self.panel, id=wx.ID_CLOSE)
+        self.btnClose = Button(parent=self.panel, id=wx.ID_CLOSE)
 
 
         self.btnUninstall.Bind(wx.EVT_BUTTON, self.OnUninstall)
         self.btnUninstall.Bind(wx.EVT_BUTTON, self.OnUninstall)
         self.btnUpdate.Bind(wx.EVT_BUTTON, self.OnUpdate)
         self.btnUpdate.Bind(wx.EVT_BUTTON, self.OnUpdate)

+ 5 - 5
gui/wxpython/modules/histogram.py

@@ -32,7 +32,7 @@ from gui_core.preferences import DefaultFontDialog
 from core.debug import Debug
 from core.debug import Debug
 from core.gcmd import GError
 from core.gcmd import GError
 from gui_core.toolbars import BaseToolbar, BaseIcons
 from gui_core.toolbars import BaseToolbar, BaseIcons
-from gui_core.wrap import PseudoDC
+from gui_core.wrap import PseudoDC, Menu, EmptyBitmap
 
 
 
 
 class BufferedWindow(wx.Window):
 class BufferedWindow(wx.Window):
@@ -80,7 +80,7 @@ class BufferedWindow(wx.Window):
 
 
         self.pdc = PseudoDC()
         self.pdc = PseudoDC()
         # will store an off screen empty bitmap for saving to file
         # will store an off screen empty bitmap for saving to file
-        self._buffer = wx.EmptyBitmap(
+        self._buffer = EmptyBitmap(
             max(1, self.Map.width),
             max(1, self.Map.width),
             max(1, self.Map.height))
             max(1, self.Map.height))
 
 
@@ -160,7 +160,7 @@ class BufferedWindow(wx.Window):
         # Make new off screen bitmap: this bitmap will always have the
         # Make new off screen bitmap: this bitmap will always have the
         # current drawing in it, so it can be used to save the image to
         # current drawing in it, so it can be used to save the image to
         # a file, or whatever.
         # a file, or whatever.
-        self._buffer = wx.EmptyBitmap(self.Map.width, self.Map.height)
+        self._buffer = EmptyBitmap(self.Map.width, self.Map.height)
 
 
         # get the image to be rendered
         # get the image to be rendered
         self.img = self.GetImage()
         self.img = self.GetImage()
@@ -193,7 +193,7 @@ class BufferedWindow(wx.Window):
         wx.Yield()
         wx.Yield()
 
 
         self.Map.ChangeMapSize((width, height))
         self.Map.ChangeMapSize((width, height))
-        ibuffer = wx.EmptyBitmap(max(1, width), max(1, height))
+        ibuffer = EmptyBitmap(max(1, width), max(1, height))
         self.Map.Render(force=True, windres=True)
         self.Map.Render(force=True, windres=True)
         img = self.GetImage()
         img = self.GetImage()
         self.Draw(self.pdc, img, drawid=99)
         self.Draw(self.pdc, img, drawid=99)
@@ -496,7 +496,7 @@ class HistogramFrame(wx.Frame):
         """Print options and output menu
         """Print options and output menu
         """
         """
         point = wx.GetMousePosition()
         point = wx.GetMousePosition()
-        printmenu = wx.Menu()
+        printmenu = Menu()
         # Add items to the menu
         # Add items to the menu
         setup = wx.MenuItem(printmenu, id=wx.ID_ANY, text=_('Page setup'))
         setup = wx.MenuItem(printmenu, id=wx.ID_ANY, text=_('Page setup'))
         printmenu.AppendItem(setup)
         printmenu.AppendItem(setup)

+ 5 - 5
gui/wxpython/modules/import_export.py

@@ -40,7 +40,7 @@ from core.gcmd import RunCommand, GMessage, GWarning
 from gui_core.forms import CmdPanel
 from gui_core.forms import CmdPanel
 from gui_core.gselect import OgrTypeSelect, GdalSelect, SubGroupSelect
 from gui_core.gselect import OgrTypeSelect, GdalSelect, SubGroupSelect
 from gui_core.widgets import LayersList, GListCtrl, GNotebook
 from gui_core.widgets import LayersList, GListCtrl, GNotebook
-from gui_core.wrap import Button
+from gui_core.wrap import Button, StaticText, StaticBox
 from core.utils import GetValidLayerName, _
 from core.utils import GetValidLayerName, _
 from core.settings import UserSettings, GetDisplayVectSettings
 from core.settings import UserSettings, GetDisplayVectSettings
 
 
@@ -64,7 +64,7 @@ class ImportDialog(wx.Dialog):
 
 
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
 
 
-        self.layerBox = wx.StaticBox(parent=self.panel, id=wx.ID_ANY)
+        self.layerBox = StaticBox(parent=self.panel, id=wx.ID_ANY)
         if self.importType == 'gdal':
         if self.importType == 'gdal':
             label = _("List of raster layers")
             label = _("List of raster layers")
         elif self.importType == 'ogr':
         elif self.importType == 'ogr':
@@ -869,7 +869,7 @@ class ReprojectionDialog(wx.Dialog):
         columns = [_('Layer id'),
         columns = [_('Layer id'),
                    _('Name for output GRASS map')]
                    _('Name for output GRASS map')]
 
 
-        self.layerBox = wx.StaticBox(parent=self.panel, id=wx.ID_ANY)
+        self.layerBox = StaticBox(parent=self.panel, id=wx.ID_ANY)
         self.layerSizer = wx.StaticBoxSizer(self.layerBox, wx.HORIZONTAL)
         self.layerSizer = wx.StaticBoxSizer(self.layerBox, wx.HORIZONTAL)
 
 
         self.list = GListCtrl(parent=self.panel)
         self.list = GListCtrl(parent=self.panel)
@@ -884,7 +884,7 @@ class ReprojectionDialog(wx.Dialog):
 
 
         self.list.LoadData(data)
         self.list.LoadData(data)
 
 
-        self.labelText = wx.StaticText(parent=self.panel, id=wx.ID_ANY, label=_(
+        self.labelText = StaticText(parent=self.panel, id=wx.ID_ANY, label=_(
             "Projection of following layers do not match with projection of current location. "))
             "Projection of following layers do not match with projection of current location. "))
 
 
         label = _("Layers to be reprojected")
         label = _("Layers to be reprojected")
@@ -895,7 +895,7 @@ class ReprojectionDialog(wx.Dialog):
         # buttons
         # buttons
         #
         #
         # cancel
         # cancel
-        self.btn_close = wx.Button(parent=self.panel, id=wx.ID_CANCEL)
+        self.btn_close = Button(parent=self.panel, id=wx.ID_CANCEL)
 
 
         # run
         # run
         self.btn_run = Button(
         self.btn_run = Button(

+ 16 - 15
gui/wxpython/modules/mcalc_builder.py

@@ -29,7 +29,8 @@ from core.utils import _
 from gui_core.gselect import Select
 from gui_core.gselect import Select
 from gui_core.forms import GUI
 from gui_core.forms import GUI
 from gui_core.widgets import IntegerValidator
 from gui_core.widgets import IntegerValidator
-from gui_core.wrap import Button, TextCtrl
+from gui_core.wrap import Button, TextCtrl, StaticText, \
+    StaticBox
 from core.settings import UserSettings
 from core.settings import UserSettings
 
 
 
 
@@ -138,14 +139,14 @@ class MapCalcFrame(wx.Frame):
         # from selection
         # from selection
         self.lastMapName = ''
         self.lastMapName = ''
 
 
-        self.operatorBox = wx.StaticBox(parent=self.panel, id=wx.ID_ANY,
-                                        label=" %s " % _('Operators'))
-        self.outputBox = wx.StaticBox(parent=self.panel, id=wx.ID_ANY,
-                                      label=" %s " % _('Output'))
-        self.operandBox = wx.StaticBox(parent=self.panel, id=wx.ID_ANY,
-                                       label=" %s " % _('Operands'))
-        self.expressBox = wx.StaticBox(parent=self.panel, id=wx.ID_ANY,
-                                       label=" %s " % _('Expression'))
+        self.operatorBox = StaticBox(parent=self.panel, id=wx.ID_ANY,
+                                     label=" %s " % _('Operators'))
+        self.outputBox = StaticBox(parent=self.panel, id=wx.ID_ANY,
+                                   label=" %s " % _('Output'))
+        self.operandBox = StaticBox(parent=self.panel, id=wx.ID_ANY,
+                                    label=" %s " % _('Operands'))
+        self.expressBox = StaticBox(parent=self.panel, id=wx.ID_ANY,
+                                    label=" %s " % _('Expression'))
 
 
         #
         #
         # Buttons
         # Buttons
@@ -244,14 +245,14 @@ class MapCalcFrame(wx.Frame):
         #
         #
         # Text area
         # Text area
         #
         #
-        self.text_mcalc = wx.TextCtrl(
+        self.text_mcalc = TextCtrl(
             parent=self.panel, id=wx.ID_ANY, size=(-1, 75),
             parent=self.panel, id=wx.ID_ANY, size=(-1, 75),
             style=wx.TE_MULTILINE)
             style=wx.TE_MULTILINE)
         wx.CallAfter(self.text_mcalc.SetFocus)
         wx.CallAfter(self.text_mcalc.SetFocus)
 
 
         #
         #
         # Map and function insertion text and ComboBoxes
         # Map and function insertion text and ComboBoxes
-        self.newmaplabel = wx.StaticText(parent=self.panel, id=wx.ID_ANY)
+        self.newmaplabel = StaticText(parent=self.panel, id=wx.ID_ANY)
         if self.rast3d:
         if self.rast3d:
             self.newmaplabel.SetLabel(
             self.newmaplabel.SetLabel(
                 _('Name for new 3D raster map to create'))
                 _('Name for new 3D raster map to create'))
@@ -263,7 +264,7 @@ class MapCalcFrame(wx.Frame):
             parent=self.panel, id=wx.ID_ANY, size=(
             parent=self.panel, id=wx.ID_ANY, size=(
                 250, -1), type=element, multiple=False,
                 250, -1), type=element, multiple=False,
                 fullyQualified=False)
                 fullyQualified=False)
-        self.mapsellabel = wx.StaticText(parent=self.panel, id=wx.ID_ANY)
+        self.mapsellabel = StaticText(parent=self.panel, id=wx.ID_ANY)
         if self.rast3d:
         if self.rast3d:
             self.mapsellabel.SetLabel(_('Insert existing 3D raster map'))
             self.mapsellabel.SetLabel(_('Insert existing 3D raster map'))
         else:
         else:
@@ -271,8 +272,8 @@ class MapCalcFrame(wx.Frame):
         self.mapselect = Select(
         self.mapselect = Select(
             parent=self.panel, id=wx.ID_ANY, size=(
             parent=self.panel, id=wx.ID_ANY, size=(
                 250, -1), type=element, multiple=False)
                 250, -1), type=element, multiple=False)
-        self.functlabel = wx.StaticText(parent=self.panel, id=wx.ID_ANY,
-                                        label=_('Insert mapcalc function'))
+        self.functlabel = StaticText(parent=self.panel, id=wx.ID_ANY,
+                                     label=_('Insert mapcalc function'))
         self.function = wx.ComboBox(
         self.function = wx.ComboBox(
             parent=self.panel, id=wx.ID_ANY, size=(250, -1),
             parent=self.panel, id=wx.ID_ANY, size=(250, -1),
             choices=sorted(self.funct_dict.keys()),
             choices=sorted(self.funct_dict.keys()),
@@ -290,7 +291,7 @@ class MapCalcFrame(wx.Frame):
         self.randomSeed = wx.CheckBox(
         self.randomSeed = wx.CheckBox(
             parent=self.panel,
             parent=self.panel,
             label=_("Generate random seed for rand()"))
             label=_("Generate random seed for rand()"))
-        self.randomSeedStaticText = wx.StaticText(
+        self.randomSeedStaticText = StaticText(
             parent=self.panel, label=_("Seed:"))
             parent=self.panel, label=_("Seed:"))
         self.randomSeedText = TextCtrl(parent=self.panel, size=(100, -1),
         self.randomSeedText = TextCtrl(parent=self.panel, size=(100, -1),
                                        validator=IntegerValidator())
                                        validator=IntegerValidator())

+ 20 - 18
gui/wxpython/modules/vclean.py

@@ -25,6 +25,8 @@ from core.utils import _
 from gui_core.gselect import Select
 from gui_core.gselect import Select
 from core.settings import UserSettings
 from core.settings import UserSettings
 from grass.script import core as grass
 from grass.script import core as grass
+from gui_core.wrap import Button, StaticText, StaticBox, \
+    TextCtrl
 
 
 
 
 class VectorCleaningFrame(wx.Frame):
 class VectorCleaningFrame(wx.Frame):
@@ -122,18 +124,18 @@ class VectorCleaningFrame(wx.Frame):
         self.ctlabel = _('Choose cleaning tools and set thresholds')
         self.ctlabel = _('Choose cleaning tools and set thresholds')
 
 
         # top controls
         # top controls
-        self.inmaplabel = wx.StaticText(parent=self.panel, id=wx.ID_ANY,
-                                        label=_('Select input vector map:'))
+        self.inmaplabel = StaticText(parent=self.panel, id=wx.ID_ANY,
+                                     label=_('Select input vector map:'))
         self.selectionInput = Select(parent=self.panel, id=wx.ID_ANY,
         self.selectionInput = Select(parent=self.panel, id=wx.ID_ANY,
                                      size=globalvar.DIALOG_GSELECT_SIZE,
                                      size=globalvar.DIALOG_GSELECT_SIZE,
                                      type='vector')
                                      type='vector')
         self.ftype_check = {}
         self.ftype_check = {}
-        ftypeBox = wx.StaticBox(parent=self.panel, id=wx.ID_ANY,
-                                label=_(' Feature type: '))
+        ftypeBox = StaticBox(parent=self.panel, id=wx.ID_ANY,
+                             label=_(' Feature type: '))
         self.ftypeSizer = wx.StaticBoxSizer(ftypeBox, wx.HORIZONTAL)
         self.ftypeSizer = wx.StaticBoxSizer(ftypeBox, wx.HORIZONTAL)
 
 
-        self.outmaplabel = wx.StaticText(parent=self.panel, id=wx.ID_ANY,
-                                         label=_('Select output vector map:'))
+        self.outmaplabel = StaticText(parent=self.panel, id=wx.ID_ANY,
+                                      label=_('Select output vector map:'))
         self.selectionOutput = Select(parent=self.panel, id=wx.ID_ANY,
         self.selectionOutput = Select(parent=self.panel, id=wx.ID_ANY,
                                       size=globalvar.DIALOG_GSELECT_SIZE,
                                       size=globalvar.DIALOG_GSELECT_SIZE,
                                       mapsets=[grass.gisenv()['MAPSET'], ],
                                       mapsets=[grass.gisenv()['MAPSET'], ],
@@ -150,32 +152,32 @@ class VectorCleaningFrame(wx.Frame):
                 subkey='enabled'))
                 subkey='enabled'))
 
 
         # cleaning tools
         # cleaning tools
-        self.ct_label = wx.StaticText(parent=self.panel, id=wx.ID_ANY,
-                                      label=self.ctlabel)
+        self.ct_label = StaticText(parent=self.panel, id=wx.ID_ANY,
+                                   label=self.ctlabel)
 
 
         self.ct_panel = self._toolsPanel()
         self.ct_panel = self._toolsPanel()
 
 
         # buttons to manage cleaning tools
         # buttons to manage cleaning tools
-        self.btn_add = wx.Button(parent=self.panel, id=wx.ID_ADD)
-        self.btn_remove = wx.Button(parent=self.panel, id=wx.ID_REMOVE)
-        self.btn_moveup = wx.Button(parent=self.panel, id=wx.ID_UP)
-        self.btn_movedown = wx.Button(parent=self.panel, id=wx.ID_DOWN)
+        self.btn_add = Button(parent=self.panel, id=wx.ID_ADD)
+        self.btn_remove = Button(parent=self.panel, id=wx.ID_REMOVE)
+        self.btn_moveup = Button(parent=self.panel, id=wx.ID_UP)
+        self.btn_movedown = Button(parent=self.panel, id=wx.ID_DOWN)
 
 
         # add one tool as default
         # add one tool as default
         self.AddTool()
         self.AddTool()
         self.selected = -1
         self.selected = -1
 
 
         # Buttons
         # Buttons
-        self.btn_close = wx.Button(parent=self.panel, id=wx.ID_CLOSE)
-        self.btn_run = wx.Button(
+        self.btn_close = Button(parent=self.panel, id=wx.ID_CLOSE)
+        self.btn_run = Button(
             parent=self.panel,
             parent=self.panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_("&Run"))
             label=_("&Run"))
         self.btn_run.SetDefault()
         self.btn_run.SetDefault()
-        self.btn_clipboard = wx.Button(parent=self.panel, id=wx.ID_COPY)
-        self.btn_clipboard.SetToolTipString(
+        self.btn_clipboard = Button(parent=self.panel, id=wx.ID_COPY)
+        self.btn_clipboard.SetToolTip(
             _("Copy the current command string to the clipboard (Ctrl+C)"))
             _("Copy the current command string to the clipboard (Ctrl+C)"))
-        self.btn_help = wx.Button(parent=self.panel, id=wx.ID_HELP)
+        self.btn_help = Button(parent=self.panel, id=wx.ID_HELP)
 
 
         # bindings
         # bindings
         self.btn_close.Bind(wx.EVT_BUTTON, self.OnClose)
         self.btn_close.Bind(wx.EVT_BUTTON, self.OnClose)
@@ -361,7 +363,7 @@ class VectorCleaningFrame(wx.Frame):
                                 wx.CB_READONLY | wx.TE_PROCESS_ENTER)
                                 wx.CB_READONLY | wx.TE_PROCESS_ENTER)
         self.Bind(wx.EVT_COMBOBOX, self.OnSetTool, tool_cbox)
         self.Bind(wx.EVT_COMBOBOX, self.OnSetTool, tool_cbox)
         # threshold
         # threshold
-        txt_ctrl = wx.TextCtrl(
+        txt_ctrl = TextCtrl(
             parent=self.ct_panel, id=2000 + num, value='0.00', size=(100, -1),
             parent=self.ct_panel, id=2000 + num, value='0.00', size=(100, -1),
             style=wx.TE_NOHIDESEL)
             style=wx.TE_NOHIDESEL)
         self.Bind(wx.EVT_TEXT, self.OnThreshValue, txt_ctrl)
         self.Bind(wx.EVT_TEXT, self.OnThreshValue, txt_ctrl)

+ 2 - 1
gui/wxpython/nviz/mapwindow.py

@@ -20,6 +20,7 @@ This program is free software under the GNU General Public License
 
 
 import os
 import os
 import sys
 import sys
+import six
 import time
 import time
 import copy
 import copy
 import math
 import math
@@ -483,7 +484,7 @@ class GLWindow(MapWindowBase, glcanvas.GLCanvas):
             and then to textures so that they can be rendered by OpenGL.
             and then to textures so that they can be rendered by OpenGL.
             Updates self.imagelist"""
             Updates self.imagelist"""
         # update images (legend and text)
         # update images (legend and text)
-        for oid, overlay in self.overlays.iteritems():
+        for oid, overlay in six.iteritems(self.overlays):
             if not overlay.IsShown() or overlay.name in ('barscale', 'northarrow'):
             if not overlay.IsShown() or overlay.name in ('barscale', 'northarrow'):
                 continue
                 continue
             if oid not in [t.GetId() for t in self.imagelist]:  # new
             if oid not in [t.GetId() for t in self.imagelist]:  # new

+ 67 - 66
gui/wxpython/nviz/preferences.py

@@ -26,7 +26,8 @@ from core import globalvar
 from core.settings import UserSettings
 from core.settings import UserSettings
 from core.utils import _
 from core.utils import _
 from gui_core.preferences import PreferencesBaseDialog
 from gui_core.preferences import PreferencesBaseDialog
-from gui_core.wrap import SpinCtrl
+from gui_core.wrap import SpinCtrl, Button, CheckBox, StaticText, \
+    StaticBox
 
 
 
 
 class NvizPreferencesDialog(PreferencesBaseDialog):
 class NvizPreferencesDialog(PreferencesBaseDialog):
@@ -58,7 +59,7 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
 
 
         self.SetMinSize(self.GetBestSize())
         self.SetMinSize(self.GetBestSize())
         self.SetSize(self.size)
         self.SetSize(self.size)
-        self.btnDefault.SetToolTipString(
+        self.btnDefault.SetToolTip(
             _("Revert settings to default, changes are not applied"))
             _("Revert settings to default, changes are not applied"))
 
 
     def _createViewPage(self, notebook):
     def _createViewPage(self, notebook):
@@ -70,8 +71,8 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
 
 
         pageSizer = wx.BoxSizer(wx.VERTICAL)
         pageSizer = wx.BoxSizer(wx.VERTICAL)
 
 
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % (_("View")))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % (_("View")))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
         row = 0
         row = 0
@@ -82,11 +83,11 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
             key='view',
             key='view',
             subkey='persp',
             subkey='persp',
             settings_type='internal')
             settings_type='internal')
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Perspective:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Perspective:")),
                       pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL)
                       pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL)
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel, id=wx.ID_ANY, label=_("value:")), pos=(
                 parent=panel, id=wx.ID_ANY, label=_("value:")), pos=(
                 row, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
                 row, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
 
 
@@ -99,7 +100,7 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
                       flag=wx.ALIGN_CENTER_VERTICAL)
                       flag=wx.ALIGN_CENTER_VERTICAL)
 
 
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel, id=wx.ID_ANY, label=_("step:")), pos=(
                 parent=panel, id=wx.ID_ANY, label=_("step:")), pos=(
                 row, 3), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
                 row, 3), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
 
 
@@ -114,11 +115,11 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
 
 
         # position
         # position
         posvals = UserSettings.Get(group='nviz', key='view', subkey='position')
         posvals = UserSettings.Get(group='nviz', key='view', subkey='position')
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Position:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Position:")),
                       pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL)
                       pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL)
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel, id=wx.ID_ANY, label=_("x:")), pos=(
                 parent=panel, id=wx.ID_ANY, label=_("x:")), pos=(
                 row, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
                 row, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
 
 
@@ -131,7 +132,7 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
                       flag=wx.ALIGN_CENTER_VERTICAL)
                       flag=wx.ALIGN_CENTER_VERTICAL)
 
 
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel, id=wx.ID_ANY, label="y:"), pos=(
                 parent=panel, id=wx.ID_ANY, label="y:"), pos=(
                 row, 3), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
                 row, 3), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
 
 
@@ -153,11 +154,11 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
             key='view',
             key='view',
             subkey='twist',
             subkey='twist',
             settings_type='internal')
             settings_type='internal')
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Twist:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Twist:")),
                       pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL)
                       pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL)
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel, id=wx.ID_ANY, label=_("value:")), pos=(
                 parent=panel, id=wx.ID_ANY, label=_("value:")), pos=(
                 row, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
                 row, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
 
 
@@ -172,11 +173,11 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
 
 
         # z-exag
         # z-exag
         zvals = UserSettings.Get(group='nviz', key='view', subkey='z-exag')
         zvals = UserSettings.Get(group='nviz', key='view', subkey='z-exag')
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Z-exag:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Z-exag:")),
                       pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL)
                       pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL)
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel, id=wx.ID_ANY, label=_("value:")), pos=(
                 parent=panel, id=wx.ID_ANY, label=_("value:")), pos=(
                 row, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
                 row, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
 
 
@@ -194,14 +195,14 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
                       flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM,
                       flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM,
                       border=3)
                       border=3)
 
 
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % (_("Image Appearance")))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % (_("Image Appearance")))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
 
 
         # background color
         # background color
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Background color:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Background color:")),
                       pos=(0, 0), flag=wx.ALIGN_CENTER_VERTICAL)
                       pos=(0, 0), flag=wx.ALIGN_CENTER_VERTICAL)
 
 
         color = csel.ColourSelect(
         color = csel.ColourSelect(
@@ -237,14 +238,14 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
                          text=" %s " % _("Fly-through"))
                          text=" %s " % _("Fly-through"))
         pageSizer = wx.BoxSizer(wx.VERTICAL)
         pageSizer = wx.BoxSizer(wx.VERTICAL)
         # fly throuhg mode
         # fly throuhg mode
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % (_("Fly-through mode")))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % (_("Fly-through mode")))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
 
 
         # move exag
         # move exag
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Move exag:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Move exag:")),
                       pos=(0, 0), flag=wx.ALIGN_CENTER_VERTICAL)
                       pos=(0, 0), flag=wx.ALIGN_CENTER_VERTICAL)
 
 
         moveExag = SpinCtrl(
         moveExag = SpinCtrl(
@@ -256,8 +257,8 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
         gridSizer.Add(moveExag, pos=(0, 1))
         gridSizer.Add(moveExag, pos=(0, 1))
 
 
         # turn exag
         # turn exag
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Turn exag:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Turn exag:")),
                       pos=(1, 0), flag=wx.ALIGN_CENTER_VERTICAL)
                       pos=(1, 0), flag=wx.ALIGN_CENTER_VERTICAL)
 
 
         turnExag = SpinCtrl(
         turnExag = SpinCtrl(
@@ -288,19 +289,19 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
 
 
         pageSizer = wx.BoxSizer(wx.VERTICAL)
         pageSizer = wx.BoxSizer(wx.VERTICAL)
 
 
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % (_("Light")))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % (_("Light")))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
 
 
         # position
         # position
         posvals = UserSettings.Get(
         posvals = UserSettings.Get(
             group='nviz', key='light', subkey='position')
             group='nviz', key='light', subkey='position')
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Position:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Position:")),
                       pos=(0, 0), flag=wx.ALIGN_CENTER_VERTICAL)
                       pos=(0, 0), flag=wx.ALIGN_CENTER_VERTICAL)
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel, id=wx.ID_ANY, label=_("x:")), pos=(
                 parent=panel, id=wx.ID_ANY, label=_("x:")), pos=(
                 0, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
                 0, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
 
 
@@ -313,7 +314,7 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
                       flag=wx.ALIGN_CENTER_VERTICAL)
                       flag=wx.ALIGN_CENTER_VERTICAL)
 
 
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel, id=wx.ID_ANY, label="y:"), pos=(
                 parent=panel, id=wx.ID_ANY, label="y:"), pos=(
                 0, 3), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
                 0, 3), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
 
 
@@ -326,7 +327,7 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
                       flag=wx.ALIGN_CENTER_VERTICAL)
                       flag=wx.ALIGN_CENTER_VERTICAL)
 
 
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel, id=wx.ID_ANY, label=_("z:")), pos=(
                 parent=panel, id=wx.ID_ANY, label=_("z:")), pos=(
                 0, 5), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
                 0, 5), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
 
 
@@ -341,8 +342,8 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
         # brightness
         # brightness
         brightval = UserSettings.Get(
         brightval = UserSettings.Get(
             group='nviz', key='light', subkey='bright')
             group='nviz', key='light', subkey='bright')
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Brightness:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Brightness:")),
                       pos=(1, 0), flag=wx.ALIGN_CENTER_VERTICAL)
                       pos=(1, 0), flag=wx.ALIGN_CENTER_VERTICAL)
 
 
         bright = SpinCtrl(parent=panel, id=wx.ID_ANY, size=(65, -1),
         bright = SpinCtrl(parent=panel, id=wx.ID_ANY, size=(65, -1),
@@ -355,8 +356,8 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
 
 
         # ambient
         # ambient
         ambval = UserSettings.Get(group='nviz', key='light', subkey='ambient')
         ambval = UserSettings.Get(group='nviz', key='light', subkey='ambient')
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Ambient:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Ambient:")),
                       pos=(2, 0), flag=wx.ALIGN_CENTER_VERTICAL)
                       pos=(2, 0), flag=wx.ALIGN_CENTER_VERTICAL)
 
 
         amb = SpinCtrl(parent=panel, id=wx.ID_ANY, size=(65, -1),
         amb = SpinCtrl(parent=panel, id=wx.ID_ANY, size=(65, -1),
@@ -368,8 +369,8 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
                       flag=wx.ALIGN_CENTER_VERTICAL)
                       flag=wx.ALIGN_CENTER_VERTICAL)
 
 
         # light color
         # light color
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Color:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Color:")),
                       pos=(3, 0), flag=wx.ALIGN_CENTER_VERTICAL)
                       pos=(3, 0), flag=wx.ALIGN_CENTER_VERTICAL)
 
 
         color = csel.ColourSelect(
         color = csel.ColourSelect(
@@ -401,14 +402,14 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
 
 
         # draw
         # draw
 
 
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % (_("Draw")))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % (_("Draw")))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
 
 
         # mode
         # mode
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Mode:")),
                 label=_("Mode:")),
@@ -429,7 +430,7 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
 
 
         # fine
         # fine
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Fine mode:")),
                 label=_("Fine mode:")),
@@ -441,7 +442,7 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
             group='nviz', key='surface', subkey=[
             group='nviz', key='surface', subkey=[
                 'draw', 'res-fine'])
                 'draw', 'res-fine'])
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("resolution:")),
                 label=_("resolution:")),
@@ -460,7 +461,7 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
 
 
         # coarse
         # coarse
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("Coarse mode:")),
                 label=_("Coarse mode:")),
@@ -472,7 +473,7 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
             group='nviz', key='surface', subkey=[
             group='nviz', key='surface', subkey=[
                 'draw', 'res-coarse'])
                 'draw', 'res-coarse'])
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("resolution:")),
                 label=_("resolution:")),
@@ -490,7 +491,7 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
                       pos=(2, 2))
                       pos=(2, 2))
         # style
         # style
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("style:")),
                 label=_("style:")),
@@ -511,7 +512,7 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
                       pos=(3, 2))
                       pos=(3, 2))
         # wire color
         # wire color
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_("wire color:")),
                 label=_("wire color:")),
@@ -548,15 +549,15 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
         pageSizer = wx.BoxSizer(wx.VERTICAL)
         pageSizer = wx.BoxSizer(wx.VERTICAL)
 
 
         # vector lines
         # vector lines
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % (_("Vector lines")))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % (_("Vector lines")))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
 
 
         row = 0
         row = 0
         # icon size
         # icon size
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Width:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Width:")),
                       pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL)
                       pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL)
 
 
         iwidth = SpinCtrl(parent=panel, id=wx.ID_ANY, size=(65, -1),
         iwidth = SpinCtrl(parent=panel, id=wx.ID_ANY, size=(65, -1),
@@ -570,8 +571,8 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
                       flag=wx.ALIGN_CENTER_VERTICAL)
                       flag=wx.ALIGN_CENTER_VERTICAL)
 
 
         # icon color
         # icon color
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Color:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Color:")),
                       pos=(row, 4), flag=wx.ALIGN_CENTER_VERTICAL)
                       pos=(row, 4), flag=wx.ALIGN_CENTER_VERTICAL)
         icolor = csel.ColourSelect(panel, id=wx.ID_ANY,
         icolor = csel.ColourSelect(panel, id=wx.ID_ANY,
                                    size=globalvar.DIALOG_COLOR_SIZE)
                                    size=globalvar.DIALOG_COLOR_SIZE)
@@ -588,23 +589,23 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
                       border=5)
                       border=5)
 
 
         # vector points
         # vector points
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % (_("Vector points")))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % (_("Vector points")))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=5)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=5)
 
 
         row = 0
         row = 0
         # icon size
         # icon size
-        autosize = wx.CheckBox(parent=panel, label=_("Automatic size"))
-        autosize.SetToolTipString(_("Icon size is set automatically based on landscape dimensions."))
+        autosize = CheckBox(parent=panel, label=_("Automatic size"))
+        autosize.SetToolTip(_("Icon size is set automatically based on landscape dimensions."))
         gridSizer.Add(autosize, pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL)
         gridSizer.Add(autosize, pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL)
         self.winId['nviz:vector:points:autosize'] = autosize.GetId()
         self.winId['nviz:vector:points:autosize'] = autosize.GetId()
         autosize.SetValue(UserSettings.Get(group='nviz', key='vector',
         autosize.SetValue(UserSettings.Get(group='nviz', key='vector',
                                            subkey=['points', 'autosize']))
                                            subkey=['points', 'autosize']))
 
 
         row += 1
         row += 1
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Size:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Size:")),
                       pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL)
                       pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL)
 
 
         isize = SpinCtrl(parent=panel, id=wx.ID_ANY, size=(65, -1),
         isize = SpinCtrl(parent=panel, id=wx.ID_ANY, size=(65, -1),
@@ -619,8 +620,8 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
 
 
         # icon symbol
         # icon symbol
         row += 1
         row += 1
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Marker:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Marker:")),
                       pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL)
                       pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL)
         isym = wx.Choice(
         isym = wx.Choice(
             parent=panel, id=wx.ID_ANY, size=(100, -1),
             parent=panel, id=wx.ID_ANY, size=(100, -1),
@@ -636,8 +637,8 @@ class NvizPreferencesDialog(PreferencesBaseDialog):
 
 
         # icon color
         # icon color
         row += 1
         row += 1
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Color:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Color:")),
                       pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL)
                       pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL)
         icolor = csel.ColourSelect(panel, id=wx.ID_ANY,
         icolor = csel.ColourSelect(panel, id=wx.ID_ANY,
                                    size=globalvar.DIALOG_COLOR_SIZE)
                                    size=globalvar.DIALOG_COLOR_SIZE)

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 225 - 223
gui/wxpython/nviz/tools.py


+ 18 - 12
gui/wxpython/nviz/workspace.py

@@ -15,6 +15,7 @@ This program is free software under the GNU General Public License
 """
 """
 
 
 import copy
 import copy
+import six
 
 
 from core.settings import UserSettings
 from core.settings import UserSettings
 from core.utils import _
 from core.utils import _
@@ -33,8 +34,8 @@ class NvizSettings(object):
     def SetConstantDefaultProp(self):
     def SetConstantDefaultProp(self):
         """Set default constant data properties"""
         """Set default constant data properties"""
         data = dict()
         data = dict()
-        for key, value in UserSettings.Get(
-                group='nviz', key='constant').iteritems():
+        for key, value in six.iteritems(UserSettings.Get(group='nviz',
+                                                         key='constant')):
             data[key] = value
             data[key] = value
         color = str(data['color'][0]) + ':' + str(data['color']
         color = str(data['color'][0]) + ':' + str(data['color']
                                                   [1]) + ':' + str(data['color'][2])
                                                   [1]) + ':' + str(data['color'][2])
@@ -54,8 +55,9 @@ class NvizSettings(object):
         #
         #
         for attrb in ('shine', ):
         for attrb in ('shine', ):
             data['attribute'][attrb] = {}
             data['attribute'][attrb] = {}
-            for key, value in UserSettings.Get(group='nviz', key='surface',
-                                               subkey=attrb).iteritems():
+            for key, value in six.iteritems(UserSettings.Get(group='nviz',
+                                                             key='surface',
+                                                             subkey=attrb)):
                 data['attribute'][attrb][key] = value
                 data['attribute'][attrb][key] = value
             data['attribute'][attrb]['update'] = None
             data['attribute'][attrb]['update'] = None
 
 
@@ -63,8 +65,9 @@ class NvizSettings(object):
         # draw
         # draw
         #
         #
         data['draw']['all'] = False  # apply only for current surface
         data['draw']['all'] = False  # apply only for current surface
-        for control, value in UserSettings.Get(group='nviz', key='surface',
-                                               subkey='draw').iteritems():
+        for control, value in six.iteritems(UserSettings.Get(group='nviz',
+                                                             key='surface',
+                                                             subkey='draw')):
             if control[:3] == 'res':
             if control[:3] == 'res':
                 if 'resolution' not in data['draw']:
                 if 'resolution' not in data['draw']:
                     data['draw']['resolution'] = {}
                     data['draw']['resolution'] = {}
@@ -115,8 +118,9 @@ class NvizSettings(object):
         #
         #
         # draw
         # draw
         #
         #
-        for control, value in UserSettings.Get(
-                group='nviz', key='volume', subkey='draw').iteritems():
+        for control, value in six.iteritems(UserSettings.Get(group='nviz',
+                                                             key='volume',
+                                                             subkey='draw')):
             if control == 'shading':
             if control == 'shading':
                 sel = UserSettings.Get(
                 sel = UserSettings.Get(
                     group='nviz', key='volume', subkey=[
                     group='nviz', key='volume', subkey=[
@@ -157,8 +161,9 @@ class NvizSettings(object):
         #
         #
         for attrb in ('shine', ):
         for attrb in ('shine', ):
             data['attribute'][attrb] = {}
             data['attribute'][attrb] = {}
-            for key, value in UserSettings.Get(group='nviz', key='volume',
-                                               subkey=attrb).iteritems():
+            for key, value in six.iteritems(UserSettings.Get(group='nviz',
+                                                             key='volume',
+                                                             subkey=attrb)):
                 data['attribute'][attrb][key] = value
                 data['attribute'][attrb][key] = value
 
 
         return data
         return data
@@ -172,8 +177,9 @@ class NvizSettings(object):
             if attr == 'inout':
             if attr == 'inout':
                 data[attr]['value'] = 0
                 data[attr]['value'] = 0
                 continue
                 continue
-            for key, value in UserSettings.Get(group='nviz', key='volume',
-                                               subkey=attr).iteritems():
+            for key, value in six.iteritems(UserSettings.Get(group='nviz',
+                                                             key='volume',
+                                                             subkey=attr)):
                 data[attr][key] = value
                 data[attr][key] = value
         return data
         return data
 
 

+ 36 - 34
gui/wxpython/photo2image/ip2i_manager.py

@@ -28,6 +28,7 @@ from __future__ import print_function
 
 
 import os
 import os
 import sys
 import sys
+import six
 import shutil
 import shutil
 import time
 import time
 from copy import copy
 from copy import copy
@@ -53,7 +54,8 @@ from core.gcmd import RunCommand, GMessage, GError, GWarning, EncodeString
 from core.settings import UserSettings
 from core.settings import UserSettings
 from photo2image.ip2i_mapdisplay import MapFrame
 from photo2image.ip2i_mapdisplay import MapFrame
 from core.giface import Notification
 from core.giface import Notification
-from gui_core.wrap import SpinCtrl
+from gui_core.wrap import SpinCtrl, Button, StaticText, StaticBox, \
+    TextCtrl, Menu
 
 
 from location_wizard.wizard import TitledPage as TitledPage
 from location_wizard.wizard import TitledPage as TitledPage
 
 
@@ -685,7 +687,7 @@ class GCP(MapFrame, ColumnSorterMixin):
                    "ucolor": "unused"}
                    "ucolor": "unused"}
         wpx = UserSettings.Get(group='gcpman', key='symbol', subkey='width')
         wpx = UserSettings.Get(group='gcpman', key='symbol', subkey='width')
 
 
-        for k, v in colours.iteritems():
+        for k, v in six.iteritems(colours):
             col = UserSettings.Get(group='gcpman', key='symbol', subkey=k)
             col = UserSettings.Get(group='gcpman', key='symbol', subkey=k)
             self.pointsToDrawSrc.GetPen(v).SetColour(wx.Colour(
             self.pointsToDrawSrc.GetPen(v).SetColour(wx.Colour(
                 col[0], col[1], col[2], 255))  # TODO GetPen neni to spatne?
                 col[0], col[1], col[2], 255))  # TODO GetPen neni to spatne?
@@ -1451,7 +1453,7 @@ class GCP(MapFrame, ColumnSorterMixin):
         """Popup Zoom menu
         """Popup Zoom menu
         """
         """
         point = wx.GetMousePosition()
         point = wx.GetMousePosition()
-        zoommenu = wx.Menu()
+        zoommenu = Menu()
         # Add items to the menu
         # Add items to the menu
 
 
         zoomsource = wx.MenuItem(zoommenu, wx.ID_ANY, _(
         zoomsource = wx.MenuItem(zoommenu, wx.ID_ANY, _(
@@ -1743,7 +1745,7 @@ class EditGCP(wx.Dialog):
 
 
         sizer = wx.BoxSizer(wx.VERTICAL)
         sizer = wx.BoxSizer(wx.VERTICAL)
 
 
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel, id=wx.ID_ANY, label=" %s %s " %
             parent=panel, id=wx.ID_ANY, label=" %s %s " %
             (_("Ground Control Point No."), str(gcpno)))
             (_("Ground Control Point No."), str(gcpno)))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
@@ -1751,10 +1753,10 @@ class EditGCP(wx.Dialog):
         # source coordinates
         # source coordinates
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
 
 
-        self.xcoord = wx.TextCtrl(parent=panel, id=wx.ID_ANY, size=(150, -1))
-        self.ycoord = wx.TextCtrl(parent=panel, id=wx.ID_ANY, size=(150, -1))
-        self.ecoord = wx.TextCtrl(parent=panel, id=wx.ID_ANY, size=(150, -1))
-        self.ncoord = wx.TextCtrl(parent=panel, id=wx.ID_ANY, size=(150, -1))
+        self.xcoord = TextCtrl(parent=panel, id=wx.ID_ANY, size=(150, -1))
+        self.ycoord = TextCtrl(parent=panel, id=wx.ID_ANY, size=(150, -1))
+        self.ecoord = TextCtrl(parent=panel, id=wx.ID_ANY, size=(150, -1))
+        self.ncoord = TextCtrl(parent=panel, id=wx.ID_ANY, size=(150, -1))
 
 
         # swap source N, target E
         # swap source N, target E
         tmp_coord = data[1]
         tmp_coord = data[1]
@@ -1768,8 +1770,8 @@ class EditGCP(wx.Dialog):
                            (_("target X:"), self.ecoord),
                            (_("target X:"), self.ecoord),
                            (_("source Y:"), self.ycoord),
                            (_("source Y:"), self.ycoord),
                            (_("target Y:"), self.ncoord)):
                            (_("target Y:"), self.ncoord)):
-            label = wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                  label=label)
+            label = StaticText(parent=panel, id=wx.ID_ANY,
+                               label=label)
             gridSizer.Add(label,
             gridSizer.Add(label,
                           flag=wx.ALIGN_CENTER_VERTICAL,
                           flag=wx.ALIGN_CENTER_VERTICAL,
                           pos=(row, col))
                           pos=(row, col))
@@ -1796,8 +1798,8 @@ class EditGCP(wx.Dialog):
         #
         #
         # buttons
         # buttons
         #
         #
-        self.btnCancel = wx.Button(panel, wx.ID_CANCEL)
-        self.btnOk = wx.Button(panel, wx.ID_OK)
+        self.btnCancel = Button(panel, wx.ID_CANCEL)
+        self.btnOk = Button(panel, wx.ID_OK)
         self.btnOk.SetDefault()
         self.btnOk.SetDefault()
 
 
         btnSizer = wx.StdDialogButtonSizer()
         btnSizer = wx.StdDialogButtonSizer()
@@ -1865,19 +1867,19 @@ class GrSettingsDialog(wx.Dialog):
         self.__CreateRectificationPage(notebook)
         self.__CreateRectificationPage(notebook)
 
 
         # buttons
         # buttons
-        btnSave = wx.Button(self, wx.ID_SAVE)
-        btnApply = wx.Button(self, wx.ID_APPLY)
-        btnClose = wx.Button(self, wx.ID_CLOSE)
+        btnSave = Button(self, wx.ID_SAVE)
+        btnApply = Button(self, wx.ID_APPLY)
+        btnClose = Button(self, wx.ID_CLOSE)
         btnApply.SetDefault()
         btnApply.SetDefault()
 
 
         # bindings
         # bindings
         btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
         btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
-        btnApply.SetToolTipString(_("Apply changes for the current session"))
+        btnApply.SetToolTip(_("Apply changes for the current session"))
         btnSave.Bind(wx.EVT_BUTTON, self.OnSave)
         btnSave.Bind(wx.EVT_BUTTON, self.OnSave)
-        btnSave.SetToolTipString(
+        btnSave.SetToolTip(
             _("Apply and save changes to user settings file (default for next sessions)"))
             _("Apply and save changes to user settings file (default for next sessions)"))
         btnClose.Bind(wx.EVT_BUTTON, self.OnClose)
         btnClose.Bind(wx.EVT_BUTTON, self.OnClose)
-        btnClose.SetToolTipString(_("Close dialog"))
+        btnClose.SetToolTip(_("Close dialog"))
 
 
         # sizers
         # sizers
         btnSizer = wx.BoxSizer(wx.HORIZONTAL)
         btnSizer = wx.BoxSizer(wx.HORIZONTAL)
@@ -1923,7 +1925,7 @@ class GrSettingsDialog(wx.Dialog):
                 0))
                 0))
 
 
         # RMS forward error threshold
         # RMS forward error threshold
-        rmslabel = wx.StaticText(
+        rmslabel = StaticText(
             parent=panel, id=wx.ID_ANY,
             parent=panel, id=wx.ID_ANY,
             label=_("Highlight RMS error > M + SD * factor:"))
             label=_("Highlight RMS error > M + SD * factor:"))
         rmslabel.SetToolTip(
         rmslabel.SetToolTip(
@@ -1940,8 +1942,8 @@ class GrSettingsDialog(wx.Dialog):
                 0))
                 0))
         sdfactor = UserSettings.Get(
         sdfactor = UserSettings.Get(
             group='gcpman', key='rms', subkey='sdfactor')
             group='gcpman', key='rms', subkey='sdfactor')
-        self.rmsWin = wx.TextCtrl(parent=panel, id=wx.ID_ANY,
-                                  size=(70, -1), style=wx.TE_NOHIDESEL)
+        self.rmsWin = TextCtrl(parent=panel, id=wx.ID_ANY,
+                               size=(70, -1), style=wx.TE_NOHIDESEL)
         self.rmsWin.SetValue("%s" % str(sdfactor))
         self.rmsWin.SetValue("%s" % str(sdfactor))
         if (self.parent.highest_only == True):
         if (self.parent.highest_only == True):
             self.rmsWin.Disable()
             self.rmsWin.Disable()
@@ -1951,8 +1953,8 @@ class GrSettingsDialog(wx.Dialog):
         rmsgridSizer.AddGrowableCol(1)
         rmsgridSizer.AddGrowableCol(1)
         sizer.Add(rmsgridSizer, flag=wx.EXPAND | wx.ALL, border=5)
         sizer.Add(rmsgridSizer, flag=wx.EXPAND | wx.ALL, border=5)
 
 
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % _("Symbol settings"))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % _("Symbol settings"))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
 
 
@@ -1960,7 +1962,7 @@ class GrSettingsDialog(wx.Dialog):
         # general symbol color
         # general symbol color
         #
         #
         row = 0
         row = 0
-        label = wx.StaticText(parent=panel, id=wx.ID_ANY, label=_("Color:"))
+        label = StaticText(parent=panel, id=wx.ID_ANY, label=_("Color:"))
         gridSizer.Add(label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0))
         gridSizer.Add(label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0))
         col = UserSettings.Get(group='gcpman', key='symbol', subkey='color')
         col = UserSettings.Get(group='gcpman', key='symbol', subkey='color')
         colWin = csel.ColourSelect(parent=panel, id=wx.ID_ANY,
         colWin = csel.ColourSelect(parent=panel, id=wx.ID_ANY,
@@ -1977,7 +1979,7 @@ class GrSettingsDialog(wx.Dialog):
         # symbol color for high forward RMS error
         # symbol color for high forward RMS error
         #
         #
         row += 1
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_("Color for high RMS error:"))
             label=_("Color for high RMS error:"))
@@ -1997,7 +1999,7 @@ class GrSettingsDialog(wx.Dialog):
         # symbol color for selected GCP
         # symbol color for selected GCP
         #
         #
         row += 1
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_("Color for selected GCP:"))
             label=_("Color for selected GCP:"))
@@ -2017,7 +2019,7 @@ class GrSettingsDialog(wx.Dialog):
         # symbol color for unused GCP
         # symbol color for unused GCP
         #
         #
         row += 1
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_("Color for unused GCPs:"))
             label=_("Color for unused GCPs:"))
@@ -2050,7 +2052,7 @@ class GrSettingsDialog(wx.Dialog):
         # symbol size
         # symbol size
         #
         #
         row += 1
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_("Symbol size:"))
             label=_("Symbol size:"))
@@ -2072,7 +2074,7 @@ class GrSettingsDialog(wx.Dialog):
         # symbol width
         # symbol width
         #
         #
         row += 1
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             parent=panel,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_("Line width:"))
             label=_("Line width:"))
@@ -2118,7 +2120,7 @@ class GrSettingsDialog(wx.Dialog):
         self.tgtrastselection.GetElementList()
         self.tgtrastselection.GetElementList()
 
 
         sizer.Add(
         sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Select source map to display:')),
                 label=_('Select source map to display:')),
@@ -2132,7 +2134,7 @@ class GrSettingsDialog(wx.Dialog):
             border=5)
             border=5)
         self.srcselection.SetValue(src_map)
         self.srcselection.SetValue(src_map)
         sizer.Add(
         sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Select target raster map to display:')),
                 label=_('Select target raster map to display:')),
@@ -2182,7 +2184,7 @@ class GrSettingsDialog(wx.Dialog):
         # interpolation method
         # interpolation method
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
         gridSizer.Add(
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Select interpolation method:')),
                 label=_('Select interpolation method:')),
@@ -2208,14 +2210,14 @@ class GrSettingsDialog(wx.Dialog):
 
 
         # extension
         # extension
         sizer.Add(
         sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 parent=panel,
                 id=wx.ID_ANY,
                 id=wx.ID_ANY,
                 label=_('Extension for output maps:')),
                 label=_('Extension for output maps:')),
             proportion=0,
             proportion=0,
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL,
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL,
             border=5)
             border=5)
-        self.ext_txt = wx.TextCtrl(
+        self.ext_txt = TextCtrl(
             parent=panel, id=wx.ID_ANY, value="", size=(
             parent=panel, id=wx.ID_ANY, value="", size=(
                 350, -1))
                 350, -1))
         self.ext_txt.SetValue(self.parent.extension)
         self.ext_txt.SetValue(self.parent.extension)

+ 3 - 2
gui/wxpython/photo2image/ip2i_mapdisplay.py

@@ -30,6 +30,7 @@ from core.gcmd import GMessage
 from core.utils import _
 from core.utils import _
 from gui_core.dialogs import GetImageHandlers, ImageSizeDialog
 from gui_core.dialogs import GetImageHandlers, ImageSizeDialog
 from gui_core.mapdisp import SingleMapFrame
 from gui_core.mapdisp import SingleMapFrame
+from gui_core.wrap import Menu
 from core.settings import UserSettings
 from core.settings import UserSettings
 from mapwin.buffered import BufferedMapWindow
 from mapwin.buffered import BufferedMapWindow
 from mapwin.base import MapWindowProperties
 from mapwin.base import MapWindowProperties
@@ -420,7 +421,7 @@ class MapFrame(SingleMapFrame):
         Print options and output menu for map display
         Print options and output menu for map display
         """
         """
         point = wx.GetMousePosition()
         point = wx.GetMousePosition()
-        printmenu = wx.Menu()
+        printmenu = Menu()
         # Add items to the menu
         # Add items to the menu
         setup = wx.MenuItem(printmenu, wx.ID_ANY, _('Page setup'))
         setup = wx.MenuItem(printmenu, wx.ID_ANY, _('Page setup'))
         printmenu.AppendItem(setup)
         printmenu.AppendItem(setup)
@@ -466,7 +467,7 @@ class MapFrame(SingleMapFrame):
         """Popup Zoom menu
         """Popup Zoom menu
         """
         """
         point = wx.GetMousePosition()
         point = wx.GetMousePosition()
-        zoommenu = wx.Menu()
+        zoommenu = Menu()
         # Add items to the menu
         # Add items to the menu
 
 
         zoomwind = wx.MenuItem(zoommenu, wx.ID_ANY, _(
         zoomwind = wx.MenuItem(zoommenu, wx.ID_ANY, _(

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 184 - 183
gui/wxpython/psmap/dialogs.py


+ 32 - 29
gui/wxpython/psmap/frame.py

@@ -17,7 +17,10 @@ This program is free software under the GNU General Public License
 
 
 import os
 import os
 import sys
 import sys
-import Queue
+if sys.version_info.major == 2:
+    import Queue
+else:
+    import queue as Queue
 from math import sin, cos, pi, sqrt
 from math import sin, cos, pi, sqrt
 
 
 import wx
 import wx
@@ -39,7 +42,7 @@ from core.utils import _, PilImageToWxImage
 from gui_core.forms import GUI
 from gui_core.forms import GUI
 from gui_core.dialogs import HyperlinkDialog
 from gui_core.dialogs import HyperlinkDialog
 from gui_core.ghelp import ShowAboutDialog
 from gui_core.ghelp import ShowAboutDialog
-from gui_core.wrap import PseudoDC
+from gui_core.wrap import PseudoDC, Rect, StockCursor, EmptyBitmap
 from psmap.menudata import PsMapMenuData
 from psmap.menudata import PsMapMenuData
 from gui_core.toolbars import ToolSwitcher
 from gui_core.toolbars import ToolSwitcher
 
 
@@ -103,10 +106,10 @@ class PsMapFrame(wx.Frame):
         }
         }
         # available cursors
         # available cursors
         self.cursors = {
         self.cursors = {
-            "default": wx.StockCursor(wx.CURSOR_ARROW),
-            "cross": wx.StockCursor(wx.CURSOR_CROSS),
-            "hand": wx.StockCursor(wx.CURSOR_HAND),
-            "sizenwse": wx.StockCursor(wx.CURSOR_SIZENWSE)
+            "default": StockCursor(wx.CURSOR_ARROW),
+            "cross": StockCursor(wx.CURSOR_CROSS),
+            "hand": StockCursor(wx.CURSOR_HAND),
+            "sizenwse": StockCursor(wx.CURSOR_SIZENWSE)
         }
         }
         # pen and brush
         # pen and brush
         self.pen = {
         self.pen = {
@@ -855,9 +858,9 @@ class PsMapFrame(wx.Frame):
         if 0 < rotation < pi:
         if 0 < rotation < pi:
             Y = y - H
             Y = y - H
         if rotation == 0:
         if rotation == 0:
-            return wx.Rect(x, y, *textExtent)
+            return Rect(x, y, *textExtent)
         else:
         else:
-            return wx.Rect(X, Y, abs(W), abs(H)).Inflate(h, h)
+            return Rect(X, Y, abs(W), abs(H)).Inflate(h, h)
 
 
     def makePSFont(self, textDict):
     def makePSFont(self, textDict):
         """creates a wx.Font object from selected postscript font. To be
         """creates a wx.Font object from selected postscript font. To be
@@ -1255,7 +1258,7 @@ class PsMapBufferedWindow(wx.Window):
         self.pdcImage = PseudoDC()
         self.pdcImage = PseudoDC()
 
 
         self.SetClientSize((700, 510))  # ?
         self.SetClientSize((700, 510))  # ?
-        self._buffer = wx.EmptyBitmap(*self.GetClientSize())
+        self._buffer = EmptyBitmap(*self.GetClientSize())
 
 
         self.idBoxTmp = wx.NewId()
         self.idBoxTmp = wx.NewId()
         self.idZoomBoxTmp = wx.NewId()
         self.idZoomBoxTmp = wx.NewId()
@@ -1362,7 +1365,7 @@ class PsMapBufferedWindow(wx.Window):
 
 
         x = cW / 2 - pW / 2
         x = cW / 2 - pW / 2
         y = cH / 2 - pH / 2
         y = cH / 2 - pH / 2
-        self.DrawPaper(wx.Rect(x, y, pW, pH))
+        self.DrawPaper(Rect(x, y, pW, pH))
 
 
     def modifyRectangle(self, r):
     def modifyRectangle(self, r):
         """Recalculates rectangle not to have negative size"""
         """Recalculates rectangle not to have negative size"""
@@ -1501,7 +1504,7 @@ class PsMapBufferedWindow(wx.Window):
         else:
         else:
             self.mouse['use'] = 'zoomout'
             self.mouse['use'] = 'zoomout'
 
 
-        zoomFactor, view = self.ComputeZoom(wx.Rect(0, 0, 0, 0))
+        zoomFactor, view = self.ComputeZoom(Rect(0, 0, 0, 0))
         self.Zoom(zoomFactor, view)
         self.Zoom(zoomFactor, view)
         self.mouse['use'] = oldUse
         self.mouse['use'] = oldUse
 
 
@@ -1694,7 +1697,7 @@ class PsMapBufferedWindow(wx.Window):
                             self.dragId].type].updateDialog()
                             self.dragId].type].updateDialog()
 
 
         elif self.mouse['use'] in ('addPoint', 'addLine', 'addRectangle'):
         elif self.mouse['use'] in ('addPoint', 'addLine', 'addRectangle'):
-            endCoordinates = self.CanvasPaperCoordinates(rect=wx.Rect(
+            endCoordinates = self.CanvasPaperCoordinates(rect=Rect(
                 event.GetX(), event.GetY(), 0, 0), canvasToPaper=True)[:2]
                 event.GetX(), event.GetY(), 0, 0), canvasToPaper=True)[:2]
 
 
             diffX = event.GetX() - self.mouse['begin'][0]
             diffX = event.GetX() - self.mouse['begin'][0]
@@ -1710,7 +1713,7 @@ class PsMapBufferedWindow(wx.Window):
                     return
                     return
 
 
                 beginCoordinates = self.CanvasPaperCoordinates(
                 beginCoordinates = self.CanvasPaperCoordinates(
-                    rect=wx.Rect(
+                    rect=Rect(
                         self.mouse['begin'][0],
                         self.mouse['begin'][0],
                         self.mouse['begin'][1],
                         self.mouse['begin'][1],
                         0, 0),
                         0, 0),
@@ -1772,7 +1775,7 @@ class PsMapBufferedWindow(wx.Window):
             if self.mouse['use'] in (
             if self.mouse['use'] in (
                     'zoomin', 'zoomout', 'addMap', 'addLine', 'addRectangle'):
                     'zoomin', 'zoomout', 'addMap', 'addLine', 'addRectangle'):
                 self.mouse['end'] = event.GetPosition()
                 self.mouse['end'] = event.GetPosition()
-                r = wx.Rect(
+                r = Rect(
                     self.mouse['begin'][0],
                     self.mouse['begin'][0],
                     self.mouse['begin'][1],
                     self.mouse['begin'][1],
                     self.mouse['end'][0] -
                     self.mouse['end'][0] -
@@ -1847,7 +1850,7 @@ class PsMapBufferedWindow(wx.Window):
                     if newWidth < 10 or newHeight < 10:
                     if newWidth < 10 or newHeight < 10:
                         return
                         return
 
 
-                    bounds = wx.Rect(x, y, newWidth, newHeight)
+                    bounds = Rect(x, y, newWidth, newHeight)
                     self.Draw(
                     self.Draw(
                         pen=self.pen['map'],
                         pen=self.pen['map'],
                         brush=self.brush['map'],
                         brush=self.brush['map'],
@@ -1897,7 +1900,7 @@ class PsMapBufferedWindow(wx.Window):
 
 
                     # update paper coordinates
                     # update paper coordinates
                     points[self.currentLinePoint] = self.CanvasPaperCoordinates(
                     points[self.currentLinePoint] = self.CanvasPaperCoordinates(
-                        rect=wx.RectPS(pos, (0, 0)), canvasToPaper=True)[:2]
+                        rect=Rect(pos, (0, 0)), canvasToPaper=True)[:2]
 
 
                 self.RedrawSelectBox(self.dragId)
                 self.RedrawSelectBox(self.dragId)
 
 
@@ -2149,7 +2152,7 @@ class PsMapBufferedWindow(wx.Window):
         self.Zoom(zoomFactor, view)
         self.Zoom(zoomFactor, view)
 
 
     def Draw(self, pen, brush, pdc, drawid=None, pdctype='rect',
     def Draw(self, pen, brush, pdc, drawid=None, pdctype='rect',
-             bb=wx.Rect(0, 0, 0, 0), lineCoords=None):
+             bb=Rect(0, 0, 0, 0), lineCoords=None):
         """Draw object with given pen and brush.
         """Draw object with given pen and brush.
 
 
         :param pdc: PseudoDC
         :param pdc: PseudoDC
@@ -2191,17 +2194,17 @@ class PsMapBufferedWindow(wx.Window):
             dc.SetFont(font)
             dc.SetFont(font)
             pdc.SetFont(font)
             pdc.SetFont(font)
             text = '\n'.join(self.itemLabels[drawid])
             text = '\n'.join(self.itemLabels[drawid])
-            w, h, lh = dc.GetMultiLineTextExtent(text)
+            w, h = dc.GetMultiLineTextExtent(text)
             textExtent = (w, h)
             textExtent = (w, h)
-            textRect = wx.Rect(0, 0, *textExtent).CenterIn(bb)
+            textRect = Rect(0, 0, *textExtent).CenterIn(bb)
             r = map(int, bb)
             r = map(int, bb)
-            while not wx.Rect(*r).ContainsRect(textRect) and size >= 8:
+            while not Rect(*r).ContainsRect(textRect) and size >= 8:
                 size -= 2
                 size -= 2
                 font.SetPointSize(size)
                 font.SetPointSize(size)
                 dc.SetFont(font)
                 dc.SetFont(font)
                 pdc.SetFont(font)
                 pdc.SetFont(font)
                 textExtent = dc.GetTextExtent(text)
                 textExtent = dc.GetTextExtent(text)
-                textRect = wx.Rect(0, 0, *textExtent).CenterIn(bb)
+                textRect = Rect(0, 0, *textExtent).CenterIn(bb)
             pdc.SetTextForeground(wx.Colour(100, 100, 100, 200))
             pdc.SetTextForeground(wx.Colour(100, 100, 100, 200))
             pdc.SetBackgroundMode(wx.TRANSPARENT)
             pdc.SetBackgroundMode(wx.TRANSPARENT)
             pdc.DrawLabel(text=text, rect=textRect)
             pdc.DrawLabel(text=text, rect=textRect)
@@ -2327,7 +2330,7 @@ class PsMapBufferedWindow(wx.Window):
         else:
         else:
             pdc.DrawRotatedText(textDict['text'], coords[0], coords[1], rot)
             pdc.DrawRotatedText(textDict['text'], coords[0], coords[1], rot)
 
 
-        pdc.SetIdBounds(drawId, wx.Rect(*bounds))
+        pdc.SetIdBounds(drawId, Rect(*bounds))
         self.Refresh()
         self.Refresh()
         pdc.EndDrawing()
         pdc.EndDrawing()
 
 
@@ -2382,7 +2385,7 @@ class PsMapBufferedWindow(wx.Window):
         iH = iH * self.currScale
         iH = iH * self.currScale
         x = cW / 2 - iW / 2
         x = cW / 2 - iW / 2
         y = cH / 2 - iH / 2
         y = cH / 2 - iH / 2
-        imageRect = wx.Rect(x, y, iW, iH)
+        imageRect = Rect(x, y, iW, iH)
 
 
         return imageRect
         return imageRect
 
 
@@ -2404,7 +2407,7 @@ class PsMapBufferedWindow(wx.Window):
             # draw small marks signalizing resizing
             # draw small marks signalizing resizing
             if self.instruction[id].type in ('map', 'rectangle'):
             if self.instruction[id].type in ('map', 'rectangle'):
                 controlP = self.pdcObj.GetIdBounds(id).GetBottomRight()
                 controlP = self.pdcObj.GetIdBounds(id).GetBottomRight()
-                rect = wx.RectPS(controlP, self.resizeBoxSize)
+                rect = Rect(controlP, self.resizeBoxSize)
                 self.Draw(
                 self.Draw(
                     pen=self.pen['resize'],
                     pen=self.pen['resize'],
                     brush=self.brush['resize'],
                     brush=self.brush['resize'],
@@ -2421,9 +2424,9 @@ class PsMapBufferedWindow(wx.Window):
                 p2Canvas = self.CanvasPaperCoordinates(
                 p2Canvas = self.CanvasPaperCoordinates(
                     rect=Rect2DPS(p2Paper, (0, 0)), canvasToPaper=False)[:2]
                     rect=Rect2DPS(p2Paper, (0, 0)), canvasToPaper=False)[:2]
                 rect = []
                 rect = []
-                box = wx.RectS(self.resizeBoxSize)
-                rect.append(box.CenterIn(wx.RectPS(p1Canvas, wx.Size())))
-                rect.append(box.CenterIn(wx.RectPS(p2Canvas, wx.Size())))
+                box = Rect(self.resizeBoxSize)
+                rect.append(box.CenterIn(Rect(p1Canvas, wx.Size())))
+                rect.append(box.CenterIn(Rect(p2Canvas, wx.Size())))
                 for i, point in enumerate((p1Canvas, p2Canvas)):
                 for i, point in enumerate((p1Canvas, p2Canvas)):
                     self.Draw(
                     self.Draw(
                         pen=self.pen['resize'],
                         pen=self.pen['resize'],
@@ -2495,11 +2498,11 @@ class PsMapBufferedWindow(wx.Window):
         # Make new off screen bitmap: this bitmap will always have the
         # Make new off screen bitmap: this bitmap will always have the
         # current drawing in it, so it can be used to save the image
         # current drawing in it, so it can be used to save the image
         # to a file, or whatever.
         # to a file, or whatever.
-        self._buffer = wx.EmptyBitmap(width, height)
+        self._buffer = EmptyBitmap(width, height)
         # re-render image on idle
         # re-render image on idle
         self.resize = True
         self.resize = True
 
 
     def ScaleRect(self, rect, scale):
     def ScaleRect(self, rect, scale):
         """Scale rectangle"""
         """Scale rectangle"""
-        return wx.Rect(rect.GetLeft() * scale, rect.GetTop() * scale,
+        return Rect(rect.GetLeft() * scale, rect.GetTop() * scale,
                        rect.GetSize()[0] * scale, rect.GetSize()[1] * scale)
                        rect.GetSize()[0] * scale, rect.GetSize()[1] * scale)

+ 3 - 2
gui/wxpython/psmap/instructions.py

@@ -34,6 +34,7 @@ This program is free software under the GNU General Public License
 
 
 import os
 import os
 import string
 import string
+import six
 from math import ceil
 from math import ceil
 from time import strftime, localtime
 from time import strftime, localtime
 
 
@@ -762,8 +763,8 @@ class PageSetup(InstructionObject):
                         # e.g. paper a3
                         # e.g. paper a3
                         try:
                         try:
                             instr['Format'] = pformat
                             instr['Format'] = pformat
-                            for key, value in availableFormats[
-                                    pformat].iteritems():
+                            for key, value in six.iteritems(availableFormats[
+                                                            pformat]):
                                 instr[key] = float(value)
                                 instr[key] = float(value)
                             break
                             break
                         except KeyError:
                         except KeyError:

+ 7 - 8
gui/wxpython/psmap/utils.py

@@ -385,14 +385,13 @@ def GetMapBounds(filename, portrait=True):
     if not portrait:
     if not portrait:
         orient = 'r'
         orient = 'r'
     try:
     try:
-        bb = map(
-            float,
-            grass.read_command(
-                'ps.map',
-                flags='b' +
-                orient,
-                quiet=True,
-                input=filename).strip().split('=')[1].split(','))
+        bb = list(map(float,
+                    grass.read_command(
+                    'ps.map',
+                    flags='b' +
+                    orient,
+                    quiet=True,
+                    input=filename).strip().split('=')[1].split(',')))
     except (grass.ScriptError, IndexError):
     except (grass.ScriptError, IndexError):
         GError(message=_("Unable to run `ps.map -b`"))
         GError(message=_("Unable to run `ps.map -b`"))
         return None
         return None

+ 6 - 5
gui/wxpython/rdigit/dialogs.py

@@ -18,6 +18,7 @@ import wx
 
 
 from core.utils import _
 from core.utils import _
 from gui_core.gselect import Select
 from gui_core.gselect import Select
+from gui_core.wrap import Button, StaticText
 from core.gcmd import GWarning
 from core.gcmd import GWarning
 
 
 import grass.script.core as gcore
 import grass.script.core as gcore
@@ -42,24 +43,24 @@ class NewRasterDialog(wx.Dialog):
         self._typeChoice.SetSelection(0)
         self._typeChoice.SetSelection(0)
         self._mapSelect.SetFocus()
         self._mapSelect.SetFocus()
 
 
-        btnCancel = wx.Button(parent=self, id=wx.ID_CANCEL)
-        btnOK = wx.Button(parent=self, id=wx.ID_OK)
+        btnCancel = Button(parent=self, id=wx.ID_CANCEL)
+        btnOK = Button(parent=self, id=wx.ID_OK)
         btnOK.SetDefault()
         btnOK.SetDefault()
         btnOK.Bind(wx.EVT_BUTTON, self.OnOK)
         btnOK.Bind(wx.EVT_BUTTON, self.OnOK)
 
 
         # do layout
         # do layout
         mainSizer = wx.BoxSizer(wx.VERTICAL)
         mainSizer = wx.BoxSizer(wx.VERTICAL)
         sizer = wx.GridBagSizer(hgap=10, vgap=10)
         sizer = wx.GridBagSizer(hgap=10, vgap=10)
-        sizer.Add(wx.StaticText(self, label=_("Name for new raster map:")),
+        sizer.Add(StaticText(self, label=_("Name for new raster map:")),
                   pos=(0, 0), span=(1, 2), flag=wx.ALIGN_CENTER_VERTICAL)
                   pos=(0, 0), span=(1, 2), flag=wx.ALIGN_CENTER_VERTICAL)
         sizer.Add(self._mapSelect, pos=(1, 0), span=(1, 2))
         sizer.Add(self._mapSelect, pos=(1, 0), span=(1, 2))
         sizer.Add(
         sizer.Add(
-            wx.StaticText(
+            StaticText(
                 self, label=_("Optionally select background raster map:")), pos=(
                 self, label=_("Optionally select background raster map:")), pos=(
                 2, 0), span=(
                 2, 0), span=(
                 1, 2), flag=wx.ALIGN_CENTER_VERTICAL)
                 1, 2), flag=wx.ALIGN_CENTER_VERTICAL)
         sizer.Add(self._backgroundSelect, pos=(3, 0), span=(1, 2))
         sizer.Add(self._backgroundSelect, pos=(3, 0), span=(1, 2))
-        sizer.Add(wx.StaticText(self, label=_("New raster map type:")),
+        sizer.Add(StaticText(self, label=_("New raster map type:")),
                   pos=(4, 0), flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL)
                   pos=(4, 0), flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL)
         sizer.Add(self._typeChoice, pos=(4, 1), flag=wx.EXPAND)
         sizer.Add(self._typeChoice, pos=(4, 1), flag=wx.EXPAND)
 
 

+ 5 - 4
gui/wxpython/rdigit/toolbars.py

@@ -21,6 +21,7 @@ from gui_core.toolbars import BaseToolbar
 from icons.icon import MetaIcon
 from icons.icon import MetaIcon
 from gui_core.widgets import FloatValidator
 from gui_core.widgets import FloatValidator
 import wx.lib.colourselect as csel
 import wx.lib.colourselect as csel
+from gui_core.wrap import TextCtrl, StaticText
 
 
 
 
 rdigitIcons = {'area': MetaIcon(img='polygon-create',
 rdigitIcons = {'area': MetaIcon(img='polygon-create',
@@ -82,22 +83,22 @@ class RDigitToolbar(BaseToolbar):
                               lambda evt: self._cellValueChanged())
                               lambda evt: self._cellValueChanged())
         self._valueCombo.SetSelection(0)
         self._valueCombo.SetSelection(0)
         self._cellValueChanged()
         self._cellValueChanged()
-        labelValue = wx.StaticText(self, label=" %s" % _("Cell value:"))
+        labelValue = StaticText(self, label=" %s" % _("Cell value:"))
         self.InsertControl(6, labelValue)
         self.InsertControl(6, labelValue)
         self.InsertControl(7, self._valueCombo)
         self.InsertControl(7, self._valueCombo)
 
 
         self._widthValueId = wx.NewId()
         self._widthValueId = wx.NewId()
         # validator does not work with combobox, SetBackgroundColor is not
         # validator does not work with combobox, SetBackgroundColor is not
         # working
         # working
-        self._widthValue = wx.TextCtrl(
+        self._widthValue = TextCtrl(
             self, id=self._widthValueId, value='0', size=(
             self, id=self._widthValueId, value='0', size=(
                 80, -1), validator=FloatValidator())
                 80, -1), validator=FloatValidator())
         self._widthValue.Bind(wx.EVT_TEXT,
         self._widthValue.Bind(wx.EVT_TEXT,
                               lambda evt: self._widthValueChanged())
                               lambda evt: self._widthValueChanged())
         self._widthValueChanged()
         self._widthValueChanged()
-        self._widthValue.SetToolTipString(
+        self._widthValue.SetToolTip(
             _("Width of currently digitized line or diameter of a digitized point in map units."))
             _("Width of currently digitized line or diameter of a digitized point in map units."))
-        labelWidth = wx.StaticText(self, label=" %s" % _("Width:"))
+        labelWidth = StaticText(self, label=" %s" % _("Width:"))
         self.InsertControl(8, labelWidth)
         self.InsertControl(8, labelWidth)
         self.InsertControl(9, self._widthValue)
         self.InsertControl(9, self._widthValue)
 
 

+ 17 - 16
gui/wxpython/rlisetup/frame.py

@@ -15,6 +15,7 @@ from rlisetup.functions import retRLiPath
 from rlisetup.wizard import RLIWizard
 from rlisetup.wizard import RLIWizard
 import locale
 import locale
 import codecs
 import codecs
+from gui_core.wrap import Button, StaticBox, TextCtrl
 
 
 
 
 class ViewFrame(wx.Frame):
 class ViewFrame(wx.Frame):
@@ -32,20 +33,20 @@ class ViewFrame(wx.Frame):
         self.SetIcon(wx.Icon(os.path.join(globalvar.ICONDIR, 'grass.ico'),
         self.SetIcon(wx.Icon(os.path.join(globalvar.ICONDIR, 'grass.ico'),
                              wx.BITMAP_TYPE_ICO))
                              wx.BITMAP_TYPE_ICO))
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
-        self.confilesBox = wx.StaticBox(
+        self.confilesBox = StaticBox(
             parent=self.panel, id=wx.ID_ANY, label=_(
             parent=self.panel, id=wx.ID_ANY, label=_(
                 "View and modify the "
                 "View and modify the "
                 "configuration file '{name}'".format(
                 "configuration file '{name}'".format(
                     name=self.confile)))
                     name=self.confile)))
-        self.textCtrl = wx.TextCtrl(parent=self.panel, id=wx.ID_ANY,
-                                    style=wx.TE_MULTILINE, size=(-1, 75))
+        self.textCtrl = TextCtrl(parent=self.panel, id=wx.ID_ANY,
+                                 style=wx.TE_MULTILINE, size=(-1, 75))
         self.textCtrl.Bind(wx.EVT_TEXT, self.OnFileText)
         self.textCtrl.Bind(wx.EVT_TEXT, self.OnFileText)
         f = open(self.pathfile)
         f = open(self.pathfile)
         self.textCtrl.SetValue(''.join(f.readlines()))
         self.textCtrl.SetValue(''.join(f.readlines()))
         f.close()
         f.close()
         # BUTTONS      #definition
         # BUTTONS      #definition
-        self.btn_close = wx.Button(parent=self, id=wx.ID_EXIT)
-        self.btn_ok = wx.Button(parent=self, id=wx.ID_SAVE)
+        self.btn_close = Button(parent=self, id=wx.ID_EXIT)
+        self.btn_ok = Button(parent=self, id=wx.ID_SAVE)
         self.btn_close.Bind(wx.EVT_BUTTON, self.OnClose)
         self.btn_close.Bind(wx.EVT_BUTTON, self.OnClose)
         self.btn_ok.Bind(wx.EVT_BUTTON, self.OnOk)
         self.btn_ok.Bind(wx.EVT_BUTTON, self.OnOk)
         self._layout()
         self._layout()
@@ -127,27 +128,27 @@ class RLiSetupFrame(wx.Frame):
                              wx.BITMAP_TYPE_ICO))
                              wx.BITMAP_TYPE_ICO))
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
         # box for select configuration file
         # box for select configuration file
-        self.confilesBox = wx.StaticBox(
+        self.confilesBox = StaticBox(
             parent=self.panel, id=wx.ID_ANY,
             parent=self.panel, id=wx.ID_ANY,
             label=_('Available sampling area configuration files'))
             label=_('Available sampling area configuration files'))
         self.listfileBox = wx.ListBox(parent=self.panel, id=wx.ID_ANY,
         self.listfileBox = wx.ListBox(parent=self.panel, id=wx.ID_ANY,
                                       choices=self.listfiles)
                                       choices=self.listfiles)
 
 
         # BUTTONS      #definition
         # BUTTONS      #definition
-        self.btn_close = wx.Button(parent=self, id=wx.ID_CLOSE)
-        self.btn_help = wx.Button(parent=self, id=wx.ID_HELP)
-        self.btn_remove = wx.Button(parent=self, id=wx.ID_ANY,
+        self.btn_close = Button(parent=self, id=wx.ID_CLOSE)
+        self.btn_help = Button(parent=self, id=wx.ID_HELP)
+        self.btn_remove = Button(parent=self, id=wx.ID_ANY,
                                     label=_("Remove"))
                                     label=_("Remove"))
-        self.btn_remove.SetToolTipString(_('Remove a configuration file'))
-        self.btn_new = wx.Button(parent=self, id=wx.ID_ANY,
+        self.btn_remove.SetToolTip(_('Remove a configuration file'))
+        self.btn_new = Button(parent=self, id=wx.ID_ANY,
                                  label=_("Create"))
                                  label=_("Create"))
-        self.btn_new.SetToolTipString(_('Create a new configuration file'))
-        self.btn_rename = wx.Button(parent=self, id=wx.ID_ANY,
+        self.btn_new.SetToolTip(_('Create a new configuration file'))
+        self.btn_rename = Button(parent=self, id=wx.ID_ANY,
                                     label=_("Rename"))
                                     label=_("Rename"))
-        self.btn_rename.SetToolTipString(_('Rename a configuration file'))
-        self.btn_view = wx.Button(parent=self, id=wx.ID_ANY,
+        self.btn_rename.SetToolTip(_('Rename a configuration file'))
+        self.btn_view = Button(parent=self, id=wx.ID_ANY,
                                   label=_("View/Edit"))
                                   label=_("View/Edit"))
-        self.btn_view.SetToolTipString(_('View and edit a configuration file'))
+        self.btn_view.SetToolTip(_('View and edit a configuration file'))
         # set action for button
         # set action for button
         self.btn_close.Bind(wx.EVT_BUTTON, self.OnClose)
         self.btn_close.Bind(wx.EVT_BUTTON, self.OnClose)
         self.btn_help.Bind(wx.EVT_BUTTON, self.OnHelp)
         self.btn_help.Bind(wx.EVT_BUTTON, self.OnHelp)

+ 1 - 1
gui/wxpython/rlisetup/sampling_frame.py

@@ -47,7 +47,7 @@ from core.gcmd import GMessage
 from grass.pydispatch.signal import Signal
 from grass.pydispatch.signal import Signal
 from grass.pydispatch.errors import DispatcherKeyError
 from grass.pydispatch.errors import DispatcherKeyError
 
 
-from functions import SamplingType, checkMapExists
+from .functions import SamplingType, checkMapExists
 
 
 
 
 class Circle:
 class Circle:

+ 85 - 84
gui/wxpython/rlisetup/wizard.py

@@ -33,6 +33,7 @@ else:
 import wx.lib.scrolledpanel as scrolled
 import wx.lib.scrolledpanel as scrolled
 
 
 from gui_core import gselect
 from gui_core import gselect
+from gui_core.wrap import Button, StaticText, TextCtrl
 from core.utils import _
 from core.utils import _
 from location_wizard.wizard import TitledPage as TitledPage
 from location_wizard.wizard import TitledPage as TitledPage
 from rlisetup.functions import checkValue, retRLiPath
 from rlisetup.functions import checkValue, retRLiPath
@@ -493,12 +494,12 @@ class FirstPage(TitledPage):
         self.parent = parent
         self.parent = parent
 
 
         # name of output configuration file
         # name of output configuration file
-        self.newconflabel = wx.StaticText(
+        self.newconflabel = StaticText(
             parent=self, id=wx.ID_ANY,
             parent=self, id=wx.ID_ANY,
             label=_('Name for new configuration file to create'))
             label=_('Name for new configuration file to create'))
 
 
-        self.newconftxt = wx.TextCtrl(parent=self, id=wx.ID_ANY,
-                                      size=(250, -1))
+        self.newconftxt = TextCtrl(parent=self, id=wx.ID_ANY,
+                                   size=(250, -1))
         wx.CallAfter(self.newconftxt.SetFocus)
         wx.CallAfter(self.newconftxt.SetFocus)
 
 
         self.sizer.Add(self.newconflabel, border=5, pos=(0, 0),
         self.sizer.Add(self.newconflabel, border=5, pos=(0, 0),
@@ -506,7 +507,7 @@ class FirstPage(TitledPage):
         self.sizer.Add(self.newconftxt, border=5, pos=(0, 1),
         self.sizer.Add(self.newconftxt, border=5, pos=(0, 1),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         # raster
         # raster
-        self.mapsellabel = wx.StaticText(
+        self.mapsellabel = StaticText(
             parent=self, id=wx.ID_ANY,
             parent=self, id=wx.ID_ANY,
             label=_('Raster map to use to select areas'))
             label=_('Raster map to use to select areas'))
         self.mapselect = gselect.Select(parent=self, id=wx.ID_ANY,
         self.mapselect = gselect.Select(parent=self, id=wx.ID_ANY,
@@ -517,7 +518,7 @@ class FirstPage(TitledPage):
         self.sizer.Add(self.mapselect, border=5, pos=(1, 1),
         self.sizer.Add(self.mapselect, border=5, pos=(1, 1),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         # vector
         # vector
-        self.vectsellabel = wx.StaticText(
+        self.vectsellabel = StaticText(
             parent=self, id=wx.ID_ANY,
             parent=self, id=wx.ID_ANY,
             label=_('Vector map to use to select areas'))
             label=_('Vector map to use to select areas'))
         self.vectselect = gselect.Select(parent=self, id=wx.ID_ANY,
         self.vectselect = gselect.Select(parent=self, id=wx.ID_ANY,
@@ -528,7 +529,7 @@ class FirstPage(TitledPage):
         self.sizer.Add(self.vectselect, border=5, pos=(2, 1),
         self.sizer.Add(self.vectselect, border=5, pos=(2, 1),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         # vector layer
         # vector layer
-        self.vectlaylabel = wx.StaticText(
+        self.vectlaylabel = StaticText(
             parent=self, id=wx.ID_ANY,
             parent=self, id=wx.ID_ANY,
             label=_('Vector map layer to use to select areas'))
             label=_('Vector map layer to use to select areas'))
         self.vectlayer = wx.ComboBox(parent=self, id=wx.ID_ANY,
         self.vectlayer = wx.ComboBox(parent=self, id=wx.ID_ANY,
@@ -554,7 +555,7 @@ class FirstPage(TitledPage):
         self.sizer.Add(self.sampling_reg,
         self.sizer.Add(self.sampling_reg,
                        flag=wx.ALIGN_CENTER | wx.ALL | wx.EXPAND, border=5,
                        flag=wx.ALIGN_CENTER | wx.ALL | wx.EXPAND, border=5,
                        pos=(5, 0), span=(1, 2))
                        pos=(5, 0), span=(1, 2))
-        self.infoError = wx.StaticText(self, label='')
+        self.infoError = StaticText(self, label='')
         self.infoError.SetForegroundColour(wx.RED)
         self.infoError.SetForegroundColour(wx.RED)
         self.sizer.Add(self.infoError,
         self.sizer.Add(self.infoError,
                        flag=wx.ALIGN_CENTER | wx.ALL | wx.EXPAND, border=5,
                        flag=wx.ALIGN_CENTER | wx.ALL | wx.EXPAND, border=5,
@@ -713,12 +714,12 @@ class KeyboardPage(TitledPage):
         self.row_up = '0'
         self.row_up = '0'
 
 
         # column up/left
         # column up/left
-        self.ColUpLeftlabel = wx.StaticText(parent=self, id=wx.ID_ANY,
+        self.ColUpLeftlabel = StaticText(parent=self, id=wx.ID_ANY,
                                             label=_("Column of upper left "
                                             label=_("Column of upper left "
                                                     "corner"))
                                                     "corner"))
 
 
-        self.ColUpLefttxt = wx.TextCtrl(parent=self, id=wx.ID_ANY,
-                                        size=(250, -1))
+        self.ColUpLefttxt = TextCtrl(parent=self, id=wx.ID_ANY,
+                                     size=(250, -1))
         wx.CallAfter(self.ColUpLeftlabel.SetFocus)
         wx.CallAfter(self.ColUpLeftlabel.SetFocus)
 
 
         self.sizer.Add(self.ColUpLeftlabel, border=5, pos=(1, 1),
         self.sizer.Add(self.ColUpLeftlabel, border=5, pos=(1, 1),
@@ -727,11 +728,11 @@ class KeyboardPage(TitledPage):
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.AddGrowableCol(2)
         self.sizer.AddGrowableCol(2)
         # row up/left
         # row up/left
-        self.RowUpLeftlabel = wx.StaticText(
+        self.RowUpLeftlabel = StaticText(
             parent=self, id=wx.ID_ANY, label=_('Row of upper left corner'))
             parent=self, id=wx.ID_ANY, label=_('Row of upper left corner'))
 
 
-        self.RowUpLefttxt = wx.TextCtrl(parent=self, id=wx.ID_ANY,
-                                        size=(250, -1))
+        self.RowUpLefttxt = TextCtrl(parent=self, id=wx.ID_ANY,
+                                     size=(250, -1))
         wx.CallAfter(self.RowUpLeftlabel.SetFocus)
         wx.CallAfter(self.RowUpLeftlabel.SetFocus)
 
 
         self.sizer.Add(self.RowUpLeftlabel, border=5, pos=(2, 1),
         self.sizer.Add(self.RowUpLeftlabel, border=5, pos=(2, 1),
@@ -740,12 +741,12 @@ class KeyboardPage(TitledPage):
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
 
 
         # row length
         # row length
-        self.RowLenlabel = wx.StaticText(
+        self.RowLenlabel = StaticText(
             parent=self,
             parent=self,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_('Row length of sampling frame'))
             label=_('Row length of sampling frame'))
 
 
-        self.RowLentxt = wx.TextCtrl(parent=self, id=wx.ID_ANY, size=(250, -1))
+        self.RowLentxt = TextCtrl(parent=self, id=wx.ID_ANY, size=(250, -1))
         wx.CallAfter(self.RowLenlabel.SetFocus)
         wx.CallAfter(self.RowLenlabel.SetFocus)
 
 
         self.sizer.Add(self.RowLenlabel, border=5, pos=(3, 1),
         self.sizer.Add(self.RowLenlabel, border=5, pos=(3, 1),
@@ -754,12 +755,12 @@ class KeyboardPage(TitledPage):
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
 
 
         # column length
         # column length
-        self.ColLenlabel = wx.StaticText(
+        self.ColLenlabel = StaticText(
             parent=self,
             parent=self,
             id=wx.ID_ANY,
             id=wx.ID_ANY,
             label=_('Row length of sampling frame'))
             label=_('Row length of sampling frame'))
 
 
-        self.ColLentxt = wx.TextCtrl(parent=self, id=wx.ID_ANY, size=(250, -1))
+        self.ColLentxt = TextCtrl(parent=self, id=wx.ID_ANY, size=(250, -1))
         wx.CallAfter(self.ColLenlabel.SetFocus)
         wx.CallAfter(self.ColLenlabel.SetFocus)
 
 
         self.sizer.Add(self.ColLenlabel, border=5, pos=(4, 1),
         self.sizer.Add(self.ColLenlabel, border=5, pos=(4, 1),
@@ -912,10 +913,10 @@ class SamplingAreasPage(TitledPage):
 
 
         self.regionPanelSizer = wx.GridBagSizer(1, 2)
         self.regionPanelSizer = wx.GridBagSizer(1, 2)
         self.regionNumPanel = wx.Panel(parent=self, id=wx.ID_ANY)
         self.regionNumPanel = wx.Panel(parent=self, id=wx.ID_ANY)
-        self.regionNumLabel = wx.StaticText(
+        self.regionNumLabel = StaticText(
             parent=self.regionNumPanel, id=wx.ID_ANY,
             parent=self.regionNumPanel, id=wx.ID_ANY,
             label=_('Number of regions to draw:'))
             label=_('Number of regions to draw:'))
-        self.regionNumTxt = wx.TextCtrl(parent=self.regionNumPanel,
+        self.regionNumTxt = TextCtrl(parent=self.regionNumPanel,
                                         id=wx.ID_ANY, size=(50, -1))
                                         id=wx.ID_ANY, size=(50, -1))
         self.regionPanelSizer.Add(self.regionNumLabel, flag=wx.ALIGN_CENTER,
         self.regionPanelSizer.Add(self.regionNumLabel, flag=wx.ALIGN_CENTER,
                                   pos=(0, 0))
                                   pos=(0, 0))
@@ -927,17 +928,17 @@ class SamplingAreasPage(TitledPage):
 
 
         self.areaPanelSizer = wx.GridBagSizer(2, 3)
         self.areaPanelSizer = wx.GridBagSizer(2, 3)
         self.areaPanel = wx.Panel(parent=self, id=wx.ID_ANY)
         self.areaPanel = wx.Panel(parent=self, id=wx.ID_ANY)
-        self.overwriteText = wx.StaticText(
+        self.overwriteText = StaticText(
             parent=self.areaPanel, id=wx.ID_ANY, label=_(
             parent=self.areaPanel, id=wx.ID_ANY, label=_(
                 'Do you want to overwrite existing'
                 'Do you want to overwrite existing'
                 ' temporal maps if they exist?'))
                 ' temporal maps if they exist?'))
         self.overwriteCheck = wx.CheckBox(parent=self.areaPanel, id=wx.ID_ANY)
         self.overwriteCheck = wx.CheckBox(parent=self.areaPanel, id=wx.ID_ANY)
-        self.areaText = wx.StaticText(
+        self.areaText = StaticText(
             parent=self.areaPanel, id=wx.ID_ANY,
             parent=self.areaPanel, id=wx.ID_ANY,
             label=_('Do you want to check vector areas?'))
             label=_('Do you want to check vector areas?'))
-        self.areaOK = wx.Button(self.areaPanel, wx.ID_ANY, 'Yes', (50, 80))
+        self.areaOK = Button(self.areaPanel, wx.ID_ANY, 'Yes', (50, 80))
         self.areaOK.SetToolTip(wx.ToolTip(_("Select if use area by area")))
         self.areaOK.SetToolTip(wx.ToolTip(_("Select if use area by area")))
-        self.areaNO = wx.Button(self.areaPanel, wx.ID_ANY, 'No', (50, 80))
+        self.areaNO = Button(self.areaPanel, wx.ID_ANY, 'No', (50, 80))
         self.areaNO.SetToolTip(wx.ToolTip(_("All the features will be used")))
         self.areaNO.SetToolTip(wx.ToolTip(_("All the features will be used")))
         self.areaOK.Bind(wx.EVT_BUTTON, self.OnVectYes)
         self.areaOK.Bind(wx.EVT_BUTTON, self.OnVectYes)
         self.areaNO.Bind(wx.EVT_BUTTON, self.OnVectNo)
         self.areaNO.Bind(wx.EVT_BUTTON, self.OnVectNo)
@@ -953,7 +954,7 @@ class SamplingAreasPage(TitledPage):
         self.areaPanel.SetSizer(self.areaPanelSizer)
         self.areaPanel.SetSizer(self.areaPanelSizer)
         self.sizer.Add(self.areaPanel, flag=wx.ALIGN_CENTER, pos=(3, 0))
         self.sizer.Add(self.areaPanel, flag=wx.ALIGN_CENTER, pos=(3, 0))
 
 
-        self.calculatingAreas = wx.StaticText(
+        self.calculatingAreas = StaticText(
             parent=self, id=wx.ID_ANY,
             parent=self, id=wx.ID_ANY,
             label=_('Analysing all vector features...'))
             label=_('Analysing all vector features...'))
         self.sizer.Add(self.calculatingAreas, flag=wx.ALIGN_CENTER, pos=(4, 0))
         self.sizer.Add(self.calculatingAreas, flag=wx.ALIGN_CENTER, pos=(4, 0))
@@ -1189,9 +1190,9 @@ class SampleUnitsKeyPage(TitledPage):
 
 
         self.panelSizer.Add(self.typeBox, flag=wx.ALIGN_LEFT, pos=(0, 0),
         self.panelSizer.Add(self.typeBox, flag=wx.ALIGN_LEFT, pos=(0, 0),
                             span=(1, 2))
                             span=(1, 2))
-        self.widthLabel = wx.StaticText(parent=self.scrollPanel, id=wx.ID_ANY)
-        self.widthTxt = wx.TextCtrl(parent=self.scrollPanel, id=wx.ID_ANY,
-                                    size=(250, -1))
+        self.widthLabel = StaticText(parent=self.scrollPanel, id=wx.ID_ANY)
+        self.widthTxt = TextCtrl(parent=self.scrollPanel, id=wx.ID_ANY,
+                                 size=(250, -1))
 
 
         self.panelSizer.Add(
         self.panelSizer.Add(
             self.widthLabel, pos=(1, 0),
             self.widthLabel, pos=(1, 0),
@@ -1200,9 +1201,9 @@ class SampleUnitsKeyPage(TitledPage):
             self.widthTxt, pos=(1, 1),
             self.widthTxt, pos=(1, 1),
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
 
 
-        self.heightLabel = wx.StaticText(parent=self.scrollPanel, id=wx.ID_ANY)
-        self.heightTxt = wx.TextCtrl(parent=self.scrollPanel, id=wx.ID_ANY,
-                                     size=(250, -1))
+        self.heightLabel = StaticText(parent=self.scrollPanel, id=wx.ID_ANY)
+        self.heightTxt = TextCtrl(parent=self.scrollPanel, id=wx.ID_ANY,
+                                  size=(250, -1))
 
 
         self.panelSizer.Add(
         self.panelSizer.Add(
             self.heightLabel, pos=(2, 0),
             self.heightLabel, pos=(2, 0),
@@ -1231,21 +1232,21 @@ class SampleUnitsKeyPage(TitledPage):
         self.panelSizer.Add(self.distributionBox, pos=(3, 0), span=(
         self.panelSizer.Add(self.distributionBox, pos=(3, 0), span=(
             1, 2), flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
             1, 2), flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
 
 
-        self.distr1Label = wx.StaticText(parent=self.scrollPanel, id=wx.ID_ANY,
+        self.distr1Label = StaticText(parent=self.scrollPanel, id=wx.ID_ANY,
                                          label=_("What number of Sampling "
                                          label=_("What number of Sampling "
                                                  "Units to use?"))
                                                  "Units to use?"))
-        self.distr1Txt = wx.TextCtrl(parent=self.scrollPanel, id=wx.ID_ANY,
-                                     size=(250, -1))
+        self.distr1Txt = TextCtrl(parent=self.scrollPanel, id=wx.ID_ANY,
+                                  size=(250, -1))
         self.panelSizer.Add(
         self.panelSizer.Add(
             self.distr1Label, pos=(4, 0),
             self.distr1Label, pos=(4, 0),
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.panelSizer.Add(
         self.panelSizer.Add(
             self.distr1Txt, pos=(4, 1),
             self.distr1Txt, pos=(4, 1),
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
-        self.distr2Label = wx.StaticText(parent=self.scrollPanel, id=wx.ID_ANY,
+        self.distr2Label = StaticText(parent=self.scrollPanel, id=wx.ID_ANY,
                                          label="")
                                          label="")
-        self.distr2Txt = wx.TextCtrl(parent=self.scrollPanel, id=wx.ID_ANY,
-                                     size=(250, -1))
+        self.distr2Txt = TextCtrl(parent=self.scrollPanel, id=wx.ID_ANY,
+                                  size=(250, -1))
         self.panelSizer.Add(
         self.panelSizer.Add(
             self.distr2Label, pos=(5, 0),
             self.distr2Label, pos=(5, 0),
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
@@ -1367,16 +1368,16 @@ class MovingKeyPage(TitledPage):
         self.typeBox.Bind(wx.EVT_RADIOBOX, self.OnType)
         self.typeBox.Bind(wx.EVT_RADIOBOX, self.OnType)
         self.Bind(wiz.EVT_WIZARD_PAGE_CHANGED, self.OnEnterPage)
         self.Bind(wiz.EVT_WIZARD_PAGE_CHANGED, self.OnEnterPage)
 
 
-        self.widthLabel = wx.StaticText(parent=self, id=wx.ID_ANY,
+        self.widthLabel = StaticText(parent=self, id=wx.ID_ANY,
                                         label=_('Width size (in cells)?'))
                                         label=_('Width size (in cells)?'))
-        self.widthTxt = wx.TextCtrl(parent=self, id=wx.ID_ANY, size=(250, -1))
+        self.widthTxt = TextCtrl(parent=self, id=wx.ID_ANY, size=(250, -1))
         self.sizer.Add(self.widthLabel, border=5, pos=(2, 1),
         self.sizer.Add(self.widthLabel, border=5, pos=(2, 1),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.Add(self.widthTxt, border=5, pos=(2, 2),
         self.sizer.Add(self.widthTxt, border=5, pos=(2, 2),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
-        self.heightLabel = wx.StaticText(parent=self, id=wx.ID_ANY,
+        self.heightLabel = StaticText(parent=self, id=wx.ID_ANY,
                                          label=_('Height size (in cells)?'))
                                          label=_('Height size (in cells)?'))
-        self.heightTxt = wx.TextCtrl(parent=self, id=wx.ID_ANY, size=(250, -1))
+        self.heightTxt = TextCtrl(parent=self, id=wx.ID_ANY, size=(250, -1))
         self.sizer.Add(self.heightLabel, border=5, pos=(3, 1),
         self.sizer.Add(self.heightLabel, border=5, pos=(3, 1),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.Add(self.heightTxt, border=5, pos=(3, 2),
         self.sizer.Add(self.heightTxt, border=5, pos=(3, 2),
@@ -1456,11 +1457,11 @@ class UnitsMousePage(TitledPage):
 
 
         self.regionPanelSizer = wx.GridBagSizer(1, 2)
         self.regionPanelSizer = wx.GridBagSizer(1, 2)
         self.regionNumPanel = wx.Panel(parent=self, id=wx.ID_ANY)
         self.regionNumPanel = wx.Panel(parent=self, id=wx.ID_ANY)
-        self.regionNumLabel = wx.StaticText(
+        self.regionNumLabel = StaticText(
             parent=self.regionNumPanel, id=wx.ID_ANY,
             parent=self.regionNumPanel, id=wx.ID_ANY,
             label=_('Number of sampling area to draw:'))
             label=_('Number of sampling area to draw:'))
-        self.regionNumTxt = wx.TextCtrl(parent=self.regionNumPanel,
-                                        id=wx.ID_ANY, size=(50, -1))
+        self.regionNumTxt = TextCtrl(parent=self.regionNumPanel,
+                                     id=wx.ID_ANY, size=(50, -1))
         self.regionPanelSizer.Add(self.regionNumLabel, flag=wx.ALIGN_CENTER,
         self.regionPanelSizer.Add(self.regionNumLabel, flag=wx.ALIGN_CENTER,
                                   pos=(0, 0))
                                   pos=(0, 0))
         self.regionPanelSizer.Add(self.regionNumTxt, flag=wx.ALIGN_CENTER,
         self.regionPanelSizer.Add(self.regionNumTxt, flag=wx.ALIGN_CENTER,
@@ -1617,10 +1618,10 @@ class VectorAreasPage(TitledPage):
         self.Bind(wiz.EVT_WIZARD_PAGE_CHANGING, self.OnExitPage)
         self.Bind(wiz.EVT_WIZARD_PAGE_CHANGING, self.OnExitPage)
         self.areaPanelSizer = wx.GridBagSizer(1, 3)
         self.areaPanelSizer = wx.GridBagSizer(1, 3)
         self.areaPanel = wx.Panel(parent=self, id=wx.ID_ANY)
         self.areaPanel = wx.Panel(parent=self, id=wx.ID_ANY)
-        self.areaText = wx.StaticText(parent=self.areaPanel, id=wx.ID_ANY,
+        self.areaText = StaticText(parent=self.areaPanel, id=wx.ID_ANY,
                                       label=_('Is this area ok?'))
                                       label=_('Is this area ok?'))
-        self.areaOK = wx.Button(self.areaPanel, wx.ID_ANY, 'Yes', (50, 80))
-        self.areaNO = wx.Button(self.areaPanel, wx.ID_ANY, 'No', (50, 80))
+        self.areaOK = Button(self.areaPanel, wx.ID_ANY, 'Yes', (50, 80))
+        self.areaNO = Button(self.areaPanel, wx.ID_ANY, 'No', (50, 80))
         self.areaOK.Bind(wx.EVT_BUTTON, self.OnYes)
         self.areaOK.Bind(wx.EVT_BUTTON, self.OnYes)
         self.areaNO.Bind(wx.EVT_BUTTON, self.OnNo)
         self.areaNO.Bind(wx.EVT_BUTTON, self.OnNo)
         self.areaPanelSizer.Add(self.areaText, flag=wx.ALIGN_CENTER,
         self.areaPanelSizer.Add(self.areaText, flag=wx.ALIGN_CENTER,
@@ -1740,100 +1741,100 @@ class SummaryPage(TitledPage):
         self.parent = parent
         self.parent = parent
 
 
         # configuration file name
         # configuration file name
-        self.conflabel = wx.StaticText(parent=self, id=wx.ID_ANY,
-                                       label=_('Configuration file name:'))
-        self.conftxt = wx.StaticText(parent=self, id=wx.ID_ANY,
-                                     label="")
+        self.conflabel = StaticText(parent=self, id=wx.ID_ANY,
+                                    label=_('Configuration file name:'))
+        self.conftxt = StaticText(parent=self, id=wx.ID_ANY,
+                                  label="")
         self.sizer.Add(self.conflabel, border=5, pos=(0, 0),
         self.sizer.Add(self.conflabel, border=5, pos=(0, 0),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.Add(self.conftxt, border=5, pos=(0, 1),
         self.sizer.Add(self.conftxt, border=5, pos=(0, 1),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         # raster name
         # raster name
-        self.rastlabel = wx.StaticText(parent=self, id=wx.ID_ANY,
-                                       label=_('Raster name:'))
-        self.rasttxt = wx.StaticText(parent=self, id=wx.ID_ANY,
-                                     label="")
+        self.rastlabel = StaticText(parent=self, id=wx.ID_ANY,
+                                    label=_('Raster name:'))
+        self.rasttxt = StaticText(parent=self, id=wx.ID_ANY,
+                                  label="")
         self.sizer.Add(self.rastlabel, border=5, pos=(1, 0),
         self.sizer.Add(self.rastlabel, border=5, pos=(1, 0),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.Add(self.rasttxt, border=5, pos=(1, 1),
         self.sizer.Add(self.rasttxt, border=5, pos=(1, 1),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
 
 
         # vector name
         # vector name
-        self.vectlabel = wx.StaticText(parent=self, id=wx.ID_ANY,
-                                       label=_('Vector name:'))
-        self.vecttxt = wx.StaticText(parent=self, id=wx.ID_ANY, label="")
+        self.vectlabel = StaticText(parent=self, id=wx.ID_ANY,
+                                    label=_('Vector name:'))
+        self.vecttxt = StaticText(parent=self, id=wx.ID_ANY, label="")
         self.sizer.Add(self.vectlabel, border=5, pos=(2, 0),
         self.sizer.Add(self.vectlabel, border=5, pos=(2, 0),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.Add(self.vecttxt, border=5, pos=(2, 1),
         self.sizer.Add(self.vecttxt, border=5, pos=(2, 1),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
 
 
         # region type name
         # region type name
-        self.regionlabel = wx.StaticText(parent=self, id=wx.ID_ANY,
-                                         label=_('Region type:'))
-        self.regiontxt = wx.StaticText(parent=self, id=wx.ID_ANY, label="")
+        self.regionlabel = StaticText(parent=self, id=wx.ID_ANY,
+                                      label=_('Region type:'))
+        self.regiontxt = StaticText(parent=self, id=wx.ID_ANY, label="")
         self.sizer.Add(self.regionlabel, border=5, pos=(3, 0),
         self.sizer.Add(self.regionlabel, border=5, pos=(3, 0),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.Add(self.regiontxt, border=5, pos=(3, 1),
         self.sizer.Add(self.regiontxt, border=5, pos=(3, 1),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
 
 
         # region keyboard
         # region keyboard
-        self.regionkeylabel = wx.StaticText(parent=self, id=wx.ID_ANY,
-                                            label="")
-        self.regionkeytxt = wx.StaticText(parent=self, id=wx.ID_ANY, label="")
+        self.regionkeylabel = StaticText(parent=self, id=wx.ID_ANY,
+                                         label="")
+        self.regionkeytxt = StaticText(parent=self, id=wx.ID_ANY, label="")
         self.sizer.Add(self.regionkeylabel, border=5, pos=(4, 0),
         self.sizer.Add(self.regionkeylabel, border=5, pos=(4, 0),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.Add(self.regionkeytxt, border=5, pos=(4, 1),
         self.sizer.Add(self.regionkeytxt, border=5, pos=(4, 1),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.Bind(wiz.EVT_WIZARD_PAGE_CHANGED, self.OnEnterPage)
         self.Bind(wiz.EVT_WIZARD_PAGE_CHANGED, self.OnEnterPage)
         # sampling area
         # sampling area
-        self.samplinglabel = wx.StaticText(parent=self, id=wx.ID_ANY,
-                                           label=_('Sampling area type:'))
-        self.samplingtxt = wx.StaticText(parent=self, id=wx.ID_ANY, label="")
+        self.samplinglabel = StaticText(parent=self, id=wx.ID_ANY,
+                                        label=_('Sampling area type:'))
+        self.samplingtxt = StaticText(parent=self, id=wx.ID_ANY, label="")
         self.sizer.Add(self.samplinglabel, border=5, pos=(5, 0),
         self.sizer.Add(self.samplinglabel, border=5, pos=(5, 0),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.Add(self.samplingtxt, border=5, pos=(5, 1),
         self.sizer.Add(self.samplingtxt, border=5, pos=(5, 1),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         # shapetype
         # shapetype
-        self.shapelabel = wx.StaticText(parent=self, id=wx.ID_ANY, label="")
-        self.shapetxt = wx.StaticText(parent=self, id=wx.ID_ANY, label="")
+        self.shapelabel = StaticText(parent=self, id=wx.ID_ANY, label="")
+        self.shapetxt = StaticText(parent=self, id=wx.ID_ANY, label="")
         self.sizer.Add(self.shapelabel, border=5, pos=(6, 0),
         self.sizer.Add(self.shapelabel, border=5, pos=(6, 0),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.Add(self.shapetxt, border=5, pos=(6, 1),
         self.sizer.Add(self.shapetxt, border=5, pos=(6, 1),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         # shapedim
         # shapedim
-        self.shapewidthlabel = wx.StaticText(parent=self, id=wx.ID_ANY,
-                                             label="")
-        self.shapewidthtxt = wx.StaticText(parent=self, id=wx.ID_ANY,
-                                           label="")
+        self.shapewidthlabel = StaticText(parent=self, id=wx.ID_ANY,
+                                          label="")
+        self.shapewidthtxt = StaticText(parent=self, id=wx.ID_ANY,
+                                        label="")
         self.sizer.Add(self.shapewidthlabel, border=5, pos=(7, 0),
         self.sizer.Add(self.shapewidthlabel, border=5, pos=(7, 0),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.Add(self.shapewidthtxt, border=5, pos=(7, 1),
         self.sizer.Add(self.shapewidthtxt, border=5, pos=(7, 1),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
-        self.shapeheightlabel = wx.StaticText(parent=self, id=wx.ID_ANY,
-                                              label="")
-        self.shapeheighttxt = wx.StaticText(parent=self, id=wx.ID_ANY,
-                                            label="")
+        self.shapeheightlabel = StaticText(parent=self, id=wx.ID_ANY,
+                                           label="")
+        self.shapeheighttxt = StaticText(parent=self, id=wx.ID_ANY,
+                                         label="")
         self.sizer.Add(self.shapeheightlabel, border=5, pos=(8, 0),
         self.sizer.Add(self.shapeheightlabel, border=5, pos=(8, 0),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.Add(self.shapeheighttxt, border=5, pos=(8, 1),
         self.sizer.Add(self.shapeheighttxt, border=5, pos=(8, 1),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         # units type
         # units type
-        self.unitslabel = wx.StaticText(parent=self, id=wx.ID_ANY, label="")
-        self.unitstxt = wx.StaticText(parent=self, id=wx.ID_ANY, label="")
+        self.unitslabel = StaticText(parent=self, id=wx.ID_ANY, label="")
+        self.unitstxt = StaticText(parent=self, id=wx.ID_ANY, label="")
         self.sizer.Add(self.unitslabel, border=5, pos=(9, 0),
         self.sizer.Add(self.unitslabel, border=5, pos=(9, 0),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.Add(self.unitstxt, border=5, pos=(9, 1),
         self.sizer.Add(self.unitstxt, border=5, pos=(9, 1),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
-        self.unitsmorelabel = wx.StaticText(parent=self, id=wx.ID_ANY,
-                                            label="")
-        self.unitsmoretxt = wx.StaticText(parent=self, id=wx.ID_ANY, label="")
+        self.unitsmorelabel = StaticText(parent=self, id=wx.ID_ANY,
+                                         label="")
+        self.unitsmoretxt = StaticText(parent=self, id=wx.ID_ANY, label="")
         self.sizer.Add(self.unitsmorelabel, border=5, pos=(10, 0),
         self.sizer.Add(self.unitsmorelabel, border=5, pos=(10, 0),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.Add(self.unitsmoretxt, border=5, pos=(10, 1),
         self.sizer.Add(self.unitsmoretxt, border=5, pos=(10, 1),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
-        self.unitsmorelabel2 = wx.StaticText(parent=self, id=wx.ID_ANY,
-                                             label="")
-        self.unitsmoretxt2 = wx.StaticText(parent=self, id=wx.ID_ANY, label="")
+        self.unitsmorelabel2 = StaticText(parent=self, id=wx.ID_ANY,
+                                          label="")
+        self.unitsmoretxt2 = StaticText(parent=self, id=wx.ID_ANY, label="")
         self.sizer.Add(self.unitsmorelabel2, border=5, pos=(11, 0),
         self.sizer.Add(self.unitsmorelabel2, border=5, pos=(11, 0),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.Add(self.unitsmoretxt2, border=5, pos=(11, 1),
         self.sizer.Add(self.unitsmoretxt2, border=5, pos=(11, 1),

+ 3 - 3
gui/wxpython/startup/locdownload.py

@@ -44,7 +44,7 @@ set_gui_path()
 from core.debug import Debug
 from core.debug import Debug
 from core.utils import _
 from core.utils import _
 from core.gthread import gThread
 from core.gthread import gThread
-from gui_core.wrap import Button
+from gui_core.wrap import Button, StaticText
 
 
 
 
 # TODO: labels (and descriptions) translatable?
 # TODO: labels (and descriptions) translatable?
@@ -288,7 +288,7 @@ class LocationDownloadPanel(wx.Panel):
         self.database = database
         self.database = database
         self.locations = locations
         self.locations = locations
 
 
-        self.label = wx.StaticText(
+        self.label = StaticText(
             parent=self,
             parent=self,
             label=_("Select sample location to download:"))
             label=_("Select sample location to download:"))
 
 
@@ -307,7 +307,7 @@ class LocationDownloadPanel(wx.Panel):
         # TODO: add thumbnail for each location?
         # TODO: add thumbnail for each location?
 
 
         # TODO: messages copied from gis_set.py, need this as API?
         # TODO: messages copied from gis_set.py, need this as API?
-        self.message = wx.StaticText(parent=self, size=(-1, 50))
+        self.message = StaticText(parent=self, size=(-1, 50))
         sys.stdout = RedirectText(self.message)
         sys.stdout = RedirectText(self.message)
 
 
         # It is not clear if all wx versions supports color, so try-except.
         # It is not clear if all wx versions supports color, so try-except.

+ 0 - 0
gui/wxpython/timeline/frame.py


Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov