[GRASS-SVN] r73229 - in grass/trunk: gui/wxpython gui/wxpython/animation gui/wxpython/core gui/wxpython/datacatalog gui/wxpython/dbmgr gui/wxpython/gcp gui/wxpython/gmodeler gui/wxpython/gui_core gui/wxpython/iclass gui/wxpython/icons gui/wxpython/image2target gui/wxpython/iscatt gui/wxpython/lmgr gui/wxpython/location_wizard gui/wxpython/mapdisp gui/wxpython/mapswipe gui/wxpython/mapwin gui/wxpython/modules gui/wxpython/nviz gui/wxpython/photo2image gui/wxpython/psmap gui/wxpython/rdigit gui/wxpython/rlisetup gui/wxpython/startup gui/wxpython/timeline gui/wxpython/tools gui/wxpython/tplot gui/wxpython/vdigit gui/wxpython/vnet gui/wxpython/web_services gui/wxpython/wxplot lib/python/ctypes lib/python/ctypes/ctypesgencore lib/python/ctypes/ctypesgencore/parser lib/python/ctypes/ctypesgencore/printer lib/python/ctypes/ctypesgencore/processor lib/python/gunittest lib/python/pydispatch lib/python/pygrass/modules/interface lib/python/pygrass/raster lib/python/pygrass/raster/testsuite lib/pyt hon/pygrass/vector lib/python/script lib/python/script/testsuite lib/python/temporal lib/python/temporal/testsuite locale man scripts/db.droptable scripts/db.in.ogr scripts/db.test scripts/db.univar scripts/g.extension scripts/g.extension/testsuite scripts/g.search.modules/testsuite scripts/i.in.spotvgt scripts/i.oif scripts/i.pansharpen scripts/i.tasscap scripts/m.proj scripts/r.buffer.lowmem scripts/r.colors.stddev scripts/r.fillnulls scripts/r.in.srtm scripts/r.in.wms scripts/r.mask scripts/r.reclass.area scripts/r.tileset scripts/v.db.addcolumn scripts/v.db.addtable scripts/v.db.droptable scripts/v.db.reconnect.all scripts/v.db.univar scripts/v.dissolve scripts/v.in.e00 scripts/v.in.lines scripts/v.in.mapgen scripts/v.in.wfs scripts/v.rast.stats scripts/v.report scripts/v.to.lines scripts/v.what.strds/testsuite

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Sep 2 19:04:20 PDT 2018


Author: annakrat
Date: 2018-09-02 19:04:19 -0700 (Sun, 02 Sep 2018)
New Revision: 73229

Modified:
   grass/trunk/gui/wxpython/animation/anim.py
   grass/trunk/gui/wxpython/animation/dialogs.py
   grass/trunk/gui/wxpython/animation/frame.py
   grass/trunk/gui/wxpython/animation/mapwindow.py
   grass/trunk/gui/wxpython/animation/provider.py
   grass/trunk/gui/wxpython/animation/utils.py
   grass/trunk/gui/wxpython/core/gcmd.py
   grass/trunk/gui/wxpython/core/gconsole.py
   grass/trunk/gui/wxpython/core/gthread.py
   grass/trunk/gui/wxpython/core/render.py
   grass/trunk/gui/wxpython/core/settings.py
   grass/trunk/gui/wxpython/core/toolboxes.py
   grass/trunk/gui/wxpython/core/treemodel.py
   grass/trunk/gui/wxpython/core/units.py
   grass/trunk/gui/wxpython/core/utils.py
   grass/trunk/gui/wxpython/core/workspace.py
   grass/trunk/gui/wxpython/core/ws.py
   grass/trunk/gui/wxpython/datacatalog/dialogs.py
   grass/trunk/gui/wxpython/datacatalog/frame.py
   grass/trunk/gui/wxpython/datacatalog/toolbars.py
   grass/trunk/gui/wxpython/datacatalog/tree.py
   grass/trunk/gui/wxpython/dbmgr/base.py
   grass/trunk/gui/wxpython/dbmgr/dialogs.py
   grass/trunk/gui/wxpython/dbmgr/sqlbuilder.py
   grass/trunk/gui/wxpython/dbmgr/vinfo.py
   grass/trunk/gui/wxpython/gcp/manager.py
   grass/trunk/gui/wxpython/gcp/mapdisplay.py
   grass/trunk/gui/wxpython/gis_set.py
   grass/trunk/gui/wxpython/gmodeler/dialogs.py
   grass/trunk/gui/wxpython/gmodeler/frame.py
   grass/trunk/gui/wxpython/gmodeler/model.py
   grass/trunk/gui/wxpython/gmodeler/preferences.py
   grass/trunk/gui/wxpython/gui_core/dialogs.py
   grass/trunk/gui/wxpython/gui_core/forms.py
   grass/trunk/gui/wxpython/gui_core/ghelp.py
   grass/trunk/gui/wxpython/gui_core/goutput.py
   grass/trunk/gui/wxpython/gui_core/gselect.py
   grass/trunk/gui/wxpython/gui_core/mapdisp.py
   grass/trunk/gui/wxpython/gui_core/menu.py
   grass/trunk/gui/wxpython/gui_core/preferences.py
   grass/trunk/gui/wxpython/gui_core/pyedit.py
   grass/trunk/gui/wxpython/gui_core/query.py
   grass/trunk/gui/wxpython/gui_core/simplelmgr.py
   grass/trunk/gui/wxpython/gui_core/toolbars.py
   grass/trunk/gui/wxpython/gui_core/treeview.py
   grass/trunk/gui/wxpython/gui_core/vselect.py
   grass/trunk/gui/wxpython/gui_core/widgets.py
   grass/trunk/gui/wxpython/gui_core/wrap.py
   grass/trunk/gui/wxpython/gui_core/wxlibplot.py
   grass/trunk/gui/wxpython/iclass/dialogs.py
   grass/trunk/gui/wxpython/iclass/frame.py
   grass/trunk/gui/wxpython/iclass/statistics.py
   grass/trunk/gui/wxpython/iclass/toolbars.py
   grass/trunk/gui/wxpython/icons/icon.py
   grass/trunk/gui/wxpython/image2target/ii2t_gis_set.py
   grass/trunk/gui/wxpython/image2target/ii2t_manager.py
   grass/trunk/gui/wxpython/image2target/ii2t_mapdisplay.py
   grass/trunk/gui/wxpython/iscatt/controllers.py
   grass/trunk/gui/wxpython/iscatt/core_c.py
   grass/trunk/gui/wxpython/iscatt/dialogs.py
   grass/trunk/gui/wxpython/iscatt/frame.py
   grass/trunk/gui/wxpython/iscatt/iscatt_core.py
   grass/trunk/gui/wxpython/iscatt/plots.py
   grass/trunk/gui/wxpython/lmgr/layertree.py
   grass/trunk/gui/wxpython/location_wizard/base.py
   grass/trunk/gui/wxpython/location_wizard/dialogs.py
   grass/trunk/gui/wxpython/location_wizard/wizard.py
   grass/trunk/gui/wxpython/mapdisp/frame.py
   grass/trunk/gui/wxpython/mapdisp/main.py
   grass/trunk/gui/wxpython/mapdisp/statusbar.py
   grass/trunk/gui/wxpython/mapdisp/test_mapdisp.py
   grass/trunk/gui/wxpython/mapswipe/dialogs.py
   grass/trunk/gui/wxpython/mapswipe/frame.py
   grass/trunk/gui/wxpython/mapswipe/mapwindow.py
   grass/trunk/gui/wxpython/mapswipe/toolbars.py
   grass/trunk/gui/wxpython/mapwin/base.py
   grass/trunk/gui/wxpython/mapwin/buffered.py
   grass/trunk/gui/wxpython/modules/colorrules.py
   grass/trunk/gui/wxpython/modules/extensions.py
   grass/trunk/gui/wxpython/modules/histogram.py
   grass/trunk/gui/wxpython/modules/import_export.py
   grass/trunk/gui/wxpython/modules/mcalc_builder.py
   grass/trunk/gui/wxpython/modules/vclean.py
   grass/trunk/gui/wxpython/nviz/mapwindow.py
   grass/trunk/gui/wxpython/nviz/preferences.py
   grass/trunk/gui/wxpython/nviz/tools.py
   grass/trunk/gui/wxpython/nviz/workspace.py
   grass/trunk/gui/wxpython/photo2image/ip2i_manager.py
   grass/trunk/gui/wxpython/photo2image/ip2i_mapdisplay.py
   grass/trunk/gui/wxpython/psmap/dialogs.py
   grass/trunk/gui/wxpython/psmap/frame.py
   grass/trunk/gui/wxpython/psmap/instructions.py
   grass/trunk/gui/wxpython/psmap/utils.py
   grass/trunk/gui/wxpython/rdigit/dialogs.py
   grass/trunk/gui/wxpython/rdigit/toolbars.py
   grass/trunk/gui/wxpython/rlisetup/frame.py
   grass/trunk/gui/wxpython/rlisetup/sampling_frame.py
   grass/trunk/gui/wxpython/rlisetup/wizard.py
   grass/trunk/gui/wxpython/startup/locdownload.py
   grass/trunk/gui/wxpython/timeline/frame.py
   grass/trunk/gui/wxpython/tools/update_menudata.py
   grass/trunk/gui/wxpython/tplot/frame.py
   grass/trunk/gui/wxpython/vdigit/dialogs.py
   grass/trunk/gui/wxpython/vdigit/mapwindow.py
   grass/trunk/gui/wxpython/vdigit/preferences.py
   grass/trunk/gui/wxpython/vdigit/toolbars.py
   grass/trunk/gui/wxpython/vdigit/wxdigit.py
   grass/trunk/gui/wxpython/vdigit/wxdisplay.py
   grass/trunk/gui/wxpython/vnet/dialogs.py
   grass/trunk/gui/wxpython/vnet/vnet_core.py
   grass/trunk/gui/wxpython/vnet/vnet_data.py
   grass/trunk/gui/wxpython/vnet/widgets.py
   grass/trunk/gui/wxpython/web_services/dialogs.py
   grass/trunk/gui/wxpython/web_services/widgets.py
   grass/trunk/gui/wxpython/wxplot/base.py
   grass/trunk/gui/wxpython/wxplot/dialogs.py
   grass/trunk/gui/wxpython/wxplot/histogram.py
   grass/trunk/gui/wxpython/wxplot/profile.py
   grass/trunk/gui/wxpython/wxplot/scatter.py
   grass/trunk/lib/python/ctypes/ctypesgen.py
   grass/trunk/lib/python/ctypes/ctypesgencore/ctypedescs.py
   grass/trunk/lib/python/ctypes/ctypesgencore/descriptions.py
   grass/trunk/lib/python/ctypes/ctypesgencore/expressions.py
   grass/trunk/lib/python/ctypes/ctypesgencore/libraryloader.py
   grass/trunk/lib/python/ctypes/ctypesgencore/messages.py
   grass/trunk/lib/python/ctypes/ctypesgencore/options.py
   grass/trunk/lib/python/ctypes/ctypesgencore/parser/cdeclarations.py
   grass/trunk/lib/python/ctypes/ctypesgencore/parser/cgrammar.py
   grass/trunk/lib/python/ctypes/ctypesgencore/parser/cparser.py
   grass/trunk/lib/python/ctypes/ctypesgencore/parser/ctypesparser.py
   grass/trunk/lib/python/ctypes/ctypesgencore/parser/datacollectingparser.py
   grass/trunk/lib/python/ctypes/ctypesgencore/parser/lex.py
   grass/trunk/lib/python/ctypes/ctypesgencore/parser/lextab.py
   grass/trunk/lib/python/ctypes/ctypesgencore/parser/pplexer.py
   grass/trunk/lib/python/ctypes/ctypesgencore/parser/preprocessor.py
   grass/trunk/lib/python/ctypes/ctypesgencore/parser/yacc.py
   grass/trunk/lib/python/ctypes/ctypesgencore/printer/printer.py
   grass/trunk/lib/python/ctypes/ctypesgencore/processor/pipeline.py
   grass/trunk/lib/python/ctypes/preamble.py
   grass/trunk/lib/python/gunittest/case.py
   grass/trunk/lib/python/gunittest/gutils.py
   grass/trunk/lib/python/pydispatch/dispatcher.py
   grass/trunk/lib/python/pydispatch/robustapply.py
   grass/trunk/lib/python/pygrass/modules/interface/module.py
   grass/trunk/lib/python/pygrass/modules/interface/parameter.py
   grass/trunk/lib/python/pygrass/raster/abstract.py
   grass/trunk/lib/python/pygrass/raster/history.py
   grass/trunk/lib/python/pygrass/raster/segment.py
   grass/trunk/lib/python/pygrass/raster/testsuite/test_history.py
   grass/trunk/lib/python/pygrass/vector/geometry.py
   grass/trunk/lib/python/pygrass/vector/table.py
   grass/trunk/lib/python/script/core.py
   grass/trunk/lib/python/script/db.py
   grass/trunk/lib/python/script/task.py
   grass/trunk/lib/python/script/testsuite/test_start_command_functions.py
   grass/trunk/lib/python/script/testsuite/test_utils.py
   grass/trunk/lib/python/script/utils.py
   grass/trunk/lib/python/temporal/c_libraries_interface.py
   grass/trunk/lib/python/temporal/core.py
   grass/trunk/lib/python/temporal/temporal_algebra.py
   grass/trunk/lib/python/temporal/temporal_raster_base_algebra.py
   grass/trunk/lib/python/temporal/temporal_vector_algebra.py
   grass/trunk/lib/python/temporal/testsuite/test_register_function.py
   grass/trunk/locale/grass_po_stats.py
   grass/trunk/man/build_class.py
   grass/trunk/man/build_class_graphical.py
   grass/trunk/man/build_full_index.py
   grass/trunk/man/build_html.py
   grass/trunk/man/build_index.py
   grass/trunk/man/build_index_rest.py
   grass/trunk/man/build_keywords.py
   grass/trunk/man/build_manual_gallery.py
   grass/trunk/man/build_rest.py
   grass/trunk/man/build_topics.py
   grass/trunk/man/parser_standard_options.py
   grass/trunk/scripts/db.droptable/db.droptable.py
   grass/trunk/scripts/db.in.ogr/db.in.ogr.py
   grass/trunk/scripts/db.test/db.test.py
   grass/trunk/scripts/db.univar/db.univar.py
   grass/trunk/scripts/g.extension/g.extension.py
   grass/trunk/scripts/g.extension/testsuite/test_addons_modules.py
   grass/trunk/scripts/g.extension/testsuite/test_addons_toolboxes.py
   grass/trunk/scripts/g.search.modules/testsuite/test_g_search_modules.py
   grass/trunk/scripts/i.in.spotvgt/i.in.spotvgt.py
   grass/trunk/scripts/i.oif/i.oif.py
   grass/trunk/scripts/i.pansharpen/i.pansharpen.py
   grass/trunk/scripts/i.tasscap/i.tasscap.py
   grass/trunk/scripts/m.proj/m.proj.py
   grass/trunk/scripts/r.buffer.lowmem/r.buffer.lowmem.py
   grass/trunk/scripts/r.colors.stddev/r.colors.stddev.py
   grass/trunk/scripts/r.fillnulls/r.fillnulls.py
   grass/trunk/scripts/r.in.srtm/r.in.srtm.py
   grass/trunk/scripts/r.in.wms/r.in.wms.py
   grass/trunk/scripts/r.in.wms/wms_base.py
   grass/trunk/scripts/r.in.wms/wms_drv.py
   grass/trunk/scripts/r.mask/r.mask.py
   grass/trunk/scripts/r.reclass.area/r.reclass.area.py
   grass/trunk/scripts/r.tileset/r.tileset.py
   grass/trunk/scripts/v.db.addcolumn/v.db.addcolumn.py
   grass/trunk/scripts/v.db.addtable/v.db.addtable.py
   grass/trunk/scripts/v.db.droptable/v.db.droptable.py
   grass/trunk/scripts/v.db.reconnect.all/v.db.reconnect.all.py
   grass/trunk/scripts/v.db.univar/v.db.univar.py
   grass/trunk/scripts/v.dissolve/v.dissolve.py
   grass/trunk/scripts/v.in.e00/v.in.e00.py
   grass/trunk/scripts/v.in.lines/v.in.lines.py
   grass/trunk/scripts/v.in.mapgen/v.in.mapgen.py
   grass/trunk/scripts/v.in.wfs/v.in.wfs.py
   grass/trunk/scripts/v.rast.stats/v.rast.stats.py
   grass/trunk/scripts/v.report/v.report.py
   grass/trunk/scripts/v.to.lines/v.to.lines.py
   grass/trunk/scripts/v.what.strds/testsuite/test_what_strds.py
Log:
experimental GSoC 2018 Python 3 support by Sanjeet Bhatti

Modified: grass/trunk/gui/wxpython/animation/anim.py
===================================================================
--- grass/trunk/gui/wxpython/animation/anim.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/animation/anim.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -15,7 +15,7 @@
 """
 
 import wx
-from utils import Orientation, ReplayMode
+from .utils import Orientation, ReplayMode
 from core.utils import _
 
 

Modified: grass/trunk/gui/wxpython/animation/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/animation/dialogs.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/animation/dialogs.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -39,7 +39,8 @@
 from core.utils import _
 from gui_core.gselect import Select
 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.data import AnimationData, AnimLayer
@@ -99,14 +100,14 @@
         #
         # 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)
         gridSizer = wx.GridBagSizer(hgap=5, vgap=5)
 
-        labelDuration = wx.StaticText(
+        labelDuration = StaticText(
             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,
             id=wx.ID_ANY,
@@ -138,16 +139,16 @@
         #
         # 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)
         gridSizer = wx.GridBagSizer(hgap=5, vgap=5)
 
-        labelTimeUnit = wx.StaticText(
+        labelTimeUnit = StaticText(
             self, id=wx.ID_ANY, label=_("Time unit:"))
-        labelDuration = wx.StaticText(
+        labelDuration = StaticText(
             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, id=wx.ID_ANY, min=self.minimumDuration, max=10000,
             initial=self.defaultSpeed)
@@ -183,9 +184,9 @@
             flag=wx.EXPAND | wx.ALL,
             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.Bind(wx.EVT_BUTTON, self.OnOk)
@@ -352,8 +353,8 @@
             border=3)
 
         # 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.Bind(wx.EVT_BUTTON, self.OnOk)
         # button sizer
@@ -381,10 +382,10 @@
                 _("bottom right")])
         self.windowChoice.SetSelection(self.animationData.windowIndex)
 
-        self.nameCtrl = wx.TextCtrl(
+        self.nameCtrl = TextCtrl(
             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
         index = 0
         for i, (viewMode, viewModeName) in enumerate(
@@ -394,12 +395,12 @@
                 index = i
 
         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)
 
         gridSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5)
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 panel,
                 id=wx.ID_ANY,
                 label=_("Name:")),
@@ -406,7 +407,7 @@
             flag=wx.ALIGN_CENTER_VERTICAL)
         gridSizer.Add(self.nameCtrl, proportion=1, flag=wx.EXPAND)
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 panel,
                 id=wx.ID_ANY,
                 label=_("Window position:")),
@@ -416,7 +417,7 @@
             proportion=1,
             flag=wx.ALIGN_RIGHT)
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 panel,
                 id=wx.ID_ANY,
                 label=_("View mode:")),
@@ -432,7 +433,7 @@
         label = _(
             "For 3D animation, please select only one space-time dataset\n"
             "or one series of map layers.")
-        self.warning3DLayers = wx.StaticText(panel, label=label)
+        self.warning3DLayers = StaticText(panel, label=label)
         self.warning3DLayers.SetForegroundColour(
             wx.SystemSettings.GetColour(wx.SYS_COLOUR_GRAYTEXT))
         mainSizer.Add(
@@ -475,7 +476,7 @@
 
         self.legend = wx.CheckBox(panel, label=_("Show raster legend"))
         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.legendBtn.Bind(wx.EVT_BUTTON, self.OnLegendProperties)
 
@@ -495,8 +496,8 @@
 
     def _create3DPanel(self, parent):
         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)
 
         # workspace file
@@ -514,7 +515,7 @@
             fileMask="GRASS Workspace File (*.gxw)|*.gxw")
         if self.animationData.workspaceFile:
             self.fileSelector.SetValue(self.animationData.workspaceFile)
-        self.paramLabel = wx.StaticText(
+        self.paramLabel = StaticText(
             panel, wx.ID_ANY, label=_("Parameter for animation:"))
         self.paramChoice = wx.Choice(
             panel, id=wx.ID_ANY, choices=self.animationData.nvizParameters)
@@ -552,13 +553,13 @@
         panel = wx.Panel(parent=parent)
 
         mainSizer = wx.BoxSizer(wx.VERTICAL)
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel, label=" %s " %
             _("Animate region change (2D view only)"))
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
 
         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)
         self.stRegion = Select(parent=panel, type='region', size=(200, -1))
         if self.animationData.startRegion:
@@ -567,7 +568,7 @@
             self.stRegion, pos=(0, 1),
             flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND)
 
-        self.endRegRadio = wx.RadioButton(
+        self.endRegRadio = RadioButton(
             panel, label=_("End region:"), style=wx.RB_GROUP)
         gridSizer.Add(self.endRegRadio, pos=(1, 0), flag=wx.EXPAND)
         self.endRegion = Select(parent=panel, type='region', size=(200, -1))
@@ -574,18 +575,18 @@
         gridSizer.Add(
             self.endRegion, pos=(1, 1),
             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)
 
         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)
         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)
         zoomSizer.Add(self.zoomEW, proportion=1, flag=wx.LEFT, border=3)
         gridSizer.Add(
@@ -761,7 +762,7 @@
 
     def _layout(self):
         mainSizer = wx.BoxSizer(wx.VERTICAL)
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=self,
             id=wx.ID_ANY,
             label=" %s " %
@@ -776,11 +777,11 @@
             style=wx.LB_SINGLE | wx.LB_NEEDED_SB)
         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.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.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._updateListBox()
@@ -802,8 +803,8 @@
                       flag=wx.EXPAND | wx.ALL, border=5)
 
         # 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.Bind(wx.EVT_BUTTON, self.OnOk)
         # button sizer
@@ -933,9 +934,9 @@
         mainSizer.Add(notebook, proportion=0,
                       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.btnCancel = wx.Button(self, wx.ID_CANCEL)
+        self.btnCancel = Button(self, wx.ID_CANCEL)
         self.btnExport.SetDefault()
 
         self.btnExport.Bind(wx.EVT_BUTTON, self.OnExport)
@@ -993,7 +994,7 @@
         for buttonName, buttonLabel in zip(buttonNames, buttonLabels):
             if buttonName == 'time' and self.temporal == TemporalMode.NONTEMPORAL:
                 continue
-            btn = wx.Button(
+            btn = Button(
                 panel,
                 id=wx.ID_ANY,
                 name=buttonName,
@@ -1012,7 +1013,7 @@
                 flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                 border=0)
             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)
         gridBagSizer.Add(
             removeButton,
@@ -1034,7 +1035,7 @@
         else:
             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)
         self.informBox.Add(
             label,
@@ -1050,7 +1051,7 @@
         # font
         self.fontBox = wx.BoxSizer(wx.HORIZONTAL)
         self.fontBox.Add(
-            wx.StaticText(
+            StaticText(
                 panel,
                 id=wx.ID_ANY,
                 label=_("Font settings:")),
@@ -1057,11 +1058,11 @@
             proportion=0,
             flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT,
             border=5)
-        self.sampleLabel = wx.StaticText(
+        self.sampleLabel = StaticText(
             panel, id=wx.ID_ANY, label=_("Sample text"))
         self.fontBox.Add(self.sampleLabel, proportion=1,
                          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)
         self.fontBox.Add(
             fontButton,
@@ -1092,7 +1093,7 @@
         # text
         self.textBox = wx.BoxSizer(wx.HORIZONTAL)
         self.textBox.Add(
-            wx.StaticText(
+            StaticText(
                 panel,
                 id=wx.ID_ANY,
                 label=_("Text:")),
@@ -1099,7 +1100,7 @@
             proportion=0,
             flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT,
             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.textBox.Add(self.textCtrl, proportion=1, flag=wx.EXPAND)
         self.hidevbox.Add(self.textBox, proportion=0, flag=wx.EXPAND)
@@ -1114,7 +1115,7 @@
 
     def _positionWidget(self, panel):
         grid = wx.GridBagSizer(vgap=5, hgap=5)
-        label = wx.StaticText(
+        label = StaticText(
             panel, id=wx.ID_ANY, label=_(
                 "Placement as percentage of"
                 " screen coordinates (X: 0, Y: 0 is top left):"))
@@ -1137,9 +1138,9 @@
                 temp))
 
         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)
-        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)
         grid.Add(self.spinX, pos=(1, 1))
         grid.Add(self.spinY, pos=(1, 3))
@@ -1159,7 +1160,7 @@
             lambda event: self.ChangeFormat(
                 event.GetSelection()))
         hSizer.Add(
-            wx.StaticText(
+            StaticText(
                 panel,
                 id=wx.ID_ANY,
                 label=_("Export to:")),
@@ -1186,11 +1187,11 @@
 
         # panel for image sequence
         imSeqPanel = wx.Panel(parent=panel, id=wx.ID_ANY)
-        prefixLabel = wx.StaticText(
+        prefixLabel = StaticText(
             imSeqPanel, id=wx.ID_ANY, label=_("File prefix:"))
-        self.prefixCtrl = wx.TextCtrl(
+        self.prefixCtrl = TextCtrl(
             imSeqPanel, id=wx.ID_ANY, value=_("animation_"))
-        formatLabel = wx.StaticText(
+        formatLabel = StaticText(
             imSeqPanel, id=wx.ID_ANY, label=_("File format:"))
         imageTypes = ['PNG', 'JPEG', 'GIF', 'TIFF', 'PPM', 'BMP']
         self.imSeqFormatChoice = wx.Choice(imSeqPanel, choices=imageTypes)
@@ -1281,7 +1282,7 @@
             warning = _(
                 "Program 'ffmpeg' was not found.\nPlease install it first "
                 "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)
         self.aviBrowse = filebrowse.FileBrowseButton(
             parent=aviPanel,
@@ -1292,16 +1293,16 @@
             buttonText=_("Browse"),
             startDirectory=os.getcwd(),
             fileMode=wx.FD_SAVE)
-        encodingLabel = wx.StaticText(
+        encodingLabel = StaticText(
             parent=aviPanel,
             id=wx.ID_ANY,
             label=_("Video codec:"))
-        self.encodingText = wx.TextCtrl(
+        self.encodingText = TextCtrl(
             parent=aviPanel, id=wx.ID_ANY, value='mpeg4')
-        optionsLabel = wx.StaticText(
+        optionsLabel = StaticText(
             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' "
                 "if not satisfied with video quality. "
@@ -1337,7 +1338,7 @@
         fpsSizer = wx.BoxSizer(wx.HORIZONTAL)
         fps = 1000 / self.timeTick
         fpsSizer.Add(
-            wx.StaticText(
+            StaticText(
                 panel,
                 id=wx.ID_ANY,
                 label=_("Current frame rate: %.2f fps") %
@@ -1635,7 +1636,7 @@
         else:
             bitmap = wx.ArtProvider.GetBitmap(
                 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)
 
         types = [('raster', _("Multiple raster maps")),
@@ -1653,10 +1654,10 @@
         for type_, text in types:
             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.editBtn.Bind(wx.EVT_BUTTON, self._onProperties)
@@ -1682,7 +1683,7 @@
         bodySizer = wx.BoxSizer(wx.VERTICAL)
         typeSizer = 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)
         typeSizer.AddStretchSpacer()
         typeSizer.Add(self.tchoice)
@@ -1862,7 +1863,7 @@
 
         row = 0
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 label=_("Background color:")),
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,
@@ -1883,7 +1884,7 @@
 
         row += 1
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 label=_("Number of parallel processes:")),
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,
@@ -1912,7 +1913,7 @@
 
         row += 1
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 label=_("Text foreground color:")),
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,
@@ -1933,7 +1934,7 @@
 
         row += 1
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 label=_("Text background color:")),
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,
@@ -1975,7 +1976,7 @@
 
         row = 0
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 label=_("Absolute time format:")),
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,
@@ -1987,7 +1988,7 @@
         self.tempFormat.SetValue(self._initFormat)
         self.winId['animation:temporal:format'] = self.tempFormat.GetId()
         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(
             wx.EVT_COMBOBOX,
             lambda evt: self._setTimeFormat(
@@ -2021,9 +2022,9 @@
                       flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT)
 
         row += 2
-        noDataCheck = wx.CheckBox(
+        noDataCheck = CheckBox(
             panel, label=_("Display instances with no data"))
-        noDataCheck.SetToolTipString(
+        noDataCheck.SetToolTip(
             _(
                 "When animating instant-based data which have irregular timestamps "
                 "you can display 'no data frame' (checked option) or "

Modified: grass/trunk/gui/wxpython/animation/frame.py
===================================================================
--- grass/trunk/gui/wxpython/animation/frame.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/animation/frame.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -22,11 +22,13 @@
 import wx
 import wx.aui
 import tempfile
+import six
 
 import grass.script as gcore
 import grass.temporal as tgis
 from core import globalvar
 from gui_core.widgets import IntegerValidator
+from gui_core.wrap import StaticText, TextCtrl
 from core.gcmd import RunCommand
 from core.utils import _
 
@@ -136,7 +138,7 @@
                           Name('animPanel').CentrePane().CaptionVisible(False).PaneBorder(False).
                           Floatable(False).BestSize((-1, -1)).
                           CloseButton(False).DestroyOnClose(True).Layer(0))
-        for name, slider in self.animationSliders.iteritems():
+        for name, slider in six.iteritems(self.animationSliders):
             self._mgr.AddPane(
                 slider,
                 wx.aui.AuiPaneInfo().PaneBorder(False).Name(
@@ -328,6 +330,7 @@
         if self.controller.timer.IsRunning():
             self.controller.timer.Stop()
         CleanUp(TMP_DIR)()
+        self._mgr.UnInit()
         self.Destroy()
 
     def __del__(self):
@@ -383,11 +386,11 @@
 
     def __init__(self, parent):
         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.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.callbackSliderChanged = None
@@ -512,8 +515,8 @@
     def __init__(self, parent):
         AnimationSliderBase.__init__(self, parent)
         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.temporalType = TemporalType.RELATIVE
 

Modified: grass/trunk/gui/wxpython/animation/mapwindow.py
===================================================================
--- grass/trunk/gui/wxpython/animation/mapwindow.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/animation/mapwindow.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -17,8 +17,8 @@
 
 import wx
 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):
@@ -44,8 +44,8 @@
         wx.Window.__init__(self, *args, **kwargs)
 
         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.
         # This might result in OnSize getting called twice on some
         # platforms at initialization, but little harm done.
@@ -177,7 +177,7 @@
         self._pdc.BeginDrawing()
         self._pdc.SetId(1)
         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._pdc.EndDrawing()
 

Modified: grass/trunk/gui/wxpython/animation/provider.py
===================================================================
--- grass/trunk/gui/wxpython/animation/provider.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/animation/provider.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -32,6 +32,7 @@
 from core.utils import _, autoCropImageFromFile
 
 from animation.utils import HashCmd, HashCmds, GetFileFromCmd, GetFileFromCmds
+from gui_core.wrap import EmptyBitmap
 
 import grass.script.core as gcore
 from grass.script.task import cmdlist_to_tuple
@@ -802,7 +803,7 @@
     """
     Debug.msg(4, "createNoDataBitmap: w={w}, h={h}, text={t}".format(
         w=imageWidth, h=imageHeight, t=text))
-    bitmap = wx.EmptyBitmap(imageWidth, imageHeight)
+    bitmap = EmptyBitmap(imageWidth, imageHeight)
     dc = wx.MemoryDC()
     dc.SelectObject(bitmap)
     dc.Clear()

Modified: grass/trunk/gui/wxpython/animation/utils.py
===================================================================
--- grass/trunk/gui/wxpython/animation/utils.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/animation/utils.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -20,6 +20,7 @@
 import os
 import wx
 import hashlib
+import six
 from multiprocessing import cpu_count
 try:
     from PIL import Image
@@ -29,6 +30,8 @@
 
 import grass.temporal as tgis
 import grass.script as grass
+from grass.script.utils import encode
+from gui_core.wrap import EmptyBitmap
 
 from core.gcmd import GException
 from core.utils import _
@@ -97,7 +100,7 @@
                 raise GException(_("Map <%s> not found.") % name)
         else:
             found = False
-            for mapset, mapNames in mapDict.iteritems():
+            for mapset, mapNames in six.iteritems(mapDict):
                 if name in mapNames:
                     found = True
                     newNames.append(name + "@" + mapset)
@@ -245,10 +248,10 @@
 
 def RenderText(text, font, bgcolor, fgcolor):
     """Renderes text with given font to bitmap."""
-    dc = wx.MemoryDC(wx.EmptyBitmap(20, 20))
+    dc = wx.MemoryDC(EmptyBitmap(20, 20))
     dc.SetFont(font)
     w, h = dc.GetTextExtent(text)
-    bmp = wx.EmptyBitmap(w + 2, h + 2)
+    bmp = EmptyBitmap(w + 2, h + 2)
     dc.SelectObject(bmp)
     dc.SetBackgroundMode(wx.SOLID)
     dc.SetTextBackground(wx.Colour(*bgcolor))
@@ -278,7 +281,7 @@
     name = '_'.join(cmd)
     if region:
         name += str(sorted(region.items()))
-    return hashlib.sha1(name).hexdigest()
+    return hashlib.sha1(encode(name)).hexdigest()
 
 
 def HashCmds(cmds, region):
@@ -286,7 +289,7 @@
     name = ';'.join([item for sublist in cmds for item in sublist])
     if region:
         name += str(sorted(region.items()))
-    return hashlib.sha1(name).hexdigest()
+    return hashlib.sha1(encode(name)).hexdigest()
 
 
 def GetFileFromCmd(dirname, cmd, region, extension='ppm'):

Modified: grass/trunk/gui/wxpython/core/gcmd.py
===================================================================
--- grass/trunk/gui/wxpython/core/gcmd.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/core/gcmd.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -35,7 +35,11 @@
 import traceback
 import locale
 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 win32pipe import PeekNamedPipe
     import msvcrt
@@ -42,12 +46,8 @@
 else:
     import select
     import fcntl
-from threading import Thread
 
-import wx
-
 from grass.script import core as grass
-
 from core import globalvar
 from core.debug import Debug
 
@@ -66,7 +66,10 @@
         return string
     _ = null_gettext
 
+if sys.version_info.major == 2:
+    bytes = str
 
+
 def DecodeString(string):
     """Decode string using system encoding
 
@@ -77,10 +80,9 @@
     if not string:
         return string
 
-    if _enc:
+    if _enc and isinstance(string, bytes):
         Debug.msg(5, "DecodeString(): enc=%s" % _enc)
         return string.decode(_enc)
-
     return string
 
 
@@ -93,11 +95,9 @@
     """
     if not string:
         return string
-
     if _enc:
         Debug.msg(5, "EncodeString(): enc=%s" % _enc)
         return string.encode(_enc)
-
     return string
 
 
@@ -174,7 +174,7 @@
     """Subclass subprocess.Popen"""
 
     def __init__(self, args, **kwargs):
-        if subprocess.mswindows:
+        if is_mswindows:
             args = map(EncodeString, args)
 
             # The Windows shell (cmd.exe) requires some special characters to
@@ -230,7 +230,7 @@
 
     def kill(self):
         """Try to kill running process"""
-        if subprocess.mswindows:
+        if is_mswindows:
             import win32api
             handle = win32api.OpenProcess(1, 0, self.pid)
             return (0 != win32api.TerminateProcess(handle, 0))
@@ -620,7 +620,7 @@
         if self.stdout:
             # make module stdout/stderr non-blocking
             out_fileno = self.module.stdout.fileno()
-            if not subprocess.mswindows:
+            if not is_mswindows:
                 flags = fcntl.fcntl(out_fileno, fcntl.F_GETFL)
                 fcntl.fcntl(out_fileno, fcntl.F_SETFL, flags | os.O_NONBLOCK)
 
@@ -627,7 +627,7 @@
         if self.stderr:
             # make module stdout/stderr non-blocking
             out_fileno = self.module.stderr.fileno()
-            if not subprocess.mswindows:
+            if not is_mswindows:
                 flags = fcntl.fcntl(out_fileno, fcntl.F_GETFL)
                 fcntl.fcntl(out_fileno, fcntl.F_SETFL, flags | os.O_NONBLOCK)
 
@@ -703,8 +703,8 @@
     :return: returncode, stdout, messages (read == True and getErrorMsg == True)
     :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)
 
@@ -729,7 +729,7 @@
         ps.stdin.close()
         ps.stdin = None
 
-    stdout, stderr = map(DecodeString, ps.communicate())
+    stdout, stderr = list(map(DecodeString, ps.communicate()))
 
     if parent:  # restore previous settings
         os.environ['GRASS_MESSAGE_FORMAT'] = messageFormat

Modified: grass/trunk/gui/wxpython/core/gconsole.py
===================================================================
--- grass/trunk/gui/wxpython/core/gconsole.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/core/gconsole.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -27,7 +27,12 @@
 import re
 import time
 import threading
-import Queue
+
+if sys.version_info.major == 2:
+    import Queue
+else:
+    import queue as Queue
+
 import codecs
 import locale
 

Modified: grass/trunk/gui/wxpython/core/gthread.py
===================================================================
--- grass/trunk/gui/wxpython/core/gthread.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/core/gthread.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -19,7 +19,11 @@
 
 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
 

Modified: grass/trunk/gui/wxpython/core/render.py
===================================================================
--- grass/trunk/gui/wxpython/core/render.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/core/render.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -144,7 +144,7 @@
                   (self.type, self.name, self.mapfile))
 
         # prepare command for each layer
-        layertypes = utils.command2ltype.values() + ['overlay', 'command']
+        layertypes = list(utils.command2ltype.values()) + ['overlay', 'command']
 
         if self.type not in layertypes:
             raise GException(
@@ -254,7 +254,7 @@
 
     def SetType(self, ltype):
         """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)
 
         if not self.renderMgr:
@@ -1154,7 +1154,7 @@
         """
         selected = []
 
-        if isinstance(ltype, types.StringType):
+        if isinstance(ltype, str):
             one_type = True
         else:
             one_type = False

Modified: grass/trunk/gui/wxpython/core/settings.py
===================================================================
--- grass/trunk/gui/wxpython/core/settings.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/core/settings.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -858,9 +858,9 @@
         """Define internal settings (based on user settings)
         """
         self.internalSettings = {}
-        for group in self.userSettings.keys():
+        for group in list(self.userSettings.keys()):
             self.internalSettings[group] = {}
-            for key in self.userSettings[group].keys():
+            for key in list(self.userSettings[group].keys()):
                 self.internalSettings[group][key] = {}
 
         # self.internalSettings['general']["mapsetPath"]['value'] = self.GetMapsetPath()
@@ -1030,9 +1030,9 @@
 
         try:
             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))
                     for idx in range(len(subkeys)):
                         value = settings[group][key][subkeys[idx]]
@@ -1042,7 +1042,7 @@
                                     '%s%s%s%s%s' %
                                     (os.linesep, group, self.sep, key, 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))
                             for sidx in srange:
                                 svalue = self._parseValue(

Modified: grass/trunk/gui/wxpython/core/toolboxes.py
===================================================================
--- grass/trunk/gui/wxpython/core/toolboxes.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/core/toolboxes.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -34,7 +34,7 @@
 
 import grass.script.task as gtask
 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
 
 
@@ -766,9 +766,9 @@
     :return: XML as string
     """
     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():
@@ -897,7 +897,7 @@
     tree = createTree(distributionRootFile=mainFile, userRootFile=None,
                       userDefined=False)
     root = tree.getroot()
-    sys.stdout.write(_getXMLString(root))
+    sys.stdout.write(decode(_getXMLString(root), encoding='UTF-8'))
 
     return 0
 

Modified: grass/trunk/gui/wxpython/core/treemodel.py
===================================================================
--- grass/trunk/gui/wxpython/core/treemodel.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/core/treemodel.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -15,6 +15,7 @@
 
 @author Anna Petrasova <kratochanna gmail.com>
 """
+import six
 
 
 class TreeModel(object):
@@ -174,7 +175,7 @@
     def nprint(self, text, indent=0):
         text.append(indent * ' ' + self.label)
         if self.data:
-            for key, value in self.data.iteritems():
+            for key, value in six.iteritems(self.data):
                 text.append(
                     "%(indent)s* %(key)s : %(value)s" %
                     {'indent': (indent + 2) * ' ', 'key': key, 'value': value})

Modified: grass/trunk/gui/wxpython/core/units.py
===================================================================
--- grass/trunk/gui/wxpython/core/units.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/core/units.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -21,6 +21,7 @@
 @author Martin Landa <landa.martin gmail.com>
 """
 
+import six
 import math
 
 if __name__ == '__main__':
@@ -79,7 +80,7 @@
 
         :return: index
         """
-        for k, u in self._units[type].iteritems():
+        for k, u in six.iteritems(self._units[type]):
             if u['key'] == key:
                 return k
         return 0

Modified: grass/trunk/gui/wxpython/core/utils.py
===================================================================
--- grass/trunk/gui/wxpython/core/utils.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/core/utils.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -20,6 +20,7 @@
 import shlex
 import re
 import inspect
+import six
 
 from grass.script import core as grass
 from grass.script import task as gtask
@@ -44,9 +45,14 @@
     _ = null_gettext
 
 
+def cmp(a, b):
+    """cmp function"""
+    return ((a > b) - (a < b))
+
+
 def normalize_whitespace(text):
     """Remove redundant whitespace from a string"""
-    return string.join(string.split(text), ' ')
+    return (' ').join(text.split())
 
 
 def split(s):
@@ -324,7 +330,7 @@
 
 def ListSortLower(list):
     """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):
@@ -731,7 +737,7 @@
         else:
             formats['file'].append(name)
 
-    for items in formats.itervalues():
+    for items in six.itervalues(formats):
         items.sort()
 
     return formats
@@ -917,7 +923,7 @@
     else:
         expCmd = 'export'
 
-    for key, value in environ.iteritems():
+    for key, value in six.iteritems(environ):
         fd.write('%s %s=%s\n' % (expCmd, key, value))
 
     # write also skipped lines

Modified: grass/trunk/gui/wxpython/core/workspace.py
===================================================================
--- grass/trunk/gui/wxpython/core/workspace.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/core/workspace.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -19,6 +19,7 @@
 import os
 
 import wx
+import six
 
 from core.utils import normalize_whitespace, _
 from core.settings import UserSettings
@@ -976,7 +977,7 @@
                     '%s<task name="%s">\n' %
                     (' ' * self.indent, cmd[0]))
                 self.indent += 4
-                for key, val in cmd[1].iteritems():
+                for key, val in six.iteritems(cmd[1]):
                     if key == 'flags':
                         for f in val:
                             self.file.write('%s<flag name="%s" />\n' %
@@ -1003,7 +1004,7 @@
                     self.file.write('%s<vdigit>\n' % (' ' * self.indent))
                     if 'geomAttr' in vdigit:
                         self.indent += 4
-                        for type, val in vdigit['geomAttr'].iteritems():
+                        for type, val in six.iteritems(vdigit['geomAttr']):
                             units = ''
                             if val['units'] != 'mu':
                                 units = ' units="%s"' % val['units']
@@ -1038,13 +1039,13 @@
         self.indent += 4
         self.file.write('%s<surface>\n' % (' ' * self.indent))
         self.indent += 4
-        for attrb in data.iterkeys():
+        for attrb in six.iterkeys(data):
             if len(data[attrb]) < 1:  # skip empty attributes
                 continue
             if attrb == 'object':
                 continue
 
-            for name in data[attrb].iterkeys():
+            for name in six.iterkeys(data[attrb]):
                 # surface attribute
                 if attrb == 'attribute':
                     if data[attrb][name]['map'] is None:
@@ -1064,7 +1065,7 @@
             if attrb == 'draw':
                 self.file.write('%s<%s' % (' ' * self.indent, 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('>\n')  # <draw ...>
 
@@ -1121,7 +1122,7 @@
         self.indent += 4
         self.file.write('%s<volume>\n' % (' ' * self.indent))
         self.indent += 4
-        for attrb in data.iterkeys():
+        for attrb in six.iterkeys(data):
             if len(data[attrb]) < 1:  # skip empty attributes
                 continue
             if attrb == 'object':
@@ -1128,7 +1129,7 @@
                 continue
 
             if attrb == 'attribute':
-                for name in data[attrb].iterkeys():
+                for name in six.iterkeys(data[attrb]):
                     # surface attribute
                     if data[attrb][name]['map'] is None:
                         continue
@@ -1211,10 +1212,10 @@
             if attrb == 'isosurface':
                 for isosurface in data[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.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:
                                 val = '1'
                             elif isosurface[name][att] is False:
@@ -1242,10 +1243,10 @@
             if attrb == 'slice':
                 for slice_ in data[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.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'):
                                 continue
                             val = slice_[name][att]
@@ -1275,7 +1276,7 @@
         :param data: Nviz layer properties
         """
         self.indent += 4
-        for attrb in data.iterkeys():
+        for attrb in six.iterkeys(data):
             if len(data[attrb]) < 1:  # skip empty attributes
                 continue
 
@@ -1292,7 +1293,7 @@
                                                            attrb,
                                                            marker))
             self.indent += 4
-            for name in data[attrb].iterkeys():
+            for name in six.iterkeys(data[attrb]):
                 if name in ('object', 'marker'):
                     continue
                 if name == 'mode':
@@ -1318,7 +1319,7 @@
                     self.file.write('%s</%s>\n' % ((' ' * self.indent, name)))
                 elif name == 'thematic':
                     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'):
                             self.file.write(
                                 '%s="%s" ' %
@@ -1325,7 +1326,7 @@
                                 (key, int(data[attrb][name][key])))
                     self.file.write('>\n')
                     self.indent += 4
-                    for key, value in data[attrb][name].iteritems():
+                    for key, value in six.iteritems(data[attrb][name]):
                         if key.startswith('use'):
                             continue
                         if value is None:

Modified: grass/trunk/gui/wxpython/core/ws.py
===================================================================
--- grass/trunk/gui/wxpython/core/ws.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/core/ws.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -19,6 +19,7 @@
 import sys
 import copy
 import time
+import six
 
 import wx
 from wx.lib.newevent import NewEvent
@@ -213,7 +214,7 @@
         """Create string for GRASS_REGION env variable from  dict created by _getRegionDict.
         """
         regionStr = ''
-        for k, v in region.iteritems():
+        for k, v in six.iteritems(region):
             item = k + ': ' + str(v)
             if regionStr:
                 regionStr += '; '
@@ -356,7 +357,7 @@
         if sXsize < 1 or sYsize < 1:
             return
 
-        for sBandNnum, tBandNum in sTBands.iteritems():
+        for sBandNnum, tBandNum in six.iteritems(sTBands):
             bandData = sDataset.GetRasterBand(sBandNnum).ReadRaster(
                 sXoff, sYoff, sXsize, sYsize, tXsize, tYsize, gdal.GDT_Byte)
             self.tDataset.GetRasterBand(tBandNum).WriteRaster(

Modified: grass/trunk/gui/wxpython/datacatalog/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/datacatalog/dialogs.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/datacatalog/dialogs.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -20,6 +20,7 @@
 from gui_core.widgets import FloatValidator, IntegerValidator
 from core.giface import Notification
 from core.gcmd import RunCommand
+from gui_core.wrap import Button, StaticText, TextCtrl
 
 from grass.script import parse_key_val, region_env
 
@@ -61,26 +62,26 @@
 
     def _widgets(self):
         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),
                                         choices=['nearest', 'bilinear', 'bicubic', 'lanczos',
                                                  'bilinear_f', 'bicubic_f', 'lanczos_f'])
         else:
-            self.vsplit = wx.TextCtrl(self.panel, validator=IntegerValidator())
+            self.vsplit = TextCtrl(self.panel, validator=IntegerValidator())
             self.vsplit.SetValue('10000')
 
         #
         # 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())
 
         # 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':
-            self.btn_run.SetToolTipString(_("Reproject raster"))
+            self.btn_run.SetToolTip(_("Reproject raster"))
         elif self.etype == 'vector':
-            self.btn_run.SetToolTipString(_("Reproject vector"))
+            self.btn_run.SetToolTip(_("Reproject vector"))
         self.btn_run.SetDefault()
         self.btn_run.Bind(wx.EVT_BUTTON, self.OnReproject)
 
@@ -91,25 +92,25 @@
 
         label = _("Map layer <{ml}> needs to be reprojected.\n"
                   "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)
         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)
             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)
             optionsSizer.Add(self.resampling, pos=(1, 1), flag=wx.EXPAND)
         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)
             optionsSizer.Add(self.vsplit, pos=(1, 1), flag=wx.EXPAND)
         optionsSizer.AddGrowableCol(1)
         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)
         #
         # buttons

Modified: grass/trunk/gui/wxpython/datacatalog/frame.py
===================================================================
--- grass/trunk/gui/wxpython/datacatalog/frame.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/datacatalog/frame.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -26,6 +26,7 @@
 from core.gcmd import RunCommand, GMessage
 from datacatalog.tree import DataCatalogTree
 from datacatalog.toolbars import DataCatalogToolbar
+from gui_core.wrap import Button
 
 
 class DataCatalogFrame(wx.Frame):
@@ -62,8 +63,8 @@
                                                                    mapset=mapset))
 
         # 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()
 
         # events

Modified: grass/trunk/gui/wxpython/datacatalog/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/datacatalog/toolbars.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/datacatalog/toolbars.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -16,6 +16,7 @@
 
 import wx
 from gui_core.toolbars import BaseToolbar
+from gui_core.wrap import StaticText, TextCtrl
 from icons.icon import MetaIcon
 from core.utils import _
 
@@ -46,12 +47,12 @@
 
         self.InitToolbar(self._toolbarData())
         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.Bind(wx.EVT_TEXT,
                          lambda event: self.parent.Filter(
                          self.filter.GetValue()))
-        self.AddControl(wx.StaticText(self, label=_("Search:")))
+        self.AddControl(StaticText(self, label=_("Search:")))
         self.AddControl(self.filter)
         help = _("Type to search database by map type or name. "
                  "Use prefix 'r:', 'v:' and 'r3:'"

Modified: grass/trunk/gui/wxpython/datacatalog/tree.py
===================================================================
--- grass/trunk/gui/wxpython/datacatalog/tree.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/datacatalog/tree.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -1009,7 +1009,7 @@
 
     def _popupMenuMapset(self):
         """Create popup menu for mapsets"""
-        menu = wx.Menu()
+        menu = Menu()
         genv = gisenv()
         currentLocation, currentMapset = self._isCurrent(genv)
 
@@ -1030,7 +1030,7 @@
 
     def _popupMenuElement(self):
         """Create popup menu for elements"""
-        menu = wx.Menu()
+        menu = Menu()
         item = wx.MenuItem(menu, wx.NewId(), _("&Paste"))
         menu.AppendItem(item)
         self.Bind(wx.EVT_MENU, self.OnPasteMap, item)

Modified: grass/trunk/gui/wxpython/dbmgr/base.py
===================================================================
--- grass/trunk/gui/wxpython/dbmgr/base.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/dbmgr/base.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -36,6 +36,7 @@
 import copy
 import types
 import math
+import functools
 
 from core import globalvar
 import wx
@@ -51,6 +52,7 @@
 import wx.lib.scrolledpanel as scrolled
 
 import grass.script as grass
+from grass.script.utils import decode
 
 from dbmgr.sqlbuilder import SQLBuilderSelect, SQLBuilderUpdate
 from core.gcmd import RunCommand, GException, GError, GMessage, GWarning
@@ -60,9 +62,14 @@
 from core.debug import Debug
 from dbmgr.dialogs import ModifyTableRecord, AddColumnDialog
 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:
     """The log output SQL is redirected to the status bar of the
     containing frame.
@@ -268,7 +275,7 @@
             # but we need strip to get rid of the ending newline
             # which on windows leaves \r in a last empty attribute table cell
             # and causes error
-            record = outFile.readline().strip().replace('\n', '')
+            record = decode(outFile.readline().strip()).replace('\n', '')
 
             if not record:
                 break
@@ -332,7 +339,7 @@
             cat = i + 1
 
         for value in record:
-            if self.columns[columns[j]]['ctype'] != types.StringType:
+            if self.columns[columns[j]]['ctype'] != str:
                 try:
                     # casting disabled (2009/03)
                     # self.itemDataMap[i].append(self.columns[columns[j]]['ctype'](value))
@@ -431,7 +438,7 @@
         """Column heading right mouse button -> pop-up menu"""
         self._col = event.GetColumn()
 
-        popupMenu = wx.Menu()
+        popupMenu = Menu()
 
         if not hasattr(self, "popupID"):
             self.popupId = {'sortAsc': wx.NewId(),
@@ -452,7 +459,7 @@
         popupMenu.Append(self.popupId['sortAsc'], text=_("Sort ascending"))
         popupMenu.Append(self.popupId['sortDesc'], text=_("Sort descending"))
         popupMenu.AppendSeparator()
-        subMenu = wx.Menu()
+        subMenu = Menu()
         popupMenu.AppendMenu(self.popupId['calculate'], _(
             "Calculate (only numeric columns)"), subMenu)
         popupMenu.Append(
@@ -641,7 +648,7 @@
         """Sort items"""
         wx.BeginBusyCursor()
         items = list(self.itemDataMap.keys())
-        items.sort(self.Sorter)
+        items.sort(key=functools.cmp_to_key(self.Sorter))
         self.itemIndexMap = items
 
         # redraw the list
@@ -661,8 +668,8 @@
             item2 = self.itemDataMap[key2][self._col]
 
         if isinstance(
-                item1, types.StringType) or isinstance(
-                item2, types.StringTypes):
+                item1, str) or isinstance(
+                item2, unicode):
             cmpVal = locale.strcoll(GetUnicodeValue(item1), GetUnicodeValue(item2))
         else:
             cmpVal = cmp(item1, item2)
@@ -1119,7 +1126,7 @@
         #   controls that are placed IN the wx.StaticBox, or it will freeze
         #   on the Mac
 
-        listBox = wx.StaticBox(
+        listBox = StaticBox(
             parent=panel, id=wx.ID_ANY, label=" %s " %
             _("Attribute data - right-click to edit/manage records"))
         listSizer = wx.StaticBoxSizer(listBox, wx.VERTICAL)
@@ -1151,8 +1158,8 @@
         sqlQueryPanel = wx.Panel(parent=panel, id=wx.ID_ANY)
 
         # 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)
 
@@ -1215,7 +1222,7 @@
             _("Example: %s") %
             "MULTILANE = 'no' AND OBJECTID < 10")
 
-        sqlLabel = wx.StaticText(
+        sqlLabel = StaticText(
             parent=simpleSqlPanel,
             id=wx.ID_ANY,
             label="SELECT * FROM %s WHERE " %
@@ -1225,7 +1232,7 @@
         sqlNtb.AddPage(page=advancedSqlPanel,
                        text=_('Builder'))
 
-        btnSqlBuilder = wx.Button(
+        btnSqlBuilder = Button(
             parent=advancedSqlPanel,
             id=wx.ID_ANY,
             label=_("SQL Builder"))
@@ -1404,7 +1411,7 @@
 
         tlist = self.FindWindowById(self.layerPage[self.selLayer]['data'])
         # generate popup-menu
-        menu = wx.Menu()
+        menu = Menu()
         menu.Append(self.popupDataID1, _("Edit selected record"))
         selected = tlist.GetFirstSelected()
         if not self.dbMgrData[
@@ -1778,7 +1785,7 @@
         else:
             fn = tlist.GetItems
 
-        cats = map(int, fn())
+        cats = list(map(int, fn()))
 
         digitToolbar = None
         if 'vdigit' in self.mapdisplay.toolbars:
@@ -1980,7 +1987,7 @@
             if digitToolbar and digitToolbar.GetLayer() and digitToolbar.GetLayer(
             ).GetName() == self.dbMgrData['vectName']:
                 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(
                     render=True, renderVector=True)
 
@@ -2274,8 +2281,8 @@
         #
         # 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.Add(
             CreateDbInfoDesc(
@@ -2290,7 +2297,7 @@
         # table description
         #
         table = self.dbMgrData['mapDBInfo'].layers[layer]['table']
-        tableBox = wx.StaticBox(
+        tableBox = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -2305,17 +2312,17 @@
         self.layerPage[layer]['tableData'] = tlist.GetId()
 
         # 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)
 
-        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_ENTER, self.OnTableItemAdd)
         self.layerPage[layer]['addColName'] = column.GetId()
         addSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=_("Column")),
@@ -2334,7 +2341,7 @@
         ctype.Bind(wx.EVT_CHOICE, self.OnTableChangeType)
         self.layerPage[layer]['addColType'] = ctype.GetId()
         addSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=_("Type")),
@@ -2350,7 +2357,7 @@
         length.Enable(False)
         self.layerPage[layer]['addColLength'] = length.GetId()
         addSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=_("Length")),
@@ -2360,7 +2367,7 @@
                      flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT,
                      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.Enable(False)
         self.layerPage[layer]['addColButton'] = btnAddCol.GetId()
@@ -2368,8 +2375,8 @@
                      border=3)
 
         # 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)
 
         columnFrom = wx.ComboBox(
@@ -2379,7 +2386,7 @@
         columnFrom.SetSelection(0)
         self.layerPage[layer]['renameCol'] = columnFrom.GetId()
         renameSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=_("Column")),
@@ -2389,13 +2396,13 @@
                         flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT,
                         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_ENTER, self.OnTableItemChange)
         self.layerPage[layer]['renameColTo'] = columnTo.GetId()
         renameSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=_("To")),
@@ -2405,7 +2412,7 @@
                         flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT,
                         border=5)
 
-        btnRenameCol = wx.Button(
+        btnRenameCol = Button(
             parent=panel,
             id=wx.ID_ANY,
             label=_("&Rename"))
@@ -2580,7 +2587,7 @@
             self.Bind(wx.EVT_MENU, self.OnTableReload, id=self.popupTableID3)
 
         # generate popup-menu
-        menu = wx.Menu()
+        menu = Menu()
         menu.Append(self.popupTableID1, _("Drop selected column"))
         if self.FindWindowById(self.layerPage[self.selLayer][
                                'tableData']).GetFirstSelected() == -1:
@@ -2766,8 +2773,8 @@
         panelList = wx.Panel(parent=splitterWin, id=wx.ID_ANY)
 
         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)
 
         self.layerList = self._createLayerDesc(panelList)
@@ -2838,7 +2845,7 @@
         self.layerList.Update(self.dbMgrData['mapDBInfo'].layers)
         self.layerList.Populate(update=True)
         # update selected widgets
-        listOfLayers = map(str, self.dbMgrData['mapDBInfo'].layers.keys())
+        listOfLayers = list(map(str, self.dbMgrData['mapDBInfo'].layers.keys()))
         # delete layer page
         self.manageLayerBook.deleteLayer.SetItems(listOfLayers)
         if len(listOfLayers) > 0:
@@ -3063,8 +3070,8 @@
 
         # 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)
 
         #
@@ -3071,30 +3078,30 @@
         # list of layer widgets (label, value)
         #
         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),
                                           initial=maxLayer + 1,
                                           min=1, max=1e6)),
                                 '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),
                                                choices=self.listOfDrivers)),
                                 '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':
-                                    (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),
                                                choices=self.defaultTables)),
                                 '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),
                                                choices=self.defaultColumns)),
                                 'addCat':
@@ -3124,8 +3131,8 @@
             _("You need to add categories " "by v.category module."))
 
         # 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)
 
         #
@@ -3132,30 +3139,30 @@
         # list of table widgets
         #
         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
         self.tableWidgets['table'][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))
         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))
         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))
         btnDefault.Bind(wx.EVT_BUTTON, self.OnSetDefault)
 
@@ -3261,13 +3268,13 @@
         self.deletePanel = wx.Panel(parent=self, id=wx.ID_ANY)
         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(
             parent=self.deletePanel, id=wx.ID_ANY, size=(100, -1),
             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.Bind(wx.EVT_COMBOBOX, self.OnChangeLayer)
 
@@ -3287,7 +3294,7 @@
             self.deleteLayer.Enable(False)
             self.deleteTable.Enable(False)
 
-        btnDelete = wx.Button(
+        btnDelete = Button(
             self.deletePanel, wx.ID_DELETE, _("&Remove layer"),
             size=(125, -1))
         btnDelete.Bind(wx.EVT_BUTTON, self.OnDeleteLayer)
@@ -3337,34 +3344,34 @@
         # list of layer widgets (label, value)
         #
         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,
                                                 size=(100, -1),
                                                 style=wx.CB_SIMPLE | wx.CB_READONLY,
-                                                choices=map(str,
-                                                            self.mapDBInfo.layers.keys()))),
+                                                choices=list(map(str,
+                                                            self.mapDBInfo.layers.keys())))),
                                    '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,
                                                   size=(200, -1),
                                                   choices=self.listOfDrivers)),
                                    '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':
-                                       (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,
                                                   size=(200, -1),
                                                   choices=self.defaultTables)),
                                    '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,
                                                   size=(200, -1),
                                                   choices=self.defaultColumns))}
@@ -3406,7 +3413,7 @@
         # self.modifyLayerWidgets['database'][1].Bind(wx.EVT_TEXT_ENTER, self.OnDatabaseChanged)
         # self.modifyLayerWidgets['table'][1].Bind(wx.EVT_CHOICE, self.OnTableChanged)
 
-        btnModify = wx.Button(
+        btnModify = Button(
             self.modifyPanel, wx.ID_DELETE, _("&Modify layer"),
             size=(125, -1))
         btnModify.Bind(wx.EVT_BUTTON, self.OnModifyLayer)
@@ -3782,7 +3789,7 @@
 
         self.sp = scrolled.ScrolledPanel(parent=self.panel, id=wx.ID_ANY, size=(
             250, 150), style=wx.TAB_TRAVERSAL | wx.SUNKEN_BORDER, name="Statistics")
-        self.text = wx.TextCtrl(
+        self.text = TextCtrl(
             parent=self.sp,
             id=wx.ID_ANY,
             style=wx.TE_MULTILINE | wx.TE_READONLY)
@@ -3792,7 +3799,7 @@
         self.btnClipboard = Button(parent=self.panel, id=wx.ID_COPY)
         self.btnClipboard.SetToolTip(
             _("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()
 
         # bindings
@@ -3915,7 +3922,7 @@
             GWarning(parent=self.parent,
                      message=_("Unable to calculte standard deviation."))
         varSum = 0
-        for var in dataVar.splitlines():
+        for var in decode(dataVar).splitlines():
             varSum += float(var)
         stddev = math.sqrt(varSum / count)
 

Modified: grass/trunk/gui/wxpython/dbmgr/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/dbmgr/dialogs.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/dbmgr/dialogs.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -19,6 +19,7 @@
 
 import os
 import types
+import six
 
 from core import globalvar
 from core.utils import _
@@ -30,7 +31,8 @@
 from core.settings import UserSettings
 from dbmgr.vinfo import VectorDBInfo, GetUnicodeValue
 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):
@@ -110,10 +112,10 @@
         self.fidMulti = wx.Choice(parent=self, id=wx.ID_ANY,
                                   size=(150, -1))
         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)
 
@@ -126,9 +128,9 @@
             self.SetTitle(_("Display attributes"))
 
         # 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':
             btnSubmit.Enable(False)
 
@@ -145,8 +147,8 @@
         mainSizer.Add(self.notebook, proportion=1,
                       flag=wx.EXPAND | wx.ALL, border=5)
         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,
                      flag=wx.ALIGN_CENTER_VERTICAL)
         fidSizer.Add(self.fidMulti, proportion=0,
@@ -536,11 +538,11 @@
                     else:
                         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)
                     colValue.SetName(name)
                     if ctype == int:
@@ -591,7 +593,7 @@
         table = self.mapDBInfo.GetTable(layer)
         columns = self.mapDBInfo.GetTableDesc(table)
 
-        for key, col in columns.iteritems():
+        for key, col in six.iteritems(columns):
             if key == column:
                 col['values'] = [col['ctype'](value), ]
                 break
@@ -614,7 +616,7 @@
 
         self.keyId = keyEditable[0]
 
-        box = wx.StaticBox(parent=self, id=wx.ID_ANY)
+        box = StaticBox(parent=self, id=wx.ID_ANY)
         box.Hide()
         self.dataPanel = scrolled.ScrolledPanel(parent=self, id=wx.ID_ANY,
                                                 style=wx.TAB_TRAVERSAL)
@@ -621,8 +623,8 @@
         self.dataPanel.SetupScrolling(scroll_x=False)
 
         # 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()
 
         # data area
@@ -647,8 +649,8 @@
                         parent=self.dataPanel, id=wx.ID_ANY, value=value,
                         min=-1e9, max=1e9, size=(250, -1))
             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:
                     valueWin.SetValidator(IntegerValidator())
                 elif ctype == float:
@@ -657,10 +659,10 @@
                     wx.CallAfter(valueWin.SetFocus)
                     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(
                 (label.GetId(), ctype.GetId(), valueWin.GetId()))
 
@@ -752,7 +754,7 @@
         self.CenterOnParent()
 
         self.data = {}
-        self.data['addColName'] = wx.TextCtrl(
+        self.data['addColName'] = TextCtrl(
             parent=self, id=wx.ID_ANY, value='', size=(
                 150, -1), style=wx.TE_PROCESS_ENTER)
 
@@ -770,8 +772,8 @@
         self.data['addColLength'].Enable(False)
 
         # 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._layout()
@@ -782,7 +784,7 @@
         addSizer = wx.BoxSizer(wx.HORIZONTAL)
 
         addSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 id=wx.ID_ANY,
                 label=_("Column")),
@@ -793,7 +795,7 @@
                      border=5)
 
         addSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 id=wx.ID_ANY,
                 label=_("Type")),
@@ -804,7 +806,7 @@
                      border=5)
 
         addSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 id=wx.ID_ANY,
                 label=_("Length")),

Modified: grass/trunk/gui/wxpython/dbmgr/sqlbuilder.py
===================================================================
--- grass/trunk/gui/wxpython/dbmgr/sqlbuilder.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/dbmgr/sqlbuilder.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -28,6 +28,7 @@
 
 import os
 import sys
+import six
 
 from core import globalvar
 from core.utils import _
@@ -37,6 +38,7 @@
 
 from core.gcmd import RunCommand, GError, GMessage
 from dbmgr.vinfo import CreateDbInfoDesc, VectorDBInfo, GetUnicodeValue
+from gui_core.wrap import Button, TextCtrl, StaticText, StaticBox
 
 import grass.script as grass
 
@@ -95,8 +97,8 @@
 
         # dbInfo
         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.Add(
                 CreateDbInfoDesc(
@@ -111,11 +113,11 @@
         # text areas
         #
         # 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)
 
-        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),
                                     style=wx.TE_MULTILINE)
 
@@ -127,13 +129,12 @@
         #
         # 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': ['=', ],
                           'isnot': ['!=', ],
@@ -149,8 +150,8 @@
                           'prc': ['%', ]}
 
         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])
             self.btn_logic[key].append(btn.GetId())
 
@@ -219,8 +220,8 @@
         #
         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)
         self.list_columns = wx.ListBox(
             parent=self.panel,
@@ -248,8 +249,8 @@
         # self.list_values.SetMinSize((-1,100))
 
         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)
         self.list_values = wx.ListBox(parent=self.valuespanel, id=wx.ID_ANY,
                                       choices=self.colvalues,
@@ -258,14 +259,14 @@
                        flag=wx.EXPAND)
         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"))
         self.btn_unique.Enable(False)
-        self.btn_uniquesample = wx.Button(
+        self.btn_uniquesample = Button(
             parent=self.valuespanel,
             id=wx.ID_ANY,
             label=_("Get sample"))
-        self.btn_uniquesample.SetToolTipString(
+        self.btn_uniquesample.SetToolTip(
             _("Get first 256 unique values as sample"))
         self.btn_uniquesample.Enable(False)
 
@@ -280,12 +281,12 @@
 
         # go to
         gotosizer = wx.BoxSizer(wx.HORIZONTAL)
-        self.goto = wx.TextCtrl(
+        self.goto = TextCtrl(
             parent=self.valuespanel,
             id=wx.ID_ANY,
             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)
         gotosizer.Add(self.goto, proportion=1,
                       flag=wx.EXPAND)
@@ -339,7 +340,7 @@
         self.btn_unique.Bind(wx.EVT_BUTTON, self.OnUniqueValues)
         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.btn_close.Bind(wx.EVT_BUTTON, self.OnClose)
@@ -454,7 +455,7 @@
                 self.btn_arithmeticpanel.IsShown():
             btns = self.btn_arithmetic
 
-        for key, value in btns.iteritems():
+        for key, value in six.iteritems(btns):
             if event.GetId() == value[1]:
                 mark = value[0]
                 break
@@ -494,13 +495,13 @@
         SQLBuilder._doLayout(self, modeChoices)
 
         self.text_sql.SetValue("SELECT * FROM %s" % self.tablename)
-        self.text_sql.SetToolTipString(
+        self.text_sql.SetToolTip(
             _("Example: %s") %
             "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"))
-        self.btn_verify.SetToolTipString(_("Verify SQL statement"))
+        self.btn_verify.SetToolTip(_("Verify SQL statement"))
 
         self.buttonsizer.Insert(1, self.btn_verify)
 
@@ -659,8 +660,8 @@
 
         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])
             self.btn_arithmetic[key].append(btn.GetId())
 
@@ -700,8 +701,8 @@
 
         self.funcpanel = wx.Panel(parent=self.panel, id=wx.ID_ANY)
         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)
         self.list_func = wx.ListBox(parent=self.funcpanel, id=wx.ID_ANY,
                                     choices=self.sqlFuncs['sqlite'].keys(),
@@ -716,7 +717,7 @@
                            proportion=1, flag=wx.EXPAND)
 
         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.mode.SetSelection(0)
         self.OnMode(None)

Modified: grass/trunk/gui/wxpython/dbmgr/vinfo.py
===================================================================
--- grass/trunk/gui/wxpython/dbmgr/vinfo.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/dbmgr/vinfo.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -16,15 +16,20 @@
 
 import os
 import types
+import sys
+import six
 
 import wx
 
 from gui_core.gselect import VectorDBInfo as VectorDBInfoBase
+from gui_core.wrap import StaticText
 from core.gcmd import RunCommand, GError
 from core.settings import UserSettings
 from core.utils import _
 import grass.script as grass
 
+if sys.version_info.major >= 3:
+    unicode = str
 
 def GetUnicodeValue(value):
     """Get unicode value
@@ -33,7 +38,7 @@
 
     :return: unicode value
     """
-    if isinstance(value, types.UnicodeType):
+    if isinstance(value, unicode):
         return value
 
     enc = UserSettings.Get(group='atm', key='encoding', subkey='value')
@@ -50,31 +55,31 @@
     infoFlexSizer = wx.FlexGridSizer(cols=2, hgap=1, vgap=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(
-        wx.StaticText(
+        StaticText(
             parent=panel,
             id=wx.ID_ANY,
             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(
-        wx.StaticText(
+        StaticText(
             parent=panel,
             id=wx.ID_ANY,
             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(
-        wx.StaticText(
+        StaticText(
             parent=panel,
             id=wx.ID_ANY,
             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
 
@@ -93,7 +98,7 @@
         except KeyError:
             return []
 
-        for name, desc in self.tables[table].iteritems():
+        for name, desc in six.iteritems(self.tables[table]):
             names[desc['index']] = name
 
         return names
@@ -131,7 +136,7 @@
                 continue
 
             table = record['Table']
-            for key, value in record['Attributes'].iteritems():
+            for key, value in six.iteritems(record['Attributes']):
                 if len(value) < 1:
                     value = None
                 else:
@@ -141,7 +146,7 @@
                         value = GetUnicodeValue(value)
                 self.tables[table][key]['values'].append(value)
 
-            for key, value in record.iteritems():
+            for key, value in six.iteritems(record):
                 if key == 'Attributes':
                     continue
                 if key in ret:

Modified: grass/trunk/gui/wxpython/gcp/manager.py
===================================================================
--- grass/trunk/gui/wxpython/gcp/manager.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/gcp/manager.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -32,6 +32,7 @@
 import sys
 import shutil
 import time
+import six
 from copy import copy
 
 import wx
@@ -40,9 +41,11 @@
 
 from core import globalvar
 if globalvar.wxPythonPhoenix:
-    from wx.adv import Wizard as wiz
+    from wx import adv as wiz
+    from wx.adv import Wizard
 else:
-    import wx.wizard as wiz
+    from wx import wizard as wiz
+    from wx.wizard import Wizard
 
 import grass.script as grass
 
@@ -56,7 +59,8 @@
 from core.settings import UserSettings
 from gcp.mapdisplay import MapFrame
 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
 
@@ -371,7 +375,7 @@
 
         # location
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 id=wx.ID_ANY,
                 label=_('Select source location:')),
@@ -392,7 +396,7 @@
 
         # mapset
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 id=wx.ID_ANY,
                 label=_('Select source mapset:')),
@@ -505,7 +509,7 @@
         #
         # group
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 id=wx.ID_ANY,
                 label=_('Select/create group:')),
@@ -522,7 +526,7 @@
 
         # create group
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 id=wx.ID_ANY,
                 label=_('Create group if none exists')),
@@ -532,11 +536,11 @@
                 2,
                 1))
         btnSizer = wx.BoxSizer(wx.HORIZONTAL)
-        self.btn_mkgroup = wx.Button(
+        self.btn_mkgroup = Button(
             parent=self,
             id=wx.ID_ANY,
             label=_("Create/edit group..."))
-        self.btn_vgroup = wx.Button(
+        self.btn_vgroup = Button(
             parent=self,
             id=wx.ID_ANY,
             label=_("Add vector map to group..."))
@@ -556,7 +560,7 @@
 
         # extension
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 id=wx.ID_ANY,
                 label=_('Extension for output maps:')),
@@ -565,7 +569,7 @@
             pos=(
                 3,
                 1))
-        self.ext_txt = wx.TextCtrl(
+        self.ext_txt = TextCtrl(
             parent=self, id=wx.ID_ANY, value="", size=(
                 350, -1))
         self.ext_txt.SetValue(self.extension)
@@ -714,7 +718,7 @@
         # layout
         #
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 id=wx.ID_ANY,
                 label=_('Select source map to display:')),
@@ -740,7 +744,7 @@
                 2))
 
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 id=wx.ID_ANY,
                 label=_('Select target raster map to display:')),
@@ -763,7 +767,7 @@
                 2))
 
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 id=wx.ID_ANY,
                 label=_('Select target vector map to display:')),
@@ -1261,7 +1265,7 @@
                    "ucolor": "unused"}
         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)
             self.pointsToDrawSrc.GetPen(v).SetColour(wx.Colour(
                 col[0], col[1], col[2], 255))  # TODO GetPen neni to spatne?
@@ -2062,7 +2066,7 @@
         """Popup Zoom menu
         """
         point = wx.GetMousePosition()
-        zoommenu = wx.Menu()
+        zoommenu = Menu()
         # Add items to the menu
 
         zoomsource = wx.MenuItem(zoommenu, wx.ID_ANY, _(
@@ -2389,9 +2393,9 @@
         #
         # buttons
         #
-        self.btnCancel = wx.Button(parent=self,
+        self.btnCancel = Button(parent=self,
                                    id=wx.ID_CANCEL)
-        self.btnOK = wx.Button(parent=self,
+        self.btnOK = Button(parent=self,
                                id=wx.ID_OK)
         self.btnOK.SetDefault()
 
@@ -2398,8 +2402,8 @@
         #
         # 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):
             f = open(self.vgrpfile)
@@ -2425,7 +2429,7 @@
 
         box = wx.BoxSizer(wx.HORIZONTAL)
         box.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 id=wx.ID_ANY,
                 label=_('Select vector map(s) to add to group:')),
@@ -2494,7 +2498,7 @@
 
         sizer = wx.BoxSizer(wx.VERTICAL)
 
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel, id=wx.ID_ANY, label=" %s %s " %
             (_("Ground Control Point No."), str(gcpno)))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
@@ -2502,10 +2506,10 @@
         # source coordinates
         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
         tmp_coord = data[1]
@@ -2519,8 +2523,8 @@
                            (_("target E:"), self.ecoord),
                            (_("source N:"), self.ycoord),
                            (_("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,
                           flag=wx.ALIGN_CENTER_VERTICAL,
                           pos=(row, col))
@@ -2547,8 +2551,8 @@
         #
         # 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()
 
         btnSizer = wx.StdDialogButtonSizer()
@@ -2617,19 +2621,19 @@
         self.__CreateRectificationPage(notebook)
 
         # 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()
 
         # bindings
         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.SetToolTipString(
+        btnSave.SetToolTip(
             _("Apply and save changes to user settings file (default for next sessions)"))
         btnClose.Bind(wx.EVT_BUTTON, self.OnClose)
-        btnClose.SetToolTipString(_("Close dialog"))
+        btnClose.SetToolTip(_("Close dialog"))
 
         # sizers
         btnSizer = wx.BoxSizer(wx.HORIZONTAL)
@@ -2675,7 +2679,7 @@
                 0))
 
         # RMS forward error threshold
-        rmslabel = wx.StaticText(
+        rmslabel = StaticText(
             parent=panel, id=wx.ID_ANY,
             label=_("Highlight RMS error > M + SD * factor:"))
         rmslabel.SetToolTip(
@@ -2692,8 +2696,8 @@
                 0))
         sdfactor = UserSettings.Get(
             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))
         if (self.parent.highest_only == True):
             self.rmsWin.Disable()
@@ -2703,8 +2707,8 @@
         rmsgridSizer.AddGrowableCol(1)
         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)
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
 
@@ -2712,7 +2716,7 @@
         # general symbol color
         #
         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))
         col = UserSettings.Get(group='gcpman', key='symbol', subkey='color')
         colWin = csel.ColourSelect(parent=panel, id=wx.ID_ANY,
@@ -2729,7 +2733,7 @@
         # symbol color for high forward RMS error
         #
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Color for high RMS error:"))
@@ -2749,7 +2753,7 @@
         # symbol color for selected GCP
         #
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Color for selected GCP:"))
@@ -2769,7 +2773,7 @@
         # symbol color for unused GCP
         #
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Color for unused GCPs:"))
@@ -2802,7 +2806,7 @@
         # symbol size
         #
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Symbol size:"))
@@ -2824,7 +2828,7 @@
         # symbol width
         #
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Line width:"))
@@ -2876,7 +2880,7 @@
         self.tgtvectselection.GetElementList()
 
         sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=_('Select source map to display:')),
@@ -2890,7 +2894,7 @@
             border=5)
         self.srcselection.SetValue(src_map)
         sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=_('Select target raster map to display:')),
@@ -2904,7 +2908,7 @@
             border=5)
         self.tgtrastselection.SetValue(tgt_map['raster'])
         sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=_('Select target vector map to display:')),
@@ -2955,7 +2959,7 @@
         # interpolation method
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=_('Select interpolation method:')),
@@ -2981,7 +2985,7 @@
 
         # extension
         sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=_('Extension for output maps:')),
@@ -2988,7 +2992,7 @@
             proportion=0,
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL,
             border=5)
-        self.ext_txt = wx.TextCtrl(
+        self.ext_txt = TextCtrl(
             parent=panel, id=wx.ID_ANY, value="", size=(
                 350, -1))
         self.ext_txt.SetValue(self.parent.extension)

Modified: grass/trunk/gui/wxpython/gcp/mapdisplay.py
===================================================================
--- grass/trunk/gui/wxpython/gcp/mapdisplay.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/gcp/mapdisplay.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -30,6 +30,7 @@
 from core.utils import _
 from gui_core.dialogs import GetImageHandlers, ImageSizeDialog
 from gui_core.mapdisp import SingleMapFrame
+from gui_core.wrap import Menu
 from core.settings import UserSettings
 from mapwin.buffered import BufferedMapWindow
 from mapwin.base import MapWindowProperties
@@ -421,7 +422,7 @@
         Print options and output menu for map display
         """
         point = wx.GetMousePosition()
-        printmenu = wx.Menu()
+        printmenu = Menu()
         # Add items to the menu
         setup = wx.MenuItem(printmenu, wx.ID_ANY, _('Page setup'))
         printmenu.AppendItem(setup)
@@ -467,7 +468,7 @@
         """Popup Zoom menu
         """
         point = wx.GetMousePosition()
-        zoommenu = wx.Menu()
+        zoommenu = Menu()
         # Add items to the menu
 
         zoomwind = wx.MenuItem(zoommenu, wx.ID_ANY, _(

Modified: grass/trunk/gui/wxpython/gis_set.py
===================================================================
--- grass/trunk/gui/wxpython/gis_set.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/gis_set.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -44,8 +44,8 @@
 from location_wizard.dialogs import RegionDef
 from gui_core.dialogs import TextEntryDialog
 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)
 
@@ -110,17 +110,17 @@
         # get version & revision
         grassVersion, grassRevisionStr = sgui.GetVersion()
 
-        self.gisdbase_box = wx.StaticBox(
+        self.gisdbase_box = StaticBox(
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             _("1. Select GRASS GIS database directory"))
-        self.location_box = wx.StaticBox(
+        self.location_box = StaticBox(
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             _("2. Select GRASS Location"))
-        self.mapset_box = wx.StaticBox(
+        self.mapset_box = StaticBox(
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             _("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.
         # The color itself may not be correct for all platforms/system settings
         # but in http://xoomer.virgilio.it/infinity77/wxPython/Widgets/wx.SystemSettings.html
@@ -134,7 +134,7 @@
         self.location_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,
             label=_("GRASS GIS database directory contains Locations."))
 
@@ -204,7 +204,7 @@
         self.delete_mapset_button.SetToolTip(_("Delete selected mapset"))
 
         # textinputs
-        self.tgisdbase = wx.TextCtrl(
+        self.tgisdbase = TextCtrl(
             parent=self.gisdbase_panel, id=wx.ID_ANY, value="", size=(
                 300, -1), style=wx.TE_PROCESS_ENTER)
 
@@ -1001,7 +1001,9 @@
         mapset = self.listOfMapsets[self.lbmapsets.GetSelection()]
 
         lockfile = get_lockfile_if_present(dbase, location, mapset)
+        print (lockfile)
         if lockfile:
+            print ('aaaa')
             dlg = wx.MessageDialog(
                 parent=self,
                 message=_(
@@ -1041,6 +1043,7 @@
             else:
                 return
         self.SetLocation(dbase, location, mapset)
+        print ('ssssssssssssssss')
         self.ExitSuccessfully()
 
     def SetLocation(self, dbase, location, mapset):

Modified: grass/trunk/gui/wxpython/gmodeler/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/dialogs.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/gmodeler/dialogs.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -25,6 +25,7 @@
 
 import os
 import sys
+import six
 
 import wx
 import wx.lib.mixins.listctrl as listmix
@@ -39,6 +40,8 @@
 from gui_core.gselect import Select, ElementSelect
 from gmodeler.model import *
 from lmgr.menudata import LayerManagerMenuData
+from gui_core.wrap import Button, StaticText, StaticBox, TextCtrl, \
+    Menu
 
 from grass.script import task as gtask
 
@@ -99,7 +102,7 @@
         """Do layout"""
         if self.etype:
             self.dataSizer.Add(
-                wx.StaticText(
+                StaticText(
                     parent=self.panel,
                     id=wx.ID_ANY,
                     label=_("Type of element:")),
@@ -108,8 +111,8 @@
                 border=1)
             self.dataSizer.Add(self.typeSelect,
                                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)
         self.dataSizer.Add(self.element, proportion=0,
                            flag=wx.EXPAND | wx.ALL, border=1)
@@ -188,10 +191,10 @@
         self._command = None
         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
         menuModel = LayerManagerMenuData()
@@ -208,14 +211,14 @@
             lambda name: self.cmd_prompt.SetTextAndFocus(name + ' '))
         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,
             id=wx.ID_ANY,
             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.Bind(wx.EVT_BUTTON, self.OnOk, self.btnOk)
@@ -231,12 +234,12 @@
                      flag=wx.EXPAND)
         labelSizer = wx.StaticBoxSizer(self.labelBox, wx.VERTICAL)
         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))
         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))
         gridSizer.Add(self.comment, pos=(1, 1), flag=wx.EXPAND)
         gridSizer.AddGrowableRow(1)
@@ -353,10 +356,10 @@
 
         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,
                                   style=wx.CB_READONLY,
@@ -363,8 +366,8 @@
                                   choices=options)
         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._layout()
@@ -397,20 +400,20 @@
 
     def _layoutShape(self, shape, sizer):
         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,
                       border=5)
         elif isinstance(shape, ModelAction):
             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))
-            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))
-            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,
                           pos=(1, 0))
             gridSizer.Add(self.option,
@@ -483,10 +486,10 @@
 
         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,
                                           columns=[_("Label"),
@@ -496,8 +499,8 @@
 
         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()
 
     def _layout(self):
@@ -517,12 +520,12 @@
         ModelItemDialog.__init__(self, parent, shape, title,
                                  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"))
-        self.btnSeries.SetToolTipString(
+        self.btnSeries.SetToolTip(
             _("Define map series as condition for the loop"))
         self.btnSeries.Bind(wx.EVT_BUTTON, self.OnSeries)
 
@@ -591,13 +594,13 @@
         ModelItemDialog.__init__(self, parent, shape, title,
                                  style=style, **kwargs)
 
-        self.listBoxIf = wx.StaticBox(
+        self.listBoxIf = StaticBox(
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             _("List of items in 'if' block"))
         self.itemListIf = self.itemList
         self.itemListIf.SetName('IfBlockList')
 
-        self.listBoxElse = wx.StaticBox(
+        self.listBoxElse = StaticBox(
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             _("List of items in 'else' block"))
         self.itemListElse = ItemCheckListCtrl(parent=self.panel,
@@ -743,7 +746,7 @@
         """Populate the list"""
         self.itemDataMap = dict()
         i = 0
-        for name, values in data.iteritems():
+        for name, values in six.iteritems(data):
             self.itemDataMap[i] = [name, values['type'],
                                    values.get('value', ''),
                                    values.get('description', '')]
@@ -752,7 +755,7 @@
         self.itemCount = len(self.itemDataMap.keys())
         self.DeleteAllItems()
         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)
             self.SetStringItem(index, 0, name)
             self.SetStringItem(index, 1, vtype)
@@ -767,7 +770,7 @@
         :return: None on success
         :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:
                 return _("Variable <%s> already exists in the model. "
                          "Adding variable failed.") % name
@@ -840,7 +843,7 @@
             self.Bind(wx.EVT_MENU, self.OnReload, id=self.popupID3)
 
         # generate popup-menu
-        menu = wx.Menu()
+        menu = Menu()
         menu.Append(self.popupID1, _("Delete selected"))
         menu.Append(self.popupID2, _("Delete all"))
         if self.GetFirstSelected() == -1:
@@ -937,7 +940,7 @@
         self.DeleteAllItems()
         i = 0
         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))
                 self.SetStringItem(index, 0, name)
                 self.SetStringItem(index, 1, desc)
@@ -946,7 +949,7 @@
                     self.CheckItem(index, True)
                 i += 1
         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))
                 self.SetStringItem(index, 0, name)
                 self.SetStringItem(index, 1, inloop)
@@ -1009,7 +1012,7 @@
             self.Bind(wx.EVT_MENU, self.OnReload, id=self.popupID['reload'])
 
         # generate popup-menu
-        menu = wx.Menu()
+        menu = Menu()
         menu.Append(self.popupID['remove'], _("Delete selected"))
         if self.GetFirstSelected() == -1:
             menu.Enable(self.popupID['remove'], False)

Modified: grass/trunk/gui/wxpython/gmodeler/frame.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/frame.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/gmodeler/frame.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -27,6 +27,7 @@
 import copy
 import re
 import random
+import six
 
 import wx
 from wx.lib import ogl
@@ -51,7 +52,7 @@
 from gui_core.ghelp import ShowAboutDialog
 from gui_core.preferences import PreferencesBaseDialog
 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 gui_core.forms import GUI
 from gmodeler.preferences import PreferencesDialog, PropertiesDialog
@@ -61,6 +62,8 @@
 from gmodeler.giface import GraphicalModelerGrassInterface
 from gmodeler.model import *
 from gmodeler.dialogs import *
+from gui_core.wrap import Button, StaticText, StaticBox, TextCtrl, \
+    Menu, StockCursor, EmptyBitmap
 
 wxModelDone, EVT_MODEL_DONE = NewEvent()
 
@@ -89,8 +92,8 @@
         self.randomness = 40  # random layout
 
         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)
@@ -102,7 +105,7 @@
                     'grass.ico'),
                 wx.BITMAP_TYPE_ICO))
 
-        self.menubar = Menu(
+        self.menubar = Menubar(
             parent=self,
             model=ModelerMenuData().GetModel(
                 separators=True))
@@ -380,7 +383,7 @@
         dlg.Init(properties)
         if dlg.ShowModal() == wx.ID_OK:
             self.ModelChanged()
-            for key, value in dlg.GetValues().iteritems():
+            for key, value in six.iteritems(dlg.GetValues()):
                 properties[key] = value
             for action in self.model.GetItems(objType=ModelAction):
                 action.GetTask().set_flag('overwrite', properties['overwrite'])
@@ -698,7 +701,7 @@
                 ymaxImg = ymax
         size = wx.Size(int(xmaxImg - xminImg) + 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))
 
@@ -726,10 +729,8 @@
             dc.SetBackground(wx.WHITE_BRUSH)
             dc.SetBackgroundMode(wx.SOLID)
 
-            dc.BeginDrawing()
             self.canvas.GetDiagram().Clear(dc)
             self.canvas.GetDiagram().Redraw(dc)
-            dc.EndDrawing()
 
             bitmap.SaveFile(path, fileType)
             self.SetStatusText(_("Model exported to <%s>") % path)
@@ -1120,7 +1121,7 @@
         :return: False on failure
         """
         self.ModelChanged(False)
-        tmpfile = tempfile.TemporaryFile(mode='w+b')
+        tmpfile = tempfile.TemporaryFile(mode='w+')
         try:
             WriteModelFile(fd=tmpfile, model=self.model)
         except Exception:
@@ -1495,7 +1496,7 @@
         shape = self.GetShape()
         self._onSelectShape(shape)
 
-        popupMenu = wx.Menu()
+        popupMenu = Menu()
         popupMenu.Append(self.popupID['remove'], text=_('Remove'))
         self.frame.Bind(wx.EVT_MENU, self.OnRemove, id=self.popupID['remove'])
         if isinstance(shape, ModelAction) or isinstance(shape, ModelLoop):
@@ -1721,7 +1722,7 @@
 
         wx.Panel.__init__(self, parent=parent, id=id, **kwargs)
 
-        self.listBox = wx.StaticBox(
+        self.listBox = StaticBox(
             parent=self, id=wx.ID_ANY, label=" %s " %
             _("List of variables - right-click to delete"))
 
@@ -1735,9 +1736,9 @@
             frame=self.parent)
 
         # 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)
         self.type = wx.Choice(parent=self, id=wx.ID_ANY,
                               choices=[_("integer"),
@@ -1750,12 +1751,12 @@
                                        _("file"),
                                        _("dir")])
         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
-        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)
 
         # bindings
@@ -1774,28 +1775,28 @@
 
         addSizer = wx.StaticBoxSizer(self.addBox, wx.VERTICAL)
         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,
                       pos=(0, 0))
         gridSizer.Add(self.name,
                       pos=(0, 1),
                       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,
                       pos=(0, 2))
         gridSizer.Add(self.type,
                       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,
                       pos=(1, 0))
         gridSizer.Add(self.value,
                       pos=(1, 1), span=(1, 3),
                       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,
                       pos=(2, 0))
         gridSizer.Add(self.desc,
@@ -1845,7 +1846,7 @@
     def UpdateModelVariables(self):
         """Update model variables"""
         variables = dict()
-        for values in self.list.GetData().itervalues():
+        for values in six.itervalues(self.list.GetData()):
             name = values[0]
             variables[name] = {'type': str(values[1])}
             if values[2]:
@@ -1876,7 +1877,7 @@
 
         wx.Panel.__init__(self, parent=parent, id=id, **kwargs)
 
-        self.listBox = wx.StaticBox(
+        self.listBox = StaticBox(
             parent=self, id=wx.ID_ANY, label=" %s " %
             _("List of items - right-click to delete"))
 
@@ -1893,9 +1894,9 @@
                 3],
             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.btnMoveDown.Bind(wx.EVT_BUTTON, self.OnMoveItemsDown)
@@ -1976,18 +1977,18 @@
 
         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.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.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.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."))
         self.Bind(wx.EVT_BUTTON, self.OnRefresh, self.btnRefresh)
 
@@ -2124,7 +2125,7 @@
             if ret == wx.ID_NO:
                 return False
 
-        fd = tempfile.TemporaryFile()
+        fd = tempfile.TemporaryFile(mode='r+')
         WritePythonFile(fd, self.parent.GetModel())
         fd.seek(0)
         self.body.SetText(fd.read())

Modified: grass/trunk/gui/wxpython/gmodeler/model.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/model.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/gmodeler/model.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -32,6 +32,7 @@
 import re
 import mimetypes
 import time
+import six
 try:
     import xml.etree.ElementTree as etree
 except ImportError:
@@ -49,6 +50,7 @@
 from core.settings import UserSettings
 from gui_core.forms import GUI, CmdPanel
 from gui_core.widgets import GNotebook
+from gui_core.wrap import Button
 from gmodeler.giface import GraphicalModelerGrassInterface
 
 from grass.script import core as grass
@@ -119,7 +121,7 @@
 
     def ReorderItems(self, idxList):
         items = list()
-        for oldIdx, newIdx in idxList.iteritems():
+        for oldIdx, newIdx in six.iteritems(idxList):
             item = self.items.pop(oldIdx)
             items.append(item)
             self.items.insert(newIdx, item)
@@ -655,7 +657,7 @@
                 return
 
             err = list()
-            for key, item in params.iteritems():
+            for key, item in six.iteritems(params):
                 for p in item['params']:
                     if p.get('value', '') == '':
                         err.append(
@@ -752,7 +754,7 @@
 
         # discard values
         if params:
-            for item in params.itervalues():
+            for item in six.itervalues(params):
                 for p in item['params']:
                     p['value'] = ''
 
@@ -821,7 +823,7 @@
             result["variables"] = {'flags': list(),
                                    'params': params,
                                    'idx': idx}
-            for name, values in self.variables.iteritems():
+            for name, values in six.iteritems(self.variables):
                 gtype = values.get('type', 'string')
                 if gtype in ('raster', 'vector', 'mapset',
                              'file', 'region', 'dir'):
@@ -2278,7 +2280,7 @@
             return
         self.fd.write('%s<variables>\n' % (' ' * self.indent))
         self.indent += 4
-        for name, values in self.variables.iteritems():
+        for name, values in six.iteritems(self.variables):
             self.fd.write(
                 '%s<variable name="%s" type="%s">\n' %
                 (' ' * self.indent, EncodeString(name), values['type']))
@@ -2331,7 +2333,7 @@
         self.indent += 4
         if not action.IsEnabled():
             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':
                 for f in val:
                     if f.get('value', False) or f.get('parameterized', False):
@@ -2576,7 +2578,7 @@
 """ % (EncodeString(' '.join(properties['description'].splitlines()))))
 
         variables = self.model.GetVariables()
-        for key, data in variables.iteritems():
+        for key, data in six.iteritems(variables):
             otype = self._getStandardizedOption(data['type'])
             self.fd.write(
                 r"""
@@ -2830,8 +2832,8 @@
         if not rast and not vect and not rast3d:
             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"))
         self.btnRun.SetDefault()
 
@@ -2870,7 +2872,7 @@
     def _createPages(self):
         """Create for each parameterized module its own page"""
         nameOrdered = [''] * len(self.params.keys())
-        for name, params in self.params.iteritems():
+        for name, params in six.iteritems(self.params):
             nameOrdered[params['idx']] = name
         for name in nameOrdered:
             params = self.params[name]

Modified: grass/trunk/gui/wxpython/gmodeler/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/preferences.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/gmodeler/preferences.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -22,7 +22,8 @@
 from gui_core.preferences import PreferencesBaseDialog
 from core.settings import UserSettings
 from core.utils import _
-from gui_core.wrap import SpinCtrl
+from gui_core.wrap import SpinCtrl, Button, StaticText, \
+    StaticBox
 
 
 class PreferencesDialog(PreferencesBaseDialog):
@@ -55,15 +56,15 @@
 
         # colors
         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)
 
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
 
         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 |
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
@@ -103,15 +104,15 @@
 
         # colors
         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)
 
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
 
         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 |
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
@@ -128,8 +129,8 @@
                       pos=(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 |
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
@@ -146,8 +147,8 @@
                       pos=(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 |
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
@@ -173,15 +174,15 @@
                    wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)
 
         # 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)
 
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
 
         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 |
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
@@ -206,8 +207,8 @@
                       pos=(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 |
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
@@ -251,15 +252,15 @@
 
         # colors
         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)
 
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
 
         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 |
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
@@ -276,8 +277,8 @@
                       pos=(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 |
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
@@ -294,8 +295,8 @@
                       pos=(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 |
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
@@ -312,8 +313,8 @@
                       pos=(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 |
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
@@ -339,15 +340,15 @@
                    wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)
 
         # 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)
 
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
 
         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 |
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
@@ -372,8 +373,8 @@
                       pos=(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 |
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
@@ -417,15 +418,15 @@
 
         # colors
         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)
 
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
 
         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 |
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
@@ -451,15 +452,15 @@
                    wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)
 
         # 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)
 
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
 
         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 |
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
@@ -484,8 +485,8 @@
                       pos=(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 |
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
@@ -529,15 +530,15 @@
 
         # colors
         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)
 
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
 
         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 |
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
@@ -567,15 +568,15 @@
                    wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)
 
         # 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)
 
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
 
         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 |
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
@@ -600,8 +601,8 @@
                       pos=(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 |
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(row, 0))
@@ -664,18 +665,18 @@
         wx.Dialog.__init__(self, parent, id, title, size=size,
                            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
         self.overwrite = wx.CheckBox(parent=self, id=wx.ID_ANY, label=_(
@@ -687,13 +688,13 @@
                 subkey='enabled'))
 
         # 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.SetToolTipString(_("Apply properties"))
+        self.btnOk.SetToolTip(_("Apply properties"))
         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)
 
@@ -702,8 +703,8 @@
     def _layout(self):
         metaSizer = wx.StaticBoxSizer(self.metaBox, wx.VERTICAL)
         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 |
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(0, 0))
@@ -711,8 +712,8 @@
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                       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 |
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(1, 0))
@@ -720,8 +721,8 @@
                       flag=wx.ALIGN_LEFT |
                       wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                       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 |
                       wx.ALIGN_CENTER_VERTICAL,
                       pos=(2, 0))

Modified: grass/trunk/gui/wxpython/gui_core/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/dialogs.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/gui_core/dialogs.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -31,6 +31,7 @@
 import os
 import sys
 import re
+import six
 
 import wx
 
@@ -47,7 +48,8 @@
 from core.utils import _
 from core.settings import UserSettings
 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):
@@ -64,8 +66,8 @@
         self.SetExtraStyle(wx.WS_EX_VALIDATE_RECURSIVELY)
         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.__layout()
@@ -127,7 +129,7 @@
     def _layout(self):
         """Do layout"""
         self.dataSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self.panel,
                 id=wx.ID_ANY,
                 label=_("Name of GRASS location:")),
@@ -138,7 +140,7 @@
                            flag=wx.EXPAND | wx.ALL, border=1)
 
         self.dataSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self.panel,
                 id=wx.ID_ANY,
                 label=_("Name of mapset:")),
@@ -197,8 +199,8 @@
 
     def _layout(self):
         """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)
         self.dataSizer.Add(self.element, proportion=0,
                            flag=wx.EXPAND | wx.ALL, border=1)
@@ -236,8 +238,8 @@
 
     def _layout(self):
         """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)
         self.dataSizer.Add(self.element, proportion=0,
                            flag=wx.EXPAND | wx.ALL, border=1)
@@ -292,8 +294,8 @@
         if showType:
             self.keycol = None
         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(
                 UserSettings.Get(
                     group='atm',
@@ -327,7 +329,7 @@
     def _layout(self):
         """Do layout"""
         self.dataSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self.panel,
                 id=wx.ID_ANY,
                 label=_("Name for new vector map:")),
@@ -347,7 +349,7 @@
         if self.keycol:
             keySizer = wx.BoxSizer(wx.HORIZONTAL)
             keySizer.Add(
-                wx.StaticText(
+                StaticText(
                     parent=self.panel,
                     label=_("Key column:")),
                 proportion=0,
@@ -552,7 +554,7 @@
         sizer = wx.BoxSizer(wx.VERTICAL)
 
         box = wx.BoxSizer(wx.HORIZONTAL)
-        label = wx.StaticText(parent=self, id=wx.ID_ANY)
+        label = StaticText(parent=self, id=wx.ID_ANY)
         box.Add(
             label,
             proportion=0,
@@ -593,11 +595,11 @@
 
         btnsizer = wx.StdDialogButtonSizer()
 
-        btn = wx.Button(parent=self, id=wx.ID_OK)
+        btn = Button(parent=self, id=wx.ID_OK)
         btn.SetDefault()
         btnsizer.AddButton(btn)
 
-        btn = wx.Button(parent=self, id=wx.ID_CANCEL)
+        btn = Button(parent=self, id=wx.ID_CANCEL)
         btnsizer.AddButton(btn)
         btnsizer.Realize()
 
@@ -662,14 +664,14 @@
         self.bodySizer = self._createDialogBody()
 
         # 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"))
-        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()
 
@@ -716,8 +718,8 @@
                            " and '$' for the end.")
 
         # 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:")),
                       flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP, border=10)
         self.groupSelect = Select(parent=self, type='group',
@@ -737,7 +739,7 @@
         subg_sizer = wx.BoxSizer(wx.VERTICAL)
 
         subg_sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self.subg_panel,
                 id=wx.ID_ANY,
                 label=_(
@@ -773,7 +775,7 @@
                        pos=(0, 1))
 
         gListSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self.gListPanel,
                 label=_("Pattern:")),
             flag=wx.ALIGN_CENTER_VERTICAL,
@@ -781,10 +783,10 @@
                 1,
                 0))
 
-        self.gfilter = wx.TextCtrl(parent=self.gListPanel, id=wx.ID_ANY,
+        self.gfilter = TextCtrl(parent=self.gListPanel, id=wx.ID_ANY,
                                    value="",
                                    size=(250, -1))
-        self.gfilter.SetToolTipString(filter_tooltip)
+        self.gfilter.SetToolTip(filter_tooltip)
 
         gListSizer.Add(self.gfilter,
                        flag=wx.EXPAND,
@@ -791,7 +793,7 @@
                        pos=(1, 1))
 
         gListSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self.gListPanel,
                 label=_("List of maps:")),
             flag=wx.ALIGN_CENTER_VERTICAL | wx.BOTTOM,
@@ -807,13 +809,13 @@
             style=wx.LB_MULTIPLE | wx.LB_NEEDED_SB)
         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."))
         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."))
         buttonSizer.Add(self.removeLayer)
         sizer.Add(buttonSizer, flag=wx.LEFT, border=5)
@@ -841,7 +843,7 @@
                           pos=(0, 1))
 
         subgListSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self.subgListPanel,
                 label=_("Pattern:")),
             flag=wx.ALIGN_CENTER_VERTICAL,
@@ -849,10 +851,10 @@
                 1,
                 0))
 
-        self.subgfilter = wx.TextCtrl(parent=self.subgListPanel, id=wx.ID_ANY,
+        self.subgfilter = TextCtrl(parent=self.subgListPanel, id=wx.ID_ANY,
                                       value="",
                                       size=(250, -1))
-        self.subgfilter.SetToolTipString(filter_tooltip)
+        self.subgfilter.SetToolTip(filter_tooltip)
 
         subgListSizer.Add(self.subgfilter,
                           flag=wx.EXPAND,
@@ -859,7 +861,7 @@
                           pos=(1, 1))
 
         subgListSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self.subgListPanel,
                 label=_("List of maps:")),
             flag=wx.ALIGN_CENTER_VERTICAL | wx.BOTTOM,
@@ -868,9 +870,9 @@
                 2,
                 0))
 
-        self.subgListBox = wx.CheckListBox(
+        self.subgListBox = CheckListBox(
             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."))
 
         subgListSizer.Add(self.subgListBox, flag=wx.EXPAND, pos=(2, 1))
@@ -880,7 +882,7 @@
         self.subgListPanel.SetSizer(subgListSizer)
         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(
             self.infoLabel,
             flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP | wx.BOTTOM,
@@ -1061,7 +1063,7 @@
         """Get layers"""
         if self.edit_subg:
             layers = []
-            for maps, sel in self.subgmaps.iteritems():
+            for maps, sel in six.iteritems(self.subgmaps):
                 if sel:
                     layers.append(maps)
         else:
@@ -1106,7 +1108,7 @@
         self.subgListBox.Set(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._checkSubGSellAll()
@@ -1397,8 +1399,8 @@
         self._modelerDSeries()
 
         # 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()
 
         # sizers & do layout
@@ -1460,7 +1462,7 @@
         bodySizer = wx.GridBagSizer(vgap=3, hgap=3)
 
         # layer type
-        bodySizer.Add(wx.StaticText(parent=self, label=_("Map type:")),
+        bodySizer.Add(StaticText(parent=self, label=_("Map type:")),
                       flag=wx.ALIGN_CENTER_VERTICAL,
                       pos=(0, 0))
 
@@ -1482,7 +1484,7 @@
                       pos=(0, 2))
 
         # mapset filter
-        bodySizer.Add(wx.StaticText(parent=self, label=_("Mapset:")),
+        bodySizer.Add(StaticText(parent=self, label=_("Mapset:")),
                       flag=wx.ALIGN_CENTER_VERTICAL,
                       pos=(1, 0))
 
@@ -1492,7 +1494,7 @@
                       pos=(1, 1), span=(1, 2))
 
         # map name filter
-        bodySizer.Add(wx.StaticText(parent=self, label=_("Pattern:")),
+        bodySizer.Add(StaticText(parent=self, label=_("Pattern:")),
                       flag=wx.ALIGN_CENTER_VERTICAL,
                       pos=(2, 0))
 
@@ -1514,7 +1516,7 @@
 
         # layer list
         bodySizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 label=_("List of maps:")),
             flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_TOP,
@@ -1521,9 +1523,9 @@
             pos=(
                 3,
                 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,
                       flag=wx.EXPAND,
                       pos=(3, 1), span=(1, 2))
@@ -1574,7 +1576,7 @@
             self.Bind(wx.EVT_MENU, self.OnDeselectAll, id=self.popupDataID3)
 
         # generate popup-menu
-        menu = wx.Menu()
+        menu = Menu()
         menu.Append(self.popupDataID1, _("Select all"))
         menu.Append(self.popupDataID2, _("Invert selection"))
         menu.Append(self.popupDataID3, _("Deselect all"))
@@ -1676,7 +1678,7 @@
             self, parent=parent, title=title, **kwargs)
 
     def _addApplyButton(self):
-        btnApply = wx.Button(parent=self, id=wx.ID_APPLY)
+        btnApply = Button(parent=self, id=wx.ID_APPLY)
         self.btnSizer.AddButton(btnApply)
         btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
 
@@ -1776,11 +1778,11 @@
 
         box.Add(self.value,
                 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))
-        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,
                 pos=(1, 1))
 
@@ -1795,14 +1797,14 @@
         # buttons
         btnsizer = wx.StdDialogButtonSizer()
 
-        btnOK = wx.Button(parent=panel, id=wx.ID_OK)
+        btnOK = Button(parent=panel, id=wx.ID_OK)
         btnOK.SetDefault()
         btnsizer.AddButton(btnOK)
 
-        btnCancel = wx.Button(parent=panel, id=wx.ID_CANCEL)
+        btnCancel = Button(parent=panel, id=wx.ID_CANCEL)
         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)
         btnsizer.AddButton(btnApply)
         btnsizer.Realize()
@@ -1831,8 +1833,11 @@
     """Get list of supported image handlers"""
     lext = 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 = ''
     if 'png' in lext:
@@ -1892,8 +1897,8 @@
 
         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()
         self.width = SpinCtrl(parent=self.panel, id=wx.ID_ANY,
@@ -1915,9 +1920,9 @@
                                            "1600x1200",
                                            "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.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)
 
@@ -1931,16 +1936,16 @@
         # body
         box = wx.StaticBoxSizer(self.box, wx.HORIZONTAL)
         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)
         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)
         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)
         fbox.Add(self.template)
 
@@ -1995,13 +2000,13 @@
                 wx.BITMAP_TYPE_ICO))
         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._layout()
@@ -2076,7 +2081,7 @@
         self.folderChoice.Bind(wx.EVT_CHOICE, self.OnFolderSelect)
 
         fgSizer.Add(
-            wx.StaticText(
+            StaticText(
                 mainPanel,
                 id=wx.ID_ANY,
                 label=_("Symbol directory:")),
@@ -2086,9 +2091,9 @@
         fgSizer.Add(self.folderChoice, proportion=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(
-            wx.StaticText(
+            StaticText(
                 mainPanel,
                 id=wx.ID_ANY,
                 label=_("Symbol name:")),
@@ -2102,8 +2107,8 @@
             vSizer.Add(panel, proportion=0, 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.Enable(False)
 
@@ -2246,10 +2251,10 @@
 
         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)
 
-        self._textCtrl = wx.TextCtrl(
+        self._textCtrl = TextCtrl(
             self,
             id=wx.ID_ANY,
             value=defaultValue,
@@ -2296,7 +2301,7 @@
 
         sizer = wx.BoxSizer(wx.VERTICAL)
 
-        label = wx.StaticText(self, label=message)
+        label = StaticText(self, label=message)
         sizer.Add(
             label,
             proportion=0,
@@ -2340,15 +2345,15 @@
                 wx.ART_QUESTION,
                 client=wx.ART_MESSAGE_BOX))
 
-        self.informLabel = wx.StaticText(
+        self.informLabel = StaticText(
             parent=self.panel, id=wx.ID_ANY, label=_(
                 "Do you want to quit GRASS including shell "
                 "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"))
         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"))
         self.btnQuit.SetForegroundColour(wx.Colour(35, 142, 35))
 
@@ -2409,7 +2414,7 @@
         self.fontdict, fontdict_reverse, self.fontlist = self.GetFonts()
 
         border = wx.BoxSizer(wx.VERTICAL)
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -2418,8 +2423,8 @@
 
         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,
                       flag=wx.ALIGN_TOP,
                       pos=(0, 0))
@@ -2449,14 +2454,14 @@
             self.encoding = self.settings.Get(group='display',
                                               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,
                           flag=wx.ALIGN_CENTER_VERTICAL,
                           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,
                           flag=wx.EXPAND, pos=(4, 0))
 
@@ -2467,8 +2472,8 @@
                                           key='outputfont', subkey='type')
             self.fontsize = self.settings.Get(group='appearance',
                                               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,
                           flag=wx.ALIGN_CENTER_VERTICAL,
                           pos=(3, 0))
@@ -2503,11 +2508,11 @@
 
         btnsizer = wx.StdDialogButtonSizer()
 
-        btn = wx.Button(parent=panel, id=wx.ID_OK)
+        btn = Button(parent=panel, id=wx.ID_OK)
         btn.SetDefault()
         btnsizer.AddButton(btn)
 
-        btn = wx.Button(parent=panel, id=wx.ID_CANCEL)
+        btn = Button(parent=panel, id=wx.ID_CANCEL)
         btnsizer.AddButton(btn)
         btnsizer.Realize()
 

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

Modified: grass/trunk/gui/wxpython/gui_core/ghelp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/ghelp.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/gui_core/ghelp.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -23,6 +23,7 @@
 import re
 import textwrap
 import sys
+import six
 
 import wx
 from wx.html import HtmlWindow
@@ -42,6 +43,7 @@
 from core.utils import _
 from core.gcmd import GError, DecodeString
 from gui_core.widgets import FormNotebook, ScrolledPanel
+from gui_core.wrap import Button, StaticText, TextCtrl
 from core.debug import Debug
 
 
@@ -86,7 +88,7 @@
         wx.CallAfter(self.aboutNotebook.Refresh)
 
         # 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._doLayout()
@@ -131,20 +133,20 @@
         infoLabel = 'GRASS GIS %s' % vInfo.get('version', _('unknown version'))
         if 'x86_64' in vInfo.get('build_platform', ''):
             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.SetForegroundColour(wx.Colour(35, 142, 35))
         infoSizer.Add(info, proportion=0,
                       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,
                       flag=wx.BOTTOM | wx.ALIGN_CENTER, border=1)
 
         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),
                           flag=wx.ALIGN_RIGHT)
 
@@ -154,24 +156,24 @@
                           flag=wx.ALIGN_LEFT)
 
         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),
                           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),
                           flag=wx.ALIGN_LEFT)
 
         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),
                           flag=wx.ALIGN_RIGHT)
 
         infoGridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=infoTxt, id=wx.ID_ANY, label=vInfo.get(
                     'build_date', '?')), pos=(
                 row, 1), flag=wx.ALIGN_LEFT)
@@ -190,24 +192,24 @@
         #                   flag = wx.ALIGN_LEFT)
 
         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),
                           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),
                           flag=wx.ALIGN_LEFT)
 
         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),
                           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),
                           flag=wx.ALIGN_LEFT)
 
@@ -219,8 +221,8 @@
             flag=wx.EXPAND | wx.ALIGN_CENTER | wx.ALIGN_CENTER_VERTICAL)
 
         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),
                           flag=wx.ALIGN_RIGHT)
         self.langUsed = grass.gisenv().get('LANG', None)
@@ -231,8 +233,8 @@
                 self.langUsed = _('unknown')
             else:
                 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),
                           flag=wx.ALIGN_LEFT)
 
@@ -253,7 +255,7 @@
 
         # put text into a scrolling panel
         copyrightwin = ScrolledPanel(self.aboutNotebook)
-        copyrighttxt = wx.TextCtrl(
+        copyrighttxt = TextCtrl(
             copyrightwin, id=wx.ID_ANY, value=copytext,
         style=wx.TE_MULTILINE | wx.TE_READONLY)
         copyrightwin.SetAutoLayout(True)
@@ -277,7 +279,7 @@
             license = _('%s file missing') % 'GPL.TXT'
         # put text into a scrolling panel
         licensewin = ScrolledPanel(self.aboutNotebook)
-        licensetxt = wx.TextCtrl(
+        licensetxt = TextCtrl(
             licensewin, id=wx.ID_ANY, value=license,
         style=wx.TE_MULTILINE | wx.TE_READONLY)
         licensewin.SetAutoLayout(True)
@@ -303,7 +305,7 @@
 
         # put text into a scrolling panel
         window = ScrolledPanel(self.aboutNotebook)
-        stat_text = wx.TextCtrl(
+        stat_text = TextCtrl(
             window, id=wx.ID_ANY, value=text,
         style=wx.TE_MULTILINE | wx.TE_READONLY)
         window.SetAutoLayout(True)
@@ -327,7 +329,7 @@
         else:
             authors = _('%s file missing') % 'AUTHORS'
         authorwin = ScrolledPanel(self.aboutNotebook)
-        authortxt = wx.TextCtrl(
+        authortxt = TextCtrl(
             authorwin, id=wx.ID_ANY, value=authors,
         style=wx.TE_MULTILINE | wx.TE_READONLY)
         authorwin.SetAutoLayout(True)
@@ -385,7 +387,7 @@
         contribwin.sizer = wx.BoxSizer(wx.VERTICAL)
 
         if not contribs:
-            contribtxt = wx.StaticText(
+            contribtxt = StaticText(
                 contribwin,
                 id=wx.ID_ANY,
                 label=_('%s file missing') %
@@ -399,8 +401,8 @@
                 items = (_('Name'), _('E-mail'), _('Country'), _('OSGeo_ID'))
             contribBox = wx.FlexGridSizer(cols=len(items), vgap=5, hgap=5)
             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(
                     wx.Font(
                         10,
@@ -413,7 +415,7 @@
             for vals in sorted(contribs, key=lambda x: x[0]):
                 for item in vals:
                     contribBox.Add(
-                        wx.StaticText(
+                        StaticText(
                             parent=contribwin,
                             id=wx.ID_ANY,
                             label=item))
@@ -459,7 +461,7 @@
         translatorswin.sizer = wx.BoxSizer(wx.VERTICAL)
 
         if not translators:
-            translatorstxt = wx.StaticText(
+            translatorstxt = StaticText(
                 translatorswin,
                 id=wx.ID_ANY,
                 label=_('%s file missing') %
@@ -469,20 +471,20 @@
         else:
             translatorsBox = wx.FlexGridSizer(cols=4, vgap=5, hgap=5)
             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, ""))
             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, ""))
             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, ""))
             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, ""))
             translatorsBox.Add(tnat)
             for lang in languages:
@@ -489,7 +491,7 @@
                 for translator in translators[lang]:
                     name, email = translator
                     translatorsBox.Add(
-                        wx.StaticText(
+                        StaticText(
                             parent=translatorswin,
                             id=wx.ID_ANY,
                             label=unicode(
@@ -496,12 +498,12 @@
                                 name,
                                 "utf-8")))
                     translatorsBox.Add(
-                        wx.StaticText(
+                        StaticText(
                             parent=translatorswin,
                             id=wx.ID_ANY,
                             label=email))
                     translatorsBox.Add(
-                        wx.StaticText(
+                        StaticText(
                             parent=translatorswin,
                             id=wx.ID_ANY,
                             label=lang))
@@ -514,7 +516,7 @@
                         translatorsBox.Add(flagBitmap)
                     else:
                         translatorsBox.Add(
-                            wx.StaticText(
+                            StaticText(
                                 parent=translatorswin,
                                 id=wx.ID_ANY,
                                 label=lang))
@@ -547,35 +549,35 @@
     def _langBox(self, par, k, v):
         """Return box"""
         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)
         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))
             langBox.Add(tgood)
         except:
-            tgood = wx.StaticText(parent=par, id=wx.ID_ANY,
-                                  label="")
+            tgood = StaticText(parent=par, id=wx.ID_ANY,
+                               label="")
             langBox.Add(tgood)
         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))
             langBox.Add(tfuzzy)
         except:
-            tfuzzy = wx.StaticText(parent=par, id=wx.ID_ANY,
-                                   label="")
+            tfuzzy = StaticText(parent=par, id=wx.ID_ANY,
+                                label="")
             langBox.Add(tfuzzy)
         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))
             langBox.Add(tbad)
         except:
-            tbad = wx.StaticText(parent=par, id=wx.ID_ANY,
-                                 label="")
+            tbad = StaticText(parent=par, id=wx.ID_ANY,
+                              label="")
             langBox.Add(tbad)
         return langBox
 
@@ -593,7 +595,7 @@
         # else:
         # panel.Collapse(True)
         pageSizer = wx.BoxSizer(wx.VERTICAL)
-        for k, v in js.iteritems():
+        for k, v in six.iteritems(js):
             if k != 'total' and k != 'name':
                 box = self._langBox(win, k, v)
                 pageSizer.Add(box, proportion=1,
@@ -626,8 +628,8 @@
         if not jsStats:
             Debug.msg(5, _("File <%s> not found") % fname)
             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,
                            flag=wx.EXPAND | wx.ALL, border=3)
         else:
@@ -753,7 +755,7 @@
         try:
             contents = []
             skip = False
-            for l in file(htmlFile, "rb").readlines():
+            for l in open(htmlFile, "rb").readlines():
                 if "DESCRIPTION" in l:
                     skip = False
                 if not skip:
@@ -796,10 +798,10 @@
 
         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"))
         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"))
         self.btnPrev.Enable(False)
 

Modified: grass/trunk/gui/wxpython/gui_core/goutput.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/goutput.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/gui_core/goutput.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -37,7 +37,8 @@
     EVT_CMD_OUTPUT, EVT_CMD_PROGRESS, EVT_CMD_RUN, EVT_CMD_DONE, \
     Notification
 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.utils import _
 from gui_core.widgets import SearchModuleWidget
@@ -145,14 +146,14 @@
 
         if self._gcstyle & GC_PROMPT:
             cmdLabel = _("Command prompt")
-            self.outputBox = wx.StaticBox(
+            self.outputBox = StaticBox(
                 parent=self.panelOutput,
                 id=wx.ID_ANY,
                 label=" %s " %
                 _("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
         self.btnOutputClear = Button(
@@ -202,7 +203,7 @@
             promptSizer.Add(self.cmdPrompt, proportion=1,
                             flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP,
                             border=3)
-            helpText = wx.StaticText(
+            helpText = StaticText(
                 self.panelPrompt, id=wx.ID_ANY,
                 label="Press Tab to display command help, Ctrl+Space to autocomplete")
             helpText.SetForegroundColour(
@@ -629,7 +630,7 @@
             group='appearance',
             key='outputfont',
             subkey='size')
-        if typesize is None or typesize <= 0:
+        if typesize is None or int(typesize) <= 0:
             typesize = 10
         typesize = float(typesize)
 

Modified: grass/trunk/gui/wxpython/gui_core/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/gselect.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/gui_core/gselect.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -47,6 +47,7 @@
 import sys
 import glob
 import copy
+import six
 
 import wx
 
@@ -83,7 +84,8 @@
 from core.settings import UserSettings
 from core.debug import Debug
 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
 
@@ -526,7 +528,7 @@
 
         # add extra items first
         if self.extraItems:
-            for group, items in self.extraItems.iteritems():
+            for group, items in six.iteritems(self.extraItems):
                 node = self.AddItem(group, node=True)
                 self.seltree.SetItemTextColour(node, wx.Colour(50, 50, 200))
                 for item in items:
@@ -804,7 +806,7 @@
 
     def _CheckDBConnection(self):
         """Check DB connection"""
-        nuldev = file(os.devnull, 'w+')
+        nuldev = open(os.devnull, 'w+')
         # if map is not defined (happens with vnet initialization) or it
         # doesn't exist
         try:
@@ -989,7 +991,7 @@
         self.SetStringSelection(value)
 
 
-class DatabaseSelect(wx.TextCtrl):
+class DatabaseSelect(TextCtrl):
     """Creates combo box for selecting database driver.
     """
 
@@ -1124,16 +1126,16 @@
             columnchoices = dbInfo.GetTableDesc(table)
             keyColumn = dbInfo.GetKeyColumn(layer)
             self.columns = len(columnchoices.keys()) * ['']
-            for key, val in columnchoices.iteritems():
+            for key, val in six.iteritems(columnchoices):
                 self.columns[val['index']] = key
             if excludeKey:  # exclude key column
                 self.columns.remove(keyColumn)
             if excludeCols:  # exclude key column
-                for key in columnchoices.iterkeys():
+                for key in six.iterkeys(columnchoices):
                     if key in excludeCols:
                         self.columns.remove(key)
             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:
                         try:
                             self.columns.remove(key)
@@ -1398,7 +1400,7 @@
 
         self.reloadDataRequired = Signal('GdalSelect.reloadDataRequired')
 
-        self.inputBox = wx.StaticBox(parent=self)
+        self.inputBox = StaticBox(parent=self)
         if dest:
             self.inputBox.SetLabel(" %s " % _("Output settings"))
         else:
@@ -1502,7 +1504,7 @@
             fileMask=fileMask)
         browse.GetChildren()[1].SetName('GdalSelectDataSource')
         self.fileWidgets['browse'] = browse
-        self.fileWidgets['options'] = wx.TextCtrl(parent=self.filePanel)
+        self.fileWidgets['options'] = TextCtrl(parent=self.filePanel)
 
         # directory
         self.dirPanel = wx.Panel(parent=self)
@@ -1527,11 +1529,11 @@
                 self.dirWidgets['format'].GetStringSelection()))
         formatSelect.Bind(wx.EVT_CHOICE, self.OnUpdate)
 
-        self.dirWidgets['extensionLabel'] = wx.StaticText(
+        self.dirWidgets['extensionLabel'] = StaticText(
             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['options'] = wx.TextCtrl(parent=self.dirPanel)
+        self.dirWidgets['options'] = TextCtrl(parent=self.dirPanel)
         if self.ogr:
             shapefile = 'ESRI Shapefile'
             if shapefile in fileFormats:
@@ -1568,12 +1570,12 @@
         self.dbWidgets['choice'] = wx.Choice(
             parent=self.dbPanel, name='GdalSelectDataSource')
         self.dbWidgets['choice'].Bind(wx.EVT_CHOICE, self.OnUpdate)
-        self.dbWidgets['text'] = wx.TextCtrl(
+        self.dbWidgets['text'] = TextCtrl(
             parent=self.dbPanel, name='GdalSelectDataSource')
         self.dbWidgets['text'].Bind(wx.EVT_TEXT, self.OnUpdate)
-        self.dbWidgets['textLabel1'] = wx.StaticText(
+        self.dbWidgets['textLabel1'] = StaticText(
             parent=self.dbPanel, label=_("Name:"))
-        self.dbWidgets['textLabel2'] = wx.StaticText(
+        self.dbWidgets['textLabel2'] = StaticText(
             parent=self.dbPanel, label=_("Name:"))
         self.dbWidgets['featType'] = wx.RadioBox(
             parent=self.dbPanel,
@@ -1599,7 +1601,7 @@
             startDirectory=os.getcwd(),
             changeCallback=self.OnUpdate)
         self.dbWidgets['dirbrowse'] = browse
-        self.dbWidgets['options'] = wx.TextCtrl(parent=self.dbPanel)
+        self.dbWidgets['options'] = TextCtrl(parent=self.dbPanel)
 
         # protocol
         self.protocolPanel = wx.Panel(parent=self)
@@ -1609,9 +1611,9 @@
             choices=protocolFormats)
         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['options'] = wx.TextCtrl(
+        self.protocolWidgets['options'] = TextCtrl(
             parent=self.protocolPanel)
 
         # native
@@ -1647,7 +1649,7 @@
                     dsn = v
                     break
             optList = list()
-            for k, v in data.iteritems():
+            for k, v in six.iteritems(data):
                 if k in ('format', 'conninfo', 'topology'):
                     continue
                 optList.append('%s=%s' % (k, v))
@@ -1692,8 +1694,8 @@
         sizer.Add(paddingSizer, flag=wx.EXPAND, pos=(0, 0), span=(1, 2))
         sizer.AddGrowableCol(0)
         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,
                       pos=(1, 0))
             sizer.Add(self.fileWidgets['options'],
@@ -1706,8 +1708,8 @@
 
         # directory
         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,
                   pos=(0, 0))
         sizer.Add(self.dirWidgets['format'],
@@ -1723,14 +1725,14 @@
                   flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                   pos=(1, 0), span=(1, 4))
         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,
                       pos=(2, 0))
             sizer.Add(self.dirWidgets['options'],
                       flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                       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)
             sizer.Add(helpBtn,
                       flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
@@ -1745,8 +1747,8 @@
 
         # database
         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,
                   pos=(0, 0))
         sizer.Add(self.dbWidgets['format'],
@@ -1774,8 +1776,8 @@
             sizer.Add(self.dbWidgets['featType'],
                       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,
                       pos=(5, 0))
             sizer.Add(self.dbWidgets['options'],
@@ -1783,7 +1785,7 @@
                       pos=(5, 1), span=(1, 2))
 
             # 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)
             sizer.Add(helpBtn,
                       pos=(5, 3))
@@ -1797,15 +1799,15 @@
 
         # protocol
         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,
                   pos=(0, 0))
         sizer.Add(self.protocolWidgets['format'],
                   flag=wx.ALIGN_CENTER_VERTICAL,
                   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,
                   pos=(1, 0))
         sizer.Add(self.protocolWidgets['text'],
@@ -1812,8 +1814,8 @@
                   flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
                   pos=(1, 1))
         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,
                       pos=(2, 0))
             sizer.Add(self.protocolWidgets['options'],
@@ -1827,8 +1829,8 @@
 
         # native
         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)
         self.nativePanel.SetSizer(sizer)
 
@@ -2337,9 +2339,9 @@
     def _layout(self):
         """Do layout"""
         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,
                   flag=wx.ALIGN_CENTER_VERTICAL,
                   border=5)
@@ -2380,9 +2382,9 @@
 
         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(
             os.path.join(
@@ -2522,8 +2524,8 @@
 
         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(
             os.path.join(
@@ -2713,8 +2715,8 @@
         self.parent = parent
         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")
         icon = wx.Bitmap(
             os.path.join(

Modified: grass/trunk/gui/wxpython/gui_core/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/mapdisp.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/gui_core/mapdisp.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -21,6 +21,7 @@
 
 import os
 import sys
+import six
 
 import wx
 
@@ -333,7 +334,7 @@
 
     def StatusbarEnableLongHelp(self, enable=True):
         """Enable/disable toolbars long help"""
-        for toolbar in self.toolbars.itervalues():
+        for toolbar in six.itervalues(self.toolbars):
             toolbar.EnableLongHelp(enable)
 
     def IsStandalone(self):

Modified: grass/trunk/gui/wxpython/gui_core/menu.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/menu.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/gui_core/menu.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -27,7 +27,7 @@
 from core.utils import _
 from gui_core.widgets import SearchModuleWidget
 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 icons.icon import MetaIcon
 
@@ -149,7 +149,7 @@
 
         # tree
         self._tree = CTreeView(model=model, parent=self)
-        self._tree.SetToolTipString(
+        self._tree.SetToolTip(
             _("Double-click or Ctrl-Enter to run selected module"))
 
 #        self._dataBox = wx.StaticBox(parent = self, id = wx.ID_ANY,
@@ -163,7 +163,7 @@
             lambda result: self._tree.Select(result))
         self._search.showNotification.connect(self.showNotification)
 
-        self._helpText = wx.StaticText(
+        self._helpText = StaticText(
             parent=self, id=wx.ID_ANY,
             label="Press Enter for next match, Ctrl+Enter to run command")
         self._helpText.SetForegroundColour(

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

Modified: grass/trunk/gui/wxpython/gui_core/pyedit.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/pyedit.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/gui_core/pyedit.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -13,7 +13,10 @@
 import sys
 import os
 import stat
-from StringIO import StringIO
+try:
+    from StringIO import StringIO
+except ImportError:
+    from io import StringIO
 import time
 
 import wx

Modified: grass/trunk/gui/wxpython/gui_core/query.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/query.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/gui_core/query.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -15,10 +15,12 @@
 """
 import os
 import wx
+import six
 
 from core.utils import _
 from core.gcmd import DecodeString
 from gui_core.treeview import TreeListView
+from gui_core.wrap import Button, StaticText, Menu
 from core.treemodel import TreeModel, DictNode
 
 from grass.pydispatch.signal import Signal
@@ -39,7 +41,7 @@
         self.panel = wx.Panel(self, id=wx.ID_ANY)
         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."))
         helpText.SetForegroundColour(
             wx.SystemSettings.GetColour(
@@ -63,9 +65,9 @@
             flag=wx.EXPAND | wx.ALL,
             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())
-        copy = wx.Button(
+        copy = Button(
             self.panel,
             id=wx.ID_ANY,
             label=_("Copy all to clipboard"))
@@ -121,7 +123,7 @@
         if not nodes:
             return
 
-        menu = wx.Menu()
+        menu = Menu()
         texts = []
         if len(nodes) > 1:
             values = []
@@ -217,7 +219,7 @@
     :return: tree model
     """
     def addNode(parent, data, model):
-        for k, v in data.iteritems():
+        for k, v in six.iteritems(data):
             if isinstance(v, str):
                 k = DecodeString(k)
             if isinstance(v, dict):
@@ -224,7 +226,7 @@
                 node = model.AppendNode(parent=parent, label=k)
                 addNode(parent=node, data=v, model=model)
             else:
-                if not isinstance(v, basestring):
+                if not isinstance(v, str):
                     v = str(v)
                 elif isinstance(v, str):
                     v = DecodeString(v)

Modified: grass/trunk/gui/wxpython/gui_core/simplelmgr.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/simplelmgr.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/gui_core/simplelmgr.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -31,6 +31,7 @@
 from icons.icon import MetaIcon
 from gui_core.forms import GUI
 from gui_core.dialogs import SetOpacityDialog
+from gui_core.wrap import CheckListBox, Menu
 from core.utils import GetLayerNameFromCmd
 from core.gcmd import GError
 from core.layerlist import LayerList
@@ -59,7 +60,7 @@
 
         self._style = lmgrStyle
         self._layerList = layerList
-        self._checkList = wx.CheckListBox(self, style=wx.LB_EXTENDED)
+        self._checkList = CheckListBox(self, style=wx.LB_EXTENDED)
         if not toolbarCls:
             toolbarCls = SimpleLmgrToolbar
         self._toolbar = toolbarCls(self, lmgrStyle=self._style)
@@ -139,7 +140,7 @@
             event.Skip()
             return
 
-        menu = wx.Menu()
+        menu = Menu()
         llist = [layer.name for layer in self._layerList]
         texts = [','.join(llist), ','.join(reversed(llist))]
         labels = [_("Copy map names to clipboard (top to bottom)"),

Modified: grass/trunk/gui/wxpython/gui_core/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/toolbars.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/gui_core/toolbars.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -27,7 +27,7 @@
 from icons.icon import MetaIcon
 from collections import defaultdict
 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
 
@@ -268,9 +268,9 @@
         else:
             bitmap = wx.ArtProvider.GetBitmap(
                 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)
-        button.SetToolTipString(tooltip)
+        button.SetToolTip(tooltip)
 
         return button
 

Modified: grass/trunk/gui/wxpython/gui_core/treeview.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/treeview.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/gui_core/treeview.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -40,6 +40,7 @@
 
 from core.treemodel import TreeModel, DictNode
 from core.utils import _
+from gui_core.wrap import CustomTreeCtrl
 
 from grass.pydispatch.signal import Signal
 
@@ -183,7 +184,7 @@
         self.RefreshItems()
 
 
-class CTreeView(AbstractTreeViewMixin, CT.CustomTreeCtrl):
+class CTreeView(AbstractTreeViewMixin, CustomTreeCtrl):
     """Tree view class inheriting from wx.TreeCtrl"""
 
     def __init__(self, model, parent, **kw):

Modified: grass/trunk/gui/wxpython/gui_core/vselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/vselect.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/gui_core/vselect.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -28,6 +28,7 @@
 from core.utils import _
 from core.gcmd import GMessage, GError, GWarning
 from core.gcmd import RunCommand
+from gui_core.wrap import Button
 
 import grass.script as grass
 from grass.pydispatch.signal import Signal
@@ -132,7 +133,7 @@
         self._dialog = VectorSelectDialog(parent=self.parent)
         self._dialog.Bind(wx.EVT_CLOSE, self.OnCloseDialog)
         if createButton:
-            createMap = wx.Button(
+            createMap = Button(
                 self._dialog, wx.ID_ANY, _("Create a new map"))
             createMap.Bind(wx.EVT_BUTTON, self.OnExportMap)
             self._dialog.AddWidget(createMap, proportion=0.1)

Modified: grass/trunk/gui/wxpython/gui_core/widgets.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/widgets.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/gui_core/widgets.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -48,6 +48,7 @@
 import sys
 import string
 import re
+import six
 from bisect import bisect
 from datetime import datetime
 from core.globalvar import wxPythonPhoenix
@@ -89,7 +90,8 @@
 from core.utils import _
 from core.gcmd import GMessage, GError
 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:
@@ -477,7 +479,7 @@
         :param label: displayed label
         """
         size = (15, 15)
-        buffer = wx.EmptyBitmap(*size)
+        buffer = EmptyBitmap(*size)
         BitmapTextButton.__init__(self, parent=parent, label=" " + label,
                                   bitmap=buffer, **kwargs)
 
@@ -964,7 +966,7 @@
             self.Bind(wx.EVT_MENU, self.OnSelectNone, id=self.popupDataID2)
 
         # generate popup-menu
-        menu = wx.Menu()
+        menu = Menu()
         menu.Append(self.popupDataID1, _("Select all"))
         menu.Append(self.popupDataID2, _("Deselect all"))
 
@@ -1072,7 +1074,7 @@
 # label = " %s " % _("Find module - (press Enter for next match)"))
 
         if sys.platform == 'win32':
-            self._search = wx.TextCtrl(
+            self._search = TextCtrl(
                 parent=self, id=wx.ID_ANY, size=(-1, 25),
                 style=wx.TE_PROCESS_ENTER)
         else:
@@ -1226,8 +1228,8 @@
 
         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.Bind(wx.EVT_CHOICE, self.OnSettingsChanged)
@@ -1257,7 +1259,7 @@
 
         self.settingsSizer = wx.StaticBoxSizer(self.settingsBox, wx.HORIZONTAL)
         self.settingsSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 id=wx.ID_ANY,
                 label=_("Load:")),
@@ -1376,7 +1378,7 @@
         try:
             fd = open(self.settingsFile, 'w')
             fd.write('format_version=2.0\n')
-            for key, values in self._settings.iteritems():
+            for key, values in six.iteritems(self._settings):
                 first = True
                 for v in values:
                     # escaping characters
@@ -1542,7 +1544,7 @@
             # painting the control, but there is no valid item selected yet
             return
 
-        r = wx.Rect(*rect)  # make a copy
+        r = Rect(*rect)  # make a copy
         r.Deflate(3, 5)
 
         # for painting the items in the popup

Modified: grass/trunk/gui/wxpython/gui_core/wrap.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/wrap.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/gui_core/wrap.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -17,6 +17,10 @@
 
 import wx
 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
 if wxPythonPhoenix:
@@ -99,6 +103,32 @@
             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):
     """Wrapper around GenBitmapButton to have more control
     over the widget on different platforms/wxpython versions"""
@@ -151,6 +181,19 @@
             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):
     """Wrapper around wx.TextCtrl to have more control
     over the widget on different platforms/wxpython versions"""
@@ -215,6 +258,19 @@
             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):
     """Wrapper around wx.ToolBar to have more control
     over the widget on different platforms/wxpython versions"""
@@ -319,3 +375,16 @@
             wx.CheckBox.SetToolTip(self, tipString=tip)
         else:
             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)

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

Modified: grass/trunk/gui/wxpython/iclass/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/iclass/dialogs.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/iclass/dialogs.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -33,6 +33,8 @@
 from gui_core import gselect
 from gui_core.widgets import SimpleValidator
 from iclass.statistics import Statistics, BandStatistics
+from gui_core.wrap import CheckBox, Button, StaticText, \
+    StaticBox, TextCtrl, Menu
 
 import grass.script as grass
 
@@ -74,7 +76,7 @@
         if 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..."))
 
         self.editGroup.Bind(wx.EVT_BUTTON, self.OnEditGroup)
@@ -88,8 +90,8 @@
 
     def _layout(self):
         """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,
                            flag=wx.EXPAND | wx.BOTTOM | wx.LEFT | wx.RIGHT,
                            border=5)
@@ -101,7 +103,7 @@
         # flag = wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, border = 5)
 
         self.dataSizer.Add(
-            wx.StaticText(
+            StaticText(
                 self.panel,
                 id=wx.ID_ANY,
                 label=_("Name of imagery subgroup:")),
@@ -257,8 +259,8 @@
             label = _("Name of raster map:")
         elif self.elementType == 'vector':
             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)
         self.dataSizer.Add(self.element, proportion=0,
                            flag=wx.EXPAND | wx.ALL, border=5)
@@ -291,14 +293,14 @@
         panel = wx.Panel(parent=self, id=wx.ID_ANY)
 
         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)
         gridSizer = wx.GridBagSizer(hgap=5, vgap=5)
         self.catList = CategoryListCtrl(panel, mapwindow=parent,
                                         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(
             self.catList, pos=(
@@ -321,7 +323,7 @@
             border=5)
 
         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(closeButton, proportion=0, flag=wx.ALIGN_RIGHT)
         mainSizer.Add(
@@ -539,7 +541,7 @@
                 id=self.popupZoomtoAreas)
 
         # generate popup-menu
-        menu = wx.Menu()
+        menu = Menu()
         menu.Append(
             self.popupZoomtoAreas,
             _("Zoom to training areas of selected class"))
@@ -631,8 +633,8 @@
                                          'sig')
         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.Enable(False)
 
@@ -662,7 +664,7 @@
         dataSizer = wx.BoxSizer(wx.VERTICAL)
 
         dataSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self.panel,
                 id=wx.ID_ANY,
                 label=_("Enter name of signature file:")),
@@ -669,7 +671,7 @@
             proportion=0,
             flag=wx.ALL,
             border=3)
-        self.fileNameCtrl = wx.TextCtrl(
+        self.fileNameCtrl = TextCtrl(
             parent=self.panel, id=wx.ID_ANY, size=(400, -1))
         if self.fileName:
             self.fileNameCtrl.SetValue(self.fileName)
@@ -676,14 +678,14 @@
         dataSizer.Add(self.fileNameCtrl,
                       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)
 
         self.pathPanel = scrolled.ScrolledPanel(self.panel, size=(-1, 40))
         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(
             self.filePathText,
             proportion=1,
@@ -741,8 +743,8 @@
         self.vectorName = vectorName
         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.Enable(False)
         self.btnOK.Bind(wx.EVT_BUTTON, self.OnOK)
@@ -771,7 +773,7 @@
         dataSizer = wx.BoxSizer(wx.VERTICAL)
 
         dataSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self.panel,
                 id=wx.ID_ANY,
                 label=_("Enter name of new vector map:")),
@@ -786,10 +788,10 @@
             self.vectorNameCtrl.SetValue(self.vectorName)
         dataSizer.Add(self.vectorNameCtrl,
                       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"))
         self.withTableCtrl.SetValue(True)
-        self.withTableCtrl.SetToolTipString(
+        self.withTableCtrl.SetToolTip(
             _("Export attribute table containing" " computed statistical data"))
 
         dataSizer.Add(self.withTableCtrl,

Modified: grass/trunk/gui/wxpython/iclass/frame.py
===================================================================
--- grass/trunk/gui/wxpython/iclass/frame.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/iclass/frame.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -19,6 +19,7 @@
 
 import os
 import sys
+import six
 import copy
 import tempfile
 import types
@@ -47,6 +48,7 @@
 from core.render import Map, MapLayer
 from core.gcmd import RunCommand, GMessage, GError, GWarning
 from gui_core.dialogs import SetOpacityDialog
+from gui_core.wrap import Menu
 from mapwin.base import MapWindowProperties
 from dbmgr.vinfo import VectorDBInfo
 import grass.script as grass
@@ -223,7 +225,7 @@
         self.GetFirstWindow().GetDigit().CloseMap()
         self.plotPanel.CloseWindow()
         self._cleanup()
-
+        self._mgr.UnInit()
         self.Destroy()
 
     def _cleanup(self):
@@ -477,7 +479,7 @@
 
     def OnZoomMenu(self, event):
         """Popup Zoom menu """
-        zoommenu = wx.Menu()
+        zoommenu = Menu()
         # Add items to the menu
 
         i = 0
@@ -1462,7 +1464,7 @@
 
     def GetAlias(self, name):
         """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:
             return name[0]
         return None

Modified: grass/trunk/gui/wxpython/iclass/statistics.py
===================================================================
--- grass/trunk/gui/wxpython/iclass/statistics.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/iclass/statistics.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -18,6 +18,7 @@
 """
 
 import os
+import six
 from ctypes import *
 
 import grass.script as grass
@@ -176,7 +177,7 @@
 
     def SetStatistics(self, stats):
 
-        for st, val in stats.iteritems():
+        for st, val in six.iteritems(stats):
             setattr(self, st, val)
 
         self.statisticsSet.emit(stats=stats)

Modified: grass/trunk/gui/wxpython/iclass/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/iclass/toolbars.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/iclass/toolbars.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -27,6 +27,7 @@
 from icons.icon import MetaIcon
 from iclass.dialogs import IClassMapDialog, ContrastColor
 from gui_core.forms import GUI
+from gui_core.wrap import StaticText
 
 import grass.script as grass
 
@@ -154,7 +155,7 @@
         self.choice.Bind(wx.EVT_CHOICE, self.OnSelectCategory)
 
         # 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),
                                  style=wx.TE_PROCESS_ENTER)

Modified: grass/trunk/gui/wxpython/icons/icon.py
===================================================================
--- grass/trunk/gui/wxpython/icons/icon.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/icons/icon.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -18,6 +18,7 @@
 import os
 import sys
 import copy
+import six
 
 import wx
 
@@ -25,9 +26,10 @@
 from core.utils import _
 
 # 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(
     group='appearance',
@@ -46,7 +48,7 @@
     if iconPath and not os.path.exists(iconPath):
         raise OSError
 
-    for key, img in iconSet.iteritems():
+    for key, img in six.iteritems(iconSet):
         if key not in iconSet or \
                 iconSet[key] is None:  # add key
             iconSet[key] = img

Modified: grass/trunk/gui/wxpython/image2target/ii2t_gis_set.py
===================================================================
--- grass/trunk/gui/wxpython/image2target/ii2t_gis_set.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/image2target/ii2t_gis_set.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -40,8 +40,8 @@
 from location_wizard.dialogs import RegionDef
 from gui_core.dialogs import TextEntryDialog
 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)
 
@@ -117,17 +117,17 @@
             grassVersion = versionLine
             grassRevisionStr = ''
 
-        self.gisdbase_box = wx.StaticBox(
+        self.gisdbase_box = StaticBox(
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             _("1. Select GRASS GIS database directory"))
-        self.location_box = wx.StaticBox(
+        self.location_box = StaticBox(
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             _("2. Select GRASS Location"))
-        self.mapset_box = wx.StaticBox(
+        self.mapset_box = StaticBox(
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             _("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.
         # The color itself may not be correct for all platforms/system settings
         # but in http://xoomer.virgilio.it/infinity77/wxPython/Widgets/wx.SystemSettings.html
@@ -141,7 +141,7 @@
         self.location_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,
             label=_("GRASS GIS database directory contains Locations."))
 
@@ -207,7 +207,7 @@
         self.delete_mapset_button.SetToolTip(_("Delete selected mapset"))
 
         # textinputs
-        self.tgisdbase = wx.TextCtrl(
+        self.tgisdbase = TextCtrl(
             parent=self.gisdbase_panel, id=wx.ID_ANY, value="", size=(
                 300, -1), style=wx.TE_PROCESS_ENTER)
 

Modified: grass/trunk/gui/wxpython/image2target/ii2t_manager.py
===================================================================
--- grass/trunk/gui/wxpython/image2target/ii2t_manager.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/image2target/ii2t_manager.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -35,6 +35,7 @@
 
 import os
 import sys
+import six
 import shutil
 import time
 from copy import copy
@@ -61,7 +62,8 @@
 from core.settings import UserSettings
 from gcp.mapdisplay import MapFrame
 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
 
@@ -400,7 +402,7 @@
 
         # location
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 id=wx.ID_ANY,
                 label=_('Select source location:')),
@@ -421,7 +423,7 @@
 
         # mapset
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 id=wx.ID_ANY,
                 label=_('Select source mapset:')),
@@ -534,7 +536,7 @@
         #
         # group
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 id=wx.ID_ANY,
                 label=_('Select group:')),
@@ -551,7 +553,7 @@
 
         # create group
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 id=wx.ID_ANY,
                 label=_('Create group if none exists')),
@@ -561,11 +563,11 @@
                 2,
                 1))
         btnSizer = wx.BoxSizer(wx.HORIZONTAL)
-        self.btn_mkgroup = wx.Button(
+        self.btn_mkgroup = Button(
             parent=self,
             id=wx.ID_ANY,
             label=_("Create/edit group..."))
-        self.btn_vgroup = wx.Button(
+        self.btn_vgroup = Button(
             parent=self,
             id=wx.ID_ANY,
             label=_("Add vector map to group..."))
@@ -585,7 +587,7 @@
 
         # extension
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 id=wx.ID_ANY,
                 label=_('Extension for output maps:')),
@@ -594,7 +596,7 @@
             pos=(
                 3,
                 1))
-        self.ext_txt = wx.TextCtrl(
+        self.ext_txt = TextCtrl(
             parent=self, id=wx.ID_ANY, value="", size=(
                 350, -1))
         self.ext_txt.SetValue(self.extension)
@@ -737,7 +739,7 @@
         # layout
         #
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 id=wx.ID_ANY,
                 label=_('Select source map to display:')),
@@ -763,7 +765,7 @@
                 2))
 
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 id=wx.ID_ANY,
                 label=_('Select target raster map to display:')),
@@ -786,7 +788,7 @@
                 2))
 
         self.sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 id=wx.ID_ANY,
                 label=_('Select target vector map to display:')),
@@ -1293,7 +1295,7 @@
                    "ucolor": "unused"}
         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)
             self.pointsToDrawSrc.GetPen(v).SetColour(wx.Colour(
                 col[0], col[1], col[2], 255))  # TODO GetPen neni to spatne?
@@ -2126,7 +2128,7 @@
         """Popup Zoom menu
         """
         point = wx.GetMousePosition()
-        zoommenu = wx.Menu()
+        zoommenu = Menu()
         # Add items to the menu
 
         zoomsource = wx.MenuItem(zoommenu, wx.ID_ANY, _(
@@ -2461,17 +2463,17 @@
         #
         # 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()
 
         #
         # 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):
             f = open(self.vgrpfile)
@@ -2497,7 +2499,7 @@
 
         box = wx.BoxSizer(wx.HORIZONTAL)
         box.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self,
                 id=wx.ID_ANY,
                 label=_('Select vector map(s) to add to group:')),
@@ -2561,7 +2563,7 @@
 
         sizer = wx.BoxSizer(wx.VERTICAL)
 
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel, id=wx.ID_ANY, label=" %s %s " %
             (_("Ground Control Point No."), str(gcpno)))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
@@ -2568,12 +2570,12 @@
 
         # source coordinates
         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
         tmp_coord = data[1]
@@ -2589,8 +2591,8 @@
                            (_("target N:"), self.ncoord),
                            (_("source Z:"), self.zcoord),
                            (_("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,
                           flag=wx.ALIGN_CENTER_VERTICAL,
                           pos=(row, col))
@@ -2617,8 +2619,8 @@
         #
         # 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()
 
         btnSizer = wx.StdDialogButtonSizer()
@@ -2691,19 +2693,19 @@
         self.__CreateRectificationPage(notebook)
 
         # 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()
 
         # bindings
         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.SetToolTipString(
+        btnSave.SetToolTip(
             _("Apply and save changes to user settings file (default for next sessions)"))
         btnClose.Bind(wx.EVT_BUTTON, self.OnClose)
-        btnClose.SetToolTipString(_("Close dialog"))
+        btnClose.SetToolTip(_("Close dialog"))
 
         # sizers
         btnSizer = wx.BoxSizer(wx.HORIZONTAL)
@@ -2749,7 +2751,7 @@
                 0))
 
         # RMS forward error threshold
-        rmslabel = wx.StaticText(
+        rmslabel = StaticText(
             parent=panel, id=wx.ID_ANY,
             label=_("Highlight RMS error > M + SD * factor:"))
         rmslabel.SetToolTip(
@@ -2766,8 +2768,8 @@
                 0))
         sdfactor = UserSettings.Get(
             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))
         if (self.parent.highest_only == True):
             self.rmsWin.Disable()
@@ -2777,8 +2779,8 @@
         rmsgridSizer.AddGrowableCol(1)
         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)
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
 
@@ -2786,7 +2788,7 @@
         # general symbol color
         #
         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))
         col = UserSettings.Get(group='gcpman', key='symbol', subkey='color')
         colWin = csel.ColourSelect(parent=panel, id=wx.ID_ANY,
@@ -2803,7 +2805,7 @@
         # symbol color for high forward RMS error
         #
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Color for high RMS error:"))
@@ -2823,7 +2825,7 @@
         # symbol color for selected GCP
         #
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Color for selected GCP:"))
@@ -2843,7 +2845,7 @@
         # symbol color for unused GCP
         #
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Color for unused GCPs:"))
@@ -2876,7 +2878,7 @@
         # symbol size
         #
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Symbol size:"))
@@ -2898,7 +2900,7 @@
         # symbol width
         #
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Line width:"))
@@ -2950,7 +2952,7 @@
         self.tgtvectselection.GetElementList()
 
         sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=_('Select source map to display:')),
@@ -2964,7 +2966,7 @@
             border=5)
         self.srcselection.SetValue(src_map)
         sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=_('Select target raster map to display:')),
@@ -2978,7 +2980,7 @@
             border=5)
         self.tgtrastselection.SetValue(tgt_map['raster'])
         sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=_('Select target vector map to display:')),
@@ -3029,7 +3031,7 @@
         # interpolation method
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=_('Select interpolation method:')),
@@ -3055,7 +3057,7 @@
 
         # extension
         sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=_('Extension for output maps:')),
@@ -3062,7 +3064,7 @@
             proportion=0,
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL,
             border=5)
-        self.ext_txt = wx.TextCtrl(
+        self.ext_txt = TextCtrl(
             parent=panel, id=wx.ID_ANY, value="", size=(
                 350, -1))
         self.ext_txt.SetValue(self.parent.extension)

Modified: grass/trunk/gui/wxpython/image2target/ii2t_mapdisplay.py
===================================================================
--- grass/trunk/gui/wxpython/image2target/ii2t_mapdisplay.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/image2target/ii2t_mapdisplay.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -30,6 +30,7 @@
 from core.utils import _
 from gui_core.dialogs import GetImageHandlers, ImageSizeDialog
 from gui_core.mapdisp import SingleMapFrame
+from gui_core.wrap import Menu
 from core.settings import UserSettings
 from mapwin.buffered import BufferedMapWindow
 from mapwin.base import MapWindowProperties
@@ -421,7 +422,7 @@
         Print options and output menu for map display
         """
         point = wx.GetMousePosition()
-        printmenu = wx.Menu()
+        printmenu = Menu()
         # Add items to the menu
         setup = wx.MenuItem(printmenu, wx.ID_ANY, _('Page setup'))
         printmenu.AppendItem(setup)
@@ -467,7 +468,7 @@
         """Popup Zoom menu
         """
         point = wx.GetMousePosition()
-        zoommenu = wx.Menu()
+        zoommenu = Menu()
         # Add items to the menu
 
         zoomwind = wx.MenuItem(zoommenu, wx.ID_ANY, _(

Modified: grass/trunk/gui/wxpython/iscatt/controllers.py
===================================================================
--- grass/trunk/gui/wxpython/iscatt/controllers.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/iscatt/controllers.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -23,6 +23,7 @@
 import sys
 from copy import deepcopy
 import wx
+import six
 
 
 from core.gcmd import GException, GError, GMessage, RunCommand, GWarning
@@ -366,7 +367,7 @@
     def SetPlotsMode(self, mode):
 
         self.plot_mode = mode
-        for scatt in self.plots.itervalues():
+        for scatt in six.itervalues(self.plots):
             if scatt['scatt']:
                 scatt['scatt'].SetMode(mode)
 
@@ -374,7 +375,7 @@
 
     def ActivateSelectionPolygonMode(self, activate):
         self.pol_sel_mode[0] = activate
-        for scatt in self.plots.itervalues():
+        for scatt in six.itervalues(self.plots):
             if not scatt['scatt']:
                 continue
             scatt['scatt'].SetSelectionPolygonMode(activate)
@@ -387,7 +388,7 @@
 
     def ProcessSelectionPolygons(self, process_mode):
         scatts_polygons = {}
-        for scatt_id, scatt in self.plots.iteritems():
+        for scatt_id, scatt in six.iteritems(self.plots):
             if not scatt['scatt']:
                 continue
             coords = scatt['scatt'].GetCoords()
@@ -419,7 +420,7 @@
         if not sel_cat_id:
             return
 
-        for scatt in self.plots.itervalues():
+        for scatt in six.itervalues(self.plots):
             if scatt['scatt']:
                 scatt['scatt'].SetEmpty()
 
@@ -544,7 +545,7 @@
             else:
                 ellipses_dt = {}
 
-            for c in scatt_dt.iterkeys():
+            for c in six.iterkeys(scatt_dt):
                 try:
                     self.cat_ids.remove(c)
                     scatt_dt[c]['render'] = True
@@ -700,7 +701,7 @@
         render = False
         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']:
                 render = True
             if k in ['color', 'name']:
@@ -975,7 +976,7 @@
 
     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_name = self.cats_mgr.GetCategoryAttrs(cat_id)['name']

Modified: grass/trunk/gui/wxpython/iscatt/core_c.py
===================================================================
--- grass/trunk/gui/wxpython/iscatt/core_c.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/iscatt/core_c.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -12,6 +12,7 @@
 """
 
 import sys
+import six
 import numpy as np
 from multiprocessing import Process, Queue
 
@@ -107,13 +108,13 @@
 
 def _memmapToFileNames(data):
 
-    for k, v in data.iteritems():
+    for k, v in six.iteritems(data):
         if 'np_vals' in v:
             data[k]['np_vals'] = v['np_vals'].filename()
 
 
 def _fileNamesToMemmap(data):
-    for k, v in data.iteritems():
+    for k, v in six.iteritems(data):
         if 'np_vals' in v:
             data[k]['np_vals'] = np.memmap(filename=v['np_vals'])
 
@@ -186,7 +187,7 @@
                     'nsres': 'ns_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
             v = int(v)
         else:
@@ -221,11 +222,11 @@
     refs = []
     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))
         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
             # computed)
             vals = dt['np_vals']

Modified: grass/trunk/gui/wxpython/iscatt/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/iscatt/dialogs.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/iscatt/dialogs.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -19,6 +19,7 @@
 """
 import os
 import sys
+import six
 
 import wx
 from iscatt.iscatt_core import idBandsToidScatt
@@ -31,7 +32,8 @@
 from core.gcmd import GMessage
 from core.settings import UserSettings
 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):
@@ -55,7 +57,7 @@
         self.labels = {}
         self.params = {}
 
-        self.band_1_label = wx.StaticText(
+        self.band_1_label = StaticText(
             parent=self, id=wx.ID_ANY, label=_("x axis:"))
 
         self.band_1_ch = wx.ComboBox(parent=self, id=wx.ID_ANY,
@@ -62,7 +64,7 @@
                                      choices=self.bands,
                                      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:"))
 
         self.band_2_ch = wx.ComboBox(parent=self, id=wx.ID_ANY,
@@ -73,11 +75,11 @@
                                     style=wx.LB_MULTIPLE | wx.LB_NEEDED_SB)
 
         # 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()
 
@@ -100,7 +102,7 @@
             flag=wx.TOP | wx.ALIGN_RIGHT,
             border=5)
 
-        box = wx.StaticBox(
+        box = StaticBox(
             self, id=wx.ID_ANY, label=" %s " %
             _("Bands of scatter plots to be added (x y):"))
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
@@ -245,8 +247,8 @@
         self.rasterName = rasterName
         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.Enable(False)
         self.btnOK.Bind(wx.EVT_BUTTON, self.OnOK)
@@ -275,7 +277,7 @@
         dataSizer = wx.BoxSizer(wx.VERTICAL)
 
         dataSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=self.panel,
                 id=wx.ID_ANY,
                 label=_("Enter name of new vector map:")),
@@ -360,8 +362,8 @@
                 "selection", _("Color of selection polygon vertex:")], "sel_area": [
                 "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])
             col = UserSettings.Get(group='scatt', key=sett[0], subkey=settKey)
             self.settings[settKey] = csel.ColourSelect(
@@ -373,8 +375,8 @@
             "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])
             self.settings[settKey] = SpinCtrl(
                 parent=self, id=wx.ID_ANY, min=0, max=100)
@@ -386,20 +388,20 @@
             self.settings[settKey].SetValue(size)
 
         # 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()
 
         # bindings
         self.btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
-        self.btnApply.SetToolTipString(
+        self.btnApply.SetToolTip(
             _("Apply changes for the current session"))
         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)"))
         self.btnClose.Bind(wx.EVT_BUTTON, self.OnClose)
-        self.btnClose.SetToolTipString(_("Close dialog"))
+        self.btnClose.SetToolTip(_("Close dialog"))
 
         # Layout
 
@@ -408,8 +410,8 @@
 
         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)
 
         gridSizer = wx.GridBagSizer(vgap=1, hgap=1)
@@ -435,8 +437,8 @@
         gridSizer.AddGrowableCol(1)
         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)
         gridSizer = wx.GridBagSizer(vgap=1, hgap=1)
 
@@ -480,7 +482,7 @@
     def UpdateSettings(self):
 
         chanaged_setts = []
-        for settKey, sett in self.colorsSetts.iteritems():
+        for settKey, sett in six.iteritems(self.colorsSetts):
             col = tuple(self.settings[settKey].GetColour())
             col_s = UserSettings.Get(
                 group='scatt', key=sett[0], subkey=settKey)
@@ -491,7 +493,7 @@
                                  value=col)
                 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_s = UserSettings.Get(
                 group='scatt', key=sett[0], subkey=settKey)
@@ -562,7 +564,7 @@
     def __init__(self, parent, old_name, title=("Change class name")):
         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.dataSizer.Add(self.name, proportion=0,

Modified: grass/trunk/gui/wxpython/iscatt/frame.py
===================================================================
--- grass/trunk/gui/wxpython/iscatt/frame.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/iscatt/frame.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -22,6 +22,7 @@
 
 import os
 import sys
+import six
 
 import wx
 import wx.lib.scrolledpanel as scrolled
@@ -32,6 +33,7 @@
 
 from gui_core.gselect import Select
 from gui_core.dialogs import SetOpacityDialog
+from gui_core.wrap import StaticBox, Menu
 from iscatt.controllers import ScattsManager
 from iscatt.toolbars import MainToolbar, EditingToolbar, CategoryToolbar
 from iscatt.iscatt_core import idScattToidBands
@@ -139,8 +141,8 @@
         self.catsPanel.SetMinSize((-1, 100))
         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)
 
         self.toolbars['categoryToolbar'] = self._createCategoryToolbar(
@@ -260,7 +262,7 @@
         self.scatt_mgr.cursorPlotMove.connect(self.CursorPlotMove)
 
     def SetBusy(self, busy):
-        for scatt in self.scatts.itervalues():
+        for scatt in six.itervalues(self.scatts):
             scatt.UpdateCur(busy)
 
     def CursorPlotMove(self, x, y, scatt_id):
@@ -569,7 +571,7 @@
         cat_id = cats[cat_idx]
         showed = self.cats_mgr.GetCategoryAttrs(cat_id)['show']
 
-        menu = wx.Menu()
+        menu = Menu()
 
         item_id = wx.NewId()
         menu.Append(item_id, text=_("Rename class"))

Modified: grass/trunk/gui/wxpython/iscatt/iscatt_core.py
===================================================================
--- grass/trunk/gui/wxpython/iscatt/iscatt_core.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/iscatt/iscatt_core.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -19,6 +19,7 @@
 """
 import os
 import sys
+import six
 
 import time
 
@@ -114,7 +115,7 @@
 
         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)
 
         arr[bbox['btm_y']: bbox['up_y'], bbox['btm_x']: bbox['up_x']] = value
@@ -159,7 +160,7 @@
         if cat_id not in self.scatts_dt.GetCategories():
             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:
                 return False
@@ -471,7 +472,7 @@
         if cat_id not in self.cats.keys():
             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'])
             del scatt['np_vals']
 
@@ -552,7 +553,7 @@
     def GetData(self, requested_dt):
 
         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:
                 cats[cat_id] = {}
             for scatt_id in scatt_ids:
@@ -567,7 +568,7 @@
 
     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:
                 # if key is missing condition is always True (full scatter plor
                 # is computed)
@@ -577,7 +578,7 @@
 
     def GetScatt(self, scatt_id, cats_ids=None):
         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:
                 continue
             if scatt_id not in self.cats[cat_id]:
@@ -644,7 +645,7 @@
             return False
 
         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)
             self.cats[cat_id][scatt_id]['ellipse'] = None
 
@@ -657,7 +658,7 @@
 
         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)
 
         return True
@@ -667,7 +668,7 @@
             return False
 
         scatts = {}
-        for cat_id in self.cats.iterkeys():
+        for cat_id in six.iterkeys(self.cats):
             if cat_id == 0:
                 continue
             nstd = styles[cat_id]['nstd']
@@ -740,9 +741,9 @@
     def 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)
-        for tmp in self.cats_rasts.itervalues():
+        for tmp in six.itervalues(self.cats_rasts):
             RunCommand("g.remove", flags='f',
                        type='raster', name=tmp,
                        getErrorMsg=True)
@@ -762,7 +763,7 @@
         max_cat_id = max(self.cats_rasts_conds.keys())
 
         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
 
         return cats_rasts_conds
@@ -771,7 +772,7 @@
         max_cat_id = max(self.cats_rasts.keys())
 
         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
 
         return cats_rasts

Modified: grass/trunk/gui/wxpython/iscatt/plots.py
===================================================================
--- grass/trunk/gui/wxpython/iscatt/plots.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/iscatt/plots.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -16,6 +16,7 @@
 @author Stepan Turek <stepan.turek seznam.cz> (mentor: Martin Landa)
 """
 import wx
+import six
 import numpy as np
 from math import ceil
 from multiprocessing import Process, Queue
@@ -24,6 +25,7 @@
 from iscatt.core_c import MergeArrays, ApplyColormap
 from iscatt.dialogs import ManageBusyCursorMixin
 from core.settings import UserSettings
+from gui_core.wrap import Menu
 
 try:
     import matplotlib
@@ -550,7 +552,7 @@
 
 def _rendDtMemmapsToFiles(rend_dt):
 
-    for k, v in rend_dt.iteritems():
+    for k, v in six.iteritems(rend_dt):
         if 'dt' in v:
             rend_dt[k]['sh'] = v['dt'].shape
             rend_dt[k]['dt'] = v['dt'].filename
@@ -558,7 +560,7 @@
 
 def _rendDtFilesToMemmaps(rend_dt):
 
-    for k, v in rend_dt.iteritems():
+    for k, v in six.iteritems(rend_dt):
         if 'dt' in v:
             rend_dt[k]['dt'] = np.memmap(filename=v['dt'], shape=v['sh'])
             del rend_dt[k]['sh']
@@ -613,7 +615,7 @@
             return
 
         if event.button == 3:
-            menu = wx.Menu()
+            menu = Menu()
             menu_items = [["zoom_to_extend", _("Zoom to scatter plot extend"),
                            lambda event: self.plot.ZoomToExtend()]]
 

Modified: grass/trunk/gui/wxpython/lmgr/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/layertree.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/lmgr/layertree.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -47,7 +47,7 @@
 from icons.icon import MetaIcon
 from web_services.dialogs import SaveWMSLayerDialog
 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 core.giface import Notification
 
@@ -2255,6 +2255,6 @@
         height = 25
         if sys.platform in ('win32', 'darwin'):
             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)
         return ctrl

Modified: grass/trunk/gui/wxpython/location_wizard/base.py
===================================================================
--- grass/trunk/gui/wxpython/location_wizard/base.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/location_wizard/base.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -17,6 +17,7 @@
 """
 
 import wx
+from gui_core.wrap import StaticText, TextCtrl, Button, CheckBox
 
 
 class BaseClass(wx.Object):
@@ -30,10 +31,10 @@
         """Make aligned label"""
         if not parent:
             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)
         if tooltip:
-            label.SetToolTipString(tooltip)
+            label.SetToolTip(tooltip)
         return label
 
     def MakeTextCtrl(self, text='', size=(100, -1),
@@ -41,10 +42,10 @@
         """Generic text control"""
         if not parent:
             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)
         if tooltip:
-            textCtrl.SetToolTipString(tooltip)
+            textCtrl.SetToolTip(tooltip)
         return textCtrl
 
     def MakeButton(self, text, id=wx.ID_ANY, size=(-1, -1),
@@ -52,10 +53,10 @@
         """Generic button"""
         if not parent:
             parent = self
-        button = wx.Button(parent=parent, id=id, label=text,
+        button = Button(parent=parent, id=id, label=text,
                            size=size)
         if tooltip:
-            button.SetToolTipString(tooltip)
+            button.SetToolTip(tooltip)
         return button
 
     def MakeCheckBox(self, text, id=wx.ID_ANY, size=(-1, -1),
@@ -63,8 +64,8 @@
         """Generic checkbox"""
         if not parent:
             parent = self
-        chbox = wx.CheckBox(parent=parent, id=id, label=text,
+        chbox = CheckBox(parent=parent, id=id, label=text,
                              size=size)
         if tooltip:
-            chbox.SetToolTipString(tooltip)
+            chbox.SetToolTip(tooltip)
         return chbox

Modified: grass/trunk/gui/wxpython/location_wizard/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/location_wizard/dialogs.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/location_wizard/dialogs.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -26,6 +26,8 @@
 from core.gcmd import RunCommand
 from core.utils import _
 from location_wizard.base import BaseClass
+from gui_core.wrap import Button, StaticText, StaticBox, \
+    TextCtrl
 
 from grass.script import core as grass
 
@@ -108,7 +110,7 @@
         self.bset = self.MakeButton(
             text=_("&Set region"),
             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()
 
         #
@@ -247,13 +249,13 @@
         gridSizer = wx.GridBagSizer(vgap=0, hgap=0)
 
         # 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(
                 self.bottom), size=(
                 150, -1))
-        self.ttbres = wx.TextCtrl(
+        self.ttbres = TextCtrl(
             parent=pane, id=wx.ID_ANY, value=str(
                 self.tbres), size=(
                 150, -1))
@@ -263,17 +265,17 @@
         #                                    size = (150, -1))
 
         # labels
-        self.ldepth = wx.StaticText(
+        self.ldepth = StaticText(
             parent=pane,
             label=_("Depth: %d") %
             self.depth)
-        self.lcells3 = wx.StaticText(
+        self.lcells3 = StaticText(
             parent=pane,
             label=_("3D Cells: %d") %
             self.cells3)
 
         # top
-        gridSizer.Add(wx.StaticText(parent=pane, label=_("Top")),
+        gridSizer.Add(StaticText(parent=pane, label=_("Top")),
                       flag=wx.ALIGN_CENTER |
                       wx.LEFT | wx.RIGHT | wx.TOP, border=5,
                       pos=(0, 1))
@@ -281,7 +283,7 @@
                       flag=wx.ALIGN_CENTER_HORIZONTAL |
                       wx.ALL, border=5, pos=(1, 1))
         # bottom
-        gridSizer.Add(wx.StaticText(parent=pane, label=_("Bottom")),
+        gridSizer.Add(StaticText(parent=pane, label=_("Bottom")),
                       flag=wx.ALIGN_CENTER |
                       wx.LEFT | wx.RIGHT | wx.TOP, border=5,
                       pos=(0, 2))
@@ -290,7 +292,7 @@
                       wx.ALL, border=5, pos=(1, 2))
         # tbres
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=pane,
                 label=_("T-B resolution")),
             flag=wx.ALIGN_CENTER | wx.LEFT | wx.RIGHT | wx.TOP,
@@ -607,7 +609,7 @@
         #
         # dialog body
         #
-        bodyBox = wx.StaticBox(
+        bodyBox = StaticBox(
             parent=panel, id=wx.ID_ANY, label=" %s " %
             _("Select from list of datum transformations"))
         bodySizer = wx.StaticBoxSizer(bodyBox)
@@ -655,11 +657,11 @@
         #
         btnsizer = wx.StdDialogButtonSizer()
 
-        btn = wx.Button(parent=panel, id=wx.ID_OK)
+        btn = Button(parent=panel, id=wx.ID_OK)
         btn.SetDefault()
         btnsizer.AddButton(btn)
 
-        btn = wx.Button(parent=panel, id=wx.ID_CANCEL)
+        btn = Button(parent=panel, id=wx.ID_CANCEL)
         btnsizer.AddButton(btn)
         btnsizer.Realize()
 

Modified: grass/trunk/gui/wxpython/location_wizard/wizard.py
===================================================================
--- grass/trunk/gui/wxpython/location_wizard/wizard.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/location_wizard/wizard.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -35,6 +35,7 @@
 import os
 import sys
 import locale
+import six
 
 import wx
 import wx.lib.mixins.listctrl as listmix
@@ -51,9 +52,11 @@
 
 from core import utils
 from core.utils import _
+from core.utils import cmp
 from core.gcmd import RunCommand, GError, GMessage, GWarning
 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.dialogs import SelectTransformDialog
 
@@ -80,7 +83,7 @@
         self.page = WizardPageSimple.__init__(self, parent)
 
         # 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))
         # main sizers
         self.pagesizer = wx.BoxSizer(wx.VERTICAL)
@@ -108,10 +111,10 @@
         """Make aligned label"""
         if not parent:
             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)
         if tooltip:
-            label.SetToolTipString(tooltip)
+            label.SetToolTip(tooltip)
         return label
 
     def MakeTextCtrl(self, text='', size=(100, -1),
@@ -119,10 +122,10 @@
         """Generic text control"""
         if not parent:
             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)
         if tooltip:
-            textCtrl.SetToolTipString(tooltip)
+            textCtrl.SetToolTip(tooltip)
         return textCtrl
 
     def MakeButton(self, text, id=wx.ID_ANY, size=(-1, -1),
@@ -130,10 +133,10 @@
         """Generic button"""
         if not parent:
             parent = self
-        button = wx.Button(parent=parent, id=id, label=text,
+        button = Button(parent=parent, id=id, label=text,
                            size=size)
         if tooltip:
-            button.SetToolTipString(tooltip)
+            button.SetToolTip(tooltip)
         return button
 
     def MakeCheckBox(self, text, id=wx.ID_ANY, size=(-1, -1),
@@ -141,10 +144,10 @@
         """Generic checkbox"""
         if not parent:
             parent = self
-        chbox = wx.CheckBox(parent=parent, id=id, label=text,
+        chbox = CheckBox(parent=parent, id=id, label=text,
                             size=size)
         if tooltip:
-            chbox.SetToolTipString(tooltip)
+            chbox.SetToolTip(tooltip)
         return chbox
 
 
@@ -349,7 +352,7 @@
 
         # layout
         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))
         self.sizer.Add(self.radioEpsg,
                        flag=wx.ALIGN_LEFT, pos=(2, 1))
@@ -361,7 +364,7 @@
                        flag=wx.ALIGN_LEFT, pos=(4, 1))
         self.sizer.Add(self.radioXy,
                        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))
         self.sizer.Add(self.radioSrs,
                        flag=wx.ALIGN_LEFT, pos=(7, 1))
@@ -788,7 +791,7 @@
         self.p4projparams = ''
         self.projdesc = ''
 
-        radioSBox = wx.StaticBox(
+        radioSBox = StaticBox(
             parent=self, id=wx.ID_ANY, label=" %s " %
             _("Select datum or ellipsoid (next page)"))
         radioSBSizer = wx.StaticBoxSizer(radioSBox)
@@ -849,7 +852,7 @@
         """Go to next page"""
         if event.GetDirection():
             self.p4projparams = ''
-            for id, param in self.pparam.iteritems():
+            for id, param in six.iteritems(self.pparam):
                 if param['type'] == 'bool':
                     if param['value'] == False:
                         continue
@@ -875,7 +878,7 @@
         self.projdesc = self.parent.projections[self.parent.projpage.proj][0]
         if self.prjParamSizer is None:
             # entering page for the first time
-            self.paramSBox = wx.StaticBox(
+            self.paramSBox = StaticBox(
                 parent=self,
                 id=wx.ID_ANY,
                 label=_(" Enter parameters for %s projection ") %
@@ -922,7 +925,7 @@
                 else:
                     param['value'] = paramgrp[2]
 
-                label = wx.StaticText(
+                label = StaticText(
                     parent=self.panel,
                     id=wx.ID_ANY,
                     label=param['desc'],
@@ -941,9 +944,9 @@
                     win.Bind(wx.EVT_SPINCTRL, self.OnParamEntry)
                     win.Bind(wx.EVT_TEXT, self.OnParamEntry)
                 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)
                     if paramgrp[1] == 'noask':
                         win.Enable(False)
@@ -1699,7 +1702,7 @@
             return
 
         data = list()
-        for code, val in self.epsgCodeDict.iteritems():
+        for code, val in six.iteritems(self.epsgCodeDict):
             if code is not None:
                 data.append((code, val[0], val[1]))
 
@@ -1946,7 +1949,7 @@
             return
 
         data = list()
-        for code, val in self.epsgCodeDict.iteritems():
+        for code, val in six.iteritems(self.epsgCodeDict):
             if code is not None:
                 data.append((code, val[0], val[1]))
 

Modified: grass/trunk/gui/wxpython/mapdisp/frame.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/frame.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/mapdisp/frame.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -48,6 +48,7 @@
 from gui_core.forms import GUI
 from core.giface import Notification
 from gui_core.vselect import VectorSelectBase, VectorSelectHighlighter
+from gui_core.wrap import Menu
 from mapdisp import statusbar as sb
 
 import grass.script as grass
@@ -806,7 +807,7 @@
         """
         Print options and output menu for map display
         """
-        printmenu = wx.Menu()
+        printmenu = Menu()
         # Add items to the menu
         setup = wx.MenuItem(printmenu, wx.ID_ANY, _('Page setup'))
         printmenu.AppendItem(setup)
@@ -1383,7 +1384,7 @@
     def OnZoomMenu(self, event):
         """Popup Zoom menu
         """
-        zoommenu = wx.Menu()
+        zoommenu = Menu()
 
         for label, handler in (
             (_('Zoom to default region'),

Modified: grass/trunk/gui/wxpython/mapdisp/main.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/main.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/mapdisp/main.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -30,6 +30,7 @@
 
 import os
 import sys
+import six
 import time
 import shutil
 import fileinput
@@ -562,7 +563,7 @@
             # stop the timer
             # self.timer.Stop()
             # terminate thread
-            for f in monFile.itervalues():
+            for f in six.itervalues(monFile):
                 try_remove(f)
 
     def watcher(self):

Modified: grass/trunk/gui/wxpython/mapdisp/statusbar.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/statusbar.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/mapdisp/statusbar.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -38,6 +38,7 @@
 from core.gcmd import GMessage, RunCommand
 from core.settings import UserSettings
 from core.utils import _
+from gui_core.wrap import StaticText, TextCtrl
 
 from grass.script import core as grass
 
@@ -44,10 +45,11 @@
 from grass.pydispatch.signal import Signal
 
 
-class SbException:
+class SbException(Exception):
     """Exception class used in SbManager and SbItems"""
 
     def __init__(self, message):
+#        Exception.__init__(self, message)
         self.message = message
 
     def __str__(self):
@@ -676,9 +678,9 @@
         self.name = 'goto'
         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()
 
@@ -867,7 +869,7 @@
         SbItem.__init__(self, mapframe, statusbar, position)
         self.name = 'mask'
 
-        self.widget = wx.StaticText(
+        self.widget = StaticText(
             parent=self.statusbar,
             id=wx.ID_ANY,
             label=_('MASK'))

Modified: grass/trunk/gui/wxpython/mapdisp/test_mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/test_mapdisp.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/mapdisp/test_mapdisp.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 ############################################################################
 #
@@ -67,6 +67,7 @@
 from core.render import Map
 from rlisetup.sampling_frame import RLiSetupMapPanel
 from mapdisp.main import LayerList
+from gui_core.wrap import StaticText
 
 
 class MapdispGrassInterface(StandaloneGrassInterface):
@@ -102,7 +103,7 @@
         self._cf = wx.Frame(parent=parent, title=title)
         self._cp = wx.Panel(parent=self._cf, id=wx.ID_ANY)
         self._cs = wx.BoxSizer(wx.VERTICAL)
-        self._cl = wx.StaticText(
+        self._cl = StaticText(
             parent=self._cp,
             id=wx.ID_ANY,
             label="No text set yet")

Modified: grass/trunk/gui/wxpython/mapswipe/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/mapswipe/dialogs.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/mapswipe/dialogs.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -27,7 +27,7 @@
 from core.gcmd import GMessage
 from core.layerlist import LayerList
 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, \
     SIMPLE_LMGR_VECTOR, SIMPLE_LMGR_RGB, SIMPLE_LMGR_TB_LEFT, SIMPLE_LMGR_TB_RIGHT
 
@@ -60,10 +60,10 @@
         self._firstPanel = self._createSimplePanel()
         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.btnSwitch.Bind(wx.EVT_BUTTON, self.OnSwitchMode)
@@ -125,7 +125,7 @@
             validator=SimpleValidator(
                 callback=self.ValidatorCallback))
         sizer.Add(
-            wx.StaticText(
+            StaticText(
                 panel,
                 label=_("Name of top/left raster map:")),
             proportion=0,
@@ -134,7 +134,7 @@
         sizer.Add(self._firstRaster, proportion=0,
                   flag=wx.EXPAND | wx.ALL, border=1)
         sizer.Add(
-            wx.StaticText(
+            StaticText(
                 panel,
                 label=_("Name of bottom/right raster map:")),
             proportion=0,
@@ -269,13 +269,13 @@
         notebook.AddPage(page=panel, text=_("Mirror mode"))
 
         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)
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
 
         row = 0
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 label=_("Color:")),
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,
@@ -296,7 +296,7 @@
 
         row += 1
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 label=_("Shape:")),
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,
@@ -322,7 +322,7 @@
 
         row += 1
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 label=_("Line width:")),
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,
@@ -345,7 +345,7 @@
 
         row += 1
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 label=_("Size:")),
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL,

Modified: grass/trunk/gui/wxpython/mapswipe/frame.py
===================================================================
--- grass/trunk/gui/wxpython/mapswipe/frame.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/mapswipe/frame.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -766,6 +766,7 @@
     def OnCloseWindow(self, event):
         self.GetFirstMap().Clean()
         self.GetSecondMap().Clean()
+        self._mgr.UnInit()
         self.Destroy()
 
 

Modified: grass/trunk/gui/wxpython/mapswipe/mapwindow.py
===================================================================
--- grass/trunk/gui/wxpython/mapswipe/mapwindow.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/mapswipe/mapwindow.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -23,6 +23,7 @@
 from core.utils import _
 from core.settings import UserSettings
 from mapwin.buffered import BufferedMapWindow
+from gui_core.wrap import Rect
 
 
 EVT_MY_MOUSE_EVENTS = wx.NewEventType()
@@ -52,8 +53,8 @@
 
     def _bindMouseEvents(self):
         """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_MOUSE_EVENTS, self.MouseActions)
         self.Bind(wx.EVT_CONTEXT_MENU, self.OnContextMenu)
@@ -174,7 +175,7 @@
 
     def SetRasterNameText(self, name, textId):
         """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,
                                  'background': wx.LIGHT_GREY,
                                  'rotation': 0, 'text': name,

Modified: grass/trunk/gui/wxpython/mapswipe/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/mapswipe/toolbars.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/mapswipe/toolbars.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -19,6 +19,7 @@
 import wx
 
 from gui_core.toolbars import BaseToolbar, BaseIcons
+from gui_core.wrap import Menu
 from icons.icon import MetaIcon
 from core.utils import _
 
@@ -148,7 +149,7 @@
 
     def OnToolMenu(self, event):
         """Menu for additional tools"""
-        toolMenu = wx.Menu()
+        toolMenu = Menu()
 
         for label, itype, handler, desc in (
             (_("Switch orientation"),

Modified: grass/trunk/gui/wxpython/mapwin/base.py
===================================================================
--- grass/trunk/gui/wxpython/mapwin/base.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/mapwin/base.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -20,6 +20,7 @@
 """
 
 import wx
+import six
 
 from core.settings import UserSettings
 from core.gcmd import GError
@@ -185,7 +186,7 @@
         """Binds helper functions, which calls all handlers
            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))
 
     def EventTypeHandler(self, evHandlers):
@@ -255,7 +256,7 @@
         """
         self.mouseHandlerRegistered.emit()
         # inserts handler into list
-        for containerEv, handlers in self.handlersContainer.iteritems():
+        for containerEv, handlers in six.iteritems(self.handlersContainer):
             if event == containerEv:
                 handlers.append(handler)
 
@@ -276,7 +277,7 @@
         Before each handler is unregistered it is called with string
         value "unregistered" of event parameter.
         """
-        for containerEv, handlers in self.handlersContainer.iteritems():
+        for containerEv, handlers in six.iteritems(self.handlersContainer):
             for handler in handlers:
                 try:
                     handler("unregistered")
@@ -304,7 +305,7 @@
         :return: False if event cannot be unbind
         """
         # removes handler from list
-        for containerEv, handlers in self.handlersContainer.iteritems():
+        for containerEv, handlers in six.iteritems(self.handlersContainer):
             if event != containerEv:
                 continue
             try:

Modified: grass/trunk/gui/wxpython/mapwin/buffered.py
===================================================================
--- grass/trunk/gui/wxpython/mapwin/buffered.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/mapwin/buffered.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -37,7 +37,8 @@
 import grass.script as grass
 
 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.debug import Debug
 from core.settings import UserSettings
@@ -243,7 +244,7 @@
             return
 
         # generate popup-menu
-        menu = wx.Menu()
+        menu = Menu()
 
         if not hasattr(self, "popupCopyCoordinates"):
             self.popupCopyCoordinates = wx.NewId()
@@ -275,7 +276,7 @@
 
         pos = self.ScreenToClient(event.GetPosition())
         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()
             removeId = wx.NewId()
             self.Bind(wx.EVT_MENU,
@@ -349,7 +350,7 @@
                 bitmap, coords[0],
                 coords[1],
                 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
             if pen:
@@ -363,7 +364,7 @@
                 y1 = min(coords[1], coords[3])
                 rwidth = x2 - x1
                 rheight = y2 - y1
-                rect = wx.Rect(x1, y1, rwidth, rheight)
+                rect = Rect(x1, y1, rwidth, rheight)
                 pdc.DrawRectangleRect(rect)
                 pdc.SetIdBounds(drawid, rect)
 
@@ -376,7 +377,7 @@
                         coords[0], coords[1]), wx.Point(
                         coords[2], coords[3]))
                 pdc.SetIdBounds(
-                    drawid, wx.Rect(
+                    drawid, Rect(
                         coords[0],
                         coords[1],
                         coords[2],
@@ -426,7 +427,7 @@
                     x2 = max(xlist)
                     y1 = min(ylist)
                     y2 = max(ylist)
-                    pdc.SetIdBounds(drawid, wx.Rect(x1, y1, x2, y2))
+                    pdc.SetIdBounds(drawid, Rect(x1, y1, x2, y2))
 
         elif pdctype == 'polygon':
             if pen:
@@ -439,7 +440,7 @@
                 y = min(coords, key=lambda x: x[1])[1]
                 w = max(coords, key=lambda x: x[0])[0] - x
                 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
             if pen:
@@ -454,7 +455,7 @@
                                                  coords[3]) - radius,
                     radius=radius)
                 pdc.SetIdBounds(
-                    drawid, wx.Rect(
+                    drawid, Rect(
                         coords[0],
                         coords[1],
                         coords[2],
@@ -468,7 +469,7 @@
                                coords[1] - 5,
                                coords[0] + 5,
                                coords[1] + 5)
-                pdc.SetIdBounds(drawid, wx.Rect(coordsBound))
+                pdc.SetIdBounds(drawid, Rect(coordsBound))
 
         elif pdctype == 'text':  # draw text on top of map
             if not img['active']:
@@ -516,7 +517,7 @@
             rotation = 0.0
 
         coords = textinfo['coords']
-        bbox = wx.Rect(coords[0], coords[1], 0, 0)
+        bbox = Rect(coords[0], coords[1], 0, 0)
         relCoords = (0, 0)
         Debug.msg(4, "BufferedWindow.TextBounds(): text=%s, rotation=%f" %
                   (textinfo['text'], rotation))
@@ -612,7 +613,7 @@
                 # store buffered image
                 # self.bufferLast = wx.BitmapFromImage(self.buffer.ConvertToImage())
                 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.DrawToDC(dc)
@@ -715,7 +716,7 @@
         renderMgr = self.Map.GetRenderMgr()
         renderMgr.renderDone.disconnect(self._saveToFileDone)
 
-        ibuffer = wx.EmptyBitmap(
+        ibuffer = EmptyBitmap(
             max(1, self.Map.width),
             max(1, self.Map.height))
 
@@ -739,7 +740,7 @@
                           pdctype=self.overlays[id].pdcType, coords=coords)
 
         # redraw text labels
-        for id in self.textdict.keys():
+        for id in list(self.textdict.keys()):
             textinfo = self.textdict[id]
             oldCoords = textinfo['coords']
             textinfo['coords'] = ratio[0] * textinfo['coords'][0],\
@@ -783,7 +784,7 @@
                     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:
                         del self.imagedict[key]
 
@@ -807,7 +808,7 @@
         else:
             img = None
 
-        for key in self.imagedict.keys():
+        for key in list(self.imagedict.keys()):
             if self.imagedict[key]['id'] == imgId:
                 del self.imagedict[key]
 
@@ -967,7 +968,7 @@
                           pdctype=self.overlays[id].pdcType,
                           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,
                       pdctype='text', coords=[10, 10, 10, 10])
 
@@ -1072,7 +1073,7 @@
         r = self.pdc.GetIdBounds(id)
 
         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
             rtop = (r[0], r[1] - r[3], r[2], r[3])
             r = r.Union(rtop)
@@ -1083,7 +1084,7 @@
 
         r2 = self.pdc.GetIdBounds(id)
         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
             self.textdict[id]['bbox'] = r2
             self.textdict[id]['coords'][0] += dx
@@ -1117,7 +1118,7 @@
                            end[0], end[1]]
             r = pdc.GetIdBounds(boxid)
             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)
             try:
                 pdc.ClearId(boxid)
@@ -1135,7 +1136,7 @@
             x2 = max(begin[0], end[0])
             y1 = min(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)
             try:
                 pdc.ClearId(self.lineid)
@@ -1563,7 +1564,7 @@
             self._onLeftUp(event)
 
         elif (self.mouse['use'] == 'pointer' and
-                self.dragid >= 0):
+                self.dragid and int(self.dragid) >= 0):
             # end drag of overlay decoration
 
             if self.overlays and self.dragid in self.overlays:
@@ -1695,7 +1696,7 @@
 
         pos = event.GetPosition()
         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"
                             " properties,\nright click to remove")
         else:

Modified: grass/trunk/gui/wxpython/modules/colorrules.py
===================================================================
--- grass/trunk/gui/wxpython/modules/colorrules.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/modules/colorrules.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -26,6 +26,7 @@
 import shutil
 import copy
 import tempfile
+import six
 
 import wx
 import wx.lib.colourselect as csel
@@ -45,7 +46,8 @@
 from core.debug import Debug as Debug
 from core.settings import UserSettings
 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:
@@ -79,12 +81,12 @@
         self.checkAll = wx.CheckBox(parent, id=wx.ID_ANY, label=_("Check all"))
         self.checkAll.SetValue(True)
         # 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
         self.numRules = SpinCtrl(parent, id=wx.ID_ANY,
                                  min=1, max=1e6, initial=1)
         # 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.checkAll.Bind(wx.EVT_CHECKBOX, self.OnCheckAll)
@@ -133,11 +135,11 @@
             enable.SetName('enable')
             enable.Bind(wx.EVT_CHECKBOX, self.OnRuleEnable)
             # value
-            txt_ctrl = wx.TextCtrl(parent=self.mainPanel, id=1000 + num,
+            txt_ctrl = TextCtrl(parent=self.mainPanel, id=1000 + num,
                                    size=(80, -1),
                                    style=wx.TE_NOHIDESEL)
             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.SetName('source')
             if self.attributeType == 'color':
@@ -413,8 +415,8 @@
             maplabel = _('Select raster map:')
         else:
             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)
 
         self.selectionInput = Select(parent=parent, id=wx.ID_ANY,
@@ -430,7 +432,7 @@
 
     def _createFileSelection(self, parent):
         """Create file (open/save rules) selection part of dialog"""
-        inputBox = wx.StaticBox(
+        inputBox = StaticBox(
             parent, id=wx.ID_ANY, label=" %s " %
             _("Import or export color table:"))
         inputSizer = wx.StaticBoxSizer(inputBox, wx.HORIZONTAL)
@@ -459,7 +461,7 @@
             size=globalvar.DIALOG_COMBOBOX_SIZE,
             choices=utils.GetColorTables(),
             name="colorTableChoice")
-        self.btnSet = wx.Button(
+        self.btnSet = Button(
             parent=parent,
             id=wx.ID_ANY,
             label=_("&Set"),
@@ -470,12 +472,12 @@
         # layout
         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)
         gridSizer.Add(colorTable, pos=(0, 1))
         gridSizer.Add(self.btnSet, pos=(0, 2), flag=wx.ALIGN_RIGHT)
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent, label=_('Load color table from file:')), pos=(
                 1, 0), flag=wx.ALIGN_CENTER_VERTICAL)
         gridSizer.Add(
@@ -483,7 +485,7 @@
                 1, 1), span=(
                 1, 2), flag=wx.EXPAND)
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent, label=_('Save color table to file:')), pos=(
                 2, 0), flag=wx.ALIGN_CENTER_VERTICAL)
         gridSizer.Add(
@@ -511,12 +513,12 @@
 
     def _createButtons(self, parent):
         """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.Enable(False)
@@ -545,7 +547,7 @@
 
         row = 0
         # 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),
                       flag=wx.ALL, border=5)
 
@@ -578,12 +580,12 @@
         bodySizer.Add(self.rulesPanel.clearAll, pos=(row, 1))
 
         # preview button
-        self.btnPreview = wx.Button(parent, id=wx.ID_ANY,
+        self.btnPreview = Button(parent, id=wx.ID_ANY,
                                     label=_("Preview"))
         bodySizer.Add(self.btnPreview, pos=(row, 2),
                       flag=wx.ALIGN_RIGHT)
         self.btnPreview.Enable(False)
-        self.btnPreview.SetToolTipString(
+        self.btnPreview.SetToolTip(
             _("Show preview of map " "(current Map Display extent is used)."))
 
         row += 1
@@ -682,7 +684,7 @@
                 return
 
         rulestxt = ''
-        for rule in self.rulesPanel.ruleslines.itervalues():
+        for rule in six.itervalues(self.rulesPanel.ruleslines):
             if 'value' not in rule:
                 continue
             rulestxt += rule['value'] + ' ' + rule['color'] + '\n'
@@ -793,7 +795,7 @@
         """
         rulestxt = ''
 
-        for rule in self.rulesPanel.ruleslines.itervalues():
+        for rule in six.itervalues(self.rulesPanel.ruleslines):
             if 'value' not in rule:  # skip empty rules
                 continue
 
@@ -1105,12 +1107,12 @@
 
     def _createVectorAttrb(self, parent):
         """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':
             labels = [_("Load color from column:"), _("Save color to column:")]
@@ -1125,19 +1127,19 @@
                 label=_("Use color column instead of color table:"))
             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.sourceColumn = ColumnSelect(parent)
         self.fromColumn = 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'))
-        self.addColumn.SetToolTipString(
+        self.addColumn.SetToolTip(
             _("Add GRASSRGB column to current attribute table."))
 
         # layout
@@ -1808,7 +1810,7 @@
         """
         rulestxt = ''
 
-        for rule in self.rulesPanel.ruleslines.itervalues():
+        for rule in six.itervalues(self.rulesPanel.ruleslines):
             if 'value' not in rule:  # skip empty rules
                 break
 
@@ -1991,7 +1993,7 @@
 
     def OnPaint(self, event):
         """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)
 
         # use PrepareDC to set position correctly
@@ -2019,7 +2021,7 @@
         # 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
         # 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
         self.img = self.GetImage()

Modified: grass/trunk/gui/wxpython/modules/extensions.py
===================================================================
--- grass/trunk/gui/wxpython/modules/extensions.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/modules/extensions.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -33,6 +33,7 @@
 from gui_core.widgets import GListCtrl, SearchModuleWidget
 from gui_core.treeview import CTreeView
 from core.toolboxes import toolboxesOutdated
+from gui_core.wrap import Button, StaticBox, TextCtrl, Menu
 
 
 class InstallExtensionWindow(wx.Frame):
@@ -53,14 +54,14 @@
 
         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 " %
             _("Repository (leave empty to use the official one)"))
-        self.treeBox = wx.StaticBox(
+        self.treeBox = StaticBox(
             parent=self.panel, id=wx.ID_ANY, label=" %s " %
             _("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
         self.modelBuilder = ExtensionTreeModelBuilder()
@@ -81,8 +82,8 @@
         # load data in different thread
         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')
         ignoreFlags = ['l', 'c', 'g', 'a', 'f', 't', 'help', 'quiet']
         if sys.platform == 'win32':
@@ -109,18 +110,18 @@
 
         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"))
         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.btnFetch.Bind(wx.EVT_BUTTON, self.OnFetch)
@@ -234,7 +235,7 @@
 
         data = node.data
         if data and 'command' in data:
-            self.popupMenu = wx.Menu()
+            self.popupMenu = Menu()
             self.popupMenu.Append(self.popupID['install'], text=_("Install"))
             self.Bind(wx.EVT_MENU, self.OnInstall, id=self.popupID['install'])
             self.popupMenu.AppendSeparator()
@@ -401,7 +402,7 @@
 
         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 " %
             _("List of installed extensions"))
 
@@ -408,20 +409,20 @@
         self.extList = CheckListExtension(parent=self.panel)
 
         # buttons
-        self.btnUninstall = wx.Button(
+        self.btnUninstall = Button(
             parent=self.panel,
             id=wx.ID_REMOVE,
             label=_("Uninstall"))
-        self.btnUninstall.SetToolTipString(
+        self.btnUninstall.SetToolTip(
             _("Uninstall selected Addons extensions"))
-        self.btnUpdate = wx.Button(
+        self.btnUpdate = Button(
             parent=self.panel,
             id=wx.ID_REFRESH,
             label=_("Reinstall"))
-        self.btnUpdate.SetToolTipString(
+        self.btnUpdate.SetToolTip(
             _("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.btnUpdate.Bind(wx.EVT_BUTTON, self.OnUpdate)

Modified: grass/trunk/gui/wxpython/modules/histogram.py
===================================================================
--- grass/trunk/gui/wxpython/modules/histogram.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/modules/histogram.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -32,7 +32,7 @@
 from core.debug import Debug
 from core.gcmd import GError
 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):
@@ -80,7 +80,7 @@
 
         self.pdc = PseudoDC()
         # 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.height))
 
@@ -160,7 +160,7 @@
         # 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
         # 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
         self.img = self.GetImage()
@@ -193,7 +193,7 @@
         wx.Yield()
 
         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)
         img = self.GetImage()
         self.Draw(self.pdc, img, drawid=99)
@@ -496,7 +496,7 @@
         """Print options and output menu
         """
         point = wx.GetMousePosition()
-        printmenu = wx.Menu()
+        printmenu = Menu()
         # Add items to the menu
         setup = wx.MenuItem(printmenu, id=wx.ID_ANY, text=_('Page setup'))
         printmenu.AppendItem(setup)

Modified: grass/trunk/gui/wxpython/modules/import_export.py
===================================================================
--- grass/trunk/gui/wxpython/modules/import_export.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/modules/import_export.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -40,7 +40,7 @@
 from gui_core.forms import CmdPanel
 from gui_core.gselect import OgrTypeSelect, GdalSelect, SubGroupSelect
 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.settings import UserSettings, GetDisplayVectSettings
 
@@ -64,7 +64,7 @@
 
         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':
             label = _("List of raster layers")
         elif self.importType == 'ogr':
@@ -869,7 +869,7 @@
         columns = [_('Layer id'),
                    _('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.list = GListCtrl(parent=self.panel)
@@ -884,7 +884,7 @@
 
         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. "))
 
         label = _("Layers to be reprojected")
@@ -895,7 +895,7 @@
         # buttons
         #
         # 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
         self.btn_run = Button(

Modified: grass/trunk/gui/wxpython/modules/mcalc_builder.py
===================================================================
--- grass/trunk/gui/wxpython/modules/mcalc_builder.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/modules/mcalc_builder.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -29,7 +29,8 @@
 from gui_core.gselect import Select
 from gui_core.forms import GUI
 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
 
 
@@ -138,14 +139,14 @@
         # from selection
         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
@@ -244,7 +245,7 @@
         #
         # Text area
         #
-        self.text_mcalc = wx.TextCtrl(
+        self.text_mcalc = TextCtrl(
             parent=self.panel, id=wx.ID_ANY, size=(-1, 75),
             style=wx.TE_MULTILINE)
         wx.CallAfter(self.text_mcalc.SetFocus)
@@ -251,7 +252,7 @@
 
         #
         # 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:
             self.newmaplabel.SetLabel(
                 _('Name for new 3D raster map to create'))
@@ -263,7 +264,7 @@
             parent=self.panel, id=wx.ID_ANY, size=(
                 250, -1), type=element, multiple=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:
             self.mapsellabel.SetLabel(_('Insert existing 3D raster map'))
         else:
@@ -271,8 +272,8 @@
         self.mapselect = Select(
             parent=self.panel, id=wx.ID_ANY, size=(
                 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(
             parent=self.panel, id=wx.ID_ANY, size=(250, -1),
             choices=sorted(self.funct_dict.keys()),
@@ -290,7 +291,7 @@
         self.randomSeed = wx.CheckBox(
             parent=self.panel,
             label=_("Generate random seed for rand()"))
-        self.randomSeedStaticText = wx.StaticText(
+        self.randomSeedStaticText = StaticText(
             parent=self.panel, label=_("Seed:"))
         self.randomSeedText = TextCtrl(parent=self.panel, size=(100, -1),
                                        validator=IntegerValidator())

Modified: grass/trunk/gui/wxpython/modules/vclean.py
===================================================================
--- grass/trunk/gui/wxpython/modules/vclean.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/modules/vclean.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -25,6 +25,8 @@
 from gui_core.gselect import Select
 from core.settings import UserSettings
 from grass.script import core as grass
+from gui_core.wrap import Button, StaticText, StaticBox, \
+    TextCtrl
 
 
 class VectorCleaningFrame(wx.Frame):
@@ -122,18 +124,18 @@
         self.ctlabel = _('Choose cleaning tools and set thresholds')
 
         # 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,
                                      size=globalvar.DIALOG_GSELECT_SIZE,
                                      type='vector')
         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.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,
                                       size=globalvar.DIALOG_GSELECT_SIZE,
                                       mapsets=[grass.gisenv()['MAPSET'], ],
@@ -150,16 +152,16 @@
                 subkey='enabled'))
 
         # 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()
 
         # 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
         self.AddTool()
@@ -166,16 +168,16 @@
         self.selected = -1
 
         # 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,
             id=wx.ID_ANY,
             label=_("&Run"))
         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)"))
-        self.btn_help = wx.Button(parent=self.panel, id=wx.ID_HELP)
+        self.btn_help = Button(parent=self.panel, id=wx.ID_HELP)
 
         # bindings
         self.btn_close.Bind(wx.EVT_BUTTON, self.OnClose)
@@ -361,7 +363,7 @@
                                 wx.CB_READONLY | wx.TE_PROCESS_ENTER)
         self.Bind(wx.EVT_COMBOBOX, self.OnSetTool, tool_cbox)
         # threshold
-        txt_ctrl = wx.TextCtrl(
+        txt_ctrl = TextCtrl(
             parent=self.ct_panel, id=2000 + num, value='0.00', size=(100, -1),
             style=wx.TE_NOHIDESEL)
         self.Bind(wx.EVT_TEXT, self.OnThreshValue, txt_ctrl)

Modified: grass/trunk/gui/wxpython/nviz/mapwindow.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/mapwindow.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/nviz/mapwindow.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -20,6 +20,7 @@
 
 import os
 import sys
+import six
 import time
 import copy
 import math
@@ -483,7 +484,7 @@
             and then to textures so that they can be rendered by OpenGL.
             Updates self.imagelist"""
         # 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'):
                 continue
             if oid not in [t.GetId() for t in self.imagelist]:  # new

Modified: grass/trunk/gui/wxpython/nviz/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/preferences.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/nviz/preferences.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -26,7 +26,8 @@
 from core.settings import UserSettings
 from core.utils import _
 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):
@@ -58,7 +59,7 @@
 
         self.SetMinSize(self.GetBestSize())
         self.SetSize(self.size)
-        self.btnDefault.SetToolTipString(
+        self.btnDefault.SetToolTip(
             _("Revert settings to default, changes are not applied"))
 
     def _createViewPage(self, notebook):
@@ -70,8 +71,8 @@
 
         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)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
         row = 0
@@ -82,11 +83,11 @@
             key='view',
             subkey='persp',
             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)
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel, id=wx.ID_ANY, label=_("value:")), pos=(
                 row, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
 
@@ -99,7 +100,7 @@
                       flag=wx.ALIGN_CENTER_VERTICAL)
 
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel, id=wx.ID_ANY, label=_("step:")), pos=(
                 row, 3), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
 
@@ -114,11 +115,11 @@
 
         # 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)
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel, id=wx.ID_ANY, label=_("x:")), pos=(
                 row, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
 
@@ -131,7 +132,7 @@
                       flag=wx.ALIGN_CENTER_VERTICAL)
 
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel, id=wx.ID_ANY, label="y:"), pos=(
                 row, 3), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
 
@@ -153,11 +154,11 @@
             key='view',
             subkey='twist',
             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)
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel, id=wx.ID_ANY, label=_("value:")), pos=(
                 row, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
 
@@ -172,11 +173,11 @@
 
         # 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)
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel, id=wx.ID_ANY, label=_("value:")), pos=(
                 row, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
 
@@ -194,14 +195,14 @@
                       flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM,
                       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)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
 
         # 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)
 
         color = csel.ColourSelect(
@@ -237,14 +238,14 @@
                          text=" %s " % _("Fly-through"))
         pageSizer = wx.BoxSizer(wx.VERTICAL)
         # 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)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
 
         # 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)
 
         moveExag = SpinCtrl(
@@ -256,8 +257,8 @@
         gridSizer.Add(moveExag, pos=(0, 1))
 
         # 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)
 
         turnExag = SpinCtrl(
@@ -288,8 +289,8 @@
 
         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)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
 
@@ -296,11 +297,11 @@
         # position
         posvals = UserSettings.Get(
             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)
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel, id=wx.ID_ANY, label=_("x:")), pos=(
                 0, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
 
@@ -313,7 +314,7 @@
                       flag=wx.ALIGN_CENTER_VERTICAL)
 
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel, id=wx.ID_ANY, label="y:"), pos=(
                 0, 3), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
 
@@ -326,7 +327,7 @@
                       flag=wx.ALIGN_CENTER_VERTICAL)
 
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel, id=wx.ID_ANY, label=_("z:")), pos=(
                 0, 5), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
 
@@ -341,8 +342,8 @@
         # brightness
         brightval = UserSettings.Get(
             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)
 
         bright = SpinCtrl(parent=panel, id=wx.ID_ANY, size=(65, -1),
@@ -355,8 +356,8 @@
 
         # 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)
 
         amb = SpinCtrl(parent=panel, id=wx.ID_ANY, size=(65, -1),
@@ -368,8 +369,8 @@
                       flag=wx.ALIGN_CENTER_VERTICAL)
 
         # 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)
 
         color = csel.ColourSelect(
@@ -401,14 +402,14 @@
 
         # 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)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
 
         # mode
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=_("Mode:")),
@@ -429,7 +430,7 @@
 
         # fine
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=_("Fine mode:")),
@@ -441,7 +442,7 @@
             group='nviz', key='surface', subkey=[
                 'draw', 'res-fine'])
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=_("resolution:")),
@@ -460,7 +461,7 @@
 
         # coarse
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=_("Coarse mode:")),
@@ -472,7 +473,7 @@
             group='nviz', key='surface', subkey=[
                 'draw', 'res-coarse'])
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=_("resolution:")),
@@ -490,7 +491,7 @@
                       pos=(2, 2))
         # style
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=_("style:")),
@@ -511,7 +512,7 @@
                       pos=(3, 2))
         # wire color
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=_("wire color:")),
@@ -548,15 +549,15 @@
         pageSizer = wx.BoxSizer(wx.VERTICAL)
 
         # 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)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
 
         row = 0
         # 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)
 
         iwidth = SpinCtrl(parent=panel, id=wx.ID_ANY, size=(65, -1),
@@ -570,8 +571,8 @@
                       flag=wx.ALIGN_CENTER_VERTICAL)
 
         # 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)
         icolor = csel.ColourSelect(panel, id=wx.ID_ANY,
                                    size=globalvar.DIALOG_COLOR_SIZE)
@@ -588,15 +589,15 @@
                       border=5)
 
         # 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)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=5)
 
         row = 0
         # 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)
         self.winId['nviz:vector:points:autosize'] = autosize.GetId()
         autosize.SetValue(UserSettings.Get(group='nviz', key='vector',
@@ -603,8 +604,8 @@
                                            subkey=['points', 'autosize']))
 
         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)
 
         isize = SpinCtrl(parent=panel, id=wx.ID_ANY, size=(65, -1),
@@ -619,8 +620,8 @@
 
         # icon symbol
         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)
         isym = wx.Choice(
             parent=panel, id=wx.ID_ANY, size=(100, -1),
@@ -636,8 +637,8 @@
 
         # icon color
         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)
         icolor = csel.ColourSelect(panel, id=wx.ID_ANY,
                                    size=globalvar.DIALOG_COLOR_SIZE)

Modified: grass/trunk/gui/wxpython/nviz/tools.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/tools.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/nviz/tools.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -23,6 +23,7 @@
 import sys
 import copy
 import types
+import six
 
 import wx
 import wx.lib.colourselect as csel
@@ -53,7 +54,8 @@
 from core.settings import UserSettings
 from gui_core.widgets import ScrolledPanel, NumTextCtrl, FloatSlider, SymbolButton
 from gui_core.gselect import Select
-from gui_core.wrap import SpinCtrl, PseudoDC
+from gui_core.wrap import SpinCtrl, PseudoDC, ToggleButton, Button, \
+    TextCtrl, ToggleButton, StaticText, StaticBox, CheckListBox
 from core.debug import Debug
 try:
     from nviz.mapwindow import wxUpdateProperties, wxUpdateView,\
@@ -248,8 +250,8 @@
                              'notebook': self.GetId()}
 
         pageSizer = wx.BoxSizer(wx.VERTICAL)
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % (_("Control View")))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % (_("Control View")))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(vgap=5, hgap=10)
 
@@ -288,7 +290,7 @@
                 self.OnViewChangedText))
 
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 panel, id=wx.ID_ANY, label=_("Perspective:")), pos=(
                 1, 0), flag=wx.ALIGN_CENTER)
         gridSizer.Add(
@@ -312,7 +314,7 @@
                                   self.OnViewChanged,
                                   self.OnViewChangedText))
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 panel, id=wx.ID_ANY, label=_("Tilt:")), pos=(
                 1, 1), flag=wx.ALIGN_CENTER)
         gridSizer.Add(
@@ -362,7 +364,7 @@
 
         heightSizer = wx.GridBagSizer(vgap=3, hgap=3)
         heightSizer.Add(
-            wx.StaticText(
+            StaticText(
                 panel, id=wx.ID_ANY, label=_("Height:")), pos=(
                 0, 0), flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, span=(
                 1, 2))
@@ -381,7 +383,7 @@
                 1,
                 1))
         heightSizer.Add(
-            wx.StaticText(
+            StaticText(
                 panel,
                 id=wx.ID_ANY,
                 label=_("Z-exag:")),
@@ -408,37 +410,37 @@
 
         # view setup + reset
         viewSizer = wx.BoxSizer(wx.HORIZONTAL)
-        viewSizer.Add(wx.StaticText(panel, id=wx.ID_ANY,
-                                    label=_("Look:")),
+        viewSizer.Add(StaticText(panel, id=wx.ID_ANY,
+                                 label=_("Look:")),
                       flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                       border=5)
-        here = wx.ToggleButton(panel, id=wx.ID_ANY, label=_("here"))
+        here = ToggleButton(panel, id=wx.ID_ANY, label=_("here"))
         here.Bind(wx.EVT_TOGGLEBUTTON, self.OnLookAt)
         here.SetName('here')
-        here.SetToolTipString(_("Allows you to select a point on the surface "
-                                "that becomes the new center of view. "
-                                "Click on the button and then on the surface."))
+        here.SetToolTip(_("Allows you to select a point on the surface "
+                          "that becomes the new center of view. "
+                          "Click on the button and then on the surface."))
         viewSizer.Add(here, flag=wx.TOP | wx.BOTTOM |
                       wx.LEFT | wx.ALIGN_CENTER_VERTICAL, border=5)
 
-        center = wx.Button(panel, id=wx.ID_ANY, label=_("center"))
+        center = Button(panel, id=wx.ID_ANY, label=_("center"))
         center.Bind(wx.EVT_BUTTON, self.OnLookAt)
         center.SetName('center')
-        center.SetToolTipString(
+        center.SetToolTip(
             _("Resets the view to the original default center of view"))
         viewSizer.Add(center, flag=wx.TOP | wx.BOTTOM |
                       wx.ALIGN_CENTER_VERTICAL, border=5)
 
-        top = wx.Button(panel, id=wx.ID_ANY, label=_("top"))
+        top = Button(panel, id=wx.ID_ANY, label=_("top"))
         top.Bind(wx.EVT_BUTTON, self.OnLookAt)
         top.SetName('top')
-        top.SetToolTipString(
+        top.SetToolTip(
             _("Sets the viewer directly over the scene's center position. This top view orients approximately north south."))
         viewSizer.Add(top, flag=wx.TOP | wx.BOTTOM |
                       wx.ALIGN_CENTER_VERTICAL, border=5)
 
-        reset = wx.Button(panel, id=wx.ID_ANY, label=_("reset"))
-        reset.SetToolTipString(_("Reset to default view"))
+        reset = Button(panel, id=wx.ID_ANY, label=_("reset"))
+        reset.SetToolTip(_("Reset to default view"))
         reset.Bind(wx.EVT_BUTTON, self.OnResetView)
         viewSizer.Add(reset, proportion=0,
                       flag=wx.TOP | wx.BOTTOM | wx.RIGHT | wx.ALIGN_RIGHT,
@@ -454,15 +456,15 @@
                       flag=wx.EXPAND | wx.ALL,
                       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)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
 
         # background color
         self.win['view']['background'] = {}
-        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)
 
         color = csel.ColourSelect(
@@ -498,14 +500,14 @@
                                   'notebook': self.GetId()}
 
         pageSizer = wx.BoxSizer(wx.VERTICAL)
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % (_("Animation")))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % (_("Animation")))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         hSizer = wx.BoxSizer(wx.HORIZONTAL)
 
         self.win['anim'] = {}
         # animation help text
-        help = wx.StaticText(
+        help = StaticText(
             parent=panel, id=wx.ID_ANY, label=_(
                 "Press 'Record' button and start changing the view. "
                 "It is recommended to use fly-through mode "
@@ -538,14 +540,14 @@
         frameSlider = self.FindWindowById(
             self.win['anim']['frameIndex']['slider'])
         frameText = self.FindWindowById(self.win['anim']['frameIndex']['text'])
-        infoLabel = wx.StaticText(
+        infoLabel = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Total number of frames :"))
-        info = wx.StaticText(parent=panel, id=wx.ID_ANY)
+        info = StaticText(parent=panel, id=wx.ID_ANY)
         self.win['anim']['info'] = info.GetId()
 
-        fpsLabel = wx.StaticText(
+        fpsLabel = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Frame rate (FPS):"))
@@ -611,8 +613,8 @@
         # save animation
         self.win['anim']['save'] = {}
         self.win['anim']['save']['image'] = {}
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % (_("Save image sequence")))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % (_("Save image sequence")))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         vSizer = wx.BoxSizer(wx.VERTICAL)
         gridSizer = wx.GridBagSizer(vgap=5, hgap=10)
@@ -626,24 +628,24 @@
             buttonText=_('Browse'),
             startDirectory=pwd)
         dir.SetValue(pwd)
-        prefixLabel = wx.StaticText(
+        prefixLabel = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("File prefix:"))
-        prefixCtrl = wx.TextCtrl(
+        prefixCtrl = TextCtrl(
             parent=panel, id=wx.ID_ANY, size=(100, -1),
             value=UserSettings.Get(
                 group='nviz', key='animation', subkey='prefix'))
-        prefixCtrl.SetToolTipString(
+        prefixCtrl.SetToolTip(
             _("Generated files names will look like this: prefix_1.ppm, prefix_2.ppm, ..."))
-        fileTypeLabel = wx.StaticText(
+        fileTypeLabel = StaticText(
             parent=panel, id=wx.ID_ANY, label=_("File format:"))
         fileTypeCtrl = wx.Choice(
             parent=panel, id=wx.ID_ANY, choices=[
                 "TIF", "PPM"])
 
-        save = wx.Button(parent=panel, id=wx.ID_ANY,
-                         label="Save")
+        save = Button(parent=panel, id=wx.ID_ANY,
+                      label="Save")
 
         self.win['anim']['save']['image']['dir'] = dir.GetId()
         self.win['anim']['save']['image']['prefix'] = prefixCtrl.GetId()
@@ -823,14 +825,14 @@
         self.win['surface'] = {}
 
         # selection
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % (_("Raster map")))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % (_("Raster map")))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         rmaps = Select(parent=panel, type='raster',
                        onPopup=self.GselectOnPopup)
         rmaps.GetChildren()[0].Bind(wx.EVT_TEXT, self.OnSetRaster)
         self.win['surface']['map'] = rmaps.GetId()
-        desc = wx.StaticText(parent=panel, id=wx.ID_ANY)
+        desc = StaticText(parent=panel, id=wx.ID_ANY)
         self.win['surface']['desc'] = desc.GetId()
         boxSizer.Add(rmaps, proportion=0,
                      flag=wx.ALL,
@@ -846,14 +848,14 @@
         # draw
         #
         self.win['surface']['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)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
 
         # mode
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Mode:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Mode:")),
                       pos=(0, 0), flag=wx.ALIGN_CENTER_VERTICAL)
         mode = wx.Choice(parent=panel, id=wx.ID_ANY, size=(-1, -1),
                          choices=[_("coarse"),
@@ -867,7 +869,7 @@
 
         # shading
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel, id=wx.ID_ANY, label=_("Shading:")), pos=(
                 0, 3), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
         shade = wx.Choice(parent=panel, id=wx.ID_ANY, size=(-1, -1),
@@ -880,8 +882,8 @@
                       pos=(0, 4))
 
         # set to all
-        all = wx.Button(panel, id=wx.ID_ANY, label=_("Set to all"))
-        all.SetToolTipString(_("Use draw settings for all loaded surfaces"))
+        all = Button(panel, id=wx.ID_ANY, label=_("Set to all"))
+        all.SetToolTip(_("Use draw settings for all loaded surfaces"))
         all.Bind(wx.EVT_BUTTON, self.OnSurfaceModeAll)
         gridSizer.Add(
             all,
@@ -892,11 +894,11 @@
         self.win['surface']['all'] = all.GetId()
 
         # resolution coarse
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Coarse mode:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Coarse mode:")),
                       pos=(2, 0), flag=wx.ALIGN_CENTER_VERTICAL)
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("resolution:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("resolution:")),
                       pos=(2, 1), flag=wx.ALIGN_CENTER_VERTICAL)
         resC = SpinCtrl(parent=panel, id=wx.ID_ANY, size=(65, -1),
                         initial=6,
@@ -910,8 +912,8 @@
             flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
 
         # Coarse style
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("style:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("style:")),
                       pos=(3, 1), flag=wx.ALIGN_CENTER_VERTICAL)
         style = wx.Choice(parent=panel, id=wx.ID_ANY, size=(100, -1),
                           choices=[_("wire"),
@@ -937,12 +939,12 @@
                 3))
 
         # resolution fine
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Fine mode:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Fine mode:")),
                       pos=(1, 0), flag=wx.ALIGN_CENTER_VERTICAL)
 
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("resolution:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("resolution:")),
                       pos=(1, 1), flag=wx.ALIGN_CENTER_VERTICAL)
         resF = SpinCtrl(parent=panel, id=wx.ID_ANY, size=(65, -1),
                         initial=3,
@@ -965,8 +967,8 @@
         #
         # surface attributes
         #
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % (_("Surface attributes")))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % (_("Surface attributes")))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
 
@@ -978,8 +980,8 @@
                             ('transp', _("Transparency")),
                             ('shine', _("Shininess"))):
             self.win['surface'][code] = {}
-            gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                        label=attrb + ':'),
+            gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                     label=attrb + ':'),
                           pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL)
             use = wx.Choice(parent=panel, id=wx.ID_ANY, size=(100, -1),
                             choices=[_("map")])
@@ -1046,8 +1048,8 @@
         # position
         #
         self.win['surface']['position'] = {}
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % (_("Position")))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % (_("Position")))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
 
@@ -1069,8 +1071,8 @@
                                   "Y",
                                   "Z"])
 
-        reset = wx.Button(panel, id=wx.ID_ANY, label=_("Reset"))
-        reset.SetToolTipString(_("Reset to default position"))
+        reset = Button(panel, id=wx.ID_ANY, label=_("Reset"))
+        reset.SetToolTip(_("Reset to default position"))
         reset.Bind(wx.EVT_BUTTON, self.OnResetSurfacePosition)
         self.win['surface']['position']['reset'] = reset.GetId()
 
@@ -1142,14 +1144,14 @@
         self.win['cplane'] = {}
 
         pageSizer = wx.BoxSizer(wx.VERTICAL)
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % (_("Cutting planes")))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % (_("Cutting planes")))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         horSizer = wx.BoxSizer(wx.HORIZONTAL)
 
         # planes
-        horSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                   label=_("Active cutting plane:")),
+        horSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                label=_("Active cutting plane:")),
                      flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=5)
         choice = wx.Choice(parent=panel, id=wx.ID_ANY, choices=[])
         self.win['cplane']['planes'] = choice.GetId()
@@ -1158,8 +1160,8 @@
 
         # shading
         horSizer.Add(wx.Size(-1, -1), proportion=1)
-        horSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                   label=_("Shading:")),
+        horSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                label=_("Shading:")),
                      flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=5)
         choices = [_("clear"),
                    _("top color"),
@@ -1176,8 +1178,8 @@
 
         # cutting plane horizontal x position
         self.win['cplane']['position'] = {}
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Horizontal X:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Horizontal X:")),
                       pos=(0, 0), flag=wx.ALIGN_CENTER_VERTICAL)
         tooltip = _("Sets the X coordinate of the current cutting plane")
         self._createControl(panel,
@@ -1206,8 +1208,8 @@
                 0, 2), flag=wx.ALIGN_CENTER)
 
         # cutting plane horizontal y position
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Horizontal Y:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Horizontal Y:")),
                       pos=(1, 0), flag=wx.ALIGN_CENTER_VERTICAL)
         tooltip = _("Sets the Y coordinate of the current cutting plane")
         self._createControl(panel,
@@ -1237,8 +1239,8 @@
 
         # cutting plane rotation
         self.win['cplane']['rotation'] = {}
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Rotation:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Rotation:")),
                       pos=(2, 0), flag=wx.ALIGN_CENTER_VERTICAL)
         tooltip = _("Rotates the current cutting plane about vertical axis")
         self._createControl(
@@ -1259,8 +1261,8 @@
                 2, 2), flag=wx.ALIGN_CENTER)
 
         # cutting plane tilt
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Tilt:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Tilt:")),
                       pos=(3, 0), flag=wx.ALIGN_CENTER_VERTICAL)
         tooltip = _("Rotates the current cutting plane about horizontal axis")
         self._createControl(
@@ -1281,8 +1283,8 @@
                 3, 2), flag=wx.ALIGN_CENTER)
 
         # cutting pland height
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Height:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Height:")),
                       pos=(4, 0), flag=wx.ALIGN_CENTER_VERTICAL)
         tooltip = _(
             "Sets the Z coordinate of the current cutting plane (only meaningful when tilt is not 0)")
@@ -1319,7 +1321,7 @@
         horSizer = wx.BoxSizer(wx.HORIZONTAL)
         horSizer.Add(wx.Size(-1, -1), proportion=1, flag=wx.ALL, border=5)
         # reset
-        reset = wx.Button(parent=panel, id=wx.ID_ANY, label=_("Reset"))
+        reset = Button(parent=panel, id=wx.ID_ANY, label=_("Reset"))
         self.win['cplane']['reset'] = reset.GetId()
         reset.Bind(wx.EVT_BUTTON, self.OnCPlaneReset)
         horSizer.Add(reset, flag=wx.ALL, border=5)
@@ -1341,8 +1343,8 @@
 
         pageSizer = wx.BoxSizer(wx.VERTICAL)
 
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % (_("Constant surface")))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % (_("Constant surface")))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         horsizer = wx.BoxSizer(wx.HORIZONTAL)
 
@@ -1357,11 +1359,11 @@
             flag=wx.EXPAND | wx.RIGHT,
             border=20)
 
-        addNew = wx.Button(panel, id=wx.ID_ANY, label=_("New"))
+        addNew = Button(panel, id=wx.ID_ANY, label=_("New"))
         addNew.Bind(wx.EVT_BUTTON, self.OnNewConstant)
         self.win['constant']['new'] = addNew.GetId()
 
-        delete = wx.Button(panel, id=wx.ID_ANY, label=_("Delete"))
+        delete = Button(panel, id=wx.ID_ANY, label=_("Delete"))
         delete.Bind(wx.EVT_BUTTON, self.OnDeleteConstant)
         self.win['constant']['delete'] = delete.GetId()
 
@@ -1381,8 +1383,8 @@
 
         gridSizer = wx.GridBagSizer(hgap=5, vgap=5)
         # fine resolution
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Fine resolution:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Fine resolution:")),
                       pos=(0, 0), flag=wx.ALIGN_CENTER_VERTICAL)
         resF = SpinCtrl(parent=panel, id=wx.ID_ANY, size=(65, -1),
                         initial=3,
@@ -1395,8 +1397,8 @@
             resF, pos=(0, 1),
             flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
         # value
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Value:")), pos=(1, 0),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Value:")), pos=(1, 0),
                       flag=wx.ALIGN_CENTER_VERTICAL)
 
         value = SpinCtrl(panel, id=wx.ID_ANY,
@@ -1407,8 +1409,8 @@
         gridSizer.Add(value, pos=(1, 1))
 
         # transparency
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Transparency:")), pos=(2, 0),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Transparency:")), pos=(2, 0),
                       flag=wx.ALIGN_CENTER_VERTICAL)
 
         transp = SpinCtrl(panel, id=wx.ID_ANY,
@@ -1419,8 +1421,8 @@
         gridSizer.Add(transp, pos=(2, 1))
 
         # color
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Color:")), pos=(3, 0),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Color:")), pos=(3, 0),
                       flag=wx.ALIGN_CENTER_VERTICAL)
         color = csel.ColourSelect(panel, id=wx.ID_ANY,
                                   colour=(0, 0, 0),
@@ -1449,14 +1451,14 @@
         self.win['vector'] = {}
 
         # selection
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % (_("Vector map")))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % (_("Vector map")))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         vmaps = Select(parent=panel, type='vector',
                        onPopup=self.GselectOnPopup)
         vmaps.GetChildren()[0].Bind(wx.EVT_TEXT, self.OnSetVector)
         self.win['vector']['map'] = vmaps.GetId()
-        desc = wx.StaticText(parent=panel, id=wx.ID_ANY)
+        desc = StaticText(parent=panel, id=wx.ID_ANY)
         self.win['vector']['desc'] = desc.GetId()
         boxSizer.Add(vmaps, proportion=0,
                      flag=wx.ALL,
@@ -1483,17 +1485,17 @@
         pageSizer.Add(showLines, proportion=0, flag=wx.LEFT |
                       wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=5)
 
-        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)
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
 
         # width
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Line:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Line:")),
                       pos=(0, 0), flag=wx.ALIGN_CENTER_VERTICAL)
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("width:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("width:")),
                       pos=(0, 1), flag=wx.ALIGN_CENTER_VERTICAL |
                       wx.ALIGN_RIGHT)
 
@@ -1508,8 +1510,8 @@
                       flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT)
 
         # 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=(0, 3), flag=wx.ALIGN_CENTER_VERTICAL |
                       wx.ALIGN_RIGHT)
 
@@ -1543,7 +1545,7 @@
         hSizer = wx.BoxSizer(wx.HORIZONTAL)
         hSizer.Add(checkThematicColor, flag=wx.ALIGN_CENTER_VERTICAL,
                    border=5)
-        setThematic = wx.Button(parent=panel, id=wx.ID_ANY,
+        setThematic = Button(parent=panel, id=wx.ID_ANY,
                                 label=_("Set options..."))
         self.win['vector']['lines']['thematic'][
             'buttoncolor'] = setThematic.GetId()
@@ -1556,7 +1558,7 @@
         hSizer = wx.BoxSizer(wx.HORIZONTAL)
         hSizer.Add(checkThematicWidth, flag=wx.ALIGN_CENTER_VERTICAL,
                    border=5)
-        setThematic = wx.Button(parent=panel, id=wx.ID_ANY,
+        setThematic = Button(parent=panel, id=wx.ID_ANY,
                                 label=_("Set options..."))
         self.win['vector']['lines']['thematic'][
             'buttonwidth'] = setThematic.GetId()
@@ -1570,8 +1572,8 @@
                       pos=(1, 1), span=(1, 5))
 
         # display
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Display")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Display")),
                       pos=(2, 0), flag=wx.ALIGN_CENTER_VERTICAL |
                       wx.ALIGN_LEFT)
 
@@ -1585,12 +1587,12 @@
                       wx.ALIGN_LEFT | wx.EXPAND, pos=(2, 1), span=(1, 4))
 
         # height
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Height above surface:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Height above surface:")),
                       pos=(3, 5), flag=wx.ALIGN_BOTTOM | wx.EXPAND)
 
-        surface = wx.CheckListBox(parent=panel, id=wx.ID_ANY, size=(-1, 60),
-                                  choices=[], style=wx.LB_NEEDED_SB)
+        surface = CheckListBox(parent=panel, id=wx.ID_ANY, size=(-1, 60),
+                               choices=[], style=wx.LB_NEEDED_SB)
         surface.Bind(wx.EVT_CHECKLISTBOX, self.OnVectorSurface)
 
         self.win['vector']['lines']['surface'] = surface.GetId()
@@ -1645,18 +1647,18 @@
         pageSizer.Add(showPoints, proportion=0, flag=wx.LEFT |
                       wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=5)
 
-        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)
         vertSizer = wx.BoxSizer(wx.VERTICAL)
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
 
         # icon size
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Icon:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Icon:")),
                       pos=(0, 0), flag=wx.ALIGN_CENTER_VERTICAL)
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("size:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("size:")),
                       pos=(0, 1), flag=wx.ALIGN_CENTER_VERTICAL |
                       wx.ALIGN_RIGHT)
 
@@ -1680,8 +1682,8 @@
                       flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT)
 
         # 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=(0, 3), flag=wx.ALIGN_CENTER_VERTICAL |
                       wx.ALIGN_RIGHT)
         icolor = csel.ColourSelect(panel, id=wx.ID_ANY,
@@ -1713,7 +1715,7 @@
 # flag = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT)
         # icon symbol
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel, id=wx.ID_ANY, label=_("symbol:")), pos=(
                 0, 5), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
         isym = wx.Choice(
@@ -1752,7 +1754,7 @@
             span=(
                 1,
                 5))
-        setThematic = wx.Button(parent=panel, id=wx.ID_ANY,
+        setThematic = Button(parent=panel, id=wx.ID_ANY,
                                 label=_("Set options..."))
         self.win['vector']['points']['thematic'][
             'buttoncolor'] = setThematic.GetId()
@@ -1769,7 +1771,7 @@
             span=(
                 1,
                 5))
-        setThematic = wx.Button(parent=panel, id=wx.ID_ANY,
+        setThematic = Button(parent=panel, id=wx.ID_ANY,
                                 label=_("Set options..."))
         self.win['vector']['points']['thematic'][
             'buttonsize'] = setThematic.GetId()
@@ -1784,7 +1786,7 @@
         # high
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel, label=_("Display")), pos=(
                 0, 0), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT)
         display = wx.Choice(parent=panel)
@@ -1792,12 +1794,12 @@
         display.Bind(wx.EVT_CHOICE, self.OnVectorPointsMode)
         gridSizer.Add(display,
                       pos=(0, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND)
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Height above surface:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Height above surface:")),
                       pos=(1, 2), flag=wx.ALIGN_CENTER_VERTICAL)
 
-        surface = wx.CheckListBox(parent=panel, id=wx.ID_ANY, size=(-1, 60),
-                                  choices=[], style=wx.LB_NEEDED_SB)
+        surface = CheckListBox(parent=panel, id=wx.ID_ANY, size=(-1, 60),
+                               choices=[], style=wx.LB_NEEDED_SB)
         surface.Bind(wx.EVT_CHECKLISTBOX, self.OnVectorSurface)
         self.win['vector']['points']['surface'] = surface.GetId()
         gridSizer.Add(surface,
@@ -1862,14 +1864,14 @@
         self.win['volume'] = {}
 
         # selection
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % (_("3D raster map")))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % (_("3D raster map")))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         rmaps = Select(parent=panel, type='raster_3d',
                        onPopup=self.GselectOnPopup)
         rmaps.GetChildren()[0].Bind(wx.EVT_TEXT, self.OnSetRaster3D)
         self.win['volume']['map'] = rmaps.GetId()
-        desc = wx.StaticText(parent=panel, id=wx.ID_ANY)
+        desc = StaticText(parent=panel, id=wx.ID_ANY)
         self.win['volume']['desc'] = desc.GetId()
         boxSizer.Add(rmaps, proportion=0,
                      flag=wx.ALL,
@@ -1885,15 +1887,15 @@
         # draw
         #
         self.win['volume']['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)
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
 # gridSizer.AddGrowableCol(4)
 
         # mode
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Mode:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Mode:")),
                       pos=(0, 0), flag=wx.ALIGN_CENTER_VERTICAL)
         mode = wx.Choice(parent=panel, id=wx.ID_ANY, size=(-1, -1),
                          choices=[_("isosurfaces"),
@@ -1906,8 +1908,8 @@
                       pos=(0, 1))
 
         # shading
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Shading:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Shading:")),
                       pos=(0, 2), flag=wx.ALIGN_CENTER_VERTICAL)
         shade = wx.Choice(parent=panel, id=wx.ID_ANY, size=(100, -1),
                           choices=[_("flat"),
@@ -1919,8 +1921,8 @@
                       pos=(0, 3))
 
         # resolution (mode)
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Resolution:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Resolution:")),
                       pos=(0, 4), flag=wx.ALIGN_CENTER_VERTICAL)
         resol = SpinCtrl(parent=panel, id=wx.ID_ANY, size=(65, -1),
                          initial=1,
@@ -1949,15 +1951,15 @@
         #
         # manage isosurfaces
         #
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % (_("List of isosurfaces")))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % (_("List of isosurfaces")))
         box.SetName('listStaticBox')
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
 
         # list
-        isolevel = wx.CheckListBox(parent=panel, id=wx.ID_ANY,
-                                   size=(300, 150))
+        isolevel = CheckListBox(parent=panel, id=wx.ID_ANY,
+                                size=(300, 150))
         self.Bind(wx.EVT_CHECKLISTBOX, self.OnVolumeCheck, isolevel)
         self.Bind(wx.EVT_LISTBOX, self.OnVolumeSelect, isolevel)
 
@@ -1966,24 +1968,24 @@
         gridSizer.Add(isolevel, pos=(0, 0), span=(4, 1))
 
         # buttons (add, delete, move up, move down)
-        btnAdd = wx.Button(parent=panel, id=wx.ID_ADD)
+        btnAdd = Button(parent=panel, id=wx.ID_ADD)
         self.win['volume']['btnAdd'] = btnAdd.GetId()
         btnAdd.Bind(wx.EVT_BUTTON, self.OnVolumeAdd)
         gridSizer.Add(btnAdd,
                       pos=(0, 1))
-        btnDelete = wx.Button(parent=panel, id=wx.ID_DELETE)
+        btnDelete = Button(parent=panel, id=wx.ID_DELETE)
         self.win['volume']['btnDelete'] = btnDelete.GetId()
         btnDelete.Bind(wx.EVT_BUTTON, self.OnVolumeDelete)
         btnDelete.Enable(False)
         gridSizer.Add(btnDelete,
                       pos=(1, 1))
-        btnMoveUp = wx.Button(parent=panel, id=wx.ID_UP)
+        btnMoveUp = Button(parent=panel, id=wx.ID_UP)
         self.win['volume']['btnMoveUp'] = btnMoveUp.GetId()
         btnMoveUp.Bind(wx.EVT_BUTTON, self.OnVolumeMoveUp)
         btnMoveUp.Enable(False)
         gridSizer.Add(btnMoveUp,
                       pos=(2, 1))
-        btnMoveDown = wx.Button(parent=panel, id=wx.ID_DOWN)
+        btnMoveDown = Button(parent=panel, id=wx.ID_DOWN)
         self.win['volume']['btnMoveDown'] = btnMoveDown.GetId()
         btnMoveDown.Bind(wx.EVT_BUTTON, self.OnVolumeMoveDown)
         btnMoveDown.Enable(False)
@@ -2017,8 +2019,8 @@
         # position
         #
         self.win['volume']['position'] = {}
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % (_("Position")))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % (_("Position")))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
 
@@ -2038,8 +2040,8 @@
                                   "Y",
                                   "Z"])
 
-        reset = wx.Button(panel, id=wx.ID_ANY, label=_("Reset"))
-        reset.SetToolTipString(_("Reset to default position"))
+        reset = Button(panel, id=wx.ID_ANY, label=_("Reset"))
+        reset.SetToolTip(_("Reset to default position"))
         reset.Bind(wx.EVT_BUTTON, self.OnResetVolumePosition)
         self.win['volume']['position']['reset'] = reset.GetId()
 
@@ -2096,8 +2098,8 @@
 # flag = wx.ALL, border = 3)
 
         # position
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % (_("Light source position")))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % (_("Light source position")))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
 
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
@@ -2122,7 +2124,7 @@
 
         heightSizer = wx.GridBagSizer(vgap=3, hgap=3)
         heightSizer.Add(
-            wx.StaticText(
+            StaticText(
                 panel, id=wx.ID_ANY, label=_("Height:")), pos=(
                 0, 0), flag=wx.ALIGN_LEFT, span=(
                 1, 2))
@@ -2144,13 +2146,13 @@
                       border=3)
 
         # position
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % (_("Light color and intensity")))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % (_("Light color and intensity")))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
 
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 panel, id=wx.ID_ANY, label=_("Color:")), pos=(
                 0, 0), flag=wx.ALIGN_CENTER_VERTICAL)
         color = csel.ColourSelect(
@@ -2162,7 +2164,7 @@
         gridSizer.Add(color, pos=(0, 2))
 
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 panel, id=wx.ID_ANY, label=_("Brightness:")), pos=(
                 1, 0), flag=wx.ALIGN_CENTER_VERTICAL)
         tooltip = _("Adjusts the brightness of the light")
@@ -2179,7 +2181,7 @@
                 self.win['light']['bright']['text']), pos=(
                 1, 2), flag=wx.ALIGN_CENTER)
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 panel, id=wx.ID_ANY, label=_("Ambient:")), pos=(
                 2, 0), flag=wx.ALIGN_CENTER_VERTICAL)
         tooltip = _("Adjusts the ambient light")
@@ -2232,8 +2234,8 @@
         pageSizer = wx.BoxSizer(wx.VERTICAL)
 
         # selection
-        rbox = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                            label=" %s " % (_("Surface")))
+        rbox = StaticBox(parent=panel, id=wx.ID_ANY,
+                         label=" %s " % (_("Surface")))
         rboxSizer = wx.StaticBoxSizer(rbox, wx.VERTICAL)
         rmaps = Select(parent=panel, type='raster',
                        onPopup=self.GselectOnPopup)
@@ -2246,8 +2248,8 @@
                       flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM,
                       border=3)
 
-        ebox = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                            label=" %s " % (_("Edges with fringe")))
+        ebox = StaticBox(parent=panel, id=wx.ID_ANY,
+                         label=" %s " % (_("Edges with fringe")))
         eboxSizer = wx.StaticBoxSizer(ebox, wx.HORIZONTAL)
         for edge in [(_("N && W"), "nw"),
                      (_("N && E"), "ne"),
@@ -2268,14 +2270,14 @@
                       flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM,
                       border=3)
 
-        sbox = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                            label=" %s " % (_("Settings")))
+        sbox = StaticBox(parent=panel, id=wx.ID_ANY,
+                         label=" %s " % (_("Settings")))
         sboxSizer = wx.StaticBoxSizer(sbox, wx.HORIZONTAL)
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
 
         # elevation
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel, id=wx.ID_ANY,
                 label=_("Elevation of fringe from bottom:")),
             pos=(0, 0),
@@ -2292,8 +2294,8 @@
         gridSizer.Add(spin, pos=(0, 1))
 
         # 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=(1, 0),
                       flag=wx.ALIGN_CENTER_VERTICAL)
         color = csel.ColourSelect(parent=panel, id=wx.ID_ANY,
@@ -2328,13 +2330,13 @@
 
         # north arrow
         self.win['decoration']['arrow'] = {}
-        nabox = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                             label=" %s " % (_("North Arrow")))
+        nabox = StaticBox(parent=panel, id=wx.ID_ANY,
+                          label=" %s " % (_("North Arrow")))
         naboxSizer = wx.StaticBoxSizer(nabox, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(hgap=5, vgap=5)
         # size
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Arrow length (in map units):")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Arrow length (in map units):")),
                       pos=(0, 0), span=(1, 2), flag=wx.ALIGN_CENTER_VERTICAL)
         sizeCtrl = NumTextCtrl(
             parent=panel, id=wx.ID_ANY, size=(
@@ -2345,8 +2347,8 @@
         sizeCtrl.Bind(wx.EVT_KILL_FOCUS, self.OnDecorationProp)
 
         # color
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Arrow color:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Arrow color:")),
                       pos=(1, 0), span=(1, 2), flag=wx.ALIGN_CENTER_VERTICAL)
         color = csel.ColourSelect(parent=panel, id=wx.ID_ANY,
                                   size=globalvar.DIALOG_COLOR_SIZE)
@@ -2355,7 +2357,7 @@
         color.Bind(csel.EVT_COLOURSELECT, self.OnDecorationProp)
 
         # control
-        toggle = wx.ToggleButton(
+        toggle = ToggleButton(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Place arrow"))
@@ -2364,7 +2366,7 @@
         self.win['decoration']['arrow']['place'] = toggle.GetId()
         toggle.SetName('placeArrow')
 
-        delete = wx.Button(parent=panel, id=wx.ID_ANY, label=_("Delete"))
+        delete = Button(parent=panel, id=wx.ID_ANY, label=_("Delete"))
         self.win['decoration']['arrow']['delete'] = delete.GetId()
         gridSizer.Add(delete, pos=(2, 1))
         delete.Bind(wx.EVT_BUTTON, self.OnArrowDelete)
@@ -2377,13 +2379,13 @@
 
         # scale bars
         self.win['decoration']['scalebar'] = {}
-        nabox = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                             label=" %s " % (_("Scale bar")))
+        nabox = StaticBox(parent=panel, id=wx.ID_ANY,
+                          label=" %s " % (_("Scale bar")))
         naboxSizer = wx.StaticBoxSizer(nabox, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(hgap=5, vgap=5)
         # size
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Scale bar length (in map units):")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Scale bar length (in map units):")),
                       pos=(0, 0), span=(1, 2), flag=wx.ALIGN_CENTER_VERTICAL)
         sizeCtrl = NumTextCtrl(
             parent=panel, id=wx.ID_ANY, size=(
@@ -2394,8 +2396,8 @@
         sizeCtrl.Bind(wx.EVT_KILL_FOCUS, self.OnDecorationProp)
 
         # color
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=_("Scale bar color:")),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=_("Scale bar color:")),
                       pos=(1, 0), span=(1, 2), flag=wx.ALIGN_CENTER_VERTICAL)
         color = csel.ColourSelect(parent=panel, id=wx.ID_ANY,
                                   size=globalvar.DIALOG_COLOR_SIZE)
@@ -2404,7 +2406,7 @@
         color.Bind(csel.EVT_COLOURSELECT, self.OnDecorationProp)
 
         # control
-        toggle = wx.ToggleButton(
+        toggle = ToggleButton(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Place new scale bar"))
@@ -2416,7 +2418,7 @@
         scalebarChoice = wx.Choice(parent=panel, id=wx.ID_ANY, choices=[])
         self.win['decoration']['scalebar']['choice'] = scalebarChoice.GetId()
         gridSizer.Add(scalebarChoice, pos=(3, 0), flag=wx.EXPAND)
-        delete = wx.Button(parent=panel, id=wx.ID_ANY, label=_("Delete"))
+        delete = Button(parent=panel, id=wx.ID_ANY, label=_("Delete"))
         self.win['decoration']['scalebar']['delete'] = delete.GetId()
         gridSizer.Add(delete, pos=(3, 1))
         delete.Bind(wx.EVT_BUTTON, self.OnScalebarDelete)
@@ -2727,7 +2729,7 @@
             return
         name = _("constant#") + str(layerIdx + 1)
         data = self.mapWindow.constants[layerIdx]
-        for attr, value in data['constant'].iteritems():
+        for attr, value in six.iteritems(data['constant']):
             if attr == 'color':
                 value = self._getColorFromString(value)
             if attr in ('color', 'value', 'resolution', 'transp'):
@@ -2781,7 +2783,7 @@
         if not winName:
             return
         data[winName] = self.FindWindowById(event.GetId()).GetValue()
-        for w in win[winName].itervalues():
+        for w in six.itervalues(win[winName]):
             self.FindWindowById(w).SetValue(data[winName])
 
         event.Skip()
@@ -2796,8 +2798,8 @@
 
         vSizer = wx.BoxSizer(wx.HORIZONTAL)
 
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % (_("Isosurface attributes")))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % (_("Isosurface attributes")))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(vgap=3, hgap=3)
 
@@ -2823,7 +2825,7 @@
             if code == 'topo':
                 colspan = 2
             gridSizer.Add(
-                wx.StaticText(
+                StaticText(
                     parent=panel,
                     id=wx.ID_ANY,
                     label=attrb + ':'),
@@ -2928,14 +2930,14 @@
 
         vSizer = wx.BoxSizer(wx.HORIZONTAL)
 
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % (_("Slice attributes")))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % (_("Slice attributes")))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         hSizer = wx.BoxSizer()
 
         self.win['volume']['slice'] = {}
         hSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=_("Slice parallel to axis:")),
@@ -2954,21 +2956,21 @@
 
         # text labels
         for i in range(2):
-            label = wx.StaticText(parent=panel, id=wx.ID_ANY)
+            label = StaticText(parent=panel, id=wx.ID_ANY)
             label.SetName('label_edge_' + str(i))
             gridSizer.Add(label, pos=(0, i + 1),
                           flag=wx.ALIGN_CENTER)
         for i in range(2, 4):
-            label = wx.StaticText(parent=panel, id=wx.ID_ANY)
+            label = StaticText(parent=panel, id=wx.ID_ANY)
             label.SetName('label_edge_' + str(i))
             gridSizer.Add(label, pos=(3, i - 1),
                           flag=wx.ALIGN_CENTER)
         for i in range(2):
-            label = wx.StaticText(parent=panel, id=wx.ID_ANY)
+            label = StaticText(parent=panel, id=wx.ID_ANY)
             label.SetName('label_coord_' + str(i))
             gridSizer.Add(label, pos=(i + 1, 0),
                           flag=wx.ALIGN_CENTER_VERTICAL)
-        label = wx.StaticText(parent=panel, id=wx.ID_ANY)
+        label = StaticText(parent=panel, id=wx.ID_ANY)
         label.SetName('label_coord_2')
         gridSizer.Add(label, pos=(4, 0),
                       flag=wx.ALIGN_CENTER_VERTICAL)
@@ -3027,8 +3029,8 @@
 
         # transparency, reset
         hSizer = wx.BoxSizer()
-        hSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                 label=_("Transparency:")), proportion=0,
+        hSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                             label=_("Transparency:")), proportion=0,
                    flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, border=7)
         spin = SpinCtrl(parent=panel, id=wx.ID_ANY, size=(65, -1),
                         min=0, max=100, initial=0)
@@ -3039,7 +3041,7 @@
 
         hSizer.Add(wx.Size(-1, -1), proportion=1,
                    flag=wx.EXPAND)
-        reset = wx.Button(parent=panel, id=wx.ID_ANY, label=_("Reset"))
+        reset = Button(parent=panel, id=wx.ID_ANY, label=_("Reset"))
         reset.Bind(wx.EVT_BUTTON, self.OnSliceReset)
         self.win['volume']['slice']['reset'] = reset.GetId()
         hSizer.Add(reset, proportion=0,
@@ -3096,14 +3098,14 @@
 
     def _createCompass(self, panel, sizer, type):
         """Create 'compass' widget for light and view page"""
-        w = wx.Button(panel, id=wx.ID_ANY, label=_("W"))
-        n = wx.Button(panel, id=wx.ID_ANY, label=_("N"))
-        s = wx.Button(panel, id=wx.ID_ANY, label=_("S"))
-        e = wx.Button(panel, id=wx.ID_ANY, label=_("E"))
-        nw = wx.Button(panel, id=wx.ID_ANY, label=_("NW"))
-        ne = wx.Button(panel, id=wx.ID_ANY, label=_("NE"))
-        se = wx.Button(panel, id=wx.ID_ANY, label=_("SE"))
-        sw = wx.Button(panel, id=wx.ID_ANY, label=_("SW"))
+        w = Button(panel, id=wx.ID_ANY, label=_("W"))
+        n = Button(panel, id=wx.ID_ANY, label=_("N"))
+        s = Button(panel, id=wx.ID_ANY, label=_("S"))
+        e = Button(panel, id=wx.ID_ANY, label=_("E"))
+        nw = Button(panel, id=wx.ID_ANY, label=_("NW"))
+        ne = Button(panel, id=wx.ID_ANY, label=_("NE"))
+        se = Button(panel, id=wx.ID_ANY, label=_("SE"))
+        sw = Button(panel, id=wx.ID_ANY, label=_("SW"))
         padding = 15
         if sys.platform == 'darwin':
             padding = 20
@@ -3123,9 +3125,9 @@
         sizer.Add(w, pos=(1, 0), flag=wx.ALIGN_CENTER)
 
     def __GetWindowName(self, data, id):
-        for name in data.iterkeys():
+        for name in six.iterkeys(data):
             if isinstance(data[name], type({})):
-                for win in data[name].itervalues():
+                for win in six.itervalues(data[name]):
                     if win == id:
                         return name
             else:
@@ -3141,7 +3143,7 @@
                         'persp',
                         'twist',
                         'z-exag'):
-            for win in self.win['view'][control].itervalues():
+            for win in six.itervalues(self.win['view'][control]):
                 try:
                     if control == 'height':
                         value = int(self.mapWindow.iview[control]['value'])
@@ -3182,7 +3184,7 @@
         value = self.FindWindowById(event.GetId()).GetValue()
 
         self.mapWindow.light['position']['z'] = value
-        for win in self.win['light'][winName].itervalues():
+        for win in six.itervalues(self.win['light'][winName]):
             self.FindWindowById(win).SetValue(value)
 
         self.PostLightEvent()
@@ -3305,7 +3307,7 @@
 
         view[winName]['value'] = convert(value)
 
-        for win in self.win['view'][winName].itervalues():
+        for win in six.itervalues(self.win['view'][winName]):
             self.FindWindowById(win).SetValue(value)
 
         self.mapWindow.iview['dir']['use'] = False
@@ -3367,7 +3369,7 @@
     def OnResetSurfacePosition(self, event):
         """Reset position of surface"""
 
-        for win in self.win['surface']['position'].itervalues():
+        for win in six.itervalues(self.win['surface']['position']):
             if win == self.win['surface']['position']['axis']:
                 self.FindWindowById(win).SetSelection(2)  # Z
             elif win == self.win['surface']['position']['reset']:
@@ -3499,13 +3501,13 @@
 
     def EnablePage(self, name, enabled=True):
         """Enable/disable all widgets on page"""
-        for key, item in self.win[name].iteritems():
+        for key, item in six.iteritems(self.win[name]):
             if key in ('map', 'surface', 'new', 'planes'):
                 continue
             if isinstance(item, types.DictType):
-                for skey, sitem in self.win[name][key].iteritems():
+                for skey, sitem in six.iteritems(self.win[name][key]):
                     if isinstance(sitem, types.DictType):
-                        for ssitem in self.win[name][key][skey].itervalues():
+                        for ssitem in six.itervalues(self.win[name][key][skey]):
                             if not isinstance(ssitem, types.BooleanType) and \
                                isinstance(ssitem, types.IntType):
                                 self.FindWindowById(ssitem).Enable(enabled)
@@ -3818,7 +3820,7 @@
         slider = self.FindWindowById(self.win['surface'][winName]['slider'])
         self.AdjustSliderRange(slider=slider, value=value)
 
-        for win in self.win['surface']['position'].itervalues():
+        for win in six.itervalues(self.win['surface']['position']):
             if win in (self.win['surface']['position']['axis'],
                        self.win['surface']['position']['reset']):
                 continue
@@ -4047,7 +4049,7 @@
             self.win['vector'][vtype]['height']['slider'])
         self.AdjustSliderRange(slider=slider, value=value)
 
-        for win in self.win['vector'][vtype]['height'].itervalues():
+        for win in six.itervalues(self.win['vector'][vtype]['height']):
             self.FindWindowById(win).SetValue(value)
 
         data = self.GetLayerData('vector')
@@ -4683,7 +4685,7 @@
         slider = self.FindWindowById(self.win['volume'][winName]['slider'])
         self.AdjustSliderRange(slider=slider, value=value)
 
-        for win in self.win['volume']['position'].itervalues():
+        for win in six.itervalues(self.win['volume']['position']):
             if win in (self.win['volume']['position']['axis'],
                        self.win['volume']['position']['reset']):
                 continue
@@ -4748,7 +4750,7 @@
 
     def OnResetVolumePosition(self, event):
         """Reset position of volume"""
-        for win in self.win['volume']['position'].itervalues():
+        for win in six.itervalues(self.win['volume']['position']):
             if win == self.win['volume']['position']['axis']:
                 self.FindWindowById(win).SetSelection(2)  # Z
             elif win == self.win['volume']['position']['reset']:
@@ -5315,7 +5317,7 @@
         #
         # draw
         #
-        for control, drawData in data['draw'].iteritems():
+        for control, drawData in six.iteritems(data['draw']):
             if control == 'all':  # skip 'all' property
                 continue
             if control == 'resolution':
@@ -5516,7 +5518,7 @@
             self.FindWindowById(self.win['volume']['map']).SetValue(layer.name)
 
         # draw
-        for control, idata in data['draw'].iteritems():
+        for control, idata in six.iteritems(data['draw']):
             if control == 'all':  # skip 'all' property
                 continue
 

Modified: grass/trunk/gui/wxpython/nviz/workspace.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/workspace.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/nviz/workspace.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -15,6 +15,7 @@
 """
 
 import copy
+import six
 
 from core.settings import UserSettings
 from core.utils import _
@@ -33,8 +34,8 @@
     def SetConstantDefaultProp(self):
         """Set default constant data properties"""
         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
         color = str(data['color'][0]) + ':' + str(data['color']
                                                   [1]) + ':' + str(data['color'][2])
@@ -54,8 +55,9 @@
         #
         for attrb in ('shine', ):
             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]['update'] = None
 
@@ -63,8 +65,9 @@
         # draw
         #
         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 'resolution' not in data['draw']:
                     data['draw']['resolution'] = {}
@@ -115,8 +118,9 @@
         #
         # 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':
                 sel = UserSettings.Get(
                     group='nviz', key='volume', subkey=[
@@ -157,8 +161,9 @@
         #
         for attrb in ('shine', ):
             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
 
         return data
@@ -172,8 +177,9 @@
             if attr == 'inout':
                 data[attr]['value'] = 0
                 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
         return data
 

Modified: grass/trunk/gui/wxpython/photo2image/ip2i_manager.py
===================================================================
--- grass/trunk/gui/wxpython/photo2image/ip2i_manager.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/photo2image/ip2i_manager.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -28,6 +28,7 @@
 
 import os
 import sys
+import six
 import shutil
 import time
 from copy import copy
@@ -53,7 +54,8 @@
 from core.settings import UserSettings
 from photo2image.ip2i_mapdisplay import MapFrame
 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
 
@@ -685,7 +687,7 @@
                    "ucolor": "unused"}
         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)
             self.pointsToDrawSrc.GetPen(v).SetColour(wx.Colour(
                 col[0], col[1], col[2], 255))  # TODO GetPen neni to spatne?
@@ -1451,7 +1453,7 @@
         """Popup Zoom menu
         """
         point = wx.GetMousePosition()
-        zoommenu = wx.Menu()
+        zoommenu = Menu()
         # Add items to the menu
 
         zoomsource = wx.MenuItem(zoommenu, wx.ID_ANY, _(
@@ -1743,7 +1745,7 @@
 
         sizer = wx.BoxSizer(wx.VERTICAL)
 
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel, id=wx.ID_ANY, label=" %s %s " %
             (_("Ground Control Point No."), str(gcpno)))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
@@ -1751,10 +1753,10 @@
         # source coordinates
         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
         tmp_coord = data[1]
@@ -1768,8 +1770,8 @@
                            (_("target X:"), self.ecoord),
                            (_("source Y:"), self.ycoord),
                            (_("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,
                           flag=wx.ALIGN_CENTER_VERTICAL,
                           pos=(row, col))
@@ -1796,8 +1798,8 @@
         #
         # 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()
 
         btnSizer = wx.StdDialogButtonSizer()
@@ -1865,19 +1867,19 @@
         self.__CreateRectificationPage(notebook)
 
         # 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()
 
         # bindings
         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.SetToolTipString(
+        btnSave.SetToolTip(
             _("Apply and save changes to user settings file (default for next sessions)"))
         btnClose.Bind(wx.EVT_BUTTON, self.OnClose)
-        btnClose.SetToolTipString(_("Close dialog"))
+        btnClose.SetToolTip(_("Close dialog"))
 
         # sizers
         btnSizer = wx.BoxSizer(wx.HORIZONTAL)
@@ -1923,7 +1925,7 @@
                 0))
 
         # RMS forward error threshold
-        rmslabel = wx.StaticText(
+        rmslabel = StaticText(
             parent=panel, id=wx.ID_ANY,
             label=_("Highlight RMS error > M + SD * factor:"))
         rmslabel.SetToolTip(
@@ -1940,8 +1942,8 @@
                 0))
         sdfactor = UserSettings.Get(
             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))
         if (self.parent.highest_only == True):
             self.rmsWin.Disable()
@@ -1951,8 +1953,8 @@
         rmsgridSizer.AddGrowableCol(1)
         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)
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
 
@@ -1960,7 +1962,7 @@
         # general symbol color
         #
         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))
         col = UserSettings.Get(group='gcpman', key='symbol', subkey='color')
         colWin = csel.ColourSelect(parent=panel, id=wx.ID_ANY,
@@ -1977,7 +1979,7 @@
         # symbol color for high forward RMS error
         #
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Color for high RMS error:"))
@@ -1997,7 +1999,7 @@
         # symbol color for selected GCP
         #
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Color for selected GCP:"))
@@ -2017,7 +2019,7 @@
         # symbol color for unused GCP
         #
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Color for unused GCPs:"))
@@ -2050,7 +2052,7 @@
         # symbol size
         #
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Symbol size:"))
@@ -2072,7 +2074,7 @@
         # symbol width
         #
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Line width:"))
@@ -2118,7 +2120,7 @@
         self.tgtrastselection.GetElementList()
 
         sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=_('Select source map to display:')),
@@ -2132,7 +2134,7 @@
             border=5)
         self.srcselection.SetValue(src_map)
         sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=_('Select target raster map to display:')),
@@ -2182,7 +2184,7 @@
         # interpolation method
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=_('Select interpolation method:')),
@@ -2208,7 +2210,7 @@
 
         # extension
         sizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=_('Extension for output maps:')),
@@ -2215,7 +2217,7 @@
             proportion=0,
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL,
             border=5)
-        self.ext_txt = wx.TextCtrl(
+        self.ext_txt = TextCtrl(
             parent=panel, id=wx.ID_ANY, value="", size=(
                 350, -1))
         self.ext_txt.SetValue(self.parent.extension)

Modified: grass/trunk/gui/wxpython/photo2image/ip2i_mapdisplay.py
===================================================================
--- grass/trunk/gui/wxpython/photo2image/ip2i_mapdisplay.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/photo2image/ip2i_mapdisplay.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -30,6 +30,7 @@
 from core.utils import _
 from gui_core.dialogs import GetImageHandlers, ImageSizeDialog
 from gui_core.mapdisp import SingleMapFrame
+from gui_core.wrap import Menu
 from core.settings import UserSettings
 from mapwin.buffered import BufferedMapWindow
 from mapwin.base import MapWindowProperties
@@ -420,7 +421,7 @@
         Print options and output menu for map display
         """
         point = wx.GetMousePosition()
-        printmenu = wx.Menu()
+        printmenu = Menu()
         # Add items to the menu
         setup = wx.MenuItem(printmenu, wx.ID_ANY, _('Page setup'))
         printmenu.AppendItem(setup)
@@ -466,7 +467,7 @@
         """Popup Zoom menu
         """
         point = wx.GetMousePosition()
-        zoommenu = wx.Menu()
+        zoommenu = Menu()
         # Add items to the menu
 
         zoomwind = wx.MenuItem(zoommenu, wx.ID_ANY, _(

Modified: grass/trunk/gui/wxpython/psmap/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/psmap/dialogs.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/psmap/dialogs.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -70,7 +70,8 @@
 from gui_core.gselect import Select
 from core.gcmd import RunCommand, GError, GMessage
 from gui_core.dialogs import SymbolDialog
-from gui_core.wrap import SpinCtrl
+from gui_core.wrap import SpinCtrl, Button, TextCtrl, BitmapButton, \
+    StaticText, StaticBox, Rect, EmptyBitmap
 from psmap.utils import *
 from psmap.instructions import *
 
@@ -148,7 +149,7 @@
             # painting the control, but there is no valid item selected yet
             return
 
-        r = wx.Rect(*rect)  # make a copy
+        r = Rect(*rect)  # make a copy
         r.Deflate(3, 5)
 
         penStyle = wx.SOLID
@@ -227,7 +228,7 @@
 
     def AddUnits(self, parent, dialogDict):
         parent.units = dict()
-        parent.units['unitsLabel'] = wx.StaticText(
+        parent.units['unitsLabel'] = StaticText(
             parent, id=wx.ID_ANY, label=_("Units:"))
         choices = self.unitConv.getPageUnitsNames()
         parent.units['unitsCtrl'] = wx.Choice(
@@ -238,17 +239,17 @@
     def AddPosition(self, parent, dialogDict):
         if not hasattr(parent, "position"):
             parent.position = dict()
-        parent.position['comment'] = wx.StaticText(parent, id=wx.ID_ANY, label=_(
+        parent.position['comment'] = StaticText(parent, id=wx.ID_ANY, label=_(
             "Position of the top left corner\nfrom the top left edge of the paper"))
-        parent.position['xLabel'] = wx.StaticText(
+        parent.position['xLabel'] = StaticText(
             parent, id=wx.ID_ANY, label=_("X:"))
-        parent.position['yLabel'] = wx.StaticText(
+        parent.position['yLabel'] = StaticText(
             parent, id=wx.ID_ANY, label=_("Y:"))
-        parent.position['xCtrl'] = wx.TextCtrl(
+        parent.position['xCtrl'] = TextCtrl(
             parent, id=wx.ID_ANY, value=str(
                 dialogDict['where'][0]), validator=TCValidator(
                 flag='DIGIT_ONLY'))
-        parent.position['yCtrl'] = wx.TextCtrl(
+        parent.position['yCtrl'] = TextCtrl(
             parent, id=wx.ID_ANY, value=str(
                 dialogDict['where'][1]), validator=TCValidator(
                 flag='DIGIT_ONLY'))
@@ -267,7 +268,7 @@
     def AddExtendedPosition(self, panel, gridBagSizer, dialogDict):
         """Add widgets for setting position relative to paper and to map"""
         panel.position = dict()
-        positionLabel = wx.StaticText(
+        positionLabel = StaticText(
             panel, id=wx.ID_ANY, label=_("Position is given:"))
         panel.position['toPaper'] = wx.RadioButton(
             panel, id=wx.ID_ANY, label=_("relative to paper"), style=wx.RB_GROUP)
@@ -296,7 +297,7 @@
             border=0)
 
         # first box - paper coordinates
-        box1 = wx.StaticBox(parent=panel, id=wx.ID_ANY, label="")
+        box1 = StaticBox(parent=panel, id=wx.ID_ANY, label="")
         sizerP = wx.StaticBoxSizer(box1, wx.VERTICAL)
         self.gridBagSizerP = wx.GridBagSizer(hgap=5, vgap=5)
 
@@ -338,14 +339,14 @@
                 1, 1), flag=wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND, border=0)
 
         # second box - map coordinates
-        box2 = wx.StaticBox(parent=panel, id=wx.ID_ANY, label="")
+        box2 = StaticBox(parent=panel, id=wx.ID_ANY, label="")
         sizerM = wx.StaticBoxSizer(box2, wx.VERTICAL)
         self.gridBagSizerM = wx.GridBagSizer(hgap=5, vgap=5)
 
-        eastingLabel = wx.StaticText(panel, id=wx.ID_ANY, label="E:")
-        northingLabel = wx.StaticText(panel, id=wx.ID_ANY, label="N:")
-        panel.position['eCtrl'] = wx.TextCtrl(panel, id=wx.ID_ANY, value="")
-        panel.position['nCtrl'] = wx.TextCtrl(panel, id=wx.ID_ANY, value="")
+        eastingLabel = StaticText(panel, id=wx.ID_ANY, label="E:")
+        northingLabel = StaticText(panel, id=wx.ID_ANY, label="N:")
+        panel.position['eCtrl'] = TextCtrl(panel, id=wx.ID_ANY, value="")
+        panel.position['nCtrl'] = TextCtrl(panel, id=wx.ID_ANY, value="")
         east, north = PaperMapCoordinates(
             mapInstr=self.instruction[self.mapId],
             x=dialogDict['where'][0],
@@ -392,9 +393,9 @@
 
 # parent.font['colorCtrl'].SetColour(convertRGB(dialogDict['color']))
 
-        parent.font['fontLabel'] = wx.StaticText(
+        parent.font['fontLabel'] = StaticText(
             parent, id=wx.ID_ANY, label=_("Font:"))
-        parent.font['fontSizeLabel'] = wx.StaticText(
+        parent.font['fontSizeLabel'] = StaticText(
             parent, id=wx.ID_ANY, label=_("Font size:"))
         fontChoices = [
             'Times-Roman',
@@ -420,7 +421,7 @@
         parent.font['fontSizeCtrl'].SetValue(dialogDict['fontsize'])
 
         if color:
-            parent.font['colorLabel'] = wx.StaticText(
+            parent.font['colorLabel'] = StaticText(
                 parent, id=wx.ID_ANY, label=_("Choose color:"))
             parent.font['colorCtrl'] = wx.ColourPickerCtrl(
                 parent, id=wx.ID_ANY)
@@ -462,21 +463,21 @@
 
     def _layout(self, panel):
         # buttons
-        btnCancel = wx.Button(self, wx.ID_CANCEL)
-        btnOK = wx.Button(self, wx.ID_OK)
+        btnCancel = Button(self, wx.ID_CANCEL)
+        btnOK = Button(self, wx.ID_OK)
         btnOK.SetDefault()
         if self.apply:
-            btnApply = wx.Button(self, wx.ID_APPLY)
+            btnApply = Button(self, wx.ID_APPLY)
 
         # bindigs
         btnOK.Bind(wx.EVT_BUTTON, self.OnOK)
-        btnOK.SetToolTipString(_("Close dialog and apply changes"))
+        btnOK.SetToolTip(_("Close dialog and apply changes"))
         #btnCancel.Bind(wx.EVT_BUTTON, self.OnCancel)
-        btnCancel.SetToolTipString(_("Close dialog and ignore changes"))
+        btnCancel.SetToolTip(_("Close dialog and ignore changes"))
         btnCancel.Bind(wx.EVT_BUTTON, self.OnCancel)
         if self.apply:
             btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
-            btnApply.SetToolTipString(_("Apply changes"))
+            btnApply.SetToolTip(_("Apply changes"))
 
         # sizers
         btnSizer = wx.StdDialogButtonSizer()
@@ -601,13 +602,13 @@
         size = (110, -1)
         # sizers
         mainSizer = wx.BoxSizer(wx.VERTICAL)
-        pageBox = wx.StaticBox(
+        pageBox = StaticBox(
             self,
             id=wx.ID_ANY,
             label=" %s " %
             _("Page size"))
         pageSizer = wx.StaticBoxSizer(pageBox, wx.VERTICAL)
-        marginBox = wx.StaticBox(
+        marginBox = StaticBox(
             self, id=wx.ID_ANY, label=" %s " %
             _("Margins"))
         marginSizer = wx.StaticBoxSizer(marginBox, wx.VERTICAL)
@@ -622,7 +623,7 @@
         self.hBoxDict = {}
         for i, item in enumerate(self.cat[:3]):
             hBox = wx.BoxSizer(wx.HORIZONTAL)
-            stText = wx.StaticText(
+            stText = StaticText(
                 self, id=wx.ID_ANY, label=self.catsLabels[item] + ':')
             choice = wx.Choice(
                 self,
@@ -642,9 +643,9 @@
         #staticText + TextCtrl
         for item in self.cat[3:]:
             hBox = wx.BoxSizer(wx.HORIZONTAL)
-            label = wx.StaticText(
+            label = StaticText(
                 self, id=wx.ID_ANY, label=self.catsLabels[item] + ':')
-            textctrl = wx.TextCtrl(self, id=wx.ID_ANY, size=size, value='')
+            textctrl = TextCtrl(self, id=wx.ID_ANY, size=size, value='')
             hBox.Add(
                 label,
                 proportion=1,
@@ -664,10 +665,10 @@
                 0, wx.GROW | wx.RIGHT | wx.LEFT, 5)
         # OK button
         btnSizer = wx.StdDialogButtonSizer()
-        self.btnOk = wx.Button(self, wx.ID_OK)
+        self.btnOk = Button(self, wx.ID_OK)
         self.btnOk.SetDefault()
         btnSizer.AddButton(self.btnOk)
-        btn = wx.Button(self, wx.ID_CANCEL)
+        btn = Button(self, wx.ID_CANCEL)
         btnSizer.AddButton(btn)
         btnSizer.Realize()
 
@@ -880,7 +881,7 @@
         """Do layout"""
         border = wx.BoxSizer(wx.VERTICAL)
 
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=self,
             id=wx.ID_ANY,
             label=" %s " %
@@ -889,7 +890,7 @@
         gridBagSizer = wx.GridBagSizer(hgap=5, vgap=5)
 
         # scale options
-        frameText = wx.StaticText(
+        frameText = StaticText(
             self, id=wx.ID_ANY, label=_("Map frame options:"))
         scaleChoices = [_("fit frame to match selected map"),
                         _("fit frame to match saved region"),
@@ -909,7 +910,7 @@
             border=0)
 
         # map and region selection
-        self.staticBox = wx.StaticBox(
+        self.staticBox = StaticBox(
             parent=self, id=wx.ID_ANY, label=" %s " %
             _("Map selection"))
         sizerM = wx.StaticBoxSizer(self.staticBox, wx.HORIZONTAL)
@@ -930,7 +931,7 @@
             dc.GetTextExtent(
                 self.mapOrRegionText[0])[0], dc.GetTextExtent(
                 self.mapOrRegionText[1])[0])
-        self.mapText = wx.StaticText(
+        self.mapText = StaticText(
             self, id=wx.ID_ANY, label=self.mapOrRegionText[0],
             size=(width, -1))
         self.select = Select(
@@ -977,7 +978,7 @@
             border=0)
 
         # map scale and center
-        boxC = wx.StaticBox(
+        boxC = StaticBox(
             parent=self,
             id=wx.ID_ANY,
             label=" %s " %
@@ -985,18 +986,18 @@
         sizerC = wx.StaticBoxSizer(boxC, wx.HORIZONTAL)
         self.centerSizer = wx.FlexGridSizer(rows=2, cols=5, hgap=5, vgap=5)
 
-        centerText = wx.StaticText(self, id=wx.ID_ANY, label=_("Center:"))
-        self.eastingText = wx.StaticText(self, id=wx.ID_ANY, label=_("E:"))
-        self.northingText = wx.StaticText(self, id=wx.ID_ANY, label=_("N:"))
-        self.eastingTextCtrl = wx.TextCtrl(
+        centerText = StaticText(self, id=wx.ID_ANY, label=_("Center:"))
+        self.eastingText = StaticText(self, id=wx.ID_ANY, label=_("E:"))
+        self.northingText = StaticText(self, id=wx.ID_ANY, label=_("N:"))
+        self.eastingTextCtrl = TextCtrl(
             self, id=wx.ID_ANY, style=wx.TE_RIGHT,
             validator=TCValidator(flag='DIGIT_ONLY'))
-        self.northingTextCtrl = wx.TextCtrl(
+        self.northingTextCtrl = TextCtrl(
             self, id=wx.ID_ANY, style=wx.TE_RIGHT,
             validator=TCValidator(flag='DIGIT_ONLY'))
-        scaleText = wx.StaticText(self, id=wx.ID_ANY, label=_("Scale:"))
-        scalePrefixText = wx.StaticText(self, id=wx.ID_ANY, label=_("1 :"))
-        self.scaleTextCtrl = wx.TextCtrl(
+        scaleText = StaticText(self, id=wx.ID_ANY, label=_("Scale:"))
+        scalePrefixText = StaticText(self, id=wx.ID_ANY, label=_("1 :"))
+        self.scaleTextCtrl = TextCtrl(
             self, id=wx.ID_ANY, value="", style=wx.TE_RIGHT,
             validator=TCValidator('DIGIT_ONLY'))
 
@@ -1058,7 +1059,7 @@
         # resolution
         flexSizer = wx.FlexGridSizer(rows=1, cols=2, hgap=5, vgap=5)
 
-        resolutionText = wx.StaticText(
+        resolutionText = StaticText(
             self, id=wx.ID_ANY, label=_("Map max resolution (dpi):"))
         self.resolutionSpin = SpinCtrl(
             self, id=wx.ID_ANY, min=1, max=1000, initial=300)
@@ -1092,7 +1093,7 @@
 
         # border
         # GTC Line around legend or map frame
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=self,
             id=wx.ID_ANY,
             label=" %s " %
@@ -1108,9 +1109,9 @@
         else:
             self.borderCheck.SetValue(False)
 
-        self.borderColorText = wx.StaticText(
+        self.borderColorText = StaticText(
             self, id=wx.ID_ANY, label=_("border color:"))
-        self.borderWidthText = wx.StaticText(
+        self.borderWidthText = StaticText(
             self, id=wx.ID_ANY, label=_("border width (pts):"))
         self.borderColourPicker = wx.ColourPickerCtrl(self, id=wx.ID_ANY)
         self.borderWidthCtrl = SpinCtrl(
@@ -1558,7 +1559,7 @@
 
         # choose raster map
 
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=self,
             id=wx.ID_ANY,
             label=" %s " %
@@ -1704,7 +1705,7 @@
 
         # choose vector map
 
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=self,
             id=wx.ID_ANY,
             label=" %s " %
@@ -1712,7 +1713,7 @@
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridBagSizer = wx.GridBagSizer(hgap=5, vgap=5)
 
-        text = wx.StaticText(self, id=wx.ID_ANY, label=_("Map:"))
+        text = StaticText(self, id=wx.ID_ANY, label=_("Map:"))
         self.select = Select(self, id=wx.ID_ANY,  # size = globalvar.DIALOG_GSELECT_SIZE,
                              type='vector', multiple=False,
                              updateOnPopup=True, onPopup=None)
@@ -1727,7 +1728,7 @@
             majorDimension=3,
             style=wx.RA_SPECIFY_COLS)
 
-        self.AddVector = wx.Button(self, id=wx.ID_ANY, label=_("Add"))
+        self.AddVector = Button(self, id=wx.ID_ANY, label=_("Add"))
 
         gridBagSizer.Add(
             text, pos=(0, 0),
@@ -1752,7 +1753,7 @@
 
         # manage vector layers
 
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=self,
             id=wx.ID_ANY,
             label=" %s " %
@@ -1760,15 +1761,15 @@
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridBagSizer = wx.GridBagSizer(hgap=5, vgap=5)
 
-        text = wx.StaticText(self, id=wx.ID_ANY, label=_(
+        text = StaticText(self, id=wx.ID_ANY, label=_(
             "The topmost vector map overlaps the others"))
         self.listbox = wx.ListBox(
             self, id=wx.ID_ANY, choices=[],
             style=wx.LB_SINGLE | wx.LB_NEEDED_SB)
-        self.btnUp = wx.Button(self, id=wx.ID_ANY, label=_("Up"))
-        self.btnDown = wx.Button(self, id=wx.ID_ANY, label=_("Down"))
-        self.btnDel = wx.Button(self, id=wx.ID_ANY, label=_("Delete"))
-        self.btnProp = wx.Button(self, id=wx.ID_ANY, label=_("Properties..."))
+        self.btnUp = Button(self, id=wx.ID_ANY, label=_("Up"))
+        self.btnDown = Button(self, id=wx.ID_ANY, label=_("Down"))
+        self.btnDel = Button(self, id=wx.ID_ANY, label=_("Delete"))
+        self.btnProp = Button(self, id=wx.ID_ANY, label=_("Properties..."))
 
         self.updateListBox(selected=0)
 
@@ -2169,7 +2170,7 @@
         # data type
         self.checkType1 = self.checkType2 = None
         if self.type in ('lines', 'points'):
-            box = wx.StaticBox(
+            box = StaticBox(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=" %s " %
@@ -2213,7 +2214,7 @@
                 border=5)
 
         # layer selection
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -2221,11 +2222,11 @@
         sizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)
         self.gridBagSizerL = wx.GridBagSizer(hgap=5, vgap=5)
 
-        self.warning = wx.StaticText(panel, id=wx.ID_ANY, label="")
+        self.warning = StaticText(panel, id=wx.ID_ANY, label="")
         if not self.connection:
-            self.warning = wx.StaticText(panel, id=wx.ID_ANY, label=_(
+            self.warning = StaticText(panel, id=wx.ID_ANY, label=_(
                 "Database connection is not defined in DB file."))
-        text = wx.StaticText(panel, id=wx.ID_ANY, label=_("Select layer:"))
+        text = StaticText(panel, id=wx.ID_ANY, label=_("Select layer:"))
         self.layerChoice = wx.Choice(
             panel, id=wx.ID_ANY, choices=map(
                 str, self.layers), size=self.spinCtrlSize)
@@ -2240,7 +2241,7 @@
         self.radioWhere = wx.RadioButton(
             panel, id=wx.ID_ANY, label="SELECT * FROM %s WHERE" %
             table, style=wx.RB_GROUP)
-        self.textCtrlWhere = wx.TextCtrl(panel, id=wx.ID_ANY, value="")
+        self.textCtrlWhere = TextCtrl(panel, id=wx.ID_ANY, value="")
 
         if self.connection:
             cols = self.mapDBInfo.GetColumns(
@@ -2252,8 +2253,8 @@
 
         self.radioCats = wx.RadioButton(
             panel, id=wx.ID_ANY, label="Choose categories ")
-        self.textCtrlCats = wx.TextCtrl(panel, id=wx.ID_ANY, value="")
-        self.textCtrlCats.SetToolTipString(
+        self.textCtrlCats = TextCtrl(panel, id=wx.ID_ANY, value="")
+        self.textCtrlCats.SetToolTip(
             _("list of categories (e.g. 1,3,5-7)"))
 
         if 'cats' in self.vPropertiesDict:
@@ -2303,7 +2304,7 @@
         border.Add(sizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=5)
 
         # mask
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -2335,7 +2336,7 @@
         border = wx.BoxSizer(wx.VERTICAL)
 
         #colors - outline
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -2347,7 +2348,7 @@
             panel, id=wx.ID_ANY, label=_("draw outline"))
         self.outlineCheck.SetValue(self.vPropertiesDict['color'] != 'none')
 
-        widthText = wx.StaticText(panel, id=wx.ID_ANY, label=_("Width (pts):"))
+        widthText = StaticText(panel, id=wx.ID_ANY, label=_("Width (pts):"))
         if fs:
             self.widthSpin = fs.FloatSpin(
                 panel,
@@ -2372,7 +2373,7 @@
         else:
             self.widthSpin.SetValue(1)
 
-        colorText = wx.StaticText(panel, id=wx.ID_ANY, label=_("Color:"))
+        colorText = StaticText(panel, id=wx.ID_ANY, label=_("Color:"))
         self.colorPicker = wx.ColourPickerCtrl(panel, id=wx.ID_ANY)
         if self.vPropertiesDict['color'] != 'none':
             self.colorPicker.SetColour(
@@ -2407,7 +2408,7 @@
         self.Bind(wx.EVT_CHECKBOX, self.OnOutline, self.outlineCheck)
 
         #colors - fill
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -2491,7 +2492,7 @@
         border = wx.BoxSizer(wx.VERTICAL)
 
         #colors - outline
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -2510,7 +2511,7 @@
         self.outlineCheck.SetToolTipString(
             _("No effect for fill color from table column"))
 
-        widthText = wx.StaticText(panel, id=wx.ID_ANY, label=_("Width (pts):"))
+        widthText = StaticText(panel, id=wx.ID_ANY, label=_("Width (pts):"))
 
         if fs:
             self.outWidthSpin = fs.FloatSpin(
@@ -2533,7 +2534,7 @@
         else:
             self.outWidthSpin.SetValue(1)
 
-        colorText = wx.StaticText(panel, id=wx.ID_ANY, label=_("Color:"))
+        colorText = StaticText(panel, id=wx.ID_ANY, label=_("Color:"))
         self.colorPicker = wx.ColourPickerCtrl(panel, id=wx.ID_ANY)
         if self.vPropertiesDict['hcolor'] != 'none':
             self.colorPicker.SetColour(
@@ -2568,7 +2569,7 @@
         self.Bind(wx.EVT_CHECKBOX, self.OnOutline, self.outlineCheck)
 
         #colors - fill
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -2576,7 +2577,7 @@
         sizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)
         self.gridBagSizerF = wx.GridBagSizer(hgap=5, vgap=2)
 
-        fillText = wx.StaticText(
+        fillText = StaticText(
             panel, id=wx.ID_ANY, label=_("Color of lines:"))
 
         self.colorPickerRadio = wx.RadioButton(
@@ -2649,7 +2650,7 @@
         border = wx.BoxSizer(wx.VERTICAL)
 
         # symbology
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -2662,7 +2663,7 @@
             style=wx.RB_GROUP)
         self.symbolRadio.SetValue(bool(self.vPropertiesDict['symbol']))
 
-        self.symbolName = wx.StaticText(panel, id=wx.ID_ANY)
+        self.symbolName = StaticText(panel, id=wx.ID_ANY)
         self.symbolName.SetLabel(self.vPropertiesDict['symbol'])
         bitmap = wx.Bitmap(
             os.path.join(
@@ -2669,7 +2670,7 @@
                 globalvar.SYMBDIR,
                 self.vPropertiesDict['symbol']) +
             '.png')
-        self.symbolButton = wx.BitmapButton(panel, id=wx.ID_ANY, bitmap=bitmap)
+        self.symbolButton = BitmapButton(panel, id=wx.ID_ANY, bitmap=bitmap)
 
         self.epsRadio = wx.RadioButton(
             panel, id=wx.ID_ANY, label=_("eps file:"))
@@ -2723,7 +2724,7 @@
 
         # size
 
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -2739,7 +2740,7 @@
         self.sizecolumnRadio = wx.RadioButton(
             panel, id=wx.ID_ANY, label=_("size from map table column:"))
         self.sizeColChoice = self.getColsChoice(panel)
-        self.scaleText = wx.StaticText(panel, id=wx.ID_ANY, label=_("scale:"))
+        self.scaleText = StaticText(panel, id=wx.ID_ANY, label=_("scale:"))
         self.scaleSpin = SpinCtrl(
             panel, id=wx.ID_ANY, min=1, max=25, initial=1)
 
@@ -2800,7 +2801,7 @@
         self.Bind(wx.EVT_RADIOBUTTON, self.OnSize, self.sizecolumnRadio)
 
         # rotation
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -2881,7 +2882,7 @@
         border = wx.BoxSizer(wx.VERTICAL)
 
         # width
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -2889,7 +2890,7 @@
         sizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)
         gridBagSizer = wx.GridBagSizer(hgap=5, vgap=5)
 
-        widthText = wx.StaticText(
+        widthText = StaticText(
             panel, id=wx.ID_ANY, label=_("Set width (pts):"))
         if fs:
             self.widthSpin = fs.FloatSpin(
@@ -2935,7 +2936,7 @@
         border.Add(sizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=5)
 
         # style
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -2943,7 +2944,7 @@
         sizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)
         gridBagSizer = wx.GridBagSizer(hgap=5, vgap=5)
 
-        styleText = wx.StaticText(
+        styleText = StaticText(
             panel, id=wx.ID_ANY, label=_("Choose line style:"))
         penStyles = ["solid", "dashed", "dotted", "dashdotted"]
         self.styleCombo = PenStyleComboBox(
@@ -2956,7 +2957,7 @@
 ##                                    "The first block of repeated zeros or ones represents 'draw', "\
 ##                                    "the second block represents 'blank'. An even number of blocks "\
 # "will repeat the pattern, an odd number of blocks will alternate the pattern."))
-        linecapText = wx.StaticText(
+        linecapText = StaticText(
             panel, id=wx.ID_ANY, label=_("Choose linecap:"))
         self.linecapChoice = wx.Choice(
             panel, id=wx.ID_ANY, choices=[
@@ -3006,7 +3007,7 @@
         border = wx.BoxSizer(wx.VERTICAL)
 
         # pattern
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -3024,11 +3025,11 @@
             startDirectory=self.patternPath, initialValue='',
             fileMask="Encapsulated PostScript (*.eps)|*.eps|All files (*.*)|*.*",
             fileMode=wx.FD_OPEN)
-        self.patWidthText = wx.StaticText(
+        self.patWidthText = StaticText(
             panel, id=wx.ID_ANY, label=_("pattern line width (pts):"))
         self.patWidthSpin = SpinCtrl(
             panel, id=wx.ID_ANY, min=1, max=25, initial=1)
-        self.patScaleText = wx.StaticText(
+        self.patScaleText = StaticText(
             panel, id=wx.ID_ANY, label=_("pattern scale factor:"))
         self.patScaleSpin = SpinCtrl(
             panel, id=wx.ID_ANY, min=1, max=25, initial=1)
@@ -3404,7 +3405,7 @@
             border=5)
 
         # choose raster
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -3422,7 +3423,7 @@
 
         rasterType = getRasterType(map=self.currRaster)
 
-        self.rasterCurrent = wx.StaticText(
+        self.rasterCurrent = StaticText(
             panel, id=wx.ID_ANY, label=_("%(rast)s: type %(type)s") %
             {'rast': self.currRaster, 'type': rasterType})
         self.rasterSelect = Select(
@@ -3468,7 +3469,7 @@
 
         # type of legend
 
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -3503,7 +3504,7 @@
             mainSizer=border)
 
         # advanced settings
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -3536,20 +3537,20 @@
             self.minim, self.maxim = 0, 0
         self.range = wx.CheckBox(panel, id=wx.ID_ANY, label=_("range"))
         self.range.SetValue(self.rLegendDict['range'])
-        self.minText = wx.StaticText(
+        self.minText = StaticText(
             panel,
             id=wx.ID_ANY,
             label="min (%s)" %
             self.minim)
-        self.maxText = wx.StaticText(
+        self.maxText = StaticText(
             panel,
             id=wx.ID_ANY,
             label="max (%s)" %
             self.maxim)
-        self.min = wx.TextCtrl(
+        self.min = TextCtrl(
             panel, id=wx.ID_ANY, value=str(
                 self.rLegendDict['min']))
-        self.max = wx.TextCtrl(
+        self.max = TextCtrl(
             panel, id=wx.ID_ANY, value=str(
                 self.rLegendDict['max']))
 
@@ -3628,7 +3629,7 @@
             border=5)
 
         # vector maps, their order, labels
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -3636,7 +3637,7 @@
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridBagSizer = wx.GridBagSizer(hgap=5, vgap=5)
 
-        vectorText = wx.StaticText(panel, id=wx.ID_ANY, label=_(
+        vectorText = StaticText(panel, id=wx.ID_ANY, label=_(
             "Choose vector maps and their order in legend"))
 
         self.vectorListCtrl = CheckListCtrl(panel)
@@ -3663,9 +3664,9 @@
             self.vectorListCtrl.SetColumnWidth(0, wx.LIST_AUTOSIZE)
         self.vectorListCtrl.SetColumnWidth(1, wx.LIST_AUTOSIZE)
 
-        self.btnUp = wx.Button(panel, id=wx.ID_ANY, label=_("Up"))
-        self.btnDown = wx.Button(panel, id=wx.ID_ANY, label=_("Down"))
-        self.btnLabel = wx.Button(panel, id=wx.ID_ANY, label=_("Edit label"))
+        self.btnUp = Button(panel, id=wx.ID_ANY, label=_("Up"))
+        self.btnDown = Button(panel, id=wx.ID_ANY, label=_("Down"))
+        self.btnLabel = Button(panel, id=wx.ID_ANY, label=_("Edit label"))
 
         gridBagSizer.Add(
             vectorText, pos=(
@@ -3702,7 +3703,7 @@
 
         # border
         # GTC  Line around legend or map frame
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -3765,7 +3766,7 @@
         border = mainSizer
 
         # size and position
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -3791,13 +3792,13 @@
             border=0)
 
         hBox = wx.BoxSizer(wx.HORIZONTAL)
-        posBox = wx.StaticBox(
+        posBox = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
             _("Position"))
         posSizer = wx.StaticBoxSizer(posBox, wx.VERTICAL)
-        sizeBox = wx.StaticBox(
+        sizeBox = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -3828,7 +3829,7 @@
             border=5)
 
         # size
-        width = wx.StaticText(panel, id=wx.ID_ANY, label=_("Width:"))
+        width = StaticText(panel, id=wx.ID_ANY, label=_("Width:"))
         if legendDict['width']:
             w = self.unitConv.convert(
                 value=float(legendDict['width']),
@@ -3835,10 +3836,10 @@
                 fromUnit='inch', toUnit=legendDict['unit'])
         else:
             w = ''
-        panel.widthCtrl = wx.TextCtrl(
+        panel.widthCtrl = TextCtrl(
             panel, id=wx.ID_ANY, value=str(w),
             validator=TCValidator("DIGIT_ONLY"))
-        panel.widthCtrl.SetToolTipString(
+        panel.widthCtrl.SetToolTip(
             _("Leave the edit field empty, to use default values."))
 
         if legendType == 'raster':
@@ -3845,7 +3846,7 @@
             ##            panel.defaultSize = wx.CheckBox(panel, id = wx.ID_ANY, label = _("Use default size"))
             # panel.defaultSize.SetValue(legendDict['defaultSize'])
 
-            panel.heightOrColumnsLabel = wx.StaticText(
+            panel.heightOrColumnsLabel = StaticText(
                 panel, id=wx.ID_ANY, label=_("Height:"))
             if legendDict['height']:
                 h = self.unitConv.convert(
@@ -3853,7 +3854,7 @@
                     fromUnit='inch', toUnit=legendDict['unit'])
             else:
                 h = ''
-            panel.heightOrColumnsCtrl = wx.TextCtrl(
+            panel.heightOrColumnsCtrl = TextCtrl(
                 panel, id=wx.ID_ANY, value=str(h),
                 validator=TCValidator("DIGIT_ONLY"))
 
@@ -3878,7 +3879,7 @@
                 border=5)
 
         if legendType == 'vector':
-            panel.widthCtrl.SetToolTipString(
+            panel.widthCtrl.SetToolTip(
                 _("Width of the color symbol (for lines)\nin front of the legend text"))
             # columns
             minVect, maxVect = 0, 0
@@ -3885,7 +3886,7 @@
             if self.vectorId:
                 minVect = 1
                 maxVect = min(10, len(self.instruction[self.vectorId]['list']))
-            cols = wx.StaticText(panel, id=wx.ID_ANY, label=_("Columns:"))
+            cols = StaticText(panel, id=wx.ID_ANY, label=_("Columns:"))
             panel.colsCtrl = SpinCtrl(
                 panel,
                 id=wx.ID_ANY,
@@ -3896,9 +3897,9 @@
             # span
             panel.spanRadio = wx.CheckBox(
                 panel, id=wx.ID_ANY, label=_("column span:"))
-            panel.spanTextCtrl = wx.TextCtrl(panel, id=wx.ID_ANY, value='')
-            panel.spanTextCtrl.SetToolTipString(_("Column separation distance between the left edges\n"
-                                                  "of two columns in a multicolumn legend"))
+            panel.spanTextCtrl = TextCtrl(panel, id=wx.ID_ANY, value='')
+            panel.spanTextCtrl.SetToolTip(_("Column separation distance between the left edges\n"
+                                            "of two columns in a multicolumn legend"))
             if legendDict['span']:
                 panel.spanRadio.SetValue(True)
                 s = self.unitConv.convert(
@@ -3940,7 +3941,7 @@
         border.Add(sizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=5)
 
         # font
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -4072,7 +4073,7 @@
                     toUnit=self.rLegendDict['unit'])
             else:
                 h = ''
-            self.panelRaster.heightOrColumnsCtrl = wx.TextCtrl(
+            self.panelRaster.heightOrColumnsCtrl = TextCtrl(
                 self.panelRaster, id=wx.ID_ANY, value=str(h),
                 validator=TCValidator("DIGIT_ONLY"))
             self.panelRaster.heightOrColumnsCtrl.Enable(enabledSize)
@@ -4511,7 +4512,7 @@
         border = wx.BoxSizer(wx.VERTICAL)
 
         # position
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -4547,7 +4548,7 @@
         border.Add(sizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=5)
 
         # font
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -4582,7 +4583,7 @@
         border.Add(sizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=5)
 
         # colors
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -4789,7 +4790,7 @@
         #
         # position
         #
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -4845,7 +4846,7 @@
         #
         # size
         #
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -4853,17 +4854,17 @@
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridBagSizer = wx.GridBagSizer(hgap=5, vgap=5)
 
-        lengthText = wx.StaticText(panel, id=wx.ID_ANY, label=_("Length:"))
-        heightText = wx.StaticText(panel, id=wx.ID_ANY, label=_("Height:"))
+        lengthText = StaticText(panel, id=wx.ID_ANY, label=_("Length:"))
+        heightText = StaticText(panel, id=wx.ID_ANY, label=_("Height:"))
 
-        self.lengthTextCtrl = wx.TextCtrl(
+        self.lengthTextCtrl = TextCtrl(
             panel, id=wx.ID_ANY, validator=TCValidator('DIGIT_ONLY'))
-        self.lengthTextCtrl.SetToolTipString(
+        self.lengthTextCtrl.SetToolTip(
             _("Scalebar length is given in map units"))
 
-        self.heightTextCtrl = wx.TextCtrl(
+        self.heightTextCtrl = TextCtrl(
             panel, id=wx.ID_ANY, validator=TCValidator('DIGIT_ONLY'))
-        self.heightTextCtrl.SetToolTipString(
+        self.heightTextCtrl.SetToolTip(
             _("Scalebar height is real height on paper"))
 
         choices = [_('default')] + self.unitConv.getMapUnitsNames()
@@ -4935,7 +4936,7 @@
         #
         # style
         #
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -4943,7 +4944,7 @@
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridBagSizer = wx.GridBagSizer(hgap=5, vgap=5)
 
-        sbTypeText = wx.StaticText(panel, id=wx.ID_ANY, label=_("Type:"))
+        sbTypeText = StaticText(panel, id=wx.ID_ANY, label=_("Type:"))
         self.sbCombo = wx.combo.BitmapComboBox(panel, style=wx.CB_READONLY)
         # only temporary, images must be moved away
         imagePath = os.path.join(
@@ -4951,7 +4952,7 @@
             globalvar.IMGDIR, "scalebar-simple.png")
         for item, path in zip(['fancy', 'simple'], imagePath):
             if not os.path.exists(path):
-                bitmap = wx.EmptyBitmap(0, 0)
+                bitmap = EmptyBitmap(0, 0)
             else:
                 bitmap = wx.Bitmap(path)
             self.sbCombo.Append(item='', bitmap=bitmap, clientData=item[0])
@@ -4961,21 +4962,21 @@
         elif self.scalebarDict['scalebar'] == 's':
             self.sbCombo.SetSelection(1)
 
-        sbSegmentsText = wx.StaticText(
+        sbSegmentsText = StaticText(
             panel, id=wx.ID_ANY, label=_("Number of segments:"))
         self.sbSegmentsCtrl = SpinCtrl(
             panel, id=wx.ID_ANY, min=1, max=30, initial=4)
         self.sbSegmentsCtrl.SetValue(self.scalebarDict['segment'])
 
-        sbLabelsText1 = wx.StaticText(
+        sbLabelsText1 = StaticText(
             panel, id=wx.ID_ANY, label=_("Label every "))
-        sbLabelsText2 = wx.StaticText(panel, id=wx.ID_ANY, label=_("segments"))
+        sbLabelsText2 = StaticText(panel, id=wx.ID_ANY, label=_("segments"))
         self.sbLabelsCtrl = SpinCtrl(
             panel, id=wx.ID_ANY, min=1, max=30, initial=1)
         self.sbLabelsCtrl.SetValue(self.scalebarDict['numbers'])
 
         # font
-        fontsizeText = wx.StaticText(
+        fontsizeText = StaticText(
             panel, id=wx.ID_ANY, label=_("Font size:"))
         self.fontsizeCtrl = SpinCtrl(
             panel, id=wx.ID_ANY, min=4, max=30, initial=10)
@@ -5187,7 +5188,7 @@
         border = wx.BoxSizer(wx.VERTICAL)
 
         # text entry
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -5194,7 +5195,7 @@
             _("Text"))
         sizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)
 
-        textLabel = wx.StaticText(panel, id=wx.ID_ANY, label=_("Enter text:"))
+        textLabel = StaticText(panel, id=wx.ID_ANY, label=_("Enter text:"))
         self.textCtrl = ExpandoTextCtrl(
             panel, id=wx.ID_ANY, value=self.textDict['text'])
 
@@ -5211,7 +5212,7 @@
         border.Add(sizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=5)
 
         # font
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -5261,7 +5262,7 @@
         border.Add(sizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=5)
 
         # text effects
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -5281,7 +5282,7 @@
             panel, id=wx.ID_ANY)
         self.effect['highlightWidth'] = SpinCtrl(
             panel, id=wx.ID_ANY, size=self.spinCtrlSize, min=0, max=5, initial=1)
-        self.effect['highlightWidthLabel'] = wx.StaticText(
+        self.effect['highlightWidthLabel'] = StaticText(
             panel, id=wx.ID_ANY, label=_("Width (pts):"))
 
         self.effect['borderCtrl'] = wx.CheckBox(
@@ -5289,7 +5290,7 @@
         self.effect['borderColor'] = wx.ColourPickerCtrl(panel, id=wx.ID_ANY)
         self.effect['borderWidth'] = SpinCtrl(
             panel, id=wx.ID_ANY, size=self.spinCtrlSize, min=1, max=25, initial=1)
-        self.effect['borderWidthLabel'] = wx.StaticText(
+        self.effect['borderWidthLabel'] = StaticText(
             panel, id=wx.ID_ANY, label=_("Width (pts):"))
 
         # set values
@@ -5378,7 +5379,7 @@
 
         border = wx.BoxSizer(wx.VERTICAL)
 
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -5390,7 +5391,7 @@
         self.AddExtendedPosition(panel, gridBagSizer, self.textDict)
 
         # offset
-        box3 = wx.StaticBox(
+        box3 = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -5397,9 +5398,9 @@
             _("Offset"))
         sizerO = wx.StaticBoxSizer(box3, wx.VERTICAL)
         gridBagSizerO = wx.GridBagSizer(hgap=5, vgap=5)
-        self.xoffLabel = wx.StaticText(
+        self.xoffLabel = StaticText(
             panel, id=wx.ID_ANY, label=_("horizontal (pts):"))
-        self.yoffLabel = wx.StaticText(
+        self.yoffLabel = StaticText(
             panel, id=wx.ID_ANY, label=_("vertical (pts):"))
         self.xoffCtrl = SpinCtrl(
             panel, id=wx.ID_ANY, size=(50, -1),
@@ -5435,7 +5436,7 @@
             flag=wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND,
             border=0)
         # reference point
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -5489,7 +5490,7 @@
         border.Add(sizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=5)
 
         # rotation
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -5775,7 +5776,7 @@
         #
         # choose image
         #
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -5824,7 +5825,7 @@
             proportion=0,
             flag=wx.EXPAND | wx.BOTTOM,
             border=5)
-        panel.image['sizeInfo'] = wx.StaticText(parent=panel, id=wx.ID_ANY)
+        panel.image['sizeInfo'] = StaticText(parent=panel, id=wx.ID_ANY)
         vSizer.Add(
             panel.image['sizeInfo'],
             proportion=0,
@@ -5834,7 +5835,7 @@
         hSizer.Add(vSizer, proportion=0, flag=wx.EXPAND, border=0)
         sizer.Add(hSizer, proportion=1, flag=wx.EXPAND | wx.ALL, border=3)
 
-        epsInfo = wx.StaticText(parent=panel, id=wx.ID_ANY,
+        epsInfo = StaticText(parent=panel, id=wx.ID_ANY,
                                 label=_("Note: only EPS format supported"))
         sizer.Add(
             epsInfo,
@@ -5847,7 +5848,7 @@
         #
         # rotation
         #
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -5856,7 +5857,7 @@
 
         gridSizer = wx.GridBagSizer(hgap=5, vgap=5)
 
-        scaleLabel = wx.StaticText(
+        scaleLabel = StaticText(
             parent=panel, id=wx.ID_ANY, label=_("Scale:"))
         if fs:
             panel.image['scale'] = fs.FloatSpin(
@@ -5865,7 +5866,7 @@
             panel.image['scale'].SetFormat("%f")
             panel.image['scale'].SetDigits(1)
         else:
-            panel.image['scale'] = wx.TextCtrl(
+            panel.image['scale'] = TextCtrl(
                 panel, id=wx.ID_ANY, size=self.spinCtrlSize,
                 validator=TCValidator(flag='DIGIT_ONLY'))
 
@@ -5889,7 +5890,7 @@
             pos=(0, 1),
             flag=wx.ALIGN_CENTER_VERTICAL)
 
-        rotLabel = wx.StaticText(
+        rotLabel = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Rotation angle (deg):"))
@@ -5947,7 +5948,7 @@
         #
         # set position
         #
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -6082,7 +6083,7 @@
 
     def DrawWarningText(self, warning):
         """Draw text on preview window"""
-        buffer = wx.EmptyBitmap(*self.previewSize)
+        buffer = EmptyBitmap(*self.previewSize)
         dc = wx.MemoryDC()
         dc.SelectObject(buffer)
         dc.SetBrush(wx.Brush(wx.Colour(250, 250, 250)))
@@ -6098,7 +6099,7 @@
         """Draw bitmap, center it if smaller than preview size"""
         if bitmap.GetWidth() <= self.previewSize[
                 0] and bitmap.GetHeight() <= self.previewSize[1]:
-            buffer = wx.EmptyBitmap(*self.previewSize)
+            buffer = EmptyBitmap(*self.previewSize)
             dc = wx.MemoryDC()
             dc.SelectObject(buffer)
             dc.SetBrush(dc.GetBrush())
@@ -6122,7 +6123,7 @@
 
     def ClearPreview(self):
         """Clear preview window"""
-        buffer = wx.EmptyBitmap(*self.previewSize)
+        buffer = EmptyBitmap(*self.previewSize)
         dc = wx.MemoryDC()
         dc.SelectObject(buffer)
         dc.SetBrush(wx.WHITE_BRUSH)
@@ -6254,8 +6255,8 @@
         return os.path.join(gisbase, 'etc', 'paint', 'decorations')
 
     def _addConvergence(self, panel, gridBagSizer):
-        convergence = wx.Button(parent=panel, id=wx.ID_ANY,
-                                label=_("Compute convergence"))
+        convergence = Button(parent=panel, id=wx.ID_ANY,
+                             label=_("Compute convergence"))
         gridBagSizer.Add(convergence, pos=(1, 2),
                          flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND)
         convergence.Bind(wx.EVT_BUTTON, self.OnConvergence)
@@ -6322,7 +6323,7 @@
         #
         # choose image
         #
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -6332,23 +6333,23 @@
         gridSizer = wx.GridBagSizer(hgap=5, vgap=5)
 
         gridSizer.Add(
-            wx.StaticText(
+            StaticText(
                 parent=panel, id=wx.ID_ANY, label=_("Select symbol:")), pos=(
                 0, 0), flag=wx.ALIGN_CENTER_VERTICAL)
 
-        self.symbolLabel = wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                         label=self.pointDict['symbol'])
+        self.symbolLabel = StaticText(parent=panel, id=wx.ID_ANY,
+                                      label=self.pointDict['symbol'])
         gridSizer.Add(self.symbolLabel, pos=(0, 1),
                       flag=wx.ALIGN_CENTER_VERTICAL)
         bitmap = wx.Bitmap(os.path.join(globalvar.SYMBDIR,
                                         self.pointDict['symbol']) + '.png')
-        self.symbolButton = wx.BitmapButton(panel, id=wx.ID_ANY, bitmap=bitmap)
+        self.symbolButton = BitmapButton(panel, id=wx.ID_ANY, bitmap=bitmap)
         self.symbolButton.Bind(wx.EVT_BUTTON, self.OnSymbolSelection)
 
         gridSizer.Add(
             self.symbolButton, pos=(0, 2),
             flag=wx.ALIGN_CENTER_VERTICAL)
-        self.noteLabel = wx.StaticText(
+        self.noteLabel = StaticText(
             parent=panel, id=wx.ID_ANY, label=_(
                 "Note: Selected symbol is not displayed\n"
                 "in draft mode (only in preview mode)"))
@@ -6371,7 +6372,7 @@
         #
 
         # outline
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -6380,7 +6381,7 @@
 
         gridSizer = wx.GridBagSizer(hgap=5, vgap=5)
 
-        outlineLabel = wx.StaticText(
+        outlineLabel = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Outline color:"))
@@ -6407,7 +6408,7 @@
             self.outlineTranspCtrl, pos=(
                 0, 2), flag=wx.ALIGN_CENTER_VERTICAL)
 
-        fillLabel = wx.StaticText(
+        fillLabel = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Fill color:"))
@@ -6445,7 +6446,7 @@
         #
 
         # size
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -6454,7 +6455,7 @@
 
         gridSizer = wx.GridBagSizer(hgap=5, vgap=5)
 
-        sizeLabel = wx.StaticText(
+        sizeLabel = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Size (pt):"))
@@ -6471,7 +6472,7 @@
                 0, 1), flag=wx.ALIGN_CENTER_VERTICAL)
 
         # rotation
-        rotLabel = wx.StaticText(
+        rotLabel = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Rotation angle (deg):"))
@@ -6531,7 +6532,7 @@
         #
         # set position
         #
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -6731,7 +6732,7 @@
         border = wx.BoxSizer(wx.VERTICAL)
 
         # color
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -6739,7 +6740,7 @@
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(hgap=5, vgap=5)
 
-        outlineLabel = wx.StaticText(
+        outlineLabel = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Outline color:"))
@@ -6771,7 +6772,7 @@
 
         # fill color only in rectangle
         if self.objectType == ('rectangle',):
-            fillLabel = wx.StaticText(
+            fillLabel = StaticText(
                 parent=panel, id=wx.ID_ANY, label=_("Fill color:"))
             self.fillColorCtrl = wx.ColourPickerCtrl(panel, id=wx.ID_ANY)
             self.fillTranspCtrl = wx.CheckBox(
@@ -6800,7 +6801,7 @@
         gridSizer = wx.GridBagSizer(hgap=5, vgap=5)
 
         # width
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -6807,7 +6808,7 @@
             _("Line style"))
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
 
-        widthLabel = wx.StaticText(
+        widthLabel = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Line width:"))
@@ -6923,7 +6924,7 @@
 
         border = wx.BoxSizer(wx.VERTICAL)
 
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel, id=wx.ID_ANY, label=" %s " %
             _("Vector label files created beforehand by v.label module"))
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
@@ -6940,11 +6941,11 @@
             proportion=1,
             flag=wx.EXPAND | wx.ALL,
             border=5)
-        helpText = wx.StaticText(
+        helpText = StaticText(
             panel, id=wx.ID_ANY,
             label=_("You can select multiple label files."))
         helpText.SetForegroundColour(
-            wx.SystemSettings_GetColour(
+            wx.SystemSettings.GetColour(
                 wx.SYS_COLOUR_GRAYTEXT))
         sizer.Add(
             helpText,

Modified: grass/trunk/gui/wxpython/psmap/frame.py
===================================================================
--- grass/trunk/gui/wxpython/psmap/frame.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/psmap/frame.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -17,7 +17,10 @@
 
 import os
 import sys
-import Queue
+if sys.version_info.major == 2:
+    import Queue
+else:
+    import queue as Queue
 from math import sin, cos, pi, sqrt
 
 import wx
@@ -39,7 +42,7 @@
 from gui_core.forms import GUI
 from gui_core.dialogs import HyperlinkDialog
 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 gui_core.toolbars import ToolSwitcher
 
@@ -103,10 +106,10 @@
         }
         # available 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
         self.pen = {
@@ -855,9 +858,9 @@
         if 0 < rotation < pi:
             Y = y - H
         if rotation == 0:
-            return wx.Rect(x, y, *textExtent)
+            return Rect(x, y, *textExtent)
         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):
         """creates a wx.Font object from selected postscript font. To be
@@ -1255,7 +1258,7 @@
         self.pdcImage = PseudoDC()
 
         self.SetClientSize((700, 510))  # ?
-        self._buffer = wx.EmptyBitmap(*self.GetClientSize())
+        self._buffer = EmptyBitmap(*self.GetClientSize())
 
         self.idBoxTmp = wx.NewId()
         self.idZoomBoxTmp = wx.NewId()
@@ -1362,7 +1365,7 @@
 
         x = cW / 2 - pW / 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):
         """Recalculates rectangle not to have negative size"""
@@ -1501,7 +1504,7 @@
         else:
             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.mouse['use'] = oldUse
 
@@ -1694,7 +1697,7 @@
                             self.dragId].type].updateDialog()
 
         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]
 
             diffX = event.GetX() - self.mouse['begin'][0]
@@ -1710,7 +1713,7 @@
                     return
 
                 beginCoordinates = self.CanvasPaperCoordinates(
-                    rect=wx.Rect(
+                    rect=Rect(
                         self.mouse['begin'][0],
                         self.mouse['begin'][1],
                         0, 0),
@@ -1772,7 +1775,7 @@
             if self.mouse['use'] in (
                     'zoomin', 'zoomout', 'addMap', 'addLine', 'addRectangle'):
                 self.mouse['end'] = event.GetPosition()
-                r = wx.Rect(
+                r = Rect(
                     self.mouse['begin'][0],
                     self.mouse['begin'][1],
                     self.mouse['end'][0] -
@@ -1847,7 +1850,7 @@
                     if newWidth < 10 or newHeight < 10:
                         return
 
-                    bounds = wx.Rect(x, y, newWidth, newHeight)
+                    bounds = Rect(x, y, newWidth, newHeight)
                     self.Draw(
                         pen=self.pen['map'],
                         brush=self.brush['map'],
@@ -1897,7 +1900,7 @@
 
                     # update paper coordinates
                     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)
 
@@ -2149,7 +2152,7 @@
         self.Zoom(zoomFactor, view)
 
     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.
 
         :param pdc: PseudoDC
@@ -2191,17 +2194,17 @@
             dc.SetFont(font)
             pdc.SetFont(font)
             text = '\n'.join(self.itemLabels[drawid])
-            w, h, lh = dc.GetMultiLineTextExtent(text)
+            w, h = dc.GetMultiLineTextExtent(text)
             textExtent = (w, h)
-            textRect = wx.Rect(0, 0, *textExtent).CenterIn(bb)
+            textRect = Rect(0, 0, *textExtent).CenterIn(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
                 font.SetPointSize(size)
                 dc.SetFont(font)
                 pdc.SetFont(font)
                 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.SetBackgroundMode(wx.TRANSPARENT)
             pdc.DrawLabel(text=text, rect=textRect)
@@ -2327,7 +2330,7 @@
         else:
             pdc.DrawRotatedText(textDict['text'], coords[0], coords[1], rot)
 
-        pdc.SetIdBounds(drawId, wx.Rect(*bounds))
+        pdc.SetIdBounds(drawId, Rect(*bounds))
         self.Refresh()
         pdc.EndDrawing()
 
@@ -2382,7 +2385,7 @@
         iH = iH * self.currScale
         x = cW / 2 - iW / 2
         y = cH / 2 - iH / 2
-        imageRect = wx.Rect(x, y, iW, iH)
+        imageRect = Rect(x, y, iW, iH)
 
         return imageRect
 
@@ -2404,7 +2407,7 @@
             # draw small marks signalizing resizing
             if self.instruction[id].type in ('map', 'rectangle'):
                 controlP = self.pdcObj.GetIdBounds(id).GetBottomRight()
-                rect = wx.RectPS(controlP, self.resizeBoxSize)
+                rect = Rect(controlP, self.resizeBoxSize)
                 self.Draw(
                     pen=self.pen['resize'],
                     brush=self.brush['resize'],
@@ -2421,9 +2424,9 @@
                 p2Canvas = self.CanvasPaperCoordinates(
                     rect=Rect2DPS(p2Paper, (0, 0)), canvasToPaper=False)[:2]
                 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)):
                     self.Draw(
                         pen=self.pen['resize'],
@@ -2495,11 +2498,11 @@
         # 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 a file, or whatever.
-        self._buffer = wx.EmptyBitmap(width, height)
+        self._buffer = EmptyBitmap(width, height)
         # re-render image on idle
         self.resize = True
 
     def ScaleRect(self, rect, scale):
         """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)

Modified: grass/trunk/gui/wxpython/psmap/instructions.py
===================================================================
--- grass/trunk/gui/wxpython/psmap/instructions.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/psmap/instructions.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -34,6 +34,7 @@
 
 import os
 import string
+import six
 from math import ceil
 from time import strftime, localtime
 
@@ -762,8 +763,8 @@
                         # e.g. paper a3
                         try:
                             instr['Format'] = pformat
-                            for key, value in availableFormats[
-                                    pformat].iteritems():
+                            for key, value in six.iteritems(availableFormats[
+                                                            pformat]):
                                 instr[key] = float(value)
                             break
                         except KeyError:

Modified: grass/trunk/gui/wxpython/psmap/utils.py
===================================================================
--- grass/trunk/gui/wxpython/psmap/utils.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/psmap/utils.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -385,14 +385,13 @@
     if not portrait:
         orient = 'r'
     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):
         GError(message=_("Unable to run `ps.map -b`"))
         return None

Modified: grass/trunk/gui/wxpython/rdigit/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/rdigit/dialogs.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/rdigit/dialogs.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -18,6 +18,7 @@
 
 from core.utils import _
 from gui_core.gselect import Select
+from gui_core.wrap import Button, StaticText
 from core.gcmd import GWarning
 
 import grass.script.core as gcore
@@ -42,8 +43,8 @@
         self._typeChoice.SetSelection(0)
         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.Bind(wx.EVT_BUTTON, self.OnOK)
 
@@ -50,16 +51,16 @@
         # do layout
         mainSizer = wx.BoxSizer(wx.VERTICAL)
         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)
         sizer.Add(self._mapSelect, pos=(1, 0), span=(1, 2))
         sizer.Add(
-            wx.StaticText(
+            StaticText(
                 self, label=_("Optionally select background raster map:")), pos=(
                 2, 0), span=(
                 1, 2), flag=wx.ALIGN_CENTER_VERTICAL)
         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)
         sizer.Add(self._typeChoice, pos=(4, 1), flag=wx.EXPAND)
 

Modified: grass/trunk/gui/wxpython/rdigit/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/rdigit/toolbars.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/rdigit/toolbars.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -21,6 +21,7 @@
 from icons.icon import MetaIcon
 from gui_core.widgets import FloatValidator
 import wx.lib.colourselect as csel
+from gui_core.wrap import TextCtrl, StaticText
 
 
 rdigitIcons = {'area': MetaIcon(img='polygon-create',
@@ -82,7 +83,7 @@
                               lambda evt: self._cellValueChanged())
         self._valueCombo.SetSelection(0)
         self._cellValueChanged()
-        labelValue = wx.StaticText(self, label=" %s" % _("Cell value:"))
+        labelValue = StaticText(self, label=" %s" % _("Cell value:"))
         self.InsertControl(6, labelValue)
         self.InsertControl(7, self._valueCombo)
 
@@ -89,15 +90,15 @@
         self._widthValueId = wx.NewId()
         # validator does not work with combobox, SetBackgroundColor is not
         # working
-        self._widthValue = wx.TextCtrl(
+        self._widthValue = TextCtrl(
             self, id=self._widthValueId, value='0', size=(
                 80, -1), validator=FloatValidator())
         self._widthValue.Bind(wx.EVT_TEXT,
                               lambda evt: self._widthValueChanged())
         self._widthValueChanged()
-        self._widthValue.SetToolTipString(
+        self._widthValue.SetToolTip(
             _("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(9, self._widthValue)
 

Modified: grass/trunk/gui/wxpython/rlisetup/frame.py
===================================================================
--- grass/trunk/gui/wxpython/rlisetup/frame.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/rlisetup/frame.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -15,6 +15,7 @@
 from rlisetup.wizard import RLIWizard
 import locale
 import codecs
+from gui_core.wrap import Button, StaticBox, TextCtrl
 
 
 class ViewFrame(wx.Frame):
@@ -32,20 +33,20 @@
         self.SetIcon(wx.Icon(os.path.join(globalvar.ICONDIR, 'grass.ico'),
                              wx.BITMAP_TYPE_ICO))
         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=_(
                 "View and modify the "
                 "configuration file '{name}'".format(
                     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)
         f = open(self.pathfile)
         self.textCtrl.SetValue(''.join(f.readlines()))
         f.close()
         # 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_ok.Bind(wx.EVT_BUTTON, self.OnOk)
         self._layout()
@@ -127,7 +128,7 @@
                              wx.BITMAP_TYPE_ICO))
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
         # box for select configuration file
-        self.confilesBox = wx.StaticBox(
+        self.confilesBox = StaticBox(
             parent=self.panel, id=wx.ID_ANY,
             label=_('Available sampling area configuration files'))
         self.listfileBox = wx.ListBox(parent=self.panel, id=wx.ID_ANY,
@@ -134,20 +135,20 @@
                                       choices=self.listfiles)
 
         # 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"))
-        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"))
-        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"))
-        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"))
-        self.btn_view.SetToolTipString(_('View and edit a configuration file'))
+        self.btn_view.SetToolTip(_('View and edit a configuration file'))
         # set action for button
         self.btn_close.Bind(wx.EVT_BUTTON, self.OnClose)
         self.btn_help.Bind(wx.EVT_BUTTON, self.OnHelp)

Modified: grass/trunk/gui/wxpython/rlisetup/sampling_frame.py
===================================================================
--- grass/trunk/gui/wxpython/rlisetup/sampling_frame.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/rlisetup/sampling_frame.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -47,7 +47,7 @@
 from grass.pydispatch.signal import Signal
 from grass.pydispatch.errors import DispatcherKeyError
 
-from functions import SamplingType, checkMapExists
+from .functions import SamplingType, checkMapExists
 
 
 class Circle:

Modified: grass/trunk/gui/wxpython/rlisetup/wizard.py
===================================================================
--- grass/trunk/gui/wxpython/rlisetup/wizard.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/rlisetup/wizard.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -33,6 +33,7 @@
 import wx.lib.scrolledpanel as scrolled
 
 from gui_core import gselect
+from gui_core.wrap import Button, StaticText, TextCtrl
 from core.utils import _
 from location_wizard.wizard import TitledPage as TitledPage
 from rlisetup.functions import checkValue, retRLiPath
@@ -493,12 +494,12 @@
         self.parent = parent
 
         # name of output configuration file
-        self.newconflabel = wx.StaticText(
+        self.newconflabel = StaticText(
             parent=self, id=wx.ID_ANY,
             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)
 
         self.sizer.Add(self.newconflabel, border=5, pos=(0, 0),
@@ -506,7 +507,7 @@
         self.sizer.Add(self.newconftxt, border=5, pos=(0, 1),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         # raster
-        self.mapsellabel = wx.StaticText(
+        self.mapsellabel = StaticText(
             parent=self, id=wx.ID_ANY,
             label=_('Raster map to use to select areas'))
         self.mapselect = gselect.Select(parent=self, id=wx.ID_ANY,
@@ -517,7 +518,7 @@
         self.sizer.Add(self.mapselect, border=5, pos=(1, 1),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         # vector
-        self.vectsellabel = wx.StaticText(
+        self.vectsellabel = StaticText(
             parent=self, id=wx.ID_ANY,
             label=_('Vector map to use to select areas'))
         self.vectselect = gselect.Select(parent=self, id=wx.ID_ANY,
@@ -528,7 +529,7 @@
         self.sizer.Add(self.vectselect, border=5, pos=(2, 1),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         # vector layer
-        self.vectlaylabel = wx.StaticText(
+        self.vectlaylabel = StaticText(
             parent=self, id=wx.ID_ANY,
             label=_('Vector map layer to use to select areas'))
         self.vectlayer = wx.ComboBox(parent=self, id=wx.ID_ANY,
@@ -554,7 +555,7 @@
         self.sizer.Add(self.sampling_reg,
                        flag=wx.ALIGN_CENTER | wx.ALL | wx.EXPAND, border=5,
                        pos=(5, 0), span=(1, 2))
-        self.infoError = wx.StaticText(self, label='')
+        self.infoError = StaticText(self, label='')
         self.infoError.SetForegroundColour(wx.RED)
         self.sizer.Add(self.infoError,
                        flag=wx.ALIGN_CENTER | wx.ALL | wx.EXPAND, border=5,
@@ -713,12 +714,12 @@
         self.row_up = '0'
 
         # 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 "
                                                     "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)
 
         self.sizer.Add(self.ColUpLeftlabel, border=5, pos=(1, 1),
@@ -727,11 +728,11 @@
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.AddGrowableCol(2)
         # row up/left
-        self.RowUpLeftlabel = wx.StaticText(
+        self.RowUpLeftlabel = StaticText(
             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)
 
         self.sizer.Add(self.RowUpLeftlabel, border=5, pos=(2, 1),
@@ -740,12 +741,12 @@
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
 
         # row length
-        self.RowLenlabel = wx.StaticText(
+        self.RowLenlabel = StaticText(
             parent=self,
             id=wx.ID_ANY,
             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)
 
         self.sizer.Add(self.RowLenlabel, border=5, pos=(3, 1),
@@ -754,12 +755,12 @@
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
 
         # column length
-        self.ColLenlabel = wx.StaticText(
+        self.ColLenlabel = StaticText(
             parent=self,
             id=wx.ID_ANY,
             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)
 
         self.sizer.Add(self.ColLenlabel, border=5, pos=(4, 1),
@@ -912,10 +913,10 @@
 
         self.regionPanelSizer = wx.GridBagSizer(1, 2)
         self.regionNumPanel = wx.Panel(parent=self, id=wx.ID_ANY)
-        self.regionNumLabel = wx.StaticText(
+        self.regionNumLabel = StaticText(
             parent=self.regionNumPanel, id=wx.ID_ANY,
             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))
         self.regionPanelSizer.Add(self.regionNumLabel, flag=wx.ALIGN_CENTER,
                                   pos=(0, 0))
@@ -927,17 +928,17 @@
 
         self.areaPanelSizer = wx.GridBagSizer(2, 3)
         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=_(
                 'Do you want to overwrite existing'
                 ' temporal maps if they exist?'))
         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,
             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.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.areaOK.Bind(wx.EVT_BUTTON, self.OnVectYes)
         self.areaNO.Bind(wx.EVT_BUTTON, self.OnVectNo)
@@ -953,7 +954,7 @@
         self.areaPanel.SetSizer(self.areaPanelSizer)
         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,
             label=_('Analysing all vector features...'))
         self.sizer.Add(self.calculatingAreas, flag=wx.ALIGN_CENTER, pos=(4, 0))
@@ -1189,9 +1190,9 @@
 
         self.panelSizer.Add(self.typeBox, flag=wx.ALIGN_LEFT, pos=(0, 0),
                             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.widthLabel, pos=(1, 0),
@@ -1200,9 +1201,9 @@
             self.widthTxt, pos=(1, 1),
             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.heightLabel, pos=(2, 0),
@@ -1231,11 +1232,11 @@
         self.panelSizer.Add(self.distributionBox, pos=(3, 0), span=(
             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 "
                                                  "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.distr1Label, pos=(4, 0),
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
@@ -1242,10 +1243,10 @@
         self.panelSizer.Add(
             self.distr1Txt, pos=(4, 1),
             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="")
-        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.distr2Label, pos=(5, 0),
             flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
@@ -1367,16 +1368,16 @@
         self.typeBox.Bind(wx.EVT_RADIOBOX, self.OnType)
         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)?'))
-        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),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.Add(self.widthTxt, border=5, pos=(2, 2),
                        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)?'))
-        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),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.Add(self.heightTxt, border=5, pos=(3, 2),
@@ -1456,11 +1457,11 @@
 
         self.regionPanelSizer = wx.GridBagSizer(1, 2)
         self.regionNumPanel = wx.Panel(parent=self, id=wx.ID_ANY)
-        self.regionNumLabel = wx.StaticText(
+        self.regionNumLabel = StaticText(
             parent=self.regionNumPanel, id=wx.ID_ANY,
             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,
                                   pos=(0, 0))
         self.regionPanelSizer.Add(self.regionNumTxt, flag=wx.ALIGN_CENTER,
@@ -1617,10 +1618,10 @@
         self.Bind(wiz.EVT_WIZARD_PAGE_CHANGING, self.OnExitPage)
         self.areaPanelSizer = wx.GridBagSizer(1, 3)
         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?'))
-        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.areaNO.Bind(wx.EVT_BUTTON, self.OnNo)
         self.areaPanelSizer.Add(self.areaText, flag=wx.ALIGN_CENTER,
@@ -1740,19 +1741,19 @@
         self.parent = parent
 
         # 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),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.Add(self.conftxt, border=5, pos=(0, 1),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         # 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),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.Add(self.rasttxt, border=5, pos=(1, 1),
@@ -1759,9 +1760,9 @@
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
 
         # 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),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.Add(self.vecttxt, border=5, pos=(2, 1),
@@ -1768,9 +1769,9 @@
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
 
         # 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),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.Add(self.regiontxt, border=5, pos=(3, 1),
@@ -1777,9 +1778,9 @@
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
 
         # 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),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.Add(self.regionkeytxt, border=5, pos=(4, 1),
@@ -1786,54 +1787,54 @@
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.Bind(wiz.EVT_WIZARD_PAGE_CHANGED, self.OnEnterPage)
         # 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),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.Add(self.samplingtxt, border=5, pos=(5, 1),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         # 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),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.Add(self.shapetxt, border=5, pos=(6, 1),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         # 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),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.Add(self.shapewidthtxt, border=5, pos=(7, 1),
                        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),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.Add(self.shapeheighttxt, border=5, pos=(8, 1),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         # 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),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.Add(self.unitstxt, border=5, pos=(9, 1),
                        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),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.Add(self.unitsmoretxt, border=5, pos=(10, 1),
                        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),
                        flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
         self.sizer.Add(self.unitsmoretxt2, border=5, pos=(11, 1),

Modified: grass/trunk/gui/wxpython/startup/locdownload.py
===================================================================
--- grass/trunk/gui/wxpython/startup/locdownload.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/startup/locdownload.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -44,7 +44,7 @@
 from core.debug import Debug
 from core.utils import _
 from core.gthread import gThread
-from gui_core.wrap import Button
+from gui_core.wrap import Button, StaticText
 
 
 # TODO: labels (and descriptions) translatable?
@@ -288,7 +288,7 @@
         self.database = database
         self.locations = locations
 
-        self.label = wx.StaticText(
+        self.label = StaticText(
             parent=self,
             label=_("Select sample location to download:"))
 
@@ -307,7 +307,7 @@
         # TODO: add thumbnail for each location?
 
         # 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)
 
         # It is not clear if all wx versions supports color, so try-except.

Modified: grass/trunk/gui/wxpython/timeline/frame.py
===================================================================
--- grass/trunk/gui/wxpython/timeline/frame.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/timeline/frame.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -17,6 +17,7 @@
 """
 import os
 import signal
+import six
 from math import ceil
 from itertools import cycle
 import numpy as np
@@ -45,6 +46,7 @@
 import grass.temporal as tgis
 from core.gcmd import GError, GException, RunCommand
 from gui_core import gselect
+from gui_core.wrap import Button, StaticText
 from core import globalvar
 
 ALPHA = 1
@@ -132,9 +134,9 @@
         self.datasetSelect = gselect.Select(parent=self.panel, id=wx.ID_ANY,
                                             size=globalvar.DIALOG_GSELECT_SIZE,
                                             type='stds', multiple=True)
-        self.drawButton = wx.Button(self.panel, id=wx.ID_ANY, label=_("Draw"))
+        self.drawButton = Button(self.panel, id=wx.ID_ANY, label=_("Draw"))
         self.drawButton.Bind(wx.EVT_BUTTON, self.OnRedraw)
-        self.helpButton = wx.Button(self.panel, id=wx.ID_ANY, label=_("Help"))
+        self.helpButton = Button(self.panel, id=wx.ID_ANY, label=_("Help"))
         self.helpButton.Bind(wx.EVT_BUTTON, self.OnHelp)
         self.view3dCheck = wx.CheckBox(
             self.panel, id=wx.ID_ANY,
@@ -145,8 +147,8 @@
                                         "(matplotlib >= 1.0.0)"))
             self.view3dCheck.Disable()
 
-        gridSizer.Add(wx.StaticText(self.panel, id=wx.ID_ANY,
-                                    label=_("Select space time dataset(s):")),
+        gridSizer.Add(StaticText(self.panel, id=wx.ID_ANY,
+                                 label=_("Select space time dataset(s):")),
                       pos=(0, 0), flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL)
         gridSizer.Add(self.datasetSelect, pos=(1, 0), flag=wx.EXPAND)
         gridSizer.Add(self.drawButton, pos=(1, 1), flag=wx.EXPAND)
@@ -444,8 +446,8 @@
         tDict = tgis.tlist_grouped('stds', group_type=True, dbif=self.dbif)
         # nested list with '(map, mapset, etype)' items
         allDatasets = [[[(map, mapset, etype) for map in maps]
-                        for etype, maps in etypesDict.iteritems()]
-                       for mapset, etypesDict in tDict.iteritems()]
+                        for etype, maps in six.iteritems(etypesDict)]
+                       for mapset, etypesDict in six.iteritems(tDict)]
         # flatten this list
         if allDatasets:
             allDatasets = reduce(

Modified: grass/trunk/gui/wxpython/tools/update_menudata.py
===================================================================
--- grass/trunk/gui/wxpython/tools/update_menudata.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/tools/update_menudata.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -151,7 +151,7 @@
         print(sys.stderr, __doc__, file=sys.stderr)
         return 1
 
-    nuldev = file(os.devnull, 'w+')
+    nuldev = open(os.devnull, 'w+')
     grass.info("Step 1: running make...")
     grass.call(['make'], stderr=nuldev)
     grass.info("Step 2: parsing modules...")

Modified: grass/trunk/gui/wxpython/tplot/frame.py
===================================================================
--- grass/trunk/gui/wxpython/tplot/frame.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/tplot/frame.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -19,6 +19,7 @@
 @author start stvds support Matej Krejci
 """
 import os
+import six
 from itertools import cycle
 import numpy as np
 
@@ -63,6 +64,7 @@
 import wx.lib.filebrowsebutton as filebrowse
 
 from gui_core.widgets import GNotebook
+from gui_core.wrap import TextCtrl, Button, StaticText
 
 ALPHA = 0.5
 COLORS = ['b', 'g', 'r', 'c', 'm', 'y', 'k']
@@ -177,7 +179,7 @@
         # ------------ITEMS IN NOTEBOOK PAGE (RASTER)------------------------
 
         self.controlPanelRaster = wx.Panel(parent=self.ntb, id=wx.ID_ANY)
-        self.datasetSelectLabelR = wx.StaticText(
+        self.datasetSelectLabelR = StaticText(
             parent=self.controlPanelRaster,
             id=wx.ID_ANY,
             label=_(
@@ -189,21 +191,21 @@
         self.datasetSelectR = gselect.Select(
             parent=self.controlPanelRaster, id=wx.ID_ANY,
             size=globalvar.DIALOG_GSELECT_SIZE, type='strds', multiple=True)
-        self.coor = wx.StaticText(parent=self.controlPanelRaster, id=wx.ID_ANY,
-                                  label=_('X and Y coordinates separated by '
-                                          'comma:'))
+        self.coor = StaticText(parent=self.controlPanelRaster, id=wx.ID_ANY,
+                               label=_('X and Y coordinates separated by '
+                                       'comma:'))
         try:
             self._giface.GetMapWindow()
             self.coorval = gselect.CoordinatesSelect(
                 parent=self.controlPanelRaster, giface=self._giface)
         except:
-            self.coorval = wx.TextCtrl(parent=self.controlPanelRaster,
+            self.coorval = TextCtrl(parent=self.controlPanelRaster,
                                        id=wx.ID_ANY,
                                        size=globalvar.DIALOG_TEXTCTRL_SIZE,
                                        validator=CoordinatesValidator())
 
-        self.coorval.SetToolTipString(_("Coordinates can be obtained for example"
-                                        " by right-clicking on Map Display."))
+        self.coorval.SetToolTip(_("Coordinates can be obtained for example"
+                                  " by right-clicking on Map Display."))
         self.controlPanelSizerRaster = wx.BoxSizer(wx.VERTICAL)
         # self.controlPanelSizer.Add(wx.StaticText(self.panel, id=wx.ID_ANY,
         # label=_("Select space time raster dataset(s):")),
@@ -222,7 +224,7 @@
 
         # ------------ITEMS IN NOTEBOOK PAGE (VECTOR)------------------------
         self.controlPanelVector = wx.Panel(parent=self.ntb, id=wx.ID_ANY)
-        self.datasetSelectLabelV = wx.StaticText(
+        self.datasetSelectLabelV = StaticText(
             parent=self.controlPanelVector, id=wx.ID_ANY,
             label=_(
                 'Vector temporal '
@@ -237,9 +239,9 @@
                                  self.OnVectorSelected)
 
         self.attribute = gselect.ColumnSelect(parent=self.controlPanelVector)
-        self.attributeLabel = wx.StaticText(parent=self.controlPanelVector,
-                                            id=wx.ID_ANY,
-                                            label=_('Select attribute column'))
+        self.attributeLabel = StaticText(parent=self.controlPanelVector,
+                                         id=wx.ID_ANY,
+                                         label=_('Select attribute column'))
         # TODO fix the category selection as done for coordinates
         try:
             self._giface.GetMapWindow()
@@ -246,13 +248,13 @@
             self.cats = gselect.VectorCategorySelect(
                 parent=self.controlPanelVector, giface=self._giface)
         except:
-            self.cats = wx.TextCtrl(
+            self.cats = TextCtrl(
                 parent=self.controlPanelVector,
                 id=wx.ID_ANY,
                 size=globalvar.DIALOG_TEXTCTRL_SIZE)
-        self.catsLabel = wx.StaticText(parent=self.controlPanelVector,
-                                       id=wx.ID_ANY,
-                                       label=_('Select category of vector(s)'))
+        self.catsLabel = StaticText(parent=self.controlPanelVector,
+                                    id=wx.ID_ANY,
+                                    label=_('Select category of vector(s)'))
 
         self.controlPanelSizerVector = wx.BoxSizer(wx.VERTICAL)
         # self.controlPanelSizer.Add(wx.StaticText(self.panel, id=wx.ID_ANY,
@@ -275,21 +277,21 @@
         
         # ------------ITEMS IN NOTEBOOK PAGE (LABELS)------------------------
         self.controlPanelLabels = wx.Panel(parent=self.ntb, id=wx.ID_ANY)
-        self.titleLabel = wx.StaticText(parent=self.controlPanelLabels,
-                                        id=wx.ID_ANY,
-                                        label=_('Set title for the plot'))
-        self.title = wx.TextCtrl(parent=self.controlPanelLabels, id=wx.ID_ANY,
-                                  size=globalvar.DIALOG_TEXTCTRL_SIZE)
-        self.xLabel = wx.StaticText(parent=self.controlPanelLabels,
-                                        id=wx.ID_ANY,
-                                        label=_('Set label for X axis'))
-        self.x = wx.TextCtrl(parent=self.controlPanelLabels, id=wx.ID_ANY,
-                                  size=globalvar.DIALOG_TEXTCTRL_SIZE)
-        self.yLabel = wx.StaticText(parent=self.controlPanelLabels,
-                                        id=wx.ID_ANY,
-                                        label=_('Set label for Y axis'))
-        self.y = wx.TextCtrl(parent=self.controlPanelLabels, id=wx.ID_ANY,
-                                  size=globalvar.DIALOG_TEXTCTRL_SIZE)
+        self.titleLabel = StaticText(parent=self.controlPanelLabels,
+                                     id=wx.ID_ANY,
+                                     label=_('Set title for the plot'))
+        self.title = TextCtrl(parent=self.controlPanelLabels, id=wx.ID_ANY,
+                              size=globalvar.DIALOG_TEXTCTRL_SIZE)
+        self.xLabel = StaticText(parent=self.controlPanelLabels,
+                                 id=wx.ID_ANY,
+                                 label=_('Set label for X axis'))
+        self.x = TextCtrl(parent=self.controlPanelLabels, id=wx.ID_ANY,
+                          size=globalvar.DIALOG_TEXTCTRL_SIZE)
+        self.yLabel = StaticText(parent=self.controlPanelLabels,
+                                 id=wx.ID_ANY,
+                                 label=_('Set label for Y axis'))
+        self.y = TextCtrl(parent=self.controlPanelLabels, id=wx.ID_ANY,
+                          size=globalvar.DIALOG_TEXTCTRL_SIZE)
         self.controlPanelSizerLabels = wx.BoxSizer(wx.VERTICAL)
         self.controlPanelSizerLabels.Add(self.titleLabel, flag=wx.EXPAND)
         self.controlPanelSizerLabels.Add(self.title, flag=wx.EXPAND)
@@ -304,10 +306,10 @@
 
         # ------------ITEMS IN NOTEBOOK PAGE (EXPORT)------------------------
         self.controlPanelExport = wx.Panel(parent=self.ntb, id=wx.ID_ANY)
-        self.csvLabel = wx.StaticText(parent=self.controlPanelExport,
-                                      id=wx.ID_ANY,
-                                      label=_('Path for output CSV file '
-                                              'with plotted data'))
+        self.csvLabel = StaticText(parent=self.controlPanelExport,
+                                   id=wx.ID_ANY,
+                                   label=_('Path for output CSV file '
+                                           'with plotted data'))
         self.csvButton = filebrowse.FileBrowseButton(parent=self.controlPanelExport,
                                                      id=wx.ID_ANY,
                                                      size=globalvar.DIALOG_GSELECT_SIZE,
@@ -316,10 +318,9 @@
                                                      buttonText=_('Browse'),
                                                      startDirectory=os.getcwd(),
                                                      fileMode=wx.FD_SAVE)
-        self.headerLabel = wx.StaticText(parent=self.controlPanelExport,
-                                         id=wx.ID_ANY,
-                                         label=_('Do you want the CSV header?'
-                                                 ))
+        self.headerLabel = StaticText(parent=self.controlPanelExport,
+                                      id=wx.ID_ANY,
+                                      label=_('Do you want the CSV header?'))
         self.headerCheck = wx.CheckBox(parent=self.controlPanelExport,
                                          id=wx.ID_ANY)
         self.controlPanelSizerCheck = wx.BoxSizer(wx.HORIZONTAL)
@@ -339,11 +340,11 @@
         self.vButtPanel = wx.Panel(self.mainPanel, id=wx.ID_ANY)
         self.vButtSizer = wx.BoxSizer(wx.HORIZONTAL)
 
-        self.drawButton = wx.Button(self.vButtPanel, id=wx.ID_ANY,
-                                    label=_("Draw"))
+        self.drawButton = Button(self.vButtPanel, id=wx.ID_ANY,
+                                 label=_("Draw"))
         self.drawButton.Bind(wx.EVT_BUTTON, self.OnRedraw)
-        self.helpButton = wx.Button(self.vButtPanel, id=wx.ID_ANY,
-                                    label=_("Help"))
+        self.helpButton = Button(self.vButtPanel, id=wx.ID_ANY,
+                                 label=_("Help"))
         self.helpButton.Bind(wx.EVT_BUTTON, self.OnHelp)
         self.vButtSizer.Add(self.drawButton)
         self.vButtSizer.Add(self.helpButton)
@@ -670,7 +671,7 @@
             self.yticksPos.append(1)  # TODO
             xdata = []
             ydata = []
-            for keys, values in self.timeDataR[name].iteritems():
+            for keys, values in six.iteritems(self.timeDataR[name]):
                 if keys in ['temporalType', 'granularity', 'validTopology',
                             'unit', 'temporalDataType']:
                     continue
@@ -711,9 +712,8 @@
             xdata = []
             ydata = []
             xcsv = []
-            for keys, values in self.timeDataV[
-                    name_cat[0]][
-                    name_cat[1]].iteritems():
+            for keys, values in six.iteritems(self.timeDataV[name_cat[0]]
+                                                            [name_cat[1]]):
                 if keys in ['temporalType', 'granularity', 'validTopology',
                             'unit', 'temporalDataType']:
                     continue
@@ -763,7 +763,7 @@
             xdata = []
             ydata = []
             xcsv = []
-            for keys, values in self.timeDataV[name].iteritems():
+            for keys, values in six.iteritems(self.timeDataV[name]):
                 if keys in ['temporalType', 'granularity', 'validTopology',
                             'unit', 'temporalDataType']:
                     continue
@@ -911,8 +911,8 @@
         tDict = tgis.tlist_grouped(type=typ, group_type=True, dbif=self.dbif)
         # nested list with '(map, mapset, etype)' items
         allDatasets = [[[(map, mapset, etype) for map in maps]
-                        for etype, maps in etypesDict.iteritems()]
-                       for mapset, etypesDict in tDict.iteritems()]
+                        for etype, maps in six.iteritems(etypesDict)]
+                       for mapset, etypesDict in six.iteritems(tDict)]
         # flatten this list
         if allDatasets:
             allDatasets = reduce(lambda x, y: x + y, reduce(lambda x, y: x + y,
@@ -1070,7 +1070,7 @@
 
     def GetInformation(self, x):
         values = {}
-        for key, value in self.data.iteritems():
+        for key, value in six.iteritems(self.data):
             if value[x]:
                 values[key] = [self.convert(x), value[x]]
 
@@ -1083,7 +1083,7 @@
 def InfoFormat(timeData, values):
     """Formats information about dataset"""
     text = []
-    for key, val in values.iteritems():
+    for key, val in six.iteritems(values):
         etype = timeData[key]['temporalDataType']
         if etype == 'strds':
             text.append(_("Space time raster dataset: %s") % key)

Modified: grass/trunk/gui/wxpython/vdigit/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/vdigit/dialogs.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/vdigit/dialogs.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -20,6 +20,7 @@
 
 import sys
 import copy
+import six
 
 import wx
 import wx.lib.mixins.listctrl as listmix
@@ -28,7 +29,8 @@
 from core.debug import Debug
 from core.settings import UserSettings
 from core.utils import _
-from gui_core.wrap import SpinCtrl
+from gui_core.wrap import SpinCtrl, Button, StaticText, \
+    StaticBox, Menu
 
 
 class VDigitCategoryDialog(wx.Dialog, listmix.ColumnSorterMixin):
@@ -74,7 +76,7 @@
                            style=style, **kwargs)
 
         # list of categories
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=self, id=wx.ID_ANY, label=" %s " %
             _("List of categories - right-click to delete"))
         listSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
@@ -91,7 +93,7 @@
         self.fidMulti = wx.Choice(parent=self, id=wx.ID_ANY,
                                   size=(150, -1))
         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)
         if len(self.cats.keys()) == 1:
             self.fidMulti.Show(False)
             self.fidText.SetLabel(str(self.fid))
@@ -106,21 +108,21 @@
         listSizer.Add(self.list, proportion=1, flag=wx.EXPAND)
 
         # add new category
-        box = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                           label=" %s " % _("Add new category"))
+        box = StaticBox(parent=self, id=wx.ID_ANY,
+                        label=" %s " % _("Add new category"))
         addSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         flexSizer = wx.FlexGridSizer(cols=5, hgap=5, vgap=5)
         flexSizer.AddGrowableCol(3)
 
-        layerNewTxt = wx.StaticText(parent=self, id=wx.ID_ANY,
-                                    label="%s:" % _("Layer"))
+        layerNewTxt = StaticText(parent=self, id=wx.ID_ANY,
+                                 label="%s:" % _("Layer"))
         self.layerNew = wx.Choice(parent=self, id=wx.ID_ANY, size=(75, -1),
                                   choices=layers)
         if len(layers) > 0:
             self.layerNew.SetSelection(0)
 
-        catNewTxt = wx.StaticText(parent=self, id=wx.ID_ANY,
-                                  label="%s:" % _("Category"))
+        catNewTxt = StaticText(parent=self, id=wx.ID_ANY,
+                               label="%s:" % _("Category"))
 
         try:
             newCat = max(self.cats[self.fid][1]) + 1
@@ -128,7 +130,7 @@
             newCat = 1
         self.catNew = SpinCtrl(parent=self, id=wx.ID_ANY, size=(75, -1),
                                initial=newCat, min=0, max=1e9)
-        btnAddCat = wx.Button(self, wx.ID_ADD)
+        btnAddCat = Button(self, wx.ID_ADD)
         flexSizer.Add(layerNewTxt, proportion=0,
                       flag=wx.FIXED_MINSIZE | wx.ALIGN_CENTER_VERTICAL)
         flexSizer.Add(self.layerNew, proportion=0,
@@ -147,12 +149,12 @@
             border=5)
 
         # buttons
-        btnApply = wx.Button(self, wx.ID_APPLY)
-        btnApply.SetToolTipString(_("Apply changes"))
-        btnCancel = wx.Button(self, wx.ID_CANCEL)
-        btnCancel.SetToolTipString(_("Ignore changes and close dialog"))
-        btnOk = wx.Button(self, wx.ID_OK)
-        btnOk.SetToolTipString(_("Apply changes and close dialog"))
+        btnApply = Button(self, wx.ID_APPLY)
+        btnApply.SetToolTip(_("Apply changes"))
+        btnCancel = Button(self, wx.ID_CANCEL)
+        btnCancel.SetToolTip(_("Ignore changes and close dialog"))
+        btnOk = Button(self, wx.ID_OK)
+        btnOk.SetToolTip(_("Apply changes and close dialog"))
         btnOk.SetDefault()
 
         # sizers
@@ -171,8 +173,8 @@
                       flag=wx.EXPAND | wx.ALIGN_CENTER |
                       wx.LEFT | wx.RIGHT | wx.BOTTOM, border=5)
         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,
                      flag=wx.ALIGN_CENTER_VERTICAL)
         fidSizer.Add(self.fidMulti, proportion=0,
@@ -280,7 +282,7 @@
             self.Bind(wx.EVT_MENU, self.OnReload, id=self.popupID3)
 
         # generate popup-menu
-        menu = wx.Menu()
+        menu = Menu()
         menu.Append(self.popupID1, _("Delete selected"))
         if self.list.GetFirstSelected() == -1:
             menu.Enable(self.popupID1, False)
@@ -413,7 +415,7 @@
         newfid = -1
 
         # add/delete new category
-        for action, catsCurr in check.iteritems():
+        for action, catsCurr in six.iteritems(check):
             for layer in catsCurr[0].keys():
                 catList = []
                 for cat in catsCurr[0][layer]:
@@ -617,13 +619,13 @@
 
         border = wx.BoxSizer(wx.VERTICAL)
 
-        txt = wx.StaticText(
+        txt = StaticText(
             parent=self,
             label=_("%d lines selected for z bulk-labeling") %
             nselected)
         border.Add(txt, proportion=0, flag=wx.ALL | wx.EXPAND, border=5)
 
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=self,
             id=wx.ID_ANY,
             label=" %s " %
@@ -633,8 +635,8 @@
         flexSizer.AddGrowableCol(0)
 
         # starting value
-        txt = wx.StaticText(parent=self,
-                            label=_("Starting value"))
+        txt = StaticText(parent=self,
+                         label=_("Starting value"))
         self.value = SpinCtrl(parent=self, id=wx.ID_ANY, size=(150, -1),
                               initial=0,
                               min=-1e6, max=1e6)
@@ -645,8 +647,8 @@
             flag=wx.ALIGN_CENTER | wx.FIXED_MINSIZE)
 
         # step
-        txt = wx.StaticText(parent=self,
-                            label=_("Step"))
+        txt = StaticText(parent=self,
+                         label=_("Step"))
         self.step = SpinCtrl(parent=self, id=wx.ID_ANY, size=(150, -1),
                              initial=0,
                              min=0, max=1e6)
@@ -664,8 +666,8 @@
         border.Add(sizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=0)
 
         # buttons
-        btnCancel = wx.Button(self, wx.ID_CANCEL)
-        btnOk = wx.Button(self, wx.ID_OK)
+        btnCancel = Button(self, wx.ID_CANCEL)
+        btnOk = Button(self, wx.ID_OK)
         btnOk.SetDefault()
 
         # sizers
@@ -731,8 +733,8 @@
             id += 1
 
         # buttons
-        btnCancel = wx.Button(self, wx.ID_CANCEL)
-        btnOk = wx.Button(self, wx.ID_OK)
+        btnCancel = Button(self, wx.ID_CANCEL)
+        btnOk = Button(self, wx.ID_OK)
         btnOk.SetDefault()
 
         # sizers

Modified: grass/trunk/gui/wxpython/vdigit/mapwindow.py
===================================================================
--- grass/trunk/gui/wxpython/vdigit/mapwindow.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/vdigit/mapwindow.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -16,6 +16,7 @@
 
 import wx
 import tempfile
+import six
 
 from grass.pydispatch.signal import Signal
 
@@ -277,9 +278,9 @@
         dbInfo = gselect.VectorDBInfo(vectorName)
         sqlfile = tempfile.NamedTemporaryFile(mode="w")
         for fid in fids:
-            for layer, cats in self.digit.GetLineCats(fid).iteritems():
+            for layer, cats in six.iteritems(self.digit.GetLineCats(fid)):
                 table = dbInfo.GetTable(layer)
-                for attrb, item in vdigit['geomAttr'].iteritems():
+                for attrb, item in six.iteritems(vdigit['geomAttr']):
                     val = -1
                     if attrb == 'length':
                         val = self.digit.GetLineLength(fid)

Modified: grass/trunk/gui/wxpython/vdigit/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/vdigit/preferences.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/vdigit/preferences.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -15,6 +15,7 @@
 """
 
 import textwrap
+import six
 
 import wx
 import wx.lib.colourselect as csel
@@ -25,7 +26,8 @@
 from core.units import Units
 from core.settings import UserSettings
 from core.utils import _
-from gui_core.wrap import SpinCtrl, Button
+from gui_core.wrap import SpinCtrl, Button, StaticText, \
+    StaticBox
 
 
 class VDigitSettingsDialog(wx.Dialog):
@@ -104,7 +106,7 @@
 
         self.symbology = {}
         for label, key in self._symbologyData():
-            textLabel = wx.StaticText(panel, wx.ID_ANY, label)
+            textLabel = StaticText(panel, wx.ID_ANY, label)
             color = csel.ColourSelect(
                 panel, id=wx.ID_ANY, colour=UserSettings.Get(
                     group='vdigit', key='symbol', subkey=[
@@ -154,7 +156,7 @@
         #
         # display section
         #
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -163,13 +165,13 @@
         flexSizer = wx.FlexGridSizer(cols=3, hgap=5, vgap=5)
         flexSizer.AddGrowableCol(0)
         # line width
-        text = wx.StaticText(parent=panel, id=wx.ID_ANY, label=_("Line width"))
+        text = StaticText(parent=panel, id=wx.ID_ANY, label=_("Line width"))
         self.lineWidthValue = SpinCtrl(
             parent=panel, id=wx.ID_ANY, size=(75, -1),
             initial=UserSettings.Get(
                 group='vdigit', key="lineWidth", subkey='value'),
             min=1, max=1e6)
-        units = wx.StaticText(
+        units = StaticText(
             parent=panel, id=wx.ID_ANY, size=(115, -1),
             label=UserSettings.Get(
                 group='vdigit', key="lineWidth", subkey='units'),
@@ -195,7 +197,7 @@
         #
         # snapping section
         #
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -205,7 +207,7 @@
         flexSizer.AddGrowableCol(0)
 
         # snapping
-        text = wx.StaticText(
+        text = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Snapping threshold"))
@@ -245,7 +247,7 @@
                 subkey='enabled'))
         vertexSizer.Add(self.snapVertex, proportion=0, flag=wx.EXPAND)
         self.mapUnits = self.parent.MapWindow.Map.GetProjInfo()['units']
-        self.snappingInfo = wx.StaticText(
+        self.snappingInfo = StaticText(
             parent=panel, id=wx.ID_ANY,
             label=_("Snapping threshold is %(value).1f %(units)s") %
             {'value': self.digit.GetDisplay().GetThreshold(),
@@ -261,7 +263,7 @@
         #
         # select box
         #
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -282,7 +284,7 @@
         # threshold
         flexSizer = wx.FlexGridSizer(cols=3, hgap=5, vgap=5)
         flexSizer.AddGrowableCol(0)
-        text = wx.StaticText(
+        text = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Select threshold"))
@@ -291,7 +293,7 @@
             initial=UserSettings.Get(
                 group='vdigit', key="selectThresh", subkey='value'),
             min=1, max=1e6)
-        units = wx.StaticText(
+        units = StaticText(
             parent=panel, id=wx.ID_ANY, size=(115, -1),
             label=UserSettings.Get(
                 group='vdigit', key="lineWidth", subkey='units'),
@@ -340,7 +342,7 @@
         #
         # digitize lines box
         #
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel, id=wx.ID_ANY, label=" %s " %
             _("Digitize lines/boundaries"))
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
@@ -365,7 +367,7 @@
         #
         # digitize areas box
         #
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -392,7 +394,7 @@
         #
         # save-on-exit box
         #
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -427,7 +429,7 @@
         #
         # query tool box
         #
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -466,7 +468,7 @@
             border=1)
         flexSizer = wx.FlexGridSizer(cols=4, hgap=5, vgap=5)
         flexSizer.AddGrowableCol(0)
-        txt = wx.StaticText(
+        txt = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Select lines"))
@@ -486,7 +488,7 @@
                 group='vdigit',
                 key="queryLength",
                 subkey='thresh'))
-        units = wx.StaticText(
+        units = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label="%s" %
@@ -520,7 +522,7 @@
             border=1)
         flexSizer = wx.FlexGridSizer(cols=4, hgap=5, vgap=5)
         flexSizer.AddGrowableCol(0)
-        txt = wx.StaticText(
+        txt = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Select dangles"))
@@ -540,7 +542,7 @@
                 group='vdigit',
                 key="queryDangle",
                 subkey='thresh'))
-        units = wx.StaticText(
+        units = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label="%s" %
@@ -586,7 +588,7 @@
         #
         # add new record
         #
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel,
             id=wx.ID_ANY,
             label=" %s " %
@@ -612,7 +614,7 @@
         settings = ((_("Layer"), 1), (_("Category"), 1),
                     (_("Mode"), _("Next to use")))
         # layer
-        text = wx.StaticText(parent=panel, id=wx.ID_ANY, label=_("Layer"))
+        text = StaticText(parent=panel, id=wx.ID_ANY, label=_("Layer"))
         self.layer = SpinCtrl(parent=panel, id=wx.ID_ANY, size=(125, -1),
                               min=1, max=1e3)
         self.layer.SetValue(int(UserSettings.Get(
@@ -621,7 +623,7 @@
         flexSizer.Add(self.layer, proportion=0,
                       flag=wx.FIXED_MINSIZE | wx.ALIGN_CENTER_VERTICAL)
         # category number
-        text = wx.StaticText(
+        text = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Category number"))
@@ -637,7 +639,7 @@
         flexSizer.Add(self.category, proportion=0,
                       flag=wx.FIXED_MINSIZE | wx.ALIGN_CENTER_VERTICAL)
         # category mode
-        text = wx.StaticText(
+        text = StaticText(
             parent=panel,
             id=wx.ID_ANY,
             label=_("Category mode"))
@@ -663,7 +665,7 @@
         #
         # delete existing record
         #
-        box = wx.StaticBox(
+        box = StaticBox(
             parent=panel, id=wx.ID_ANY, label=" %s " %
             _("Delete existing feature(s)"))
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
@@ -687,8 +689,8 @@
         #
         # geometry attributes (currently only length and area are supported)
         #
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s " % _("Geometry attributes"))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s " % _("Geometry attributes"))
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(hgap=3, vgap=3)
         self.geomAttrb = {'length': {'label': _('length')},
@@ -767,8 +769,8 @@
         note = '\n'.join(textwrap.wrap(_("Note: These settings are stored "
                                          "in the workspace not in the vector digitizer "
                                          "preferences."), 55))
-        gridSizer.Add(wx.StaticText(parent=panel, id=wx.ID_ANY,
-                                    label=note),
+        gridSizer.Add(StaticText(parent=panel, id=wx.ID_ANY,
+                                 label=note),
                       pos=(3, 0), span=(1, 3))
 
         gridSizer.AddGrowableCol(0)
@@ -817,7 +819,7 @@
         checked = event.IsChecked()
         id = event.GetId()
         key = None
-        for attrb, val in self.geomAttrb.iteritems():
+        for attrb, val in six.iteritems(self.geomAttrb):
             if val['check'] == id:
                 key = attrb
                 break
@@ -985,7 +987,7 @@
         if self.parent.GetLayerManager():
             self.parent.GetLayerManager().WorkspaceChanged()  # geometry attributes
         # symbology
-        for key, (enabled, color) in self.symbology.iteritems():
+        for key, (enabled, color) in six.iteritems(self.symbology):
             if enabled:
                 UserSettings.Set(group='vdigit', key='symbol',
                                  subkey=[key, 'enabled'],
@@ -1033,7 +1035,7 @@
             item = tree.FindItemByData('maplayer', mapLayer)
         else:
             item = None
-        for key, val in self.geomAttrb.iteritems():
+        for key, val in six.iteritems(self.geomAttrb):
             checked = self.FindWindowById(val['check']).IsChecked()
             column = self.FindWindowById(val['column']).GetValue()
             unitsIdx = self.FindWindowById(val['units']).GetSelection()

Modified: grass/trunk/gui/wxpython/vdigit/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/vdigit/toolbars.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/vdigit/toolbars.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -21,7 +21,7 @@
 
 from gui_core.toolbars import BaseToolbar, BaseIcons
 from gui_core.dialogs import CreateNewVector, VectorDialog
-from gui_core.wrap import PseudoDC
+from gui_core.wrap import PseudoDC, Menu
 from vdigit.preferences import VDigitSettingsDialog
 from core.debug import Debug
 from core.settings import UserSettings
@@ -553,7 +553,7 @@
     def OnAdditionalToolMenu(self, event):
         """Menu for additional tools"""
         point = wx.GetMousePosition()
-        toolMenu = wx.Menu()
+        toolMenu = Menu()
 
         for label, itype, handler, desc in (
             (_('Break selected lines/boundaries at intersection'),

Modified: grass/trunk/gui/wxpython/vdigit/wxdigit.py
===================================================================
--- grass/trunk/gui/wxpython/vdigit/wxdigit.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/vdigit/wxdigit.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -28,6 +28,7 @@
 
 from __future__ import print_function
 
+import six
 import grass.script.core as grass
 
 from grass.pydispatch.signal import Signal
@@ -1774,7 +1775,7 @@
                 self.cats[field])
 
         # set default values
-        for field, cat in self.cats.iteritems():
+        for field, cat in six.iteritems(self.cats):
             if cat is None:
                 self.cats[field] = 0  # first category 1
             Debug.msg(

Modified: grass/trunk/gui/wxpython/vdigit/wxdisplay.py
===================================================================
--- grass/trunk/gui/wxpython/vdigit/wxdisplay.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/vdigit/wxdisplay.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -20,6 +20,7 @@
 from __future__ import print_function
 
 import locale
+import six
 
 import wx
 
@@ -26,6 +27,7 @@
 from core.debug import Debug
 from core.settings import UserSettings
 from core.utils import _
+from gui_core.wrap import Rect
 
 try:
     from grass.lib.gis import *
@@ -336,7 +338,7 @@
                     pdc.SetPen(pen)
                     pdc.SetIdBounds(
                         dcId - 1,
-                        wx.Rect(
+                        Rect(
                             point_beg.x,
                             point_beg.y,
                             0,
@@ -348,7 +350,7 @@
                     dcId += 2
                 pdc.SetIdBounds(
                     dcId - 1,
-                    wx.Rect(
+                    Rect(
                         robj.point[
                             robj.npoints - 1].x,
                         robj.point[
@@ -891,7 +893,7 @@
                 points.x[idx],
                 points.y[idx],
                 points.z[idx])
-            rect = wx.Rect(vx, vy, 0, 0)
+            rect = Rect(vx, vy, 0, 0)
             self.dc.SetIdBounds(DCid, rect)
             DCid += 2
 
@@ -1176,7 +1178,7 @@
             catsDict[layer].append(cats.cat[i])
 
         catsStr = ''
-        for l, c in catsDict.iteritems():
+        for l, c in six.iteritems(catsDict):
             catsStr = '%d: (%s)' % (l, ','.join(map(str, c)))
 
         return catsStr

Modified: grass/trunk/gui/wxpython/vnet/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/vnet/dialogs.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/vnet/dialogs.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -27,7 +27,11 @@
 import os
 import sys
 import types
+import six
 
+if sys.version_info.major >= 3:
+    unicode = str
+
 from copy import copy
 from grass.script import core as grass
 
@@ -52,7 +56,8 @@
 from gui_core.widgets import GNotebook
 from gui_core.goutput import GConsoleWindow
 from gui_core.gselect import Select, LayerSelect, ColumnSelect
-from gui_core.wrap import SpinCtrl
+from gui_core.wrap import SpinCtrl, Button, BitmapButton, StaticText, \
+    StaticBox, TextCtrl
 
 from vnet.widgets import PointsList
 from vnet.toolbars import MainToolbar, PointListToolbar, AnalysisToolbar
@@ -227,11 +232,11 @@
         maxDistPanel = wx.Panel(parent=anSettingsPanel)
         maxValue = 1e8
 
-        listBox = wx.StaticBox(parent=pointsPanel, id=wx.ID_ANY,
-                               label=" %s " % _("Points for analysis:"))
+        listBox = StaticBox(parent=pointsPanel, id=wx.ID_ANY,
+                            label=" %s " % _("Points for analysis:"))
         listSizer = wx.StaticBoxSizer(listBox, wx.VERTICAL)
-        anSettingsBox = wx.StaticBox(parent=anSettingsPanel, id=wx.ID_ANY,
-                                     label=" %s " % _("Analysis settings:"))
+        anSettingsBox = StaticBox(parent=anSettingsPanel, id=wx.ID_ANY,
+                                  label=" %s " % _("Analysis settings:"))
         anSettingsSizer = wx.StaticBoxSizer(anSettingsBox, wx.VERTICAL)
 
         self.notebook.AddPage(page=pointsPanel,
@@ -246,7 +251,7 @@
             dialog=self,
             vnet_mgr=self.vnet_mgr)
 
-        maxDistLabel = wx.StaticText(
+        maxDistLabel = StaticText(
             parent=maxDistPanel, id=wx.ID_ANY,
             label=_("Maximum distance of point to the network:"))
         self.anSettings["max_dist"] = SpinCtrl(
@@ -262,11 +267,11 @@
         #self.anSettings["show_cut"].Bind(wx.EVT_CHECKBOX, self.OnShowCut)
 
         isoLinesPanel = wx.Panel(parent=anSettingsPanel)
-        isoLineslabel = wx.StaticText(
+        isoLineslabel = StaticText(
             parent=isoLinesPanel,
             id=wx.ID_ANY,
             label=_("Iso lines:"))
-        self.anSettings["iso_lines"] = wx.TextCtrl(
+        self.anSettings["iso_lines"] = TextCtrl(
             parent=isoLinesPanel, id=wx.ID_ANY)
         self.anSettings["iso_lines"].Bind(
             wx.EVT_TEXT, lambda event: self.IsoLines())
@@ -379,9 +384,9 @@
         # self.useTurns = wx.CheckBox(parent = dataPanel, id=wx.ID_ANY,
         #                            label = _('Use turns'))
 
-        box = wx.StaticBox(dataPanel, -1, "Vector map and layers for analysis")
+        box = StaticBox(dataPanel, -1, "Vector map and layers for analysis")
         bsizer = wx.StaticBoxSizer(box, wx.VERTICAL)
-        box2 = wx.StaticBox(dataPanel, -1, "Costs")
+        box2 = StaticBox(dataPanel, -1, "Costs")
         bsizer2 = wx.StaticBoxSizer(box2, wx.VERTICAL)
         selPanels = {}
 
@@ -400,10 +405,10 @@
                         "layer-vector-add.png"))
                 icon.Rescale(18, 18)
                 icon = wx.BitmapFromImage(icon)
-                self.addToTreeBtn = wx.BitmapButton(
+                self.addToTreeBtn = BitmapButton(
                     parent=selPanels[dataSel[0]],
                     bitmap=icon, size=globalvar.DIALOG_COLOR_SIZE)
-                self.addToTreeBtn.SetToolTipString(
+                self.addToTreeBtn.SetToolTip(
                     _("Add vector map into layer tree"))
                 self.addToTreeBtn.Disable()
                 self.addToTreeBtn.Bind(wx.EVT_BUTTON, self.OnToTreeBtn)
@@ -415,8 +420,8 @@
 
                 self.inputData[dataSel[0]] = dataSel[2](
                     parent=selPanels[dataSel[0]], size=(-1, -1))
-            label[dataSel[0]] = wx.StaticText(parent=selPanels[dataSel[0]],
-                                              name=dataSel[0])
+            label[dataSel[0]] = StaticText(parent=selPanels[dataSel[0]],
+                                           name=dataSel[0])
             label[dataSel[0]].SetLabel(dataSel[1])
 
         self.inputData['input'].Bind(wx.EVT_TEXT, self.OnVectSel)
@@ -797,7 +802,7 @@
 
     def _setInputData(self):
         params = {}
-        for k, v in self.inputData.iteritems():
+        for k, v in six.iteritems(self.inputData):
             params[k] = v.GetValue()
         flags = {}
         self.vnet_mgr.SetParams(params, flags)
@@ -974,7 +979,7 @@
         used_cols = []
         attrCols = an_props["cmdParams"]["cols"]
 
-        for col in attrCols.iterkeys():
+        for col in six.iterkeys(attrCols):
 
             if "inputField" in attrCols[col]:
                 colInptF = attrCols[col]["inputField"]
@@ -1154,7 +1159,7 @@
     def SetData(self, key, data):
 
         idx = self._findIndex(key)
-        for k, v in data.iteritems():
+        for k, v in six.iteritems(data):
             if k == "use":
 
                 if v and not self.IsChecked(idx):
@@ -1206,14 +1211,14 @@
         self.settings = {}
 
         # create all staticboxes before creating widgets, needed for Mac
-        otherBox = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                                label=" %s " % _("Other settings"))
+        otherBox = StaticBox(parent=self, id=wx.ID_ANY,
+                             label=" %s " % _("Other settings"))
         otherBoxSizer = wx.StaticBoxSizer(otherBox, wx.VERTICAL)
-        ptsStyleBox = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                                   label=" %s " % _("Point style:"))
+        ptsStyleBox = StaticBox(parent=self, id=wx.ID_ANY,
+                                label=" %s " % _("Point style:"))
         ptsStyleBoxSizer = wx.StaticBoxSizer(ptsStyleBox, wx.VERTICAL)
-        styleBox = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                                label=" %s " % _("Analysis result style:"))
+        styleBox = StaticBox(parent=self, id=wx.ID_ANY,
+                             label=" %s " % _("Analysis result style:"))
         styleBoxSizer = wx.StaticBoxSizer(styleBox, wx.VERTICAL)
 
         rules = RunCommand('v.colors',
@@ -1222,7 +1227,7 @@
 
         settsLabels = {}
 
-        settsLabels['color_table'] = wx.StaticText(
+        settsLabels['color_table'] = StaticText(
             parent=self,
             id=wx.ID_ANY,
             label=_('Color table style %s:') %
@@ -1267,8 +1272,8 @@
                 "point_colors",
                 _("Color for selected point:")]}
 
-        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])
             col = UserSettings.Get(group='vnet', key=sett[0], subkey=settKey)
             self.settings[settKey] = csel.ColourSelect(
@@ -1283,8 +1288,8 @@
             "max_hist_steps": ["other", _("Maximum number of results in history:")]
         }
 
-        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])
             self.settings[settKey] = SpinCtrl(
                 parent=self, id=wx.ID_ANY, min=1, max=50)
@@ -1296,20 +1301,20 @@
             self.settings[settKey].SetValue(size)
 
         # 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()
 
         # bindings
         self.btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
-        self.btnApply.SetToolTipString(
+        self.btnApply.SetToolTip(
             _("Apply changes for the current session"))
         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)"))
         self.btnClose.Bind(wx.EVT_BUTTON, self.OnClose)
-        self.btnClose.SetToolTipString(_("Close dialog"))
+        self.btnClose.SetToolTip(_("Close dialog"))
 
         # Layout
 
@@ -1443,7 +1448,7 @@
         UserSettings.Set(group='vnet', key="res_style", subkey='line_width',
                          value=self.settings["line_width"].GetValue())
 
-        for settKey, sett in self.colorsSetts.iteritems():
+        for settKey, sett in six.iteritems(self.colorsSetts):
             col = tuple(self.settings[settKey].GetColour())
             UserSettings.Set(group='vnet',
                              key=sett[0],
@@ -1450,7 +1455,7 @@
                              subkey=settKey,
                              value=col)
 
-        for settKey, sett in self.sizeSetts.iteritems():
+        for settKey, sett in six.iteritems(self.sizeSetts):
             UserSettings.Set(group='vnet', key=sett[0], subkey=settKey,
                              value=self.settings[settKey].GetValue())
 
@@ -1483,7 +1488,7 @@
         """Create turntable dialog."""
         wx.Dialog.__init__(self, parent, id, title=_(title), style=style)
 
-        box = wx.StaticBox(self, -1, "Vector map and layers for analysis")
+        box = StaticBox(self, -1, "Vector map and layers for analysis")
         bsizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         label = {}
         dataSelects = [
@@ -1510,15 +1515,15 @@
                 self.inputData[dataSel[0]] = dataSel[2](
                     parent=selPanels[dataSel[0]], size=(-1, -1))
 
-            label[dataSel[0]] = wx.StaticText(parent=selPanels[dataSel[0]],
-                                              name=dataSel[0])
+            label[dataSel[0]] = StaticText(parent=selPanels[dataSel[0]],
+                                           name=dataSel[0])
             label[dataSel[0]].SetLabel(dataSel[1])
 
         self.inputData['input'].Bind(wx.EVT_TEXT, lambda event: self.InputSel)
 
         # 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()
 
         # Layout
@@ -1537,7 +1542,7 @@
             bsizer.Add(selPanels[sel], proportion=0,
                        flag=wx.EXPAND)
 
-        for k, v in init_data.iteritems():
+        for k, v in six.iteritems(init_data):
             if k in self.inputData:
                 self.inputData[k].SetValue(v)
 
@@ -1615,7 +1620,7 @@
     def GetData(self):
 
         params = {}
-        for param, sel in self.inputData.iteritems():
+        for param, sel in six.iteritems(self.inputData):
             params[param] = sel.GetValue()
 
         return params
@@ -1629,8 +1634,8 @@
         wx.Dialog.__init__(self, parent, id, title=_(title), style=style)
 
         self.panel = wx.Panel(parent=self)
-        box = wx.StaticBox(parent=self.panel, id=wx.ID_ANY,
-                           label="Vector map")
+        box = StaticBox(parent=self.panel, id=wx.ID_ANY,
+                        label="Vector map")
 
         self.boxSizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)
 
@@ -1639,12 +1644,12 @@
             parent=self.panel, type='vector',
             mapsets=[grass.gisenv()['MAPSET']],
             size=(-1, -1))
-        self.vectSellabel = wx.StaticText(parent=self.panel, id=wx.ID_ANY,
-                                          label=_("Name:"))
+        self.vectSellabel = StaticText(parent=self.panel, id=wx.ID_ANY,
+                                       label=_("Name:"))
 
         # buttons
-        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.SetInitialSize((400, -1))
@@ -1791,9 +1796,9 @@
 
         self.angle_list = TurnAnglesList(parent=self, data=self.data)
 
-        self.btnAdd = wx.Button(parent=self, id=wx.ID_ANY, label="Add")
-        self.btnRemove = wx.Button(parent=self, id=wx.ID_ANY, label="Remove")
-        self.btnClose = wx.Button(parent=self, id=wx.ID_CLOSE)
+        self.btnAdd = Button(parent=self, id=wx.ID_ANY, label="Add")
+        self.btnRemove = Button(parent=self, id=wx.ID_ANY, label="Remove")
+        self.btnClose = Button(parent=self, id=wx.ID_CLOSE)
         self.useUTurns = wx.CheckBox(
             parent=self, id=wx.ID_ANY, label="Use U-turns")
 

Modified: grass/trunk/gui/wxpython/vnet/vnet_core.py
===================================================================
--- grass/trunk/gui/wxpython/vnet/vnet_core.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/vnet/vnet_core.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -20,6 +20,7 @@
 """
 
 import os
+import six
 from grass.script.utils import try_remove
 from grass.script import core as grass
 from grass.script.task import cmdlist_to_tuple
@@ -509,7 +510,7 @@
         cmdParams.append("output=" + output)
 
         cats = {}
-        for cat_name, pts_coor in catPts.iteritems():
+        for cat_name, pts_coor in six.iteritems(catPts):
 
             for coor in pts_coor:
                 cat_num = str(
@@ -527,7 +528,7 @@
                 else:
                     cats[cat_name] = [cat_num]
 
-        for cat_name, cat_nums in cats.iteritems():
+        for cat_name, cat_nums in six.iteritems(cats):
             cmdParams.append(cat_name + "=" + ",".join(cat_nums))
 
         self.tmpTurnAn = AddTmpMapAnalysisMsg(
@@ -679,7 +680,7 @@
 
         self._setCmdForSpecificAn(cmdParams)
 
-        for catName, catNum in catsNums.iteritems():
+        for catName, catNum in six.iteritems(catsNums):
             if catNum[0] == catNum[1]:
                 cmdParams.append(catName + "=" + str(catNum[0]))
             else:
@@ -736,8 +737,8 @@
         """
 
         inParams = []
-        for col, v in self.data.GetAnalysisProperties()["cmdParams"][
-                "cols"].iteritems():
+        for col, v in six.iteritems(self.data.GetAnalysisProperties()["cmdParams"]
+                                                                     ["cols"]):
 
             if "inputField" in v:
                 colInptF = v["inputField"]
@@ -786,7 +787,7 @@
         pt_ascii = ""
         catNum = maxCat
 
-        for catName, pts in catPts.iteritems():
+        for catName, pts in six.iteritems(catPts):
 
             catsNums[catName] = [catNum + 1]
             for pt in pts:
@@ -871,7 +872,7 @@
             return
 
         # delete temporary maps in history steps which were deleted
-        for removedStep in removedHistData.itervalues():
+        for removedStep in six.itervalues(removedHistData):
             mapsNames = removedStep["tmp_data"]["maps"]
             for vectMapName in mapsNames:
                 tmpMap = self.tmp_maps.GetTmpVectMap(vectMapName)
@@ -917,7 +918,7 @@
         # update parameters
         params = {}
         histInputData = histStepData["an_params"]
-        for inpName, inp in histInputData.iteritems():
+        for inpName, inp in six.iteritems(histInputData):
             params[inpName] = str(inp)
             if inpName == "input":
                 inpMap = inp
@@ -969,7 +970,7 @@
                              subkey=[ptName, "checked"],
                              value=data["use"])
 
-            for param, value in params.iteritems():
+            for param, value in six.iteritems(params):
 
                 if param == "input":
                     inpMap = VectMap(self, value)

Modified: grass/trunk/gui/wxpython/vnet/vnet_data.py
===================================================================
--- grass/trunk/gui/wxpython/vnet/vnet_data.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/vnet/vnet_data.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -24,6 +24,7 @@
 """
 import os
 import types
+import six
 from copy import deepcopy
 
 from grass.script.utils import try_remove
@@ -177,11 +178,13 @@
             return False
 
         errLayerStr = ""
-        for layer, layerLabel in {
+        vals = {
                 'arc_layer': _("arc layer"),
                 'node_layer': _("node layer"),
                 'turn_layer': _("turntable layer"),
-                'turn_cat_layer': _("unique categories layer")}.iteritems():
+                'turn_cat_layer': _("unique categories layer")
+                }
+        for layer, layerLabel in six.iteritems(vals):
 
             if layer in ["turn_layer", "turn_cat_layer"] and not flags["t"]:
                 continue
@@ -327,7 +330,7 @@
                 "pts_data": pts_data})
 
     def SetPointData(self, pt_id, data):
-        for col, v in data.iteritems():
+        for col, v in six.iteritems(data):
             if col == 'use':
                 continue
 
@@ -402,7 +405,7 @@
         textProp = self.pointsToDraw.GetPropertyVal("text")
         textProp["font"].SetPointSize(ptSize + 2)
 
-        for colKey, col in colors.iteritems():
+        for colKey, col in six.iteritems(colors):
             pen = self.pointsToDraw.GetPen(colKey)
             if pen:
                 pen.SetColour(wx.Colour(col[0], col[1], col[2], 255))
@@ -419,7 +422,7 @@
                         width=ptWidth))
 
     def ParametersChanged(self, method, kwargs):
-        if "analysis" in kwargs["changed_params"].keys():
+        if "analysis" in list(kwargs["changed_params"].keys()):
             self._updateTypeCol()
 
             if self.an_params.GetParam("analysis")[0] == "v.net.path":
@@ -441,7 +444,7 @@
 
         pt_list_data = [None] * len(self.cols['name'])
 
-        for k, val in pt_data.iteritems():
+        for k, val in six.iteritems(pt_data):
             pt_list_data[self.cols["name"].index(k)] = val
 
         return pt_list_data
@@ -599,7 +602,7 @@
         i_red = 0
         hidden_cols.sort()
         for idx in hidden_cols:
-            for dt in cols_data.itervalues():
+            for dt in six.itervalues(cols_data):
                 dt.pop(idx - i_red)
             i_red += 1
 
@@ -632,7 +635,7 @@
     def SetParams(self, params, flags):
 
         changed_params = {}
-        for p, v in params.iteritems():
+        for p, v in six.iteritems(params):
             if p == "analysis" and v not in self.an_props.used_an:
                 continue
 
@@ -648,7 +651,7 @@
                 changed_params[p] = v
 
         changed_flags = {}
-        for p, v in flags.iteritems():
+        for p, v in six.iteritems(flags):
             if p in self.flags:
                 self.flags[p] = v
                 changed_flags[p] = v
@@ -721,7 +724,7 @@
                 except (KeyError, ValueError):
                     table = None
 
-            if not table or not params[col] in columnchoices.keys():
+            if not table or not params[col] in list(columnchoices.keys()):
                 invParams.append(col)
                 continue
 
@@ -893,7 +896,7 @@
                         #"v.net.steiner"
                         ]
 
-        for an in self.vnetProperties.keys():
+        for an in list(self.vnetProperties.keys()):
             if an not in self.used_an:
                 del self.vnetProperties[an]
                 continue
@@ -922,7 +925,7 @@
 
         cols = self.vnetProperties[analysis]["cmdParams"]["cols"]
 
-        for col, v in cols.iteritems():
+        for col, v in six.iteritems(cols):
             if "inputField" in col:
                 colInptF = v["inputField"]
             else:
@@ -1282,8 +1285,8 @@
     def _saveNewHistStep(self, newHist):
         """Save buffer (new step) data into file"""
         newHist.write('%s%s%s' % (os.linesep, "history step=0", os.linesep))
-        for key in self.newHistStepData.keys():
-            subkeys = self.newHistStepData[key].keys()
+        for key in list(self.newHistStepData.keys()):
+            subkeys = list(self.newHistStepData[key].keys())
             newHist.write('%s%s' % (key, self.sep))
             for idx in range(len(subkeys)):
                 value = self.newHistStepData[key][subkeys[idx]]
@@ -1291,7 +1294,7 @@
                     if idx > 0:
                         newHist.write('%s%s%s' % (os.linesep, key, self.sep))
                     newHist.write('%s%s' % (subkeys[idx], self.sep))
-                    kvalues = self.newHistStepData[key][subkeys[idx]].keys()
+                    kvalues = list(self.newHistStepData[key][subkeys[idx]].keys())
                     srange = range(len(kvalues))
                     for sidx in srange:
                         svalue = self._parseValue(

Modified: grass/trunk/gui/wxpython/vnet/widgets.py
===================================================================
--- grass/trunk/gui/wxpython/vnet/widgets.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/vnet/widgets.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -19,16 +19,22 @@
 """
 
 import os
-import wx
+import sys
+import six
 from copy import copy, deepcopy
 
 import wx
-from wx.lib.mixins.listctrl import CheckListCtrlMixin, ColumnSorterMixin, ListCtrlAutoWidthMixin, TextEditMixin
+from wx.lib.mixins.listctrl import CheckListCtrlMixin, ColumnSorterMixin, \
+    ListCtrlAutoWidthMixin, TextEditMixin
 
 from core import globalvar
 from core.utils import _
+from gui_core.wrap import Button, StaticText, StaticBox, TextCtrl
 
+if sys.version_info.major >= 3:
+    basestring = str
 
+
 class PointsList(wx.ListCtrl,
                  CheckListCtrlMixin,
                  ListCtrlAutoWidthMixin,
@@ -170,7 +176,7 @@
 
         self.selIdxs.append(itemIndexes)
 
-        for hCol in self.hiddenCols.itervalues():
+        for hCol in six.itervalues(self.hiddenCols):
             defVal = hCol['colsData'][iDefVal]
             if type(hCol['colsData'][iColEd]).__name__ == "list":
                 hCol['itemDataMap'].append(hCol['colsData'][iColEd][defVal])
@@ -184,7 +190,7 @@
         itemData[0] = self.selectedkey + 1
         self.itemDataMap.append(copy(itemData))
 
-        self.Append(map(str, itemData))
+        self.Append(list(map(str, itemData)))
 
         self.selected = self.GetItemCount() - 1
         self.SetItemData(self.selected, self.selectedkey)
@@ -287,7 +293,7 @@
         self.selIdxs.pop(key)
 
         # update hidden columns
-        for hCol in self.hiddenCols.itervalues():
+        for hCol in six.itervalues(self.hiddenCols):
             hCol['itemDataMap'].pop(key)
             hCol['selIdxs'].pop(key)
 
@@ -552,8 +558,8 @@
         panel = wx.Panel(parent=self)
         sizer = wx.BoxSizer(wx.VERTICAL)
 
-        box = wx.StaticBox(parent=panel, id=wx.ID_ANY,
-                           label=" %s %s " % (_(itemCap), str(pointNo + 1)))
+        box = StaticBox(parent=panel, id=wx.ID_ANY,
+                        label=" %s %s " % (_(itemCap), str(pointNo + 1)))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
 
         # source coordinates
@@ -584,18 +590,18 @@
 
                 if validator:
                     self.fields.append(
-                        wx.TextCtrl(
+                        TextCtrl(
                             parent=panel, id=wx.ID_ANY, validator=validator,
                             size=(150, -1)))
                 else:
-                    self.fields.append(wx.TextCtrl(parent=panel, id=wx.ID_ANY,
-                                                   size=(150, -1)))
+                    self.fields.append(TextCtrl(parent=panel, id=wx.ID_ANY,
+                                                size=(150, -1)))
                     value = cell[1]
                     if not isinstance(cell[1], basestring):
                         value = str(cell[1])
                     self.fields[iField].SetValue(value)
 
-            label = wx.StaticText(
+            label = StaticText(
                 parent=panel,
                 id=wx.ID_ANY,
                 label=_(
@@ -629,8 +635,8 @@
         #
         # 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()
 
         btnSizer = wx.StdDialogButtonSizer()

Modified: grass/trunk/gui/wxpython/web_services/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/web_services/dialogs.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/web_services/dialogs.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -22,6 +22,7 @@
 
 import os
 import sys
+import six
 import shutil
 
 from copy import deepcopy
@@ -36,7 +37,7 @@
 from core.gconsole import CmdThread, GStderr, EVT_CMD_DONE, EVT_CMD_OUTPUT
 
 from gui_core.gselect import Select
-from gui_core.wrap import Button
+from gui_core.wrap import Button, StaticText, StaticBox, TextCtrl
 
 from web_services.widgets import WSPanel, WSManageSettingsWidget
 
@@ -91,13 +92,13 @@
             parent=self, settingsFile=settingsFile,
             default_servers=self.default_servers)
 
-        self.settingsBox = wx.StaticBox(parent=self,
-                                        id=wx.ID_ANY,
-                                        label=_(" Server settings "))
+        self.settingsBox = StaticBox(parent=self,
+                                     id=wx.ID_ANY,
+                                     label=_(" Server settings "))
 
-        self.serverText = wx.StaticText(parent=self,
-                                        id=wx.ID_ANY, label=_("Server:"))
-        self.server = wx.TextCtrl(parent=self, id=wx.ID_ANY)
+        self.serverText = StaticText(parent=self,
+                                     id=wx.ID_ANY, label=_("Server:"))
+        self.server = TextCtrl(parent=self, id=wx.ID_ANY)
 
         self.btn_connect = Button(parent=self,
                                   id=wx.ID_ANY, label=_("&Connect"))
@@ -122,16 +123,16 @@
 
         self.reqDataPanel = wx.Panel(parent=self, id=wx.ID_ANY)
 
-        self.layerNameBox = wx.StaticBox(parent=self.reqDataPanel,
-                                         id=wx.ID_ANY,
-                                         label=_(" Layer Manager Settings "))
+        self.layerNameBox = StaticBox(parent=self.reqDataPanel,
+                                      id=wx.ID_ANY,
+                                      label=_(" Layer Manager Settings "))
 
-        self.layerNameText = wx.StaticText(
+        self.layerNameText = StaticText(
             parent=self.reqDataPanel, id=wx.ID_ANY,
             label=_("Output layer name:"))
-        self.layerName = wx.TextCtrl(parent=self.reqDataPanel, id=wx.ID_ANY)
+        self.layerName = TextCtrl(parent=self.reqDataPanel, id=wx.ID_ANY)
 
-        for ws in self.ws_panels.iterkeys():
+        for ws in six.iterkeys(self.ws_panels):
             # set class WSPanel argument layerNameTxtCtrl
             self.ws_panels[ws]['panel'] = WSPanel(parent=self.reqDataPanel,
                                                   web_service=ws)
@@ -212,7 +213,7 @@
         reqDataSizer.Add(self.ch_ws_sizer, proportion=0,
                          flag=wx.TOP | wx.EXPAND, border=5)
 
-        for ws in self.ws_panels.iterkeys():
+        for ws in six.iterkeys(self.ws_panels):
             reqDataSizer.Add(
                 self.ws_panels[ws]['panel'],
                 proportion=1,
@@ -253,14 +254,14 @@
     def MakeAdvConnPane(self, pane):
         """Create advanced connection settings pane
         """
-        self.usernameText = wx.StaticText(parent=pane,
-                                          id=wx.ID_ANY, label=_("Username:"))
-        self.username = wx.TextCtrl(parent=pane, id=wx.ID_ANY)
+        self.usernameText = StaticText(parent=pane,
+                                       id=wx.ID_ANY, label=_("Username:"))
+        self.username = TextCtrl(parent=pane, id=wx.ID_ANY)
 
-        self.passwText = wx.StaticText(parent=pane,
-                                       id=wx.ID_ANY, label=_("Password:"))
-        self.password = wx.TextCtrl(parent=pane, id=wx.ID_ANY,
-                                    style=wx.TE_PASSWORD)
+        self.passwText = StaticText(parent=pane,
+                                    id=wx.ID_ANY, label=_("Password:"))
+        self.password = TextCtrl(parent=pane, id=wx.ID_ANY,
+                                 style=wx.TE_PASSWORD)
 
         # pane layout
         adv_conn_sizer = wx.BoxSizer(wx.VERTICAL)
@@ -339,7 +340,7 @@
 
     def _getCapFiles(self):
         ws_cap_files = {}
-        for v in self.ws_panels.itervalues():
+        for v in six.itervalues(self.ws_panels):
             ws_cap_files[v['panel'].GetWebService()] = v['panel'].GetCapFile()
 
         return ws_cap_files
@@ -364,7 +365,7 @@
         lname = event.GetString()
         lname = lname.encode('ascii', 'replace')
 
-        for v in self.ws_panels.itervalues():
+        for v in six.itervalues(self.ws_panels):
             v['panel'].SetOutputLayerName(lname.strip())
 
     def OnConnect(self, event):
@@ -388,7 +389,7 @@
 
         # number of panels already connected
         self.finished_panels_num = 0
-        for ws in self.ws_panels.iterkeys():
+        for ws in six.iterkeys(self.ws_panels):
             self.ws_panels[ws]['panel'].ConnectToServer(
                 url=server, username=self.username.GetValue(),
                 password=self.password.GetValue())
@@ -421,7 +422,7 @@
         :return: list of found web services on server (identified as keys in self.ws_panels)
         """
         conn_ws = []
-        for ws, data in self.ws_panels.iteritems():
+        for ws, data in six.iteritems(self.ws_panels):
             if data['panel'].IsConnected():
                 conn_ws.append(ws)
 
@@ -648,7 +649,7 @@
         self.revert_cmd = cmd
 
         ws_cap = self._getWSfromCmd(cmd)
-        for ws in self.ws_panels.iterkeys():
+        for ws in six.iterkeys(self.ws_panels):
             # cap file used in cmd will be deleted, thnaks to the dialogs
             # destructor
             if ws == ws_cap and 'capfile' in cmd[1]:
@@ -663,12 +664,12 @@
         self.btn_ok.SetDefault()
 
     def __del__(self):
-        for f in self.revert_ws_cap_files.itervalues():
+        for f in six.itervalues(self.revert_ws_cap_files):
             grass.try_remove(f)
 
     def _setRevertCapFiles(self, ws_cap_files):
 
-        for ws, f in ws_cap_files.iteritems():
+        for ws, f in six.iteritems(ws_cap_files):
             if os.path.isfile(ws_cap_files[ws]):
                 shutil.copyfile(f, self.revert_ws_cap_files[ws])
             else:
@@ -726,7 +727,7 @@
 
         self.layerName.SetValue(cmd[1]['map'])
 
-        for ws, data in self.ws_panels.iteritems():
+        for ws, data in six.iteritems(self.ws_panels):
             cap_file = None
 
             if ws in ws_cap_files:
@@ -742,7 +743,7 @@
         """
         conn = {'url': '', 'username': '', 'password': ''}
 
-        for k in conn.iterkeys():
+        for k in six.iterkeys(conn):
             if k in cmd[1]:
                 conn[k] = cmd[1][k]
         return conn
@@ -853,7 +854,7 @@
         self.labels = {}
         self.params = {}
 
-        self.labels['output'] = wx.StaticText(
+        self.labels['output'] = StaticText(
             parent=self, id=wx.ID_ANY, label=_("Name for output raster map:"))
 
         self.params['output'] = Select(
@@ -863,8 +864,8 @@
                 grass.gisenv()['MAPSET']],
             size=globalvar.DIALOG_GSELECT_SIZE)
 
-        self.regionStBoxLabel = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                                             label=" %s " % _("Export region"))
+        self.regionStBoxLabel = StaticBox(parent=self, id=wx.ID_ANY,
+                                          label=" %s " % _("Export region"))
 
         self.region_types_order = ['display', 'comp', 'named']
         self.region_types = {}
@@ -887,7 +888,7 @@
                                      label=_("Overwrite existing raster map"))
 
         self.named_reg_panel = wx.Panel(parent=self, id=wx.ID_ANY)
-        self.labels['region'] = wx.StaticText(
+        self.labels['region'] = StaticText(
             parent=self.named_reg_panel, id=wx.ID_ANY,
             label=_("Choose named region:"))
 

Modified: grass/trunk/gui/wxpython/web_services/widgets.py
===================================================================
--- grass/trunk/gui/wxpython/web_services/widgets.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/web_services/widgets.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -18,6 +18,7 @@
 
 import os
 import sys
+import six
 import shutil
 
 from copy import deepcopy
@@ -55,7 +56,8 @@
 
 from gui_core.widgets import GNotebook
 from gui_core.widgets import ManageSettingsWidget
-from gui_core.wrap import SpinCtrl
+from gui_core.wrap import SpinCtrl, Button, StaticText, StaticBox, \
+    TextCtrl
 
 import grass.script as grass
 
@@ -139,7 +141,7 @@
         self.cmd_thread = CmdThread(self)
         self.cap_file = grass.tempfile()
 
-        reqDataBox = wx.StaticBox(
+        reqDataBox = StaticBox(
             parent=self, label=_(" Requested data settings "))
         self._nb_sizer = wx.StaticBoxSizer(reqDataBox, wx.VERTICAL)
         self.notebook = GNotebook(parent=self,
@@ -171,8 +173,8 @@
                               name='request')
 
         # list of layers
-        self.layersBox = wx.StaticBox(parent=self.req_page_panel, id=wx.ID_ANY,
-                                      label=_("List of layers "))
+        self.layersBox = StaticBox(parent=self.req_page_panel, id=wx.ID_ANY,
+                                   label=_("List of layers "))
 
         style = wx.TR_DEFAULT_STYLE | wx.TR_HAS_BUTTONS | wx.TR_FULL_ROW_HIGHLIGHT
         if self.drv_props['req_multiple_layers']:
@@ -188,7 +190,7 @@
 
         self.params['srs'] = None
         if 'srs' not in self.drv_props['ignored_params']:
-            projText = wx.StaticText(
+            projText = StaticText(
                 parent=self.req_page_panel, id=wx.ID_ANY,
                 label=_("Source projection:"))
             self.params['srs'] = wx.Choice(
@@ -257,22 +259,22 @@
         labels = {}
         self.l_odrder_list = None
         if 'WMS' in self.ws:
-            labels['l_order'] = wx.StaticBox(
+            labels['l_order'] = StaticBox(
                 parent=adv_setts_panel, id=wx.ID_ANY,
                 label=_("Order of layers in raster"))
             self.l_odrder_list = wx.ListBox(
                 adv_setts_panel, id=wx.ID_ANY, choices=[],
                 style=wx.LB_SINGLE | wx.LB_NEEDED_SB)
-            self.btnUp = wx.Button(
+            self.btnUp = Button(
                 adv_setts_panel, id=wx.ID_ANY, label=_("Up"))
-            self.btnDown = wx.Button(
+            self.btnDown = Button(
                 adv_setts_panel, id=wx.ID_ANY, label=_("Down"))
 
             self.btnUp.Bind(wx.EVT_BUTTON, self.OnUp)
             self.btnDown.Bind(wx.EVT_BUTTON, self.OnDown)
 
-        labels['method'] = wx.StaticText(parent=adv_setts_panel, id=wx.ID_ANY,
-                                         label=_("Reprojection method:"))
+        labels['method'] = StaticText(parent=adv_setts_panel, id=wx.ID_ANY,
+                                      label=_("Reprojection method:"))
 
         self.reproj_methods = ['nearest', 'linear', 'cubic', 'cubicspline']
         self.params['method'] = wx.Choice(
@@ -284,13 +286,13 @@
                 _('Cubic interpolation'),
                 _('Cubic spline interpolation')])
 
-        labels['maxcols'] = wx.StaticText(
+        labels['maxcols'] = StaticText(
             parent=adv_setts_panel, id=wx.ID_ANY,
             label=_("Maximum columns to request from server at time:"))
         self.params['maxcols'] = SpinCtrl(
             parent=adv_setts_panel, id=wx.ID_ANY, size=(100, -1))
 
-        labels['maxrows'] = wx.StaticText(
+        labels['maxrows'] = StaticText(
             parent=adv_setts_panel, id=wx.ID_ANY,
             label=_("Maximum rows to request from server at time:"))
         self.params['maxrows'] = SpinCtrl(
@@ -312,7 +314,7 @@
                 label=_("Do not request transparent data"))
 
             self.flags['o'].Bind(wx.EVT_CHECKBOX, self.OnTransparent)
-            labels['bgcolor'] = wx.StaticText(
+            labels['bgcolor'] = StaticText(
                 parent=adv_setts_panel, id=wx.ID_ANY,
                 label=_("Background color:"))
             self.params['bgcolor'] = csel.ColourSelect(
@@ -322,10 +324,10 @@
 
         self.params['urlparams'] = None
         if self.params['urlparams'] not in self.drv_props['ignored_params']:
-            labels['urlparams'] = wx.StaticText(
+            labels['urlparams'] = StaticText(
                 parent=adv_setts_panel, id=wx.ID_ANY,
                 label=_("Additional query parameters for server:"))
-            self.params['urlparams'] = wx.TextCtrl(
+            self.params['urlparams'] = TextCtrl(
                 parent=adv_setts_panel, id=wx.ID_ANY)
 
         # layout
@@ -521,7 +523,7 @@
         }
 
         conn_cmd = []
-        for k, v in self.conn.iteritems():
+        for k, v in six.iteritems(self.conn):
             if v:
                 conn_cmd.append("%s=%s" % (k, v))
 
@@ -635,7 +637,7 @@
         if 'method' in dcmd:
             params['method'] = dcmd['method']
 
-        for p, v in params.iteritems():
+        for p, v in six.iteritems(params):
             if self.params[p]:
                 self.params[p].SetStringSelection(v)
 
@@ -1163,8 +1165,8 @@
 
     def _layout(self):
 
-        self.btnAddDefaultServers = wx.Button(parent=self, id=wx.ID_ANY,
-                                              label=_("Add default"))
+        self.btnAddDefaultServers = Button(parent=self, id=wx.ID_ANY,
+                                           label=_("Add default"))
         self.btnAddDefaultServers.Bind(wx.EVT_BUTTON, self.OnAddDefaultServers)
 
         ManageSettingsWidget._layout(self)
@@ -1176,8 +1178,8 @@
 
         setts = self.GetSettings()
         self.servers_to_add = {}
-        for k, v in self.default_servers.iteritems():
-            if k not in setts.iterkeys():
+        for k, v in six.iteritems(self.default_servers):
+            if k not in six.iterkeys(setts):
                 self.servers_to_add[k] = v
             elif v != setts[k]:
                 GMessage(parent=self,

Modified: grass/trunk/gui/wxpython/wxplot/base.py
===================================================================
--- grass/trunk/gui/wxpython/wxplot/base.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/wxplot/base.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -17,6 +17,7 @@
 
 import os
 import sys
+import six
 
 import wx
 
@@ -27,6 +28,7 @@
 from core.render import Map
 from icons.icon import MetaIcon
 from gui_core.toolbars import BaseIcons
+from gui_core.wrap import Menu
 from core.utils import _
 
 import grass.script as grass
@@ -127,7 +129,7 @@
         for assigning colors to images in imagery groups"""
 
         self.colorDict = {}
-        for clr in grass.named_colors.iterkeys():
+        for clr in six.iterkeys(grass.named_colors):
             if clr == 'white':
                 continue
             r = grass.named_colors[clr][0] * 255
@@ -512,7 +514,7 @@
         """Popup menu for plot and text options
         """
         point = wx.GetMousePosition()
-        popt = wx.Menu()
+        popt = Menu()
         # Add items to the menu
         settext = wx.MenuItem(popt, wx.ID_ANY, _('Text settings'))
         popt.AppendItem(settext)
@@ -606,7 +608,7 @@
         """Print options and output menu
         """
         point = wx.GetMousePosition()
-        printmenu = wx.Menu()
+        printmenu = Menu()
         for title, handler in ((_("Page setup"), self.OnPageSetup),
                                (_("Print preview"), self.OnPrintPreview),
                                (_("Print display"), self.OnDoPrint)):

Modified: grass/trunk/gui/wxpython/wxplot/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/wxplot/dialogs.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/wxplot/dialogs.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -30,7 +30,8 @@
 from core.globalvar import ICONDIR
 from core.utils import _
 from gui_core.gselect import Select
-from gui_core.wrap import SpinCtrl
+from gui_core.wrap import SpinCtrl, Button, StaticText, \
+    StaticBox, TextCtrl, Choice
 
 from grass.script import core as grass
 
@@ -79,7 +80,7 @@
         rastText = rastText.rstrip(',')
 
         txt = _("Select raster map(s) to profile:")
-        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=txt)
+        label = StaticText(parent=self, id=wx.ID_ANY, label=txt)
         box.Add(label,
                 flag=wx.ALIGN_CENTER_VERTICAL, pos=(0, 0))
 
@@ -102,11 +103,11 @@
 
         btnsizer = wx.StdDialogButtonSizer()
 
-        btn = wx.Button(self, wx.ID_OK)
+        btn = Button(self, wx.ID_OK)
         btn.SetDefault()
         btnsizer.AddButton(btn)
 
-        btn = wx.Button(self, wx.ID_CANCEL)
+        btn = Button(self, wx.ID_CANCEL)
         btnsizer.AddButton(btn)
         btnsizer.Realize()
 
@@ -178,7 +179,7 @@
 
         # select rasters
         txt = _("Select pairs of raster maps for bivariate scatterplots:")
-        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=txt)
+        label = StaticText(parent=self, id=wx.ID_ANY, label=txt)
         box.Add(label,
                 flag=wx.ALIGN_CENTER_VERTICAL, pos=(0, 0))
 
@@ -191,8 +192,8 @@
         box.Add(selection, pos=(0, 1))
 
         # Nsteps for FP maps
-        label = wx.StaticText(parent=self, id=wx.ID_ANY,
-                              label=_("Number of bins (for FP maps)"))
+        label = StaticText(parent=self, id=wx.ID_ANY,
+                           label=_("Number of bins (for FP maps)"))
         box.Add(label,
                 flag=wx.ALIGN_CENTER_VERTICAL, pos=(1, 0))
         self.spinbins = SpinCtrl(
@@ -228,11 +229,11 @@
 
         btnsizer = wx.StdDialogButtonSizer()
 
-        btn = wx.Button(self, wx.ID_OK)
+        btn = Button(self, wx.ID_OK)
         btn.SetDefault()
         btnsizer.AddButton(btn)
 
-        btn = wx.Button(self, wx.ID_CANCEL)
+        btn = Button(self, wx.ID_CANCEL)
         btnsizer.AddButton(btn)
         btnsizer.Realize()
 
@@ -314,7 +315,7 @@
         sizer = wx.BoxSizer(wx.VERTICAL)
         txtSizer = wx.BoxSizer(wx.VERTICAL)
 
-        statstitle = wx.StaticText(
+        statstitle = StaticText(
             parent=self.panel,
             id=wx.ID_ANY,
             label=self.title)
@@ -326,7 +327,7 @@
         sizer.Add(line, proportion=0,
                   flag=wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=3)
         for stats in self.message:
-            statstxt = wx.StaticText(parent=sp, id=wx.ID_ANY, label=stats)
+            statstxt = StaticText(parent=sp, id=wx.ID_ANY, label=stats)
             statstxt.SetBackgroundColour("WHITE")
             txtSizer.Add(
                 statstxt,
@@ -357,8 +358,8 @@
         #
         btnSizer = wx.BoxSizer(wx.HORIZONTAL)
 
-        btn_clipboard = wx.Button(self.panel, id=wx.ID_COPY, label=_('C&opy'))
-        btn_clipboard.SetToolTipString(
+        btn_clipboard = Button(self.panel, id=wx.ID_COPY, label=_('C&opy'))
+        btn_clipboard.SetToolTip(
             _("Copy regression statistics the clipboard (Ctrl+C)"))
         btnSizer.Add(
             btn_clipboard,
@@ -366,7 +367,7 @@
             flag=wx.ALIGN_LEFT | wx.ALL,
             border=5)
 
-        btnCancel = wx.Button(self.panel, wx.ID_CLOSE)
+        btnCancel = Button(self.panel, wx.ID_CLOSE)
         btnCancel.SetDefault()
         btnSizer.Add(
             btnCancel,
@@ -463,8 +464,8 @@
         #
         # Select a raster to histogram
         #
-        label = wx.StaticText(parent=self, id=wx.ID_ANY,
-                              label=_("Select raster map:"))
+        label = StaticText(parent=self, id=wx.ID_ANY,
+                           label=_("Select raster map:"))
         box.Add(label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(1, 0))
         self.rselection = Select(self, id=wx.ID_ANY,
                                  size=globalvar.DIALOG_GSELECT_SIZE,
@@ -482,8 +483,8 @@
         #
         # Select an image group to histogram
         #
-        label = wx.StaticText(parent=self, id=wx.ID_ANY,
-                              label=_("Select image group:"))
+        label = StaticText(parent=self, id=wx.ID_ANY,
+                           label=_("Select image group:"))
         box.Add(label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(2, 0))
         self.gselection = Select(self, id=wx.ID_ANY,
                                  size=globalvar.DIALOG_GSELECT_SIZE,
@@ -498,8 +499,8 @@
         #
         # Nsteps for FP maps and histogram type selection
         #
-        label = wx.StaticText(parent=self, id=wx.ID_ANY,
-                              label=_("Number of bins (for FP maps)"))
+        label = StaticText(parent=self, id=wx.ID_ANY,
+                           label=_("Number of bins (for FP maps)"))
         box.Add(label,
                 flag=wx.ALIGN_CENTER_VERTICAL, pos=(3, 0))
         self.spinbins = SpinCtrl(
@@ -511,8 +512,8 @@
         box.Add(self.spinbins,
                 flag=wx.ALIGN_CENTER_VERTICAL, pos=(3, 1))
 
-        label = wx.StaticText(parent=self, id=wx.ID_ANY,
-                              label=_("Histogram type"))
+        label = StaticText(parent=self, id=wx.ID_ANY,
+                           label=_("Histogram type"))
         box.Add(label,
                 flag=wx.ALIGN_CENTER_VERTICAL, pos=(4, 0))
         types = ['count', 'percent', 'area']
@@ -533,11 +534,11 @@
 
         btnsizer = wx.StdDialogButtonSizer()
 
-        btn = wx.Button(self, wx.ID_OK)
+        btn = Button(self, wx.ID_OK)
         btn.SetDefault()
         btnsizer.AddButton(btn)
 
-        btn = wx.Button(self, wx.ID_CANCEL)
+        btn = Button(self, wx.ID_CANCEL)
         btnsizer.AddButton(btn)
         btnsizer.Realize()
 
@@ -660,8 +661,8 @@
         # dialog layout
         sizer = wx.BoxSizer(wx.VERTICAL)
 
-        box = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                           label=" %s " % _("Text settings"))
+        box = StaticBox(parent=self, id=wx.ID_ANY,
+                        label=" %s " % _("Text settings"))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
 
@@ -668,12 +669,12 @@
         #
         # profile title
         #
-        label = wx.StaticText(
+        label = StaticText(
             parent=self,
             id=wx.ID_ANY,
             label=_("Profile title:"))
         gridSizer.Add(label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(0, 0))
-        self.ptitleentry = wx.TextCtrl(
+        self.ptitleentry = TextCtrl(
             parent=self, id=wx.ID_ANY, value="", size=(250, -1))
         # self.ptitleentry.SetFont(self.font)
         self.ptitleentry.SetValue(self.ptitle)
@@ -682,7 +683,7 @@
         #
         # title font
         #
-        tlabel = wx.StaticText(
+        tlabel = StaticText(
             parent=self,
             id=wx.ID_ANY,
             label=_("Title font size (pts):"))
@@ -699,12 +700,12 @@
         #
         # x-axis label
         #
-        label = wx.StaticText(
+        label = StaticText(
             parent=self,
             id=wx.ID_ANY,
             label=_("X-axis label:"))
         gridSizer.Add(label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(2, 0))
-        self.xlabelentry = wx.TextCtrl(
+        self.xlabelentry = TextCtrl(
             parent=self, id=wx.ID_ANY, value="", size=(250, -1))
         # self.xlabelentry.SetFont(self.font)
         self.xlabelentry.SetValue(self.xlabel)
@@ -713,12 +714,12 @@
         #
         # y-axis label
         #
-        label = wx.StaticText(
+        label = StaticText(
             parent=self,
             id=wx.ID_ANY,
             label=_("Y-axis label:"))
         gridSizer.Add(label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(3, 0))
-        self.ylabelentry = wx.TextCtrl(
+        self.ylabelentry = TextCtrl(
             parent=self, id=wx.ID_ANY, value="", size=(250, -1))
         # self.ylabelentry.SetFont(self.font)
         self.ylabelentry.SetValue(self.ylabel)
@@ -727,7 +728,7 @@
         #
         # font size
         #
-        llabel = wx.StaticText(
+        llabel = StaticText(
             parent=self,
             id=wx.ID_ANY,
             label=_("Label font size (pts):"))
@@ -747,8 +748,8 @@
         #
         # font settings
         #
-        box = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                           label=" %s " % _("Font settings"))
+        box = StaticBox(parent=self, id=wx.ID_ANY,
+                        label=" %s " % _("Font settings"))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
 
@@ -755,7 +756,7 @@
         #
         # font family
         #
-        label1 = wx.StaticText(
+        label1 = StaticText(
             parent=self,
             id=wx.ID_ANY,
             label=_("Font family:"))
@@ -762,7 +763,7 @@
         gridSizer.Add(label1, flag=wx.ALIGN_CENTER_VERTICAL, pos=(0, 0))
         self.ffamilycb = wx.ComboBox(
             parent=self, id=wx.ID_ANY, size=(250, -1),
-            choices=self.ffamilydict.keys(),
+            choices=list(self.ffamilydict.keys()),
             style=wx.CB_DROPDOWN)
         self.ffamilycb.SetStringSelection('swiss')
         for item in self.ffamilydict.items():
@@ -774,11 +775,11 @@
         #
         # font style
         #
-        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Style:"))
+        label = StaticText(parent=self, id=wx.ID_ANY, label=_("Style:"))
         gridSizer.Add(label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(1, 0))
         self.fstylecb = wx.ComboBox(
             parent=self, id=wx.ID_ANY, size=(250, -1),
-            choices=self.fstyledict.keys(),
+            choices=list(self.fstyledict.keys()),
             style=wx.CB_DROPDOWN)
         self.fstylecb.SetStringSelection('normal')
         for item in self.fstyledict.items():
@@ -790,11 +791,11 @@
         #
         # font weight
         #
-        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Weight:"))
+        label = StaticText(parent=self, id=wx.ID_ANY, label=_("Weight:"))
         gridSizer.Add(label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(2, 0))
         self.fwtcb = wx.ComboBox(
             parent=self, size=(250, -1),
-            choices=self.fwtdict.keys(),
+            choices=list(self.fwtdict.keys()),
             style=wx.CB_DROPDOWN)
         self.fwtcb.SetStringSelection('normal')
         for item in self.fwtdict.items():
@@ -818,24 +819,24 @@
         #
         # buttons
         #
-        btnSave = wx.Button(self, wx.ID_SAVE)
-        btnApply = wx.Button(self, wx.ID_APPLY)
-        btnOk = wx.Button(self, wx.ID_OK)
-        btnCancel = wx.Button(self, wx.ID_CANCEL)
+        btnSave = Button(self, wx.ID_SAVE)
+        btnApply = Button(self, wx.ID_APPLY)
+        btnOk = Button(self, wx.ID_OK)
+        btnCancel = Button(self, wx.ID_CANCEL)
         btnOk.SetDefault()
 
         # bindings
         btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
-        btnApply.SetToolTipString(_("Apply changes for the current session"))
+        btnApply.SetToolTip(_("Apply changes for the current session"))
         btnOk.Bind(wx.EVT_BUTTON, self.OnOk)
-        btnOk.SetToolTipString(
+        btnOk.SetToolTip(
             _("Apply changes for the current session and close dialog"))
         btnOk.SetDefault()
         btnSave.Bind(wx.EVT_BUTTON, self.OnSave)
-        btnSave.SetToolTipString(
+        btnSave.SetToolTip(
             _("Apply and save changes to user settings file (default for next sessions)"))
         btnCancel.Bind(wx.EVT_BUTTON, self.OnCancel)
-        btnCancel.SetToolTipString(_("Close dialog and ignore changes"))
+        btnCancel.SetToolTip(_("Close dialog and ignore changes"))
 
         # sizers
         btnStdSizer = wx.StdDialogButtonSizer()
@@ -982,8 +983,8 @@
         """
         sizer = wx.BoxSizer(wx.VERTICAL)
 
-        box = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                           label=" %s " % _("Plot settings"))
+        box = StaticBox(parent=self, id=wx.ID_ANY,
+                        label=" %s " % _("Plot settings"))
         boxMainSizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)
 
         self.wxId['pcolor'] = 0
@@ -1003,8 +1004,8 @@
         if len(self.rasterList) == 0:
             return
 
-        box = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                           label=_("Map/image plotted"))
+        box = StaticBox(parent=self, id=wx.ID_ANY,
+                        label=_("Map/image plotted"))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
 
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
@@ -1014,9 +1015,9 @@
         for i in self.rasterList:
             choicelist.append(str(i))
 
-        self.mapchoice = wx.Choice(parent=self, id=wx.ID_ANY, size=(300, -1),
+        self.mapchoice = Choice(parent=self, id=wx.ID_ANY, size=(300, -1),
                                    choices=choicelist)
-        self.mapchoice.SetToolTipString(_("Settings for selected map"))
+        self.mapchoice.SetToolTip(_("Settings for selected map"))
 
         if not self.map:
             self.map = self.rasterList[self.mapchoice.GetCurrentSelection()]
@@ -1031,7 +1032,7 @@
         #
         if self.plottype != 'scatter':
             row += 1
-            label = wx.StaticText(
+            label = StaticText(
                 parent=self,
                 id=wx.ID_ANY,
                 label=_("Line color"))
@@ -1048,7 +1049,7 @@
             gridSizer.Add(color, pos=(row, 1))
 
             row += 1
-            label = wx.StaticText(
+            label = StaticText(
                 parent=self,
                 id=wx.ID_ANY,
                 label=_("Line width"))
@@ -1066,7 +1067,7 @@
             gridSizer.Add(width, pos=(row, 1))
 
             row += 1
-            label = wx.StaticText(
+            label = StaticText(
                 parent=self,
                 id=wx.ID_ANY,
                 label=_("Line style"))
@@ -1076,18 +1077,18 @@
                 pos=(
                     row,
                     0))
-            style = wx.Choice(
+            style = Choice(
                 parent=self, id=wx.ID_ANY, size=(
-                    120, -1), choices=self.linestyledict.keys())
+                    120, -1), choices=list(self.linestyledict.keys()))
             style.SetStringSelection(self.raster[self.map]['pstyle'])
             self.wxId['pstyle'] = style.GetId()
             gridSizer.Add(style, pos=(row, 1))
 
         row += 1
-        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Legend"))
+        label = StaticText(parent=self, id=wx.ID_ANY, label=_("Legend"))
         gridSizer.Add(label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0))
-        legend = wx.TextCtrl(parent=self, id=wx.ID_ANY,
-                             value="", size=(200, -1))
+        legend = TextCtrl(parent=self, id=wx.ID_ANY,
+                          value="", size=(200, -1))
         legend.SetValue(self.raster[self.map]['plegend'])
         gridSizer.Add(legend, pos=(row, 1))
         self.wxId['plegend'] = legend.GetId()
@@ -1099,7 +1100,7 @@
         # segment marker settings for profiles only
         #
         if self.plottype == 'profile':
-            box = wx.StaticBox(
+            box = StaticBox(
                 parent=self, id=wx.ID_ANY, label=" %s " %
                 _("Transect segment marker settings"))
 
@@ -1106,7 +1107,7 @@
             boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
 
             gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
-            label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Color"))
+            label = StaticText(parent=self, id=wx.ID_ANY, label=_("Color"))
             gridSizer.Add(
                 label,
                 flag=wx.ALIGN_CENTER_VERTICAL,
@@ -1120,7 +1121,7 @@
             self.wxId['marker']['color'] = ptcolor.GetId()
             gridSizer.Add(ptcolor, pos=(0, 1))
 
-            label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Size"))
+            label = StaticText(parent=self, id=wx.ID_ANY, label=_("Size"))
             gridSizer.Add(
                 label,
                 flag=wx.ALIGN_CENTER_VERTICAL,
@@ -1134,7 +1135,7 @@
             self.wxId['marker']['size'] = ptsize.GetId()
             gridSizer.Add(ptsize, pos=(1, 1))
 
-            label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Fill"))
+            label = StaticText(parent=self, id=wx.ID_ANY, label=_("Fill"))
             gridSizer.Add(
                 label,
                 flag=wx.ALIGN_CENTER_VERTICAL,
@@ -1141,13 +1142,13 @@
                 pos=(
                     2,
                     0))
-            ptfill = wx.Choice(parent=self, id=wx.ID_ANY,
-                               size=(120, -1), choices=self.ptfilldict.keys())
+            ptfill = Choice(parent=self, id=wx.ID_ANY,
+                               size=(120, -1), choices=list(self.ptfilldict.keys()))
             ptfill.SetStringSelection(self.properties['marker']['fill'])
             self.wxId['marker']['fill'] = ptfill.GetId()
             gridSizer.Add(ptfill, pos=(2, 1))
 
-            label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Legend"))
+            label = StaticText(parent=self, id=wx.ID_ANY, label=_("Legend"))
             gridSizer.Add(
                 label,
                 flag=wx.ALIGN_CENTER_VERTICAL,
@@ -1154,7 +1155,7 @@
                 pos=(
                     3,
                     0))
-            ptlegend = wx.TextCtrl(
+            ptlegend = TextCtrl(
                 parent=self, id=wx.ID_ANY, value="", size=(
                     200, -1))
             ptlegend.SetValue(self.properties['marker']['legend'])
@@ -1161,7 +1162,7 @@
             self.wxId['marker']['legend'] = ptlegend.GetId()
             gridSizer.Add(ptlegend, pos=(3, 1))
 
-            label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Style"))
+            label = StaticText(parent=self, id=wx.ID_ANY, label=_("Style"))
             gridSizer.Add(
                 label,
                 flag=wx.ALIGN_CENTER_VERTICAL,
@@ -1168,7 +1169,7 @@
                 pos=(
                     4,
                     0))
-            pttype = wx.Choice(
+            pttype = Choice(
                 parent=self, size=(200, -1),
                 choices=self.pttypelist)
             pttype.SetStringSelection(self.properties['marker']['type'])
@@ -1182,13 +1183,13 @@
         # point options for scatterplots
         #
         elif self.plottype == 'scatter':
-            box = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                               label=" %s " % _("Scatterplot points"))
+            box = StaticBox(parent=self, id=wx.ID_ANY,
+                            label=" %s " % _("Scatterplot points"))
 
             boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
 
             gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
-            label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Color"))
+            label = StaticText(parent=self, id=wx.ID_ANY, label=_("Color"))
             gridSizer.Add(
                 label,
                 flag=wx.ALIGN_CENTER_VERTICAL,
@@ -1201,7 +1202,7 @@
             self.wxId['pcolor'] = ptcolor.GetId()
             gridSizer.Add(ptcolor, pos=(0, 1))
 
-            label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Size"))
+            label = StaticText(parent=self, id=wx.ID_ANY, label=_("Size"))
             gridSizer.Add(
                 label,
                 flag=wx.ALIGN_CENTER_VERTICAL,
@@ -1215,7 +1216,7 @@
             self.wxId['psize'] = ptsize.GetId()
             gridSizer.Add(ptsize, pos=(1, 1))
 
-            label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Fill"))
+            label = StaticText(parent=self, id=wx.ID_ANY, label=_("Fill"))
             gridSizer.Add(
                 label,
                 flag=wx.ALIGN_CENTER_VERTICAL,
@@ -1222,13 +1223,13 @@
                 pos=(
                     2,
                     0))
-            ptfill = wx.Choice(parent=self, id=wx.ID_ANY,
-                               size=(120, -1), choices=self.ptfilldict.keys())
+            ptfill = Choice(parent=self, id=wx.ID_ANY,
+                               size=(120, -1), choices=list(self.ptfilldict.keys()))
             ptfill.SetStringSelection(self.raster[self.map]['pfill'])
             self.wxId['pfill'] = ptfill.GetId()
             gridSizer.Add(ptfill, pos=(2, 1))
 
-            label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Legend"))
+            label = StaticText(parent=self, id=wx.ID_ANY, label=_("Legend"))
             gridSizer.Add(
                 label,
                 flag=wx.ALIGN_CENTER_VERTICAL,
@@ -1235,7 +1236,7 @@
                 pos=(
                     3,
                     0))
-            ptlegend = wx.TextCtrl(
+            ptlegend = TextCtrl(
                 parent=self, id=wx.ID_ANY, value="", size=(
                     200, -1))
             ptlegend.SetValue(self.raster[self.map]['plegend'])
@@ -1242,7 +1243,7 @@
             self.wxId['plegend'] = ptlegend.GetId()
             gridSizer.Add(ptlegend, pos=(3, 1))
 
-            label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Style"))
+            label = StaticText(parent=self, id=wx.ID_ANY, label=_("Style"))
             gridSizer.Add(
                 label,
                 flag=wx.ALIGN_CENTER_VERTICAL,
@@ -1249,7 +1250,7 @@
                 pos=(
                     4,
                     0))
-            pttype = wx.Choice(
+            pttype = Choice(
                 parent=self, size=(200, -1),
                 choices=self.pttypelist)
             pttype.SetStringSelection(self.raster[self.map]['ptype'])
@@ -1264,8 +1265,8 @@
         #
         # axis options for all plots
         #
-        box = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                           label=" %s " % _("Axis settings"))
+        box = StaticBox(parent=self, id=wx.ID_ANY,
+                        label=" %s " % _("Axis settings"))
         boxMainSizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)
 
         middleSizer = wx.BoxSizer(wx.HORIZONTAL)
@@ -1273,8 +1274,8 @@
         idx = 0
         for axis, atype in [(_("X-Axis"), 'x-axis'),
                             (_("Y-Axis"), 'y-axis')]:
-            box = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                               label=" %s " % axis)
+            box = StaticBox(parent=self, id=wx.ID_ANY,
+                            label=" %s " % axis)
             boxSizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)
             gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
 
@@ -1281,7 +1282,7 @@
             prop = self.properties[atype]['prop']
 
             row = 0
-            label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Scale"))
+            label = StaticText(parent=self, id=wx.ID_ANY, label=_("Scale"))
             gridSizer.Add(
                 label,
                 flag=wx.ALIGN_CENTER_VERTICAL,
@@ -1288,17 +1289,17 @@
                 pos=(
                     row,
                     0))
-            type = wx.Choice(
+            type = Choice(
                 parent=self, id=wx.ID_ANY, size=(
                     100, -1), choices=self.axislist)
             type.SetStringSelection(prop['type'])
-            type.SetToolTipString(
+            type.SetToolTip(
                 _("Automatic axis scaling, custom max and min, or scale matches data range (min)"))
             self.wxId[atype]['type'] = type.GetId()
             gridSizer.Add(type, pos=(row, 1))
 
             row += 1
-            label = wx.StaticText(
+            label = StaticText(
                 parent=self,
                 id=wx.ID_ANY,
                 label=_("Custom min"))
@@ -1308,14 +1309,14 @@
                 pos=(
                     row,
                     0))
-            min = wx.TextCtrl(parent=self, id=wx.ID_ANY,
-                              value="", size=(70, -1))
+            min = TextCtrl(parent=self, id=wx.ID_ANY,
+                           value="", size=(70, -1))
             min.SetValue(str(prop['min']))
             self.wxId[atype]['min'] = min.GetId()
             gridSizer.Add(min, pos=(row, 1))
 
             row += 1
-            label = wx.StaticText(
+            label = StaticText(
                 parent=self,
                 id=wx.ID_ANY,
                 label=_("Custom max"))
@@ -1325,8 +1326,8 @@
                 pos=(
                     row,
                     0))
-            max = wx.TextCtrl(parent=self, id=wx.ID_ANY,
-                              value="", size=(70, -1))
+            max = TextCtrl(parent=self, id=wx.ID_ANY,
+                           value="", size=(70, -1))
             max.SetValue(str(prop['max']))
             self.wxId[atype]['max'] = max.GetId()
             gridSizer.Add(max, pos=(row, 1))
@@ -1355,13 +1356,13 @@
         self.wxId['grid'] = {}
         self.wxId['legend'] = {}
         self.wxId['font'] = {}
-        box = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                           label=" %s " % _("Grid and Legend settings"))
+        box = StaticBox(parent=self, id=wx.ID_ANY,
+                        label=" %s " % _("Grid and Legend settings"))
         boxMainSizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)
         gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
 
         row = 0
-        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Grid color"))
+        label = StaticText(parent=self, id=wx.ID_ANY, label=_("Grid color"))
         gridSizer.Add(label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0))
         gridcolor = csel.ColourSelect(
             parent=self,
@@ -1377,7 +1378,7 @@
         gridSizer.Add(gridshow, pos=(row, 0), span=(1, 2))
 
         row += 1
-        label = wx.StaticText(
+        label = StaticText(
             parent=self,
             id=wx.ID_ANY,
             label=_("Legend font size"))
@@ -1418,19 +1419,19 @@
         #
         # buttons
         #
-        btnSave = wx.Button(self, wx.ID_SAVE)
-        btnApply = wx.Button(self, wx.ID_APPLY)
-        btnOk = wx.Button(self, wx.ID_OK)
-        btnCancel = wx.Button(self, wx.ID_CANCEL)
+        btnSave = Button(self, wx.ID_SAVE)
+        btnApply = Button(self, wx.ID_APPLY)
+        btnOk = Button(self, wx.ID_OK)
+        btnCancel = Button(self, wx.ID_CANCEL)
         btnOk.SetDefault()
 
         # tooltips for buttons
-        btnApply.SetToolTipString(_("Apply changes for the current session"))
-        btnOk.SetToolTipString(
+        btnApply.SetToolTip(_("Apply changes for the current session"))
+        btnOk.SetToolTip(
             _("Apply changes for the current session and close dialog"))
-        btnSave.SetToolTipString(
+        btnSave.SetToolTip(
             _("Apply and save changes to user settings file (default for next sessions)"))
-        btnCancel.SetToolTipString(_("Close dialog and ignore changes"))
+        btnCancel.SetToolTip(_("Close dialog and ignore changes"))
 
         # sizers
         btnStdSizer = wx.StdDialogButtonSizer()

Modified: grass/trunk/gui/wxpython/wxplot/histogram.py
===================================================================
--- grass/trunk/gui/wxpython/wxplot/histogram.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/wxplot/histogram.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -21,6 +21,7 @@
 
 import grass.script as grass
 import gui_core.wxlibplot as plot
+from gui_core.wrap import StockCursor
 from gui_core.toolbars import BaseToolbar, BaseIcons
 from wxplot.base import BasePlotFrame, PlotIcons
 from wxplot.dialogs import HistRasterDialog, PlotStatsFrame
@@ -90,7 +91,7 @@
         plot to create a line graph of the histogram.
         """
         try:
-            self.SetCursor(wx.StockCursor(wx.CURSOR_ARROW))
+            self.SetCursor(StockCursor(wx.CURSOR_ARROW))
         except:
             pass
 

Modified: grass/trunk/gui/wxpython/wxplot/profile.py
===================================================================
--- grass/trunk/gui/wxpython/wxplot/profile.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/wxplot/profile.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -17,6 +17,7 @@
 
 import os
 import sys
+import six
 import math
 import numpy
 
@@ -27,6 +28,7 @@
 from core.utils import _
 from wxplot.base import BasePlotFrame, PlotIcons
 from gui_core.toolbars import BaseToolbar, BaseIcons
+from gui_core.wrap import StockCursor
 from wxplot.dialogs import ProfileRasterDialog, PlotStatsFrame
 from core.gcmd import RunCommand, GWarning, GError, GMessage
 
@@ -217,7 +219,7 @@
         self.ylabel = ''
         i = 0
 
-        for r in self.raster.iterkeys():
+        for r in six.iterkeys(self.raster):
             self.raster[r]['datalist'] = []
             datalist = self.CreateDatalist(r, self.coordstr)
             if len(datalist) > 0:
@@ -294,7 +296,7 @@
             dlg.Destroy()
             return
 
-        self.SetCursor(wx.StockCursor(wx.CURSOR_ARROW))
+        self.SetCursor(StockCursor(wx.CURSOR_ARROW))
 
         self.SetupProfile()
         p = self.CreatePlotList()
@@ -412,7 +414,7 @@
         message = []
         title = _('Statistics for Profile(s)')
 
-        for r in self.raster.iterkeys():
+        for r in six.iterkeys(self.raster):
             try:
                 rast = r.split('@')[0]
                 statstr = 'Profile of %s\n\n' % rast

Modified: grass/trunk/gui/wxpython/wxplot/scatter.py
===================================================================
--- grass/trunk/gui/wxpython/wxplot/scatter.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/gui/wxpython/wxplot/scatter.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -23,6 +23,7 @@
 import gui_core.wxlibplot as plot
 from wxplot.base import BasePlotFrame, PlotIcons
 from gui_core.toolbars import BaseToolbar, BaseIcons
+from gui_core.wrap import StockCursor
 from wxplot.dialogs import ScatterRasterDialog, PlotStatsFrame
 from core.gcmd import RunCommand, GException, GError, GMessage
 from core.utils import _
@@ -88,7 +89,7 @@
         create a list of cell value pairs. This is passed to
         plot to create a scatterplot.
         """
-        self.SetCursor(wx.StockCursor(wx.CURSOR_ARROW))
+        self.SetCursor(StockCursor(wx.CURSOR_ARROW))
         self.SetGraphStyle()
         wx.BeginBusyCursor()
         wx.SafeYield()

Modified: grass/trunk/lib/python/ctypes/ctypesgen.py
===================================================================
--- grass/trunk/lib/python/ctypes/ctypesgen.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/ctypes/ctypesgen.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -93,6 +93,15 @@
                   default=None, help='regular expression for symbols to always include')
     op.add_option('-x', '--exclude-symbols', dest='exclude_symbols',
                   default=None, help='regular expression for symbols to exclude')
+    op.add_option('', '--no-stddef-types', action='store_true',
+                  dest='no_stddef_types', default=False,
+                  help='Do not support extra C types from stddef.h')
+    op.add_option('', '--no-gnu-types', action='store_true',
+                  dest='no_gnu_types', default=False,
+                  help='Do not support extra GNU C types')
+    op.add_option('', '--no-python-types', action='store_true',
+                  dest='no_python_types', default=False,
+                  help='Do not support extra C types built in to Python')
 
     # Printer options
     op.add_option('', '--header-template', dest='header_template', default=None,
@@ -104,6 +113,9 @@
     op.add_option('', '--insert-file', dest='inserted_files', default=[],
                   action='append', metavar='FILENAME',
                   help='Add the contents of FILENAME to the end of the wrapper file.')
+    op.add_option('', '--output-language', dest='output_language', metavar='LANGUAGE',
+                  default='python',
+                  help="Choose output language (`json' or `python' [default])")
 
     # Error options
     op.add_option('', "--all-errors", action="store_true", default=False,
@@ -135,6 +147,17 @@
     if len(options.libraries) == 0:
         msgs.warning_message('No libraries specified', cls='usage')
 
+    # Check output language
+    printer = None
+    if options.output_language == "python":
+        printer = ctypesgencore.printer.WrapperPrinter
+    elif options.output_language == "json":
+        printer = ctypesgencore.printer_json.WrapperPrinter
+    else:
+        msgs.error_message("No such output language `" +
+                           options.output_language + "'", cls='usage')
+        sys.exit(1)
+
     # Step 1: Parse
     descriptions = ctypesgencore.parser.parse(options.headers, options)
 

Modified: grass/trunk/lib/python/ctypes/ctypesgencore/ctypedescs.py
===================================================================
--- grass/trunk/lib/python/ctypes/ctypesgencore/ctypedescs.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/ctypes/ctypesgencore/ctypedescs.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -57,6 +57,19 @@
     ('va_list', True, 0): 'c_void_p',
 }
 
+ctypes_type_map_python_builtin = {
+    ('int',     True,   2): 'c_longlong',
+    ('int',     False,  2): 'c_ulonglong',
+    ('size_t',  True,   0): 'c_size_t',
+    ('apr_int64_t', True, 0): 'c_int64',
+    ('off64_t', True,   0): 'c_int64',
+    ('apr_uint64_t', True, 0): 'c_uint64',
+    ('wchar_t', True,   0): 'c_wchar',
+    ('ptrdiff_t', True,  0): 'c_ptrdiff_t',  # Requires definition in preamble
+    ('ssize_t', True,   0): 'c_ptrdiff_t',  # Requires definition in preamble
+    ('va_list', True,   0): 'c_void_p',
+}
+
 # This protocol is used for walking type trees.
 
 
@@ -230,11 +243,31 @@
                                 self.count.py_string(False))
 
 
+class CtypesNoErrorCheck(object):
+
+    def py_string(self):
+        return 'None'
+
+    def __bool__(self):
+        return False
+    __nonzero__ = __bool__
+
+
+class CtypesPointerCast(object):
+
+    def __init__(self, target):
+        self.target = target
+
+    def py_string(self):
+        return 'lambda v,*a : cast(v, {})'.format(self.target.py_string())
+
+
 class CtypesFunction(CtypesType):
 
     def __init__(self, restype, parameters, variadic=False):
         CtypesType.__init__(self)
         self.restype = restype
+        self.errcheck = CtypesNoErrorCheck()
 
         # Don't allow POINTER(None) (c_void_p) as a restype... causes errors
         # when ctypes automagically returns it as an int.
@@ -242,12 +275,17 @@
         # you can make it any arbitrary type.
         if isinstance(self.restype, CtypesPointer) and \
            isinstance(self.restype.destination, CtypesSimple) and \
-           self.restype.destination.name == 'None':
-            self.restype = CtypesPointer(CtypesSpecial('c_void'), ())
+           self.restype.destination.name == 'void':
+            # we will provide a means of converting this to a c_void_p
+            self.restype = CtypesPointer(CtypesSpecial('c_ubyte'), ())
+            self.errcheck = CtypesPointerCast(CtypesSpecial('c_void_p'))
 
-        # Return 'ReturnString' instead of simply 'String'
+        # Return "String" instead of "POINTER(c_char)"
         if self.restype.py_string() == 'POINTER(c_char)':
-            self.restype = CtypesSpecial('ReturnString')
+            if 'const' in self.restype.qualifiers:
+                self.restype = CtypesSpecial('c_char_p')
+            else:
+                self.restype = CtypesSpecial('String')
 
         self.argtypes = [remove_function_pointer(p) for p in parameters]
         self.variadic = variadic
@@ -273,9 +311,10 @@
 
 class CtypesStruct(CtypesType):
 
-    def __init__(self, tag, variety, members, src=None):
+    def __init__(self, tag, packed, variety, members, src=None):
         CtypesType.__init__(self)
         self.tag = tag
+        self.packed = packed
         self.variety = variety  # "struct" or "union"
         self.members = members
 

Modified: grass/trunk/lib/python/ctypes/ctypesgencore/descriptions.py
===================================================================
--- grass/trunk/lib/python/ctypes/ctypesgencore/descriptions.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/ctypes/ctypesgencore/descriptions.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -119,10 +119,11 @@
 class StructDescription(Description):
     """Simple container class for a structure or union definition."""
 
-    def __init__(self, tag, variety, members, opaque, ctype, src=None):
+    def __init__(self, tag, packed, variety, members, opaque, ctype, src=None):
         Description.__init__(self, src)
         # The name of the structure minus the "struct" or "union"
         self.tag = tag
+        self.packed = packed
         # A string "struct" or "union"
         self.variety = variety
         # A list of pairs of (name,ctype)
@@ -167,7 +168,7 @@
 class FunctionDescription(Description):
     """Simple container class for a C function."""
 
-    def __init__(self, name, restype, argtypes, variadic=False, src=None):
+    def __init__(self, name, restype, argtypes, errcheck, variadic=False, src=None):
         Description.__init__(self, src)
         # Name, a string
         self.name = name
@@ -177,6 +178,8 @@
         self.restype = restype
         # A list of ctypes representing the argument types
         self.argtypes = argtypes
+        # An optional error checker/caster
+        self.errcheck = errcheck
         # Does this function accept a variable number of arguments?
         self.variadic = variadic
 

Modified: grass/trunk/lib/python/ctypes/ctypesgencore/expressions.py
===================================================================
--- grass/trunk/lib/python/ctypes/ctypesgencore/expressions.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/ctypes/ctypesgencore/expressions.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -7,7 +7,7 @@
 '''
 
 import keyword
-
+import sys
 from .ctypedescs import *
 
 
@@ -84,10 +84,13 @@
         neg_inf = ()
 
     def py_string(self, can_be_ctype):
-        if self.value == ConstantExpressionNode.pos_inf:
-            return "float('inf')"
-        elif self.value == ConstantExpressionNode.neg_inf:
-            return "float('-inf')"
+        if (sys.platform != 'win32' or (sys.platform == 'win32' and
+                                        sys.version_info >= (2, 6))):
+            # Windows python did not get infinity support until 2.6
+            if self.value == ConstantExpressionNode.pos_inf:
+                return "float('inf')"
+            elif self.value == ConstantExpressionNode.neg_inf:
+                return "float('-inf')"
         return repr(self.value)
 
 

Modified: grass/trunk/lib/python/ctypes/ctypesgencore/libraryloader.py
===================================================================
--- grass/trunk/lib/python/ctypes/ctypesgencore/libraryloader.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/ctypes/ctypesgencore/libraryloader.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -36,6 +36,7 @@
 import os.path
 import re
 import sys
+import platform
 
 import ctypes
 import ctypes.util
@@ -136,6 +137,7 @@
 
         dirs.extend(self.other_dirs)
         dirs.append(".")
+        dirs.append(os.path.dirname(__file__))
 
         if hasattr(sys, 'frozen') and sys.frozen == 'macosx_app':
             dirs.append(os.path.join(
@@ -171,6 +173,7 @@
                 directories.extend(os.environ[name].split(os.pathsep))
         directories.extend(self.other_dirs)
         directories.append(".")
+        directories.append(os.path.dirname(__file__))
 
         try:
             directories.extend([dir.strip() for dir in open('/etc/ld.so.conf')])
@@ -177,7 +180,21 @@
         except IOError:
             pass
 
-        directories.extend(['/lib', '/usr/lib', '/lib64', '/usr/lib64'])
+        unix_lib_dirs_list = ['/lib', '/usr/lib', '/lib64', '/usr/lib64']
+        if sys.platform.startswith('linux'):
+            # Try and support multiarch work in Ubuntu
+            # https://wiki.ubuntu.com/MultiarchSpec
+            bitage = platform.architecture()[0]
+            if bitage.startswith('32'):
+                # Assume Intel/AMD x86 compat
+                unix_lib_dirs_list += ['/lib/i386-linux-gnu', '/usr/lib/i386-linux-gnu']
+            elif bitage.startswith('64'):
+                # Assume Intel/AMD x86 compat
+                unix_lib_dirs_list += ['/lib/x86_64-linux-gnu', '/usr/lib/x86_64-linux-gnu']
+            else:
+                # guess...
+                unix_lib_dirs_list += glob.glob('/lib/*linux-gnu')
+        directories.extend(unix_lib_dirs_list)
 
         cache = {}
         lib_re = re.compile(r'lib(.*)\.s[ol]')
@@ -236,6 +253,28 @@
 class WindowsLibraryLoader(LibraryLoader):
     name_formats = ["%s.dll", "lib%s.dll"]
 
+    def load_library(self, libname):
+        try:
+            result = LibraryLoader.load_library(self, libname)
+        except ImportError:
+            result = None
+            if os.path.sep not in libname:
+                for name in self.name_formats:
+                    try:
+                        result = getattr(ctypes.cdll, name % libname)
+                        if result:
+                            break
+                    except WindowsError:
+                        result = None
+            if result is None:
+                try:
+                    result = getattr(ctypes.cdll, libname)
+                except WindowsError:
+                    result = None
+            if result is None:
+                raise ImportError("%s not found." % libname)
+        return result
+
     def load(self, path):
         return _WindowsLibrary(path)
 
@@ -242,6 +281,9 @@
     def getplatformpaths(self, libname):
         if os.path.sep not in libname:
             for name in self.name_formats:
+                dll_in_current_dir = os.path.abspath(name % libname)
+                if os.path.exists(dll_in_current_dir):
+                    yield dll_in_current_dir
                 path = ctypes.util.find_library(name % libname)
                 if path:
                     yield path
@@ -261,7 +303,16 @@
 
 
 def add_library_search_dirs(other_dirs):
-    loader.other_dirs = other_dirs
+    """
+    Add libraries to search paths.
+    If library paths are relative, convert them to absolute with respect to this
+    file's directory
+    """
+    THIS_DIR = os.path.dirname(__file__)
+    for F in other_dirs:
+        if not os.path.isabs(F):
+            F = os.path.abspath(os.path.join(THIS_DIR, F))
+        loader.other_dirs.append(F)
 
 load_library = loader.load_library
 

Modified: grass/trunk/lib/python/ctypes/ctypesgencore/messages.py
===================================================================
--- grass/trunk/lib/python/ctypes/ctypesgencore/messages.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/ctypes/ctypesgencore/messages.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -22,10 +22,20 @@
 from __future__ import print_function
 
 import sys
+import logging
 
 __all__ = ["error_message", "warning_message", "status_message"]
 
+log = logging.getLogger('ctypesgen')
+ch = logging.StreamHandler()  # use stdio
+logging_fmt_str = "%(levelname)s: %(message)s"
+formatter = logging.Formatter(logging_fmt_str)
+ch.setFormatter(formatter)
+log.addHandler(ch)
+# default level that ctypesgen was using with original version
+log.setLevel(logging.INFO)
 
+
 def error_message(msg, cls=None):
     print("Error: %s" % msg)
 

Modified: grass/trunk/lib/python/ctypes/ctypesgencore/options.py
===================================================================
--- grass/trunk/lib/python/ctypes/ctypesgencore/options.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/ctypes/ctypesgencore/options.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -32,7 +32,11 @@
     "other_known_names": [],
     "include_macros": True,
     "libraries": [],
-    "strip_build_path": None
+    "strip_build_path": None,
+    "output_language": "python",
+    "no_stddef_types": False,
+    "no_gnu_types": False,
+    "no_python_types": False,
 }
 
 

Modified: grass/trunk/lib/python/ctypes/ctypesgencore/parser/cdeclarations.py
===================================================================
--- grass/trunk/lib/python/ctypes/ctypesgencore/parser/cdeclarations.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/ctypes/ctypesgencore/parser/cdeclarations.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -130,8 +130,9 @@
 
 class StructTypeSpecifier(object):
 
-    def __init__(self, is_union, tag, declarations):
+    def __init__(self, is_union, is_packed, tag, declarations):
         self.is_union = is_union
+        self.is_packed = is_packed
         self.tag = tag
         self.declarations = declarations
 
@@ -140,6 +141,8 @@
             s = 'union'
         else:
             s = 'struct'
+        if self.is_packed:
+            s += ' __attribute__((packed))'
         if self.tag:
             s += ' %s' % self.tag
         if self.declarations:

Modified: grass/trunk/lib/python/ctypes/ctypesgencore/parser/cgrammar.py
===================================================================
--- grass/trunk/lib/python/ctypes/ctypesgencore/parser/cgrammar.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/ctypes/ctypesgencore/parser/cgrammar.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -20,6 +20,10 @@
 import warnings
 
 from . import cdeclarations
+try:
+    from . import ctypesparser
+except:
+    import ctypesparser
 import ctypesgencore.expressions as expressions
 from . import preprocessor
 from . import yacc
@@ -40,20 +44,22 @@
     'AND_ASSIGN', 'XOR_ASSIGN', 'OR_ASSIGN', 'PERIOD', 'TYPE_NAME',
 
     'TYPEDEF', 'EXTERN', 'STATIC', 'AUTO', 'REGISTER',
-    'CHAR', 'SHORT', 'INT', 'LONG', 'SIGNED', 'UNSIGNED', 'FLOAT', 'DOUBLE',
+    '_BOOL', 'CHAR', 'SHORT', 'INT', 'LONG', 'SIGNED', 'UNSIGNED', 'FLOAT', 'DOUBLE',
     'CONST', 'VOLATILE', 'VOID',
     'STRUCT', 'UNION', 'ENUM', 'ELLIPSIS',
 
     'CASE', 'DEFAULT', 'IF', 'ELSE', 'SWITCH', 'WHILE', 'DO', 'FOR', 'GOTO',
-    'CONTINUE', 'BREAK', 'RETURN', '__ASM__'
+    'CONTINUE', 'BREAK', 'RETURN', '__ASM__', '__ATTRIBUTE__', 'PACKED',
+    'ALIGNED', 'TRANSPARENT_UNION',
 )
 
 keywords = [
-    'auto', 'break', 'case', 'char', 'const', 'continue', 'default', 'do',
+    'auto', '_Bool', 'break', 'case', 'char', 'const', 'continue', 'default', 'do',
     'double', 'else', 'enum', 'extern', 'float', 'for', 'goto', 'if', 'int',
     'long', 'register', 'return', 'short', 'signed', 'sizeof', 'static',
     'struct', 'switch', 'typedef', 'union', 'unsigned', 'void', 'volatile',
-    'while', '__asm__'
+    'while', '__asm__', '__attribute__', 'packed', 'aligned',
+    'transparent_union',
 ]
 
 
@@ -618,6 +624,7 @@
 
 def p_type_specifier(p):
     '''type_specifier : VOID
+                      | _BOOL
                       | CHAR
                       | SHORT
                       | INT
@@ -637,8 +644,19 @@
         p[0] = cdeclarations.TypeSpecifier(p[1])
 
 
+class Attribs(dict):
+    def __init__(self, packed=False, aligned=False, transparent_union=False):
+        super(Attribs, self).__init__(
+          packed=packed, aligned=aligned, transparent_union=transparent_union,
+        )
+        self.__dict__ = self
+
+
 def p_struct_or_union_specifier(p):
-    '''struct_or_union_specifier : struct_or_union IDENTIFIER '{' struct_declaration_list '}'
+    '''struct_or_union_specifier : struct_or_union gcc_attribs IDENTIFIER '{' struct_declaration_list '}'
+         | struct_or_union gcc_attribs TYPE_NAME '{' struct_declaration_list '}'
+         | struct_or_union gcc_attribs '{' struct_declaration_list '}'
+         | struct_or_union IDENTIFIER '{' struct_declaration_list '}'
          | struct_or_union TYPE_NAME '{' struct_declaration_list '}'
          | struct_or_union '{' struct_declaration_list '}'
          | struct_or_union IDENTIFIER
@@ -647,13 +665,25 @@
     # The TYPE_NAME ones are dodgy, needed for Apple headers
     # CoreServices.framework/Frameworks/CarbonCore.framework/Headers/Files.h.
     # CoreServices.framework/Frameworks/OSServices.framework/Headers/Power.h
-    if len(p) == 3:
-        p[0] = cdeclarations.StructTypeSpecifier(p[1], p[2], None)
-    elif p[2] == '{':
-        p[0] = cdeclarations.StructTypeSpecifier(p[1], '', p[3])
+    packed = False
+    if len(p) == 3:  # struct <id/typname>
+        p[0] = cdeclarations.StructTypeSpecifier(p[1], False, p[2], None)
     else:
-        p[0] = cdeclarations.StructTypeSpecifier(p[1], p[2], p[4])
+        if type(p[2]) is Attribs:
+            attribs = p[2]
+            if p[3] == '{':
+                tag, decl = '', p[4]
+            else:
+                tag, decl = p[3], p[5]
+        else:
+            attribs = Attribs()
+            if p[2] == '{':
+                tag, decl = '', p[3]
+            else:
+                tag, decl = p[2], p[4]
 
+        p[0] = cdeclarations.StructTypeSpecifier(p[1], attribs.packed, tag, decl)
+
     p[0].filename = p.slice[0].filename
     p[0].lineno = p.slice[0].lineno
 
@@ -665,6 +695,21 @@
     p[0] = p[1] == 'union'
 
 
+def p_gcc_attribs(p):
+    '''gcc_attribs : __ATTRIBUTE__ '(' '(' struct_attribute ')' ')'
+    '''
+    p[0] = Attribs()
+    p[0].packed = False if len(p) == 1 else p[4] == 'packed'
+
+
+def p_struct_attribute(p):
+    '''struct_attribute : PACKED
+                        | TRANSPARENT_UNION
+                        | ALIGNED
+    '''
+    p[0] = p[1]
+
+
 def p_struct_declaration_list(p):
     '''struct_declaration_list : struct_declaration
                                | struct_declaration_list struct_declaration
@@ -688,6 +733,11 @@
             cdeclarations.apply_specifiers(p[1], declaration)
             declaration.declarator = declarator
             r += (declaration,)
+    else:
+        # anonymous field (C11/GCC extension)
+        declaration = cdeclarations.Declaration()
+        cdeclarations.apply_specifiers(p[1], declaration)
+        r = (declaration,)
     p[0] = r
 
 
@@ -909,7 +959,6 @@
     '''type_name : specifier_qualifier_list
                  | specifier_qualifier_list abstract_declarator
     '''
-    from . import ctypesparser
     typ = p[1]
     if len(p) == 3:
         declarator = p[2]
@@ -919,8 +968,8 @@
     declaration = cdeclarations.Declaration()
     declaration.declarator = declarator
     cdeclarations.apply_specifiers(typ, declaration)
-    ctype = ctypesparser.get_ctypes_type(declaration.type,
-                                         declaration.declarator)
+    ctype = p.parser.cparser.get_ctypes_type(declaration.type,
+                                             declaration.declarator)
     p[0] = ctype
 
 

Modified: grass/trunk/lib/python/ctypes/ctypesgencore/parser/cparser.py
===================================================================
--- grass/trunk/lib/python/ctypes/ctypesgencore/parser/cparser.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/ctypes/ctypesgencore/parser/cparser.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -63,7 +63,9 @@
                 t.type = t.value.upper()
             elif t.type == 'IDENTIFIER' and t.value in self.type_names:
                 if (self.pos < 2 or self.tokens[self.pos - 2].type not in
-                        ('ENUM', 'STRUCT', 'UNION')):
+                        ('VOID', '_BOOL', 'CHAR', 'SHORT', 'INT', 'LONG',
+                         'FLOAT', 'DOUBLE', 'SIGNED', 'UNSIGNED', 'ENUM',
+                         'STRUCT', 'UNION', 'TYPE_NAME')):
                     t.type = 'TYPE_NAME'
 
             t.lexer = self
@@ -101,13 +103,13 @@
         self.parser.cparser = self
 
         self.lexer = CLexer(self)
-        if stddef_types:
+        if not options.no_stddef_types:
             self.lexer.type_names.add('wchar_t')
             self.lexer.type_names.add('ptrdiff_t')
             self.lexer.type_names.add('size_t')
-        if gnu_types:
+        if not options.no_gnu_types:
             self.lexer.type_names.add('__builtin_va_list')
-        if sys.platform == 'win32':
+        if sys.platform == 'win32' and not options.no_python_types:
             self.lexer.type_names.add('__int64')
 
     def parse(self, filename, debug=False):
@@ -212,5 +214,17 @@
     def handle_declaration(self, declaration, filename, lineno):
         print(declaration)
 
+    def get_ctypes_type(self, typ, declarator):
+        return typ
+
+    def handle_define_unparseable(self, name, params, value, filename, lineno):
+        if params:
+            original_string = "#define %s(%s) %s" % \
+                (name, ",".join(params), " ".join(value))
+        else:
+            original_string = "#define %s %s" % \
+                (name, " ".join(value))
+        print(original_string)
+
 if __name__ == '__main__':
     DebugCParser().parse(sys.argv[1], debug=True)

Modified: grass/trunk/lib/python/ctypes/ctypesgencore/parser/ctypesparser.py
===================================================================
--- grass/trunk/lib/python/ctypes/ctypesgencore/parser/ctypesparser.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/ctypes/ctypesgencore/parser/ctypesparser.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -18,154 +18,177 @@
 from ctypesgencore.expressions import *
 
 
-def get_ctypes_type(typ, declarator, check_qualifiers=False):
-    signed = True
-    typename = 'int'
-    longs = 0
-    t = None
+def make_enum_from_specifier(specifier):
+    tag = specifier.tag
 
-    for specifier in typ.specifiers:
-        if isinstance(specifier, StructTypeSpecifier):
-            t = make_struct_from_specifier(specifier)
-        elif isinstance(specifier, EnumSpecifier):
-            t = make_enum_from_specifier(specifier)
-        elif specifier == 'signed':
-            signed = True
-        elif specifier == 'unsigned':
-            signed = False
-        elif specifier == 'long':
-            longs += 1
+    enumerators = []
+    last_name = None
+    for e in specifier.enumerators:
+        if e.expression:
+            value = e.expression
         else:
-            typename = str(specifier)
+            if last_name:
+                value = BinaryExpressionNode("addition", (lambda x, y: x + y),
+                                             "(%s + %s)", (False, False),
+                                             IdentifierExpressionNode(
+                                                 last_name),
+                                             ConstantExpressionNode(1))
+            else:
+                value = ConstantExpressionNode(0)
 
-    if not t:
-        # It is a numeric type of some sort
-        if (typename, signed, longs) in ctypes_type_map:
-            t = CtypesSimple(typename, signed, longs)
+        enumerators.append((e.name, value))
+        last_name = e.name
 
-        elif signed and not longs:
-            t = CtypesTypedef(typename)
+    return CtypesEnum(tag, enumerators,
+                      src=(specifier.filename, specifier.lineno))
 
-        else:
-            name = " ".join(typ.specifiers)
-            if typename in [x[0] for x in ctypes_type_map.keys()]:
-                # It's an unsupported variant of a builtin type
-                error = "Ctypes does not support the type \"%s\"." % name
-            else:
-                error = "Ctypes does not support adding additional " \
-                    "specifiers to typedefs, such as \"%s\"" % name
-            t = CtypesTypedef(name)
-            t.error(error, cls='unsupported-type')
 
-        if declarator and declarator.bitfield:
-            t = CtypesBitfield(t, declarator.bitfield)
+def get_decl_id(decl):
+    """Return the identifier of a given declarator"""
+    while isinstance(decl, Pointer):
+        decl = decl.pointer
+    p_name = ""
+    if decl is not None and decl.identifier is not None:
+        p_name = decl.identifier
+    return p_name
 
-    qualifiers = []
-    qualifiers.extend(typ.qualifiers)
-    while declarator and declarator.pointer:
-        if declarator.parameters is not None:
-            variadic = "..." in declarator.parameters
 
-            params = []
-            for param in declarator.parameters:
-                if param == "...":
-                    break
-                params.append(get_ctypes_type(param.type, param.declarator))
-            t = CtypesFunction(t, params, variadic)
+class CtypesParser(CParser):
+    '''Parse a C file for declarations that can be used by ctypes.
 
-        a = declarator.array
-        while a:
-            t = CtypesArray(t, a.size)
-            a = a.array
+    Subclass and override the handle_ctypes_* methods.
+    '''
 
-        qualifiers.extend(declarator.qualifiers)
+    def __init__(self, options):
+        super(CtypesParser, self).__init__(options)
+        self.type_map = ctypes_type_map
+        if not options.no_python_types:
+            self.type_map.update(ctypes_type_map_python_builtin)
 
-        t = CtypesPointer(t, declarator.qualifiers)
+    def make_struct_from_specifier(self, specifier):
+        variety = {True: "union", False: "struct"}[specifier.is_union]
+        tag = specifier.tag
 
-        declarator = declarator.pointer
+        if specifier.declarations:
+            members = []
+            for declaration in specifier.declarations:
+                t = self.get_ctypes_type(declaration.type,
+                                         declaration.declarator,
+                                         check_qualifiers=True)
+                declarator = declaration.declarator
+                if declarator is None:
+                    # Anonymous field in nested union/struct (C11/GCC).
+                    name = None
+                else:
+                    while declarator.pointer:
+                        declarator = declarator.pointer
+                    name = declarator.identifier
+                members.append((name, remove_function_pointer(t)))
+        else:
+            members = None
 
-    if declarator and declarator.parameters is not None:
-        variadic = "..." in declarator.parameters
+        return CtypesStruct(tag, specifier.is_packed, variety, members,
+                            src=(specifier.filename, specifier.lineno))
 
-        params = []
-        for param in declarator.parameters:
-            if param == "...":
-                break
-            params.append(get_ctypes_type(param.type, param.declarator))
-        t = CtypesFunction(t, params, variadic)
+    def get_ctypes_type(self, typ, declarator, check_qualifiers=False):
+        signed = True
+        typename = 'int'
+        longs = 0
+        t = None
 
-    if declarator:
-        a = declarator.array
-        while a:
-            t = CtypesArray(t, a.size)
-            a = a.array
+        for specifier in typ.specifiers:
+            if isinstance(specifier, StructTypeSpecifier):
+                t = self.make_struct_from_specifier(specifier)
+            elif isinstance(specifier, EnumSpecifier):
+                t = make_enum_from_specifier(specifier)
+            elif specifier == 'signed':
+                signed = True
+            elif specifier == 'unsigned':
+                signed = False
+            elif specifier == 'long':
+                longs += 1
+            else:
+                typename = str(specifier)
 
-    if isinstance(t, CtypesPointer) and \
-       isinstance(t.destination, CtypesSimple) and \
-       t.destination.name == "char" and \
-       t.destination.signed:
-        t = CtypesSpecial("String")
+        if not t:
+            # It is a numeric type of some sort
+            if (typename, signed, longs) in self.type_map:
+                t = CtypesSimple(typename, signed, longs)
 
-    return t
+            elif signed and not longs:
+                t = CtypesTypedef(typename)
 
+            else:
+                name = " ".join(typ.specifiers)
+                if typename in [x[0] for x in self.type_map.keys()]:
+                    # It's an unsupported variant of a builtin type
+                    error = "Ctypes does not support the type \"%s\"." % name
+                else:
+                    error = "Ctypes does not support adding additional " \
+                        "specifiers to typedefs, such as \"%s\"" % name
+                t = CtypesTypedef(name)
+                t.error(error, cls='unsupported-type')
 
-def make_struct_from_specifier(specifier):
-    variety = {True: "union", False: "struct"}[specifier.is_union]
-    tag = specifier.tag
+            if declarator and declarator.bitfield:
+                t = CtypesBitfield(t, declarator.bitfield)
 
-    if specifier.declarations:
-        members = []
-        for declaration in specifier.declarations:
-            t = get_ctypes_type(declaration.type,
-                                declaration.declarator,
-                                check_qualifiers=True)
-            declarator = declaration.declarator
-            if declarator is None:
-                # XXX TEMPORARY while struct with no typedef not filled in
-                break
-            while declarator.pointer:
-                declarator = declarator.pointer
-            name = declarator.identifier
-            members.append((name, remove_function_pointer(t)))
-    else:
-        members = None
+        qualifiers = []
+        qualifiers.extend(typ.qualifiers)
+        while declarator and declarator.pointer:
+            if declarator.parameters is not None:
+                variadic = "..." in declarator.parameters
 
-    return CtypesStruct(tag, variety, members,
-                        src=(specifier.filename, specifier.lineno))
+                params = []
+                for param in declarator.parameters:
+                    if param == "...":
+                        break
+                    param_name = get_decl_id(param.declarator)
+                    ct = self.get_ctypes_type(param.type, param.declarator)
+                    ct.identifier = param_name
+                    params.append(ct)
+                t = CtypesFunction(t, params, variadic)
 
+            a = declarator.array
+            while a:
+                t = CtypesArray(t, a.size)
+                a = a.array
 
-def make_enum_from_specifier(specifier):
-    tag = specifier.tag
+            qualifiers.extend(declarator.qualifiers)
 
-    enumerators = []
-    last_name = None
-    for e in specifier.enumerators:
-        if e.expression:
-            value = e.expression
-        else:
-            if last_name:
-                value = BinaryExpressionNode("addition", (lambda x, y: x + y),
-                                             "(%s + %s)", (False, False),
-                                             IdentifierExpressionNode(last_name),
-                                             ConstantExpressionNode(1))
-            else:
-                value = ConstantExpressionNode(0)
+            t = CtypesPointer(t, tuple(typ.qualifiers) +
+                              tuple(declarator.qualifiers))
 
-        enumerators.append((e.name, value))
-        last_name = e.name
+            declarator = declarator.pointer
 
-    return CtypesEnum(tag, enumerators,
-                      src=(specifier.filename, specifier.lineno))
+        if declarator and declarator.parameters is not None:
+            variadic = "..." in declarator.parameters
 
+            params = []
+            for param in declarator.parameters:
+                if param == "...":
+                    break
+                param_name = get_decl_id(param.declarator)
+                ct = self.get_ctypes_type(param.type, param.declarator)
+                ct.identifier = param_name
+                params.append(ct)
+            t = CtypesFunction(t, params, variadic)
 
-class CtypesParser(CParser):
-    '''Parse a C file for declarations that can be used by ctypes.
+        if declarator:
+            a = declarator.array
+            while a:
+                t = CtypesArray(t, a.size)
+                a = a.array
 
-    Subclass and override the handle_ctypes_* methods.
-    '''
+        if (isinstance(t, CtypesPointer) and
+            isinstance(t.destination, CtypesSimple) and
+            t.destination.name == "char" and
+                t.destination.signed):
+            t = CtypesSpecial("String")
 
+        return t
+
     def handle_declaration(self, declaration, filename, lineno):
-        t = get_ctypes_type(declaration.type, declaration.declarator)
+        t = self.get_ctypes_type(declaration.type, declaration.declarator)
 
         if type(t) in (CtypesStruct, CtypesEnum):
             self.handle_ctypes_new_type(
@@ -183,7 +206,7 @@
                 name, remove_function_pointer(t), filename, lineno)
         elif isinstance(t, CtypesFunction):
             self.handle_ctypes_function(
-                name, t.restype, t.argtypes, t.variadic, filename, lineno)
+                name, t.restype, t.argtypes, t.errcheck, t.variadic, filename, lineno)
         elif declaration.storage != 'static':
             self.handle_ctypes_variable(name, t, filename, lineno)
 
@@ -195,7 +218,7 @@
     def handle_ctypes_typedef(self, name, ctype, filename, lineno):
         pass
 
-    def handle_ctypes_function(self, name, restype, argtypes, filename, lineno):
+    def handle_ctypes_function(self, name, restype, argtypes, errcheck, filename, lineno):
         pass
 
     def handle_ctypes_variable(self, name, ctype, filename, lineno):

Modified: grass/trunk/lib/python/ctypes/ctypesgencore/parser/datacollectingparser.py
===================================================================
--- grass/trunk/lib/python/ctypes/ctypesgencore/parser/datacollectingparser.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/ctypes/ctypesgencore/parser/datacollectingparser.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -64,7 +64,7 @@
 
     def parse(self):
         fd, fname = mkstemp(suffix=".h")
-        f = os.fdopen(fd, 'w+b')
+        f = os.fdopen(fd, 'w')
         for header in self.options.other_headers:
             print('#include <%s>' % header, file=f)
         for header in self.headers:
@@ -71,7 +71,7 @@
             print('#include "%s"' % os.path.abspath(header), file=f)
         f.flush()
         f.close()
-        ctypesparser.CtypesParser.parse(self, fname, None)
+        ctypesparser.CtypesParser.parse(self, fname, False)
         os.remove(fname)
 
         for name, params, expr, (filename, lineno) in self.saved_macros:
@@ -123,8 +123,8 @@
         else:
             self.handle_struct(ctype, filename, lineno)
 
-    def handle_ctypes_function(self, name, restype, argtypes, variadic,
-                               filename, lineno):
+    def handle_ctypes_function(self, name, restype, argtypes, errcheck,
+                               variadic, filename, lineno):
         # Called by CtypesParser
         restype.visit(self)
         for argtype in argtypes:
@@ -133,6 +133,7 @@
         function = FunctionDescription(name,
                                        restype,
                                        argtypes,
+                                       errcheck,
                                        variadic=variadic,
                                        src=(filename, repr(lineno)))
 
@@ -169,6 +170,7 @@
         if ctypestruct.opaque:
             if name not in self.already_seen_opaque_structs:
                 struct = StructDescription(ctypestruct.tag,
+                                           ctypestruct.packed,
                                            ctypestruct.variety,
                                            None,  # No members
                                            True,  # Opaque
@@ -198,6 +200,7 @@
 
             else:
                 struct = StructDescription(ctypestruct.tag,
+                                           ctypestruct.packed,
                                            ctypestruct.variety,
                                            ctypestruct.members,
                                            False,  # Not opaque
@@ -223,7 +226,7 @@
         if ctypeenum.opaque:
             if tag not in self.already_seen_opaque_enums:
                 enum = EnumDescription(ctypeenum.tag,
-                                       ctypeenum.enumerators,
+                                       None,
                                        ctypeenum,
                                        src=(filename, str(lineno)))
                 enum.opaque = True
@@ -240,12 +243,13 @@
                 enum.opaque = False
                 enum.ctype = ctypeenum
                 enum.src = ctypeenum.src
+                enum.members = ctypeenum.enumerators
 
                 del self.already_seen_opaque_enums[tag]
 
             else:
                 enum = EnumDescription(ctypeenum.tag,
-                                       None,
+                                       ctypeenum.enumerators,
                                        src=(filename, str(lineno)),
                                        ctype=ctypeenum)
                 enum.opaque = False

Modified: grass/trunk/lib/python/ctypes/ctypesgencore/parser/lex.py
===================================================================
--- grass/trunk/lib/python/ctypes/ctypesgencore/parser/lex.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/ctypes/ctypesgencore/parser/lex.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -43,8 +43,9 @@
 import sys
 import types
 import collections
+import functools
+from grass.script.utils import decode
 
-
 if PY3:
     _meth_func = "__func__"
     _meth_self = "__self__"
@@ -255,7 +256,10 @@
     # input() - Push a new string into the lexer
     # ------------------------------------------------------------
     def input(self, s):
-        if not (isinstance(s, bytes) or isinstance(s, str)):
+        s = decode(s)
+        if not (isinstance(s, bytes) or
+                isinstance(s, str) or
+                isinstance(s, unicode)):
             raise ValueError("Expected a string")
         self.lexdata = s
         self.lexpos = 0
@@ -682,7 +686,7 @@
                     error = 1
                     continue
                 name, statetype = s
-                if not isinstance(name, bytes):
+                if not isinstance(name, str):
                     print("lex: state name %s must be a string" % repr(name))
                     error = 1
                     continue
@@ -732,11 +736,21 @@
 
     # Sort the functions by line number
     for f in funcsym.values():
-        f.sort(lambda x, y: cmp(get_func_code(x[1]).co_firstlineno, get_func_code(y[1]).co_firstlineno))
+        if os.sys.version_info.major >= 3:
+            f.sort(key=lambda x: get_func_code(x[1]).co_firstlineno)
+        else:
+            f.sort(key=lambda x, y: cmp(get_func_code(x[1]).co_firstlineno,
+                                        get_func_code(y[1]).co_firstlineno))
 
     # Sort the strings by regular expression length
     for s in strsym.values():
-        s.sort(lambda x, y: (len(x[1]) < len(y[1])) - (len(x[1]) > len(y[1])))
+        if os.sys.version_info.major >= 3:
+            s.sort(key=functools.cmp_to_key(lambda x, y:
+                                            (len(x[1]) < len(y[1])) -
+                                            (len(x[1]) > len(y[1]))))
+        else:
+            s.sort(key=lambda x, y: (len(x[1]) < len(y[1])) -
+                                    (len(x[1]) > len(y[1])))
 
     regexs = {}
 
@@ -747,8 +761,8 @@
         # Add rules defined by functions first
         for fname, f in funcsym[state]:
             line = get_func_code(f).co_firstlineno
-            file = get_func_code(f).co_filename
-            files[file] = None
+            file_ = get_func_code(f).co_filename
+            files[file_] = None
             tokname = toknames[fname]
 
             ismethod = isinstance(f, types.MethodType)
@@ -760,17 +774,20 @@
                 else:
                     reqargs = 1
                 if nargs > reqargs:
-                    print("%s:%d: Rule '%s' has too many arguments." % (file, line, f.__name__))
+                    print("%s:%d: Rule '%s' has too many arguments."
+                          % (file_, line, f.__name__))
                     error = 1
                     continue
 
                 if nargs < reqargs:
-                    print("%s:%d: Rule '%s' requires an argument." % (file, line, f.__name__))
+                    print("%s:%d: Rule '%s' requires an argument."
+                          % (file_, line, f.__name__))
                     error = 1
                     continue
 
                 if tokname == 'ignore':
-                    print("%s:%d: Rule '%s' must be defined as a string." % (file, line, f.__name__))
+                    print("%s:%d: Rule '%s' must be defined as a string."
+                          % (file_, line, f.__name__))
                     error = 1
                     continue
 
@@ -783,18 +800,23 @@
                     try:
                         c = re.compile("(?P<%s>%s)" % (f.__name__, f.__doc__), re.VERBOSE | reflags)
                         if c.match(""):
-                            print("%s:%d: Regular expression for rule '%s' matches empty string." % (file, line, f.__name__))
+                            print("%s:%d: Regular expression for rule '%s' "
+                                  "matches empty string."
+                                  % (file_, line, f.__name__))
                             error = 1
                             continue
                     except re.error as e:
-                        print("%s:%d: Invalid regular expression for rule '%s'. %s" % (file, line, f.__name__, e))
+                        print("%s:%d: Invalid regular expression for rule '%s'. %s"
+                              % (file_, line, f.__name__, e))
                         if '#' in f.__doc__:
-                            print("%s:%d. Make sure '#' in rule '%s' is escaped with '\\#'." % (file, line, f.__name__))
+                            print("%s:%d. Make sure '#' in rule '%s' is escaped with '\\#'."
+                                  % (file_, line, f.__name__))
                         error = 1
                         continue
 
                     if debug:
-                        print("lex: Adding rule %s -> '%s' (state '%s')" % (f.__name__, f.__doc__, state))
+                        print("lex: Adding rule %s -> '%s' (state '%s')"
+                              % (f.__name__, f.__doc__, state))
 
                 # Okay. The regular expression seemed okay.  Let's append it to the master regular
                 # expression we're building
@@ -801,7 +823,8 @@
 
                 regex_list.append("(?P<%s>%s)" % (f.__name__, f.__doc__))
             else:
-                print("%s:%d: No regular expression defined for rule '%s'" % (file, line, f.__name__))
+                print("%s:%d: No regular expression defined for rule '%s'"
+                      % (file_, line, f.__name__))
 
         # Now add all of the simple rules
         for name, r in strsym[state]:

Modified: grass/trunk/lib/python/ctypes/ctypesgencore/parser/lextab.py
===================================================================
--- grass/trunk/lib/python/ctypes/ctypesgencore/parser/lextab.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/ctypes/ctypesgencore/parser/lextab.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -1,8 +1,8 @@
 # lextab.py. This file automatically created by PLY (version 2.2). Don't edit!
-_lextokens    = {'RIGHT_OP': None, 'RIGHT_ASSIGN': None, 'DEC_OP': None, 'PP_MACRO_PARAM': None, 'DIV_ASSIGN': None, 'PP_DEFINE': None, 'PP_END_DEFINE': None, 'PP_DEFINE_MACRO_NAME': None, 'HEADER_NAME': None, 'NEWLINE': None, 'CHARACTER_CONSTANT': None, 'PP_STRINGIFY': None, 'AND_ASSIGN': None, 'PTR_OP': None, 'ELLIPSIS': None, 'IDENTIFIER': None, 'ADD_ASSIGN': None, 'PERIOD': None, 'AND_OP': None, 'OTHER': None, 'LPAREN': None, 'LEFT_OP': None, 'LE_OP': None, 'OR_OP': None, 'SUB_ASSIGN': None, 'MOD_ASSIGN': None, 'STRING_LITERAL': None, 'PP_IDENTIFIER_PASTE': None, 'PP_NUMBER': None, 'PP_DEFINE_NAME': None, 'XOR_ASSIGN': None, 'OR_ASSIGN': None, 'GE_OP': None, 'MUL_ASSIGN': None, 'LEFT_ASSIGN': None, 'INC_OP': None, 'NE_OP': None, 'EQ_OP': None}
+_lextokens    = {'PP_END_DEFINE': None, 'DIV_ASSIGN': None, 'AND_OP': None, 'PERIOD': None, 'PTR_OP': None, 'PP_MACRO_PARAM': None, 'OTHER': None, 'IDENTIFIER': None, 'PP_STRINGIFY': None, 'XOR_ASSIGN': None, 'PP_DEFINE_NAME': None, 'ELLIPSIS': None, 'INC_OP': None, 'GE_OP': None, 'LEFT_ASSIGN': None, 'MUL_ASSIGN': None, 'RIGHT_ASSIGN': None, 'SUB_ASSIGN': None, 'LPAREN': None, 'PP_IDENTIFIER_PASTE': None, 'PP_DEFINE': None, 'OR_ASSIGN': None, 'ADD_ASSIGN': None, 'HEADER_NAME': None, 'LE_OP': None, 'LEFT_OP': None, 'PP_NUMBER': None, 'DEC_OP': None, 'RIGHT_OP': None, 'MOD_ASSIGN': None, 'STRING_LITERAL': None, 'EQ_OP': None, 'OR_OP': None, 'AND_ASSIGN': None, 'CHARACTER_CONSTANT': None, 'PP_DEFINE_MACRO_NAME': None, 'NE_OP': None, 'NEWLINE': None}
 _lexreflags   = 0
 _lexliterals  = ''
-_lexstateinfo = {'INITIAL': 'inclusive', 'DEFINE': 'exclusive'}
-_lexstatere   = {'INITIAL': [('(?P<t_ANY_directive>\\#\\s+(\\d+)\\s+"([^"]+)"[ \\d]*\\n)|(?P<t_ANY_punctuator>(\\.\\.\\.|\\|\\||\\+\\+|>>=|\\|=|\\^=|<<=|\\*=|\\+=|>=|>>|%=|:>|%>|!=|\\*|\\.|==|\\^|--|-=|->|\\||<<|<=|<:|<%|\\)|\\+|\\?|&=|&&|\\[|/=|&|,|:|<|>|~|!|%|-|/|;|=|]|{|}))', [None, ('t_ANY_directive', 'ANY_directive'), None, None, ('t_ANY_punctuator', 'ANY_punctuator')]), ('(?P<t_INITIAL_identifier>[a-zA-Z_]([a-zA-Z_]|[0-9])*)', [None, ('t_INITIAL_identifier', 'INITIAL_identifier')]), ('(?P<t_ANY_float>(?P<p1>[0-9]+)?(?P<dp>[.]?)(?P<p2>(?(p1)[0-9]*|[0-9]+))(?P<exp>(?:[Ee][+-]?[0-9]+)?)(?P<suf>([FfLl]|d[dfl]|D[DFL]|[fFdD][0-9]+x?)?)(?!\\w))', [None, ('t_ANY_float', 'ANY_float'), None, None, None, None, None]), ('(?P<t_ANY_int>(?P<p1>(?:0x[a-fA-F0-9]+)|(?:[0-9]+))(?P<suf>[uUlL]*))', [None, ('t_ANY_int', 'ANY_int'), None, None]), ('(?P<t_ANY_character_constant>L?\'(\\\\.|[^\\\\\'])+\')|(?P<t_ANY_string_literal>L?"(\\\\.|[^\\\\"])*")|(?P<t_ANY_lparen>\\()|(?P<t_INITIAL_newline>\\n)|
 (?P<t_INITIAL_pp_define>\\#define)', [None, ('t_ANY_character_constant', 'ANY_character_constant'), None, ('t_ANY_string_literal', 'ANY_string_literal'), None, ('t_ANY_lparen', 'ANY_lparen'), ('t_INITIAL_newline', 'INITIAL_newline'), ('t_INITIAL_pp_define', 'INITIAL_pp_define')])], 'DEFINE': [('(?P<t_ANY_directive>\\#\\s+(\\d+)\\s+"([^"]+)"[ \\d]*\\n)|(?P<t_ANY_punctuator>(\\.\\.\\.|\\|\\||\\+\\+|>>=|\\|=|\\^=|<<=|\\*=|\\+=|>=|>>|%=|:>|%>|!=|\\*|\\.|==|\\^|--|-=|->|\\||<<|<=|<:|<%|\\)|\\+|\\?|&=|&&|\\[|/=|&|,|:|<|>|~|!|%|-|/|;|=|]|{|}))', [None, ('t_ANY_directive', 'ANY_directive'), None, None, ('t_ANY_punctuator', 'ANY_punctuator')]), ('(?P<t_DEFINE_identifier>[a-zA-Z_]([a-zA-Z_]|[0-9])*)', [None, ('t_DEFINE_identifier', 'DEFINE_identifier')]), ('(?P<t_ANY_float>(?P<p1>[0-9]+)?(?P<dp>[.]?)(?P<p2>(?(p1)[0-9]*|[0-9]+))(?P<exp>(?:[Ee][+-]?[0-9]+)?)(?P<suf>([FfLl]|d[dfl]|D[DFL]|[fFdD][0-9]+x?)?)(?!\\w))', [None, ('t_ANY_float', 'ANY_float'), None, None, None, None, None]), ('(?P<t_ANY_
 int>(?P<p1>(?:0x[a-fA-F0-9]+)|(?:[0-9]+))(?P<suf>[uUlL]*))', [None, ('t_ANY_int', 'ANY_int'), None, None]), ('(?P<t_ANY_character_constant>L?\'(\\\\.|[^\\\\\'])+\')|(?P<t_ANY_string_literal>L?"(\\\\.|[^\\\\"])*")|(?P<t_ANY_lparen>\\()|(?P<t_DEFINE_newline>\\n)|(?P<t_DEFINE_pp_param_op>(\\#\\#)|(\\#))', [None, ('t_ANY_character_constant', 'ANY_character_constant'), None, ('t_ANY_string_literal', 'ANY_string_literal'), None, ('t_ANY_lparen', 'ANY_lparen'), ('t_DEFINE_newline', 'DEFINE_newline'), ('t_DEFINE_pp_param_op', 'DEFINE_pp_param_op')])]}
-_lexstateignore = {'INITIAL': ' \t\x0b\x0c\r', 'DEFINE': ' \t\x0b\x0c\r'}
-_lexstateerrorf = {'INITIAL': 't_INITIAL_error', 'DEFINE': 't_DEFINE_error'}
+_lexstateinfo = {'DEFINE': 'exclusive', 'INITIAL': 'inclusive'}
+_lexstatere   = {'DEFINE': [('(?P<t_ANY_directive>\\#\\s+(\\d+)\\s+"([^"]+)"[ \\d]*\\n)|(?P<t_ANY_punctuator>(\\.\\.\\.|\\|\\||\\+\\+|\\*=|\\|=|\\+=|>>=|\\^=|<<=|\\)|-=|<%|<<|%>|\\+|>>|<=|/=|->|!=|&&|\\*|\\[|\\?|--|>=|\\.|:>|&=|==|<:|%=|\\||\\^|/|:|{|~|,|>|-|%|}|;|!|=|&|]|<))', [None, ('t_ANY_directive', 'ANY_directive'), None, None, ('t_ANY_punctuator', 'ANY_punctuator')]), ('(?P<t_DEFINE_identifier>[a-zA-Z_]([a-zA-Z_]|[0-9])*)', [None, ('t_DEFINE_identifier', 'DEFINE_identifier')]), ('(?P<t_ANY_float>(?P<p1>[0-9]+)?(?P<dp>[.]?)(?P<p2>(?(p1)[0-9]*|[0-9]+))(?P<exp>(?:[Ee][+-]?[0-9]+)?)(?P<suf>([FfLl]|d[dfl]|D[DFL]|[fFdD][0-9]+x?)?)(?!\\w))', [None, ('t_ANY_float', 'ANY_float'), None, None, None, None, None]), ('(?P<t_ANY_int>(?P<p1>(?:0x[a-fA-F0-9]+)|(?:[0-9]+))(?P<suf>[uUlL]*))', [None, ('t_ANY_int', 'ANY_int'), None, None]), ('(?P<t_ANY_character_constant>L?\'(\\\\.|[^\\\\\'])+\')|(?P<t_ANY_string_literal>L?"(\\\\.|[^\\\\"])*")|(?P<t_ANY_lparen>\\()|(?P<t_DEFINE_newline>\\n)|(?P<t
 _DEFINE_pp_param_op>(\\#\\#)|(\\#))', [None, ('t_ANY_character_constant', 'ANY_character_constant'), None, ('t_ANY_string_literal', 'ANY_string_literal'), None, ('t_ANY_lparen', 'ANY_lparen'), ('t_DEFINE_newline', 'DEFINE_newline'), ('t_DEFINE_pp_param_op', 'DEFINE_pp_param_op')])], 'INITIAL': [('(?P<t_ANY_directive>\\#\\s+(\\d+)\\s+"([^"]+)"[ \\d]*\\n)|(?P<t_ANY_punctuator>(\\.\\.\\.|\\|\\||\\+\\+|\\*=|\\|=|\\+=|>>=|\\^=|<<=|\\)|-=|<%|<<|%>|\\+|>>|<=|/=|->|!=|&&|\\*|\\[|\\?|--|>=|\\.|:>|&=|==|<:|%=|\\||\\^|/|:|{|~|,|>|-|%|}|;|!|=|&|]|<))', [None, ('t_ANY_directive', 'ANY_directive'), None, None, ('t_ANY_punctuator', 'ANY_punctuator')]), ('(?P<t_INITIAL_identifier>[a-zA-Z_]([a-zA-Z_]|[0-9])*)', [None, ('t_INITIAL_identifier', 'INITIAL_identifier')]), ('(?P<t_ANY_float>(?P<p1>[0-9]+)?(?P<dp>[.]?)(?P<p2>(?(p1)[0-9]*|[0-9]+))(?P<exp>(?:[Ee][+-]?[0-9]+)?)(?P<suf>([FfLl]|d[dfl]|D[DFL]|[fFdD][0-9]+x?)?)(?!\\w))', [None, ('t_ANY_float', 'ANY_float'), None, None, None, None, None]), ('(?P<t
 _ANY_int>(?P<p1>(?:0x[a-fA-F0-9]+)|(?:[0-9]+))(?P<suf>[uUlL]*))', [None, ('t_ANY_int', 'ANY_int'), None, None]), ('(?P<t_ANY_character_constant>L?\'(\\\\.|[^\\\\\'])+\')|(?P<t_ANY_string_literal>L?"(\\\\.|[^\\\\"])*")|(?P<t_ANY_lparen>\\()|(?P<t_INITIAL_newline>\\n)|(?P<t_INITIAL_pp_define>\\#define)', [None, ('t_ANY_character_constant', 'ANY_character_constant'), None, ('t_ANY_string_literal', 'ANY_string_literal'), None, ('t_ANY_lparen', 'ANY_lparen'), ('t_INITIAL_newline', 'INITIAL_newline'), ('t_INITIAL_pp_define', 'INITIAL_pp_define')])]}
+_lexstateignore = {'DEFINE': ' \t\x0b\x0c\r', 'INITIAL': ' \t\x0b\x0c\r'}
+_lexstateerrorf = {'DEFINE': 't_DEFINE_error', 'INITIAL': 't_INITIAL_error'}

Modified: grass/trunk/lib/python/ctypes/ctypesgencore/parser/pplexer.py
===================================================================
--- grass/trunk/lib/python/ctypes/ctypesgencore/parser/pplexer.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/ctypes/ctypesgencore/parser/pplexer.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -21,6 +21,7 @@
 from . import lex
 from . import yacc
 from .lex import TOKEN
+from grass.script.utils import encode, decode
 
 
 PY2 = True
@@ -76,17 +77,14 @@
 class StringLiteral(str):
 
     def __new__(cls, value):
-        assert value[0] == '"' and value[-1] == '"'
+        value = decode(value)
         # Unescaping probably not perfect but close enough.
         try:
-            value = value[1:-1].decode('string_escape')
+            value = re.sub(r'\\x([0-9a-fA-F])(?![0-9a-fA-F])',
+                           r'\x0\1', value[1:-1])
         except ValueError as e:
-            try:
-                value = re.sub(r'\\x([0-9a-fA-F])(?![0-9a-fA-F])',
-                               r'\x0\1',
-                               value[1:-1]).decode('string_escape')
-            except ValueError as e:
-                raise ValueError("invalid \\x escape in %s" % value)
+            raise ValueError("invalid \\x escape in %s" % value)
+
         return str.__new__(cls, value)
 
 # --------------------------------------------------------------------------
@@ -93,6 +91,7 @@
 # Token declarations
 # --------------------------------------------------------------------------
 
+
 punctuators = {
     # value: (regex, type)
     r'...': (r'\.\.\.', 'ELLIPSIS'),
@@ -155,6 +154,7 @@
         punctuator_regexes.sort(key=lambda a: -len(a))
     return '(%s)' % '|'.join(punctuator_regexes)
 
+
 # Process line-number directives from the preprocessor
 # See http://docs.freebsd.org/info/cpp/cpp.info.Output.html
 DIRECTIVE = r'\#\s+(\d+)\s+"([^"]+)"[ \d]*\n'
@@ -172,6 +172,7 @@
     t.type = punctuators[t.value][1]
     return t
 
+
 IDENTIFIER = sub('{L}({L}|{D})*')
 
 
@@ -210,6 +211,7 @@
         t.type = 'IDENTIFIER'
     return t
 
+
 FLOAT_LITERAL = sub(r"(?P<p1>{D}+)?(?P<dp>[.]?)(?P<p2>(?(p1){D}*|{D}+))"
                     r"(?P<exp>(?:[Ee][+-]?{D}+)?)(?P<suf>{FS}?)(?!\w)")
 
@@ -239,6 +241,7 @@
 
     return t
 
+
 INT_LITERAL = sub(r"(?P<p1>(?:0x{H}+)|(?:{D}+))(?P<suf>{IS})")
 
 
@@ -264,6 +267,7 @@
 
     return t
 
+
 CHARACTER_CONSTANT = sub(r"L?'(\\.|[^\\'])+'")
 
 
@@ -272,6 +276,7 @@
     t.type = 'CHARACTER_CONSTANT'
     return t
 
+
 STRING_LITERAL = sub(r'L?"(\\.|[^\\"])*"')
 
 
@@ -278,7 +283,7 @@
 @TOKEN(STRING_LITERAL)
 def t_ANY_string_literal(t):
     t.type = 'STRING_LITERAL'
-    t.value = StringLiteral(t.value)
+    t.value = StringLiteral(encode(t.value))
     return t
 
 
@@ -310,6 +315,7 @@
 def t_DEFINE_newline(t):
     t.type = 'PP_END_DEFINE'
     t.lexer.begin("INITIAL")
+    t.lexer.lineno += 1
     del t.lexer.macro_params
 
     # Damage control in case the token immediately after the #define failed
@@ -338,4 +344,5 @@
     t.lexer.lexpos += 1  # Skip it if it's an error in a #define
     return t
 
+
 t_ANY_ignore = ' \t\v\f\r'

Modified: grass/trunk/lib/python/ctypes/ctypesgencore/parser/preprocessor.py
===================================================================
--- grass/trunk/lib/python/ctypes/ctypesgencore/parser/preprocessor.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/ctypes/ctypesgencore/parser/preprocessor.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -24,7 +24,9 @@
 from . import yacc
 from .lex import TOKEN
 
+from grass.script.utils import decode
 
+
 # --------------------------------------------------------------------------
 # Lexers
 # --------------------------------------------------------------------------
@@ -147,17 +149,18 @@
         """Parse a file and save its output"""
 
         cmd = self.options.cpp
+        cmd += " -U __GNUC__ -dD"
+
+        # This fixes Issue #6 where OS X 10.6+ adds a C extension that breaks
+        # the parser.  Blocks shouldn't be needed for ctypesgen support anyway.
         if sys.platform == 'darwin':
             cmd += " -U __BLOCKS__"
-        cmd += " -U __GNUC__"
-        if sys.platform.startswith('freebsd'):
-            cmd += " -D __GNUCLIKE_BUILTIN_STDARG"
-        cmd += " -dD"
+
         for path in self.options.include_search_paths:
             cmd += " -I%s" % path
         for define in self.defines:
             cmd += ' "-D%s"' % define
-        cmd += " " + filename.replace('\\', '/')
+        cmd += ' "' + filename + '"'
 
         self.cparser.handle_status(cmd)
 
@@ -166,9 +169,12 @@
 
         pp = subprocess.Popen(cmd,
                               shell=True,
+                              universal_newlines=True,
                               stdout=subprocess.PIPE,
                               stderr=subprocess.PIPE)
         ppout, pperr = pp.communicate()
+        ppout = decode(ppout)
+        pperr = decode(pperr)
 
         for line in pperr.split("\n"):
             if line:
@@ -207,7 +213,7 @@
             self.cparser.handle_status("Saving preprocessed headers to %s." %
                                        self.options.save_preprocessed_headers)
             try:
-                f = file(self.options.save_preprocessed_headers, "w")
+                f = open(self.options.save_preprocessed_headers, "w")
                 f.write(text)
                 f.close()
             except IOError:

Modified: grass/trunk/lib/python/ctypes/ctypesgencore/parser/yacc.py
===================================================================
--- grass/trunk/lib/python/ctypes/ctypesgencore/parser/yacc.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/ctypes/ctypesgencore/parser/yacc.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -2135,7 +2135,7 @@
     error = 0
 
     # Add parsing method to signature
-    Signature.update(method)
+    Signature.update(method.encode())
 
     # If a "module" parameter was supplied, extract its dictionary.
     # Note: a module may in fact be an instance as well.

Modified: grass/trunk/lib/python/ctypes/ctypesgencore/printer/printer.py
===================================================================
--- grass/trunk/lib/python/ctypes/ctypesgencore/printer/printer.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/ctypes/ctypesgencore/printer/printer.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -23,7 +23,7 @@
     def __init__(self, outpath, options, data):
         status_message("Writing to %s." % outpath)
 
-        self.file = file(outpath, "w")
+        self.file = open(outpath, "w")
         self.options = options
 
         if self.options.strip_build_path and \
@@ -39,7 +39,8 @@
         self.print_loader()
         print(file=self.file)
 
-        self.print_group(self.options.libraries, "libraries", self.print_library)
+        self.print_group(self.options.libraries,
+                         "libraries", self.print_library)
         self.print_group(self.options.modules, "modules", self.print_module)
 
         method_table = {
@@ -110,7 +111,7 @@
         if self.options.header_template:
             path = self.options.header_template
             try:
-                template_file = file(path, "r")
+                template_file = open(path, "r")
             except IOError:
                 error_message("Cannot load header template from file \"%s\" "
                               " - using default template." % path, cls='missing-file')
@@ -117,7 +118,7 @@
 
         if not template_file:
             path = path_to_local_file("defaultheader.py")
-            template_file = file(path, "r")
+            template_file = open(path, "r")
 
         template_subs = self.template_subs()
         self.file.write(template_file.read() % template_subs)
@@ -129,7 +130,7 @@
 
         print("# Begin preamble", file=self.file)
         print(file=self.file)
-        preamble_file = file(path, "r")
+        preamble_file = open(path, "r")
         self.file.write(preamble_file.read())
         preamble_file.close()
         print(file=self.file)
@@ -143,14 +144,14 @@
         print(file=self.file)
         path = path_to_local_file("libraryloader.py",
                                   ctypesgencore.libraryloader)
-        loader_file = file(path, "r")
+        loader_file = open(path, "r")
         self.file.write(loader_file.read())
         loader_file.close()
         print(file=self.file)
         print("# End loader", file=self.file)
         print(file=self.file)
-        print("add_library_search_dirs([%s])" % \
-            ", ".join([repr(d) for d in self.options.runtime_libdirs]), file=self.file)
+        print("add_library_search_dirs([%s])" %
+              ", ".join([repr(d) for d in self.options.runtime_libdirs]), file=self.file)
 
     def print_library(self, library):
         print('_libs["%s"] = load_library("%s")' % (library, library), file=self.file)
@@ -159,34 +160,67 @@
         print('from %s import *' % name, file=self.file)
 
     def print_constant(self, constant):
-        print('%s = %s' % \
-            (constant.name, constant.value.py_string(False)), end=' ', file=self.file)
+        print('%s = %s' %
+              (constant.name, constant.value.py_string(False)), end=' ', file=self.file)
         self.srcinfo(constant.src)
 
     def print_typedef(self, typedef):
-        print('%s = %s' % \
-            (typedef.name, typedef.ctype.py_string()), end=' ', file=self.file)
+        print('%s = %s' %
+              (typedef.name, typedef.ctype.py_string()), end=' ', file=self.file)
         self.srcinfo(typedef.src)
 
     def print_struct(self, struct):
         self.srcinfo(struct.src)
         base = {'union': 'Union', 'struct': 'Structure'}[struct.variety]
-        print('class %s_%s(%s):' % \
-            (struct.variety, struct.tag, base), file=self.file)
+        print('class %s_%s(%s):' %
+              (struct.variety, struct.tag, base), file=self.file)
         print('    pass', file=self.file)
 
     def print_struct_members(self, struct):
         if struct.opaque:
             return
+
+        # is this supposed to be packed?
+        if struct.packed:
+            print('{}_{}._pack_ = 1'.format(struct.variety, struct.tag),
+                  file=self.file)
+
+        # handle unnamed fields.
+        unnamed_fields = []
+        names = set([x[0] for x in struct.members])
+        anon_prefix = "unnamed_"
+        n = 1
+        for mi in range(len(struct.members)):
+            mem = list(struct.members[mi])
+            if mem[0] is None:
+                while True:
+                    name = "%s%i" % (anon_prefix, n)
+                    n += 1
+                    if name not in names:
+                        break
+                mem[0] = name
+                names.add(name)
+                if type(mem[1]) is CtypesStruct:
+                    unnamed_fields.append(name)
+                struct.members[mi] = mem
+
         print('%s_%s.__slots__ = [' % (struct.variety, struct.tag), file=self.file)
         for name, ctype in struct.members:
             print("    '%s'," % name, file=self.file)
         print(']', file=self.file)
+
+        if len(unnamed_fields) > 0:
+            print ('%s_%s._anonymous_ = [' % (struct.variety,
+                                              struct.tag), file=self.file)
+            for name in unnamed_fields:
+                print ("    '%s'," % name, file=self.file)
+            print (']', file=self.file)
+
         print('%s_%s._fields_ = [' % (struct.variety, struct.tag), file=self.file)
         for name, ctype in struct.members:
             if isinstance(ctype, CtypesBitfield):
-                print("    ('%s', %s, %s)," % \
-                    (name, ctype.py_string(), ctype.bitfield.py_string(False)), file=self.file)
+                print("    ('%s', %s, %s)," %
+                      (name, ctype.py_string(), ctype.bitfield.py_string(False)), file=self.file)
             else:
                 print("    ('%s', %s)," % (name, ctype.py_string()), file=self.file)
         print(']', file=self.file)
@@ -204,67 +238,88 @@
 
     def print_fixed_function(self, function):
         self.srcinfo(function.src)
+
+        # If we know what library the function lives in, look there.
+        # Otherwise, check all the libraries.
         if function.source_library:
-            print("if hasattr(_libs[%r], %r):" % \
-                (function.source_library, function.c_name()), file=self.file)
-            print("    %s = _libs[%r].%s" % \
-                (function.py_name(), function.source_library, function.c_name()), file=self.file)
-            print("    %s.restype = %s" % \
-                (function.py_name(), function.restype.py_string()), file=self.file)
-            print("    %s.argtypes = [%s]" % (
-                function.py_name(),
-                ', '.join([a.py_string() for a in function.argtypes])), file=self.file)
+            print("if hasattr(_libs[%r], %r):" %
+                  (function.source_library, function.c_name()), file=self.file)
+            print("    %s = _libs[%r].%s" %
+                  (function.py_name(), function.source_library, function.c_name()), file=self.file)
         else:
-            print("for _lib in _libs.values():", file=self.file)
-            print("    if hasattr(_lib, %r):" % function.c_name(), file=self.file)
-            print("        %s = _lib.%s" % (function.py_name(), function.c_name()), file=self.file)
-            print("        %s.restype = %s" % (
-                function.py_name(), function.restype.py_string()), file=self.file)
-            print("        %s.argtypes = [%s]" % (
-                function.py_name(), ', '.join([a.py_string() for a in function.argtypes])), file=self.file)
-            print("        break", file=self.file)
+            print("for _lib in six.itervalues(_libs):", file=self.file)
+            print("    if not hasattr(_lib, %r):" % function.c_name(), file=self.file)
+            print("        continue", file=self.file)
+            print("    %s = _lib.%s" %
+                  (function.py_name(), function.c_name()), file=self.file)
 
+        # Argument types
+        print("    %s.argtypes = [%s]" % (function.py_name(),
+                                          ', '.join([a.py_string() for a in function.argtypes])), file=self.file)
+
+        # Return value
+        if function.restype.py_string() == "String":
+            print("    if sizeof(c_int) == sizeof(c_void_p):", file=self.file)
+            print("        %s.restype = ReturnString" %
+                  (function.py_name()), file=self.file)
+            print("    else:", file=self.file)
+            print("        %s.restype = %s" %
+                  (function.py_name(), function.restype.py_string()), file=self.file)
+            print("        %s.errcheck = ReturnString" %
+                  (function.py_name()), file=self.file)
+        else:
+            print("    %s.restype = %s" %
+                  (function.py_name(), function.restype.py_string()), file=self.file)
+            if function.errcheck:
+                print ("    %s.errcheck = %s" %
+                       (function.py_name(), function.errcheck.py_string()), file=self.file)
+
+        if not function.source_library:
+            print("    break", file=self.file)
+
     def print_variadic_function(self, function):
         self.srcinfo(function.src)
         if function.source_library:
-            print("if hasattr(_libs[%r], %r):" % \
-                (function.source_library, function.c_name()), file=self.file)
-            print("    _func = _libs[%r].%s" % \
-                (function.source_library, function.c_name()), file=self.file)
+            print("if hasattr(_libs[%r], %r):" %
+                  (function.source_library, function.c_name()), file=self.file)
+            print("    _func = _libs[%r].%s" %
+                  (function.source_library, function.c_name()), file=self.file)
             print("    _restype = %s" % function.restype.py_string(), file=self.file)
-            print("    _argtypes = [%s]" % \
-                ', '.join([a.py_string() for a in function.argtypes]), file=self.file)
-            print("    %s = _variadic_function(_func,_restype,_argtypes)" % \
-                function.py_name(), file=self.file)
+            print("    _errcheck = %s" % function.errcheck.py_string(), file=self.file)
+            print("    _argtypes = [%s]" %
+                  ', '.join([a.py_string() for a in function.argtypes]), file=self.file)
+            print("    %s = _variadic_function(_func,_restype,_argtypes,_errcheck)" %
+                  function.py_name(), file=self.file)
         else:
             print("for _lib in _libs.values():", file=self.file)
             print("    if hasattr(_lib, %r):" % function.c_name(), file=self.file)
-            print("        _func = _lib.%s" % \
-                (function.c_name()), file=self.file)
+            print("        _func = _lib.%s" %
+                  (function.c_name()), file=self.file)
             print("        _restype = %s" % function.restype.py_string(), file=self.file)
-            print("        _argtypes = [%s]" % \
-                ', '.join([a.py_string() for a in function.argtypes]), file=self.file)
-            print("        %s = _variadic_function(_func,_restype,_argtypes)" % \
-                function.py_name(), file=self.file)
+            print("        _errcheck = %s" % function.errcheck.py_string(), file=self.file)
+            print("        _argtypes = [%s]" %
+                  ', '.join([a.py_string() for a in function.argtypes]), file=self.file)
+            print("        %s = _variadic_function(_func,_restype,_argtypes,_errcheck)" %
+                  function.py_name(), file=self.file)
 
     def print_variable(self, variable):
         self.srcinfo(variable.src)
         if variable.source_library:
             print('try:', file=self.file)
-            print('    %s = (%s).in_dll(_libs[%r], %r)' % \
-                (variable.py_name(),
-                 variable.ctype.py_string(),
-                 variable.source_library,
-                 variable.c_name()), file=self.file)
+            print('    %s = (%s).in_dll(_libs[%r], %r)' %
+                  (variable.py_name(),
+                   variable.ctype.py_string(),
+                   variable.source_library,
+                   variable.c_name()), file=self.file)
             print('except:', file=self.file)
             print('    pass', file=self.file)
         else:
             print("for _lib in _libs.values():", file=self.file)
             print('    try:', file=self.file)
-            print('        %s = (%s).in_dll(_lib, %r)' % \
-                (variable.py_name(),
-                 variable.ctype.py_string(),
-                 variable.c_name()), file=self.file)
+            print('        %s = (%s).in_dll(_lib, %r)' %
+                  (variable.py_name(),
+                   variable.ctype.py_string(),
+                   variable.c_name()), file=self.file)
             print("        break", file=self.file)
             print('    except:', file=self.file)
             print('        pass', file=self.file)
@@ -287,13 +342,13 @@
 
     def print_func_macro(self, macro):
         self.srcinfo(macro.src)
-        print("def %s(%s):" % \
-            (macro.name, ", ".join(macro.params)), file=self.file)
+        print("def %s(%s):" %
+              (macro.name, ", ".join(macro.params)), file=self.file)
         print("    return %s" % macro.expr.py_string(True), file=self.file)
 
     def insert_file(self, filename):
         try:
-            inserted_file = file(filename, "r")
+            inserted_file = open(filename, "r")
         except IOError:
             error_message("Cannot open file \"%s\". Skipped it." % filename,
                           cls='missing-file')

Modified: grass/trunk/lib/python/ctypes/ctypesgencore/processor/pipeline.py
===================================================================
--- grass/trunk/lib/python/ctypes/ctypesgencore/processor/pipeline.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/ctypes/ctypesgencore/processor/pipeline.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -54,7 +54,9 @@
     filter_by_regexes_exclude(data, options)
     filter_by_regexes_include(data, options)
     remove_macros(data, options)
-    fix_conflicting_names(data, options)
+    if options.output_language == "python":
+        # this function is python specific
+        fix_conflicting_names(data, options)
     find_source_libraries(data, options)
 
     calculate_final_inclusion(data, options)

Modified: grass/trunk/lib/python/ctypes/preamble.py
===================================================================
--- grass/trunk/lib/python/ctypes/preamble.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/ctypes/preamble.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -1,9 +1,14 @@
+import ctypes
 import os
 import sys
-
-import ctypes
+import six
 from ctypes import *
+from grass.script.utils import encode, decode
 
+if sys.version_info.major >= 3:
+    long = int
+    unicode = str
+
 _int_types = (c_int16, c_int32)
 if hasattr(ctypes, 'c_int64'):
     # Some builds of ctypes apparently do not have c_int64
@@ -17,31 +22,332 @@
 del _int_types
 
 
-class c_void(Structure):
-    # c_void_p is a buggy return type, converting to int, so
-    # POINTER(None) == c_void_p is actually written as
-    # POINTER(c_void), so it can be treated as a real pointer.
-    _fields_ = [('dummy', c_int)]
+class UserString:
+    def __init__(self, seq):
+        if isinstance(seq, basestring):
+            self.data = seq
+        elif isinstance(seq, UserString):
+            self.data = seq.data[:]
+        else:
+            self.data = str(seq)
 
+    def __str__(self):
+        return str(self.data)
 
-def POINTER(obj):
-    p = ctypes.POINTER(obj)
+    def __repr__(self):
+        return repr(self.data)
 
-    # Convert None to a real NULL pointer to work around bugs
-    # in how ctypes handles None on 64-bit platforms
-    if not isinstance(p.from_param, classmethod):
-        def from_param(cls, x):
-            if x is None:
-                return cls()
+    def __int__(self):
+        return int(self.data)
+
+    def __long__(self):
+        return long(self.data)
+
+    def __float__(self):
+        return float(self.data)
+
+    def __complex__(self):
+        return complex(self.data)
+
+    def __hash__(self):
+        return hash(self.data)
+
+    def __cmp__(self, string):
+        if isinstance(string, UserString):
+            return cmp(self.data, string.data)
+        else:
+            return cmp(self.data, string)
+
+    def __contains__(self, char):
+        return char in self.data
+
+    def __len__(self):
+        return len(self.data)
+
+    def __getitem__(self, index):
+        return self.__class__(self.data[index])
+
+    def __getslice__(self, start, end):
+        start = max(start, 0)
+        end = max(end, 0)
+        return self.__class__(self.data[start:end])
+
+    def __add__(self, other):
+        if isinstance(other, UserString):
+            return self.__class__(self.data + other.data)
+        elif isinstance(other, basestring):
+            return self.__class__(self.data + other)
+        else:
+            return self.__class__(self.data + str(other))
+
+    def __radd__(self, other):
+        if isinstance(other, basestring):
+            return self.__class__(other + self.data)
+        else:
+            return self.__class__(str(other) + self.data)
+
+    def __mul__(self, n):
+        return self.__class__(self.data * n)
+    __rmul__ = __mul__
+
+    def __mod__(self, args):
+        return self.__class__(self.data % args)
+
+    # the following methods are defined in alphabetical order:
+    def capitalize(self):
+        return self.__class__(self.data.capitalize())
+
+    def center(self, width, *args):
+        return self.__class__(self.data.center(width, *args))
+
+    def count(self, sub, start=0, end=sys.maxsize):
+        return self.data.count(sub, start, end)
+
+    def decode(self, encoding=None, errors=None):  # XXX improve this?
+        if encoding:
+            if errors:
+                return self.__class__(self.data.decode(encoding, errors))
             else:
-                return x
-        p.from_param = classmethod(from_param)
+                return self.__class__(self.data.decode(encoding))
+        else:
+            return self.__class__(self.data.decode())
 
-    return p
+    def encode(self, encoding=None, errors=None):  # XXX improve this?
+        if encoding:
+            if errors:
+                return self.__class__(self.data.encode(encoding, errors))
+            else:
+                return self.__class__(self.data.encode(encoding))
+        else:
+            return self.__class__(self.data.encode())
 
-String = c_char_p
-ReturnString = c_char_p
+    def endswith(self, suffix, start=0, end=sys.maxsize):
+        return self.data.endswith(suffix, start, end)
 
+    def expandtabs(self, tabsize=8):
+        return self.__class__(self.data.expandtabs(tabsize))
+
+    def find(self, sub, start=0, end=sys.maxsize):
+        return self.data.find(sub, start, end)
+
+    def index(self, sub, start=0, end=sys.maxsize):
+        return self.data.index(sub, start, end)
+
+    def isalpha(self):
+        return self.data.isalpha()
+
+    def isalnum(self):
+        return self.data.isalnum()
+
+    def isdecimal(self):
+        return self.data.isdecimal()
+
+    def isdigit(self):
+        return self.data.isdigit()
+
+    def islower(self):
+        return self.data.islower()
+
+    def isnumeric(self):
+        return self.data.isnumeric()
+
+    def isspace(self):
+        return self.data.isspace()
+
+    def istitle(self):
+        return self.data.istitle()
+
+    def isupper(self):
+        return self.data.isupper()
+
+    def join(self, seq):
+        return self.data.join(seq)
+
+    def ljust(self, width, *args):
+        return self.__class__(self.data.ljust(width, *args))
+
+    def lower(self):
+        return self.__class__(self.data.lower())
+
+    def lstrip(self, chars=None):
+        return self.__class__(self.data.lstrip(chars))
+
+    def partition(self, sep):
+        return self.data.partition(sep)
+
+    def replace(self, old, new, maxsplit=-1):
+        return self.__class__(self.data.replace(old, new, maxsplit))
+
+    def rfind(self, sub, start=0, end=sys.maxsize):
+        return self.data.rfind(sub, start, end)
+
+    def rindex(self, sub, start=0, end=sys.maxsize):
+        return self.data.rindex(sub, start, end)
+
+    def rjust(self, width, *args):
+        return self.__class__(self.data.rjust(width, *args))
+
+    def rpartition(self, sep):
+        return self.data.rpartition(sep)
+
+    def rstrip(self, chars=None):
+        return self.__class__(self.data.rstrip(chars))
+
+    def split(self, sep=None, maxsplit=-1):
+        return self.data.split(sep, maxsplit)
+
+    def rsplit(self, sep=None, maxsplit=-1):
+        return self.data.rsplit(sep, maxsplit)
+
+    def splitlines(self, keepends=0):
+        return self.data.splitlines(keepends)
+
+    def startswith(self, prefix, start=0, end=sys.maxsize):
+        return self.data.startswith(prefix, start, end)
+
+    def strip(self, chars=None):
+        return self.__class__(self.data.strip(chars))
+
+    def swapcase(self):
+        return self.__class__(self.data.swapcase())
+
+    def title(self):
+        return self.__class__(self.data.title())
+
+    def translate(self, *args):
+        return self.__class__(self.data.translate(*args))
+
+    def upper(self):
+        return self.__class__(self.data.upper())
+
+    def zfill(self, width):
+        return self.__class__(self.data.zfill(width))
+
+
+class MutableString(UserString):
+    """mutable string objects
+
+    Python strings are immutable objects.  This has the advantage, that
+    strings may be used as dictionary keys.  If this property isn't needed
+    and you insist on changing string values in place instead, you may cheat
+    and use MutableString.
+
+    But the purpose of this class is an educational one: to prevent
+    people from inventing their own mutable string class derived
+    from UserString and than forget thereby to remove (override) the
+    __hash__ method inherited from UserString.  This would lead to
+    errors that would be very hard to track down.
+
+    A faster and better solution is to rewrite your program using lists."""
+
+    def __init__(self, string=""):
+        self.data = string
+
+    def __hash__(self):
+        raise TypeError("unhashable type (it is mutable)")
+
+    def __setitem__(self, index, sub):
+        if index < 0:
+            index += len(self.data)
+        if index < 0 or index >= len(self.data):
+            raise IndexError
+        self.data = self.data[:index] + sub + self.data[index + 1:]
+
+    def __delitem__(self, index):
+        if index < 0:
+            index += len(self.data)
+        if index < 0 or index >= len(self.data):
+            raise IndexError
+        self.data = self.data[:index] + self.data[index + 1:]
+
+    def __setslice__(self, start, end, sub):
+        start = max(start, 0)
+        end = max(end, 0)
+        if isinstance(sub, UserString):
+            self.data = self.data[:start] + sub.data + self.data[end:]
+        elif isinstance(sub, basestring):
+            self.data = self.data[:start] + sub + self.data[end:]
+        else:
+            self.data = self.data[:start] + str(sub) + self.data[end:]
+
+    def __delslice__(self, start, end):
+        start = max(start, 0)
+        end = max(end, 0)
+        self.data = self.data[:start] + self.data[end:]
+
+    def immutable(self):
+        return UserString(self.data)
+
+    def __iadd__(self, other):
+        if isinstance(other, UserString):
+            self.data += other.data
+        elif isinstance(other, basestring):
+            self.data += other
+        else:
+            self.data += str(other)
+        return self
+
+    def __imul__(self, n):
+        self.data *= n
+        return self
+
+
+class String(MutableString, Union):
+
+    _fields_ = [('raw', POINTER(c_char)),
+                ('data', c_char_p)]
+
+    def __init__(self, obj=""):
+        if isinstance(obj, (str, unicode, UserString)):
+            self.data = encode(str(obj))
+        else:
+            self.raw = obj
+
+    def __len__(self):
+        return self.data and len(self.data) or 0
+
+    def from_param(cls, obj):
+        # Convert None or 0
+        if obj is None or obj == 0:
+            return cls(POINTER(c_char)())
+
+        # Convert from String
+        elif isinstance(obj, String):
+            return obj
+
+        # Convert from bytes
+        elif isinstance(obj, bytes):
+            return cls(decode(obj))
+
+        # Convert from str/unicode
+        elif isinstance(obj, (str, unicode)):
+            return cls(obj)
+
+        # Convert from c_char_p
+        elif isinstance(obj, c_char_p):
+            return obj
+
+        # Convert from POINTER(c_char)
+        elif isinstance(obj, POINTER(c_char)):
+            return obj
+
+        # Convert from raw pointer
+        elif isinstance(obj, int):
+            return cls(cast(obj, POINTER(c_char)))
+
+        # Convert from c_char array
+        elif isinstance(obj, c_char * len(obj)):
+            return obj
+
+        # Convert from object
+        else:
+            return String.from_param(obj._as_parameter_)
+    from_param = classmethod(from_param)
+
+
+def ReturnString(obj, func=None, arguments=None):
+    return String.from_param(obj)
+
 # As of ctypes 1.0, ctypes does not support custom error-checking
 # functions on callbacks, nor does it support custom datatypes on
 # callbacks, so we must ensure that all callbacks return
@@ -64,10 +370,12 @@
 
 class _variadic_function(object):
 
-    def __init__(self, func, restype, argtypes):
+    def __init__(self, func, restype, argtypes, errcheck):
         self.func = func
         self.func.restype = restype
         self.argtypes = argtypes
+        if errcheck:
+            self.func.errcheck = errcheck
 
     def _as_parameter_(self):
         # So we can pass this variadic function as a function pointer

Modified: grass/trunk/lib/python/gunittest/case.py
===================================================================
--- grass/trunk/lib/python/gunittest/case.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/gunittest/case.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -20,6 +20,7 @@
 from grass.pygrass.modules import Module
 from grass.exceptions import CalledModuleError
 from grass.script import shutil_which
+from grass.script.utils import decode
 
 from .gmodules import call_module, SimpleModule
 from .checkers import (check_text_ellipsis,
@@ -224,7 +225,7 @@
             reference = text_to_keyvalue(reference, sep=sep, skip_empty=True)
         module = _module_from_parameters(module, **parameters)
         self.runModule(module, expecting_stdout=True)
-        raster_univar = text_to_keyvalue(module.outputs.stdout,
+        raster_univar = text_to_keyvalue(decode(module.outputs.stdout),
                                          sep=sep, skip_empty=True)
         if not keyvalue_equals(dict_a=reference, dict_b=raster_univar,
                                a_is_subset=True, precision=precision):
@@ -404,10 +405,10 @@
         """
         module = SimpleModule('v.info', flags='t', map=reference)
         self.runModule(module)
-        ref_topo = text_to_keyvalue(module.outputs.stdout, sep='=')
+        ref_topo = text_to_keyvalue(decode(module.outputs.stdout), sep='=')
         module = SimpleModule('v.info', flags='g', map=reference)
         self.runModule(module)
-        ref_info = text_to_keyvalue(module.outputs.stdout, sep='=')
+        ref_info = text_to_keyvalue(decode(module.outputs.stdout), sep='=')
         self.assertVectorFitsTopoInfo(vector=actual, reference=ref_topo,
                                       msg=msg)
         self.assertVectorFitsRegionInfo(vector=actual, reference=ref_info,
@@ -459,6 +460,7 @@
         `assertRasterFitsUnivar()` or `assertRasterFitsInfo()`
         """
         stdout = call_module('r.info', map=map, flags='r')
+        stdout = decode(stdout)
         actual = text_to_keyvalue(stdout, sep='=')
         if refmin > actual['min']:
             stdmsg = ('The actual minimum ({a}) is smaller than the reference'
@@ -489,6 +491,7 @@
         `assertRaster3DFitsUnivar()` or `assertRaster3DFitsInfo()`
         """
         stdout = call_module('r3.info', map=map, flags='r')
+        stdout = decode(stdout)
         actual = text_to_keyvalue(stdout, sep='=')
         if refmin > actual['min']:
             stdmsg = ('The actual minimum ({a}) is smaller than the reference'
@@ -872,13 +875,13 @@
             # be more appropriate
             module = SimpleModule('v.info', flags='t', map=reference)
             self.runModule(module)
-            ref_topo = text_to_keyvalue(module.outputs.stdout, sep='=')
+            ref_topo = text_to_keyvalue(decode(module.outputs.stdout), sep='=')
             self.assertVectorFitsTopoInfo(vector=intersection,
                                           reference=ref_topo,
                                           msg=msg)
             module = SimpleModule('v.info', flags='g', map=reference)
             self.runModule(module)
-            ref_info = text_to_keyvalue(module.outputs.stdout, sep='=')
+            ref_info = text_to_keyvalue(decode(module.outputs.stdout), sep='=')
             self.assertVectorFitsRegionInfo(vector=intersection,
                                             reference=ref_info,
                                             msg=msg, precision=precision)
@@ -908,7 +911,7 @@
             # 43=98606087.5818323
             # 44=727592.902311112
             # total area=2219442027.22035
-            total_area = module.outputs.stdout.splitlines()[-1].split('=')[-1]
+            total_area = decode(module.outputs.stdout).splitlines()[-1].split('=')[-1]
             if total_area > precision:
                 stdmsg = ("Area of difference of vectors <{va}> and <{vr}>"
                           " should be 0"
@@ -1094,7 +1097,7 @@
                                     module.get_python(),
                                     errors=errors)
         # TODO: use this also in assert and apply when appropriate
-        if expecting_stdout and not module.outputs.stdout.strip():
+        if expecting_stdout and not decode(module.outputs.stdout).strip():
 
             if module.outputs.stderr:
                 errors = " The errors are:\n" + module.outputs.stderr
@@ -1156,7 +1159,7 @@
                       'See the following errors:\n'
                       '{errors}'.format(
                           m=module, code=module.get_python(),
-                          errors=module.outputs.stderr
+                          errors=decode(module.outputs.stderr)
                       ))
             self.fail(self._formatMessage(msg, stdmsg))
         print(module.outputs.stdout)

Modified: grass/trunk/lib/python/gunittest/gutils.py
===================================================================
--- grass/trunk/lib/python/gunittest/gutils.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/gunittest/gutils.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -10,6 +10,7 @@
 """
 
 from grass.script.core import start_command, PIPE
+from grass.script.utils import decode
 
 from .gmodules import call_module
 from .checkers import text_to_keyvalue
@@ -49,7 +50,7 @@
                             element=type, file=name, mapset=mapset,
                             stdout=PIPE, stderr=PIPE)
     output, errors = process.communicate()
-    info = text_to_keyvalue(output, sep='=')
+    info = text_to_keyvalue(decode(output), sep='=')
     # file is the key questioned in grass.script.core find_file()
     # return code should be equivalent to checking the output
     if info['file']:

Modified: grass/trunk/lib/python/pydispatch/dispatcher.py
===================================================================
--- grass/trunk/lib/python/pydispatch/dispatcher.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/pydispatch/dispatcher.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -388,7 +388,7 @@
     else:
         for senderkey in backSet:
             try:
-                signals = connections[senderkey].keys()
+                signals = list(connections[senderkey])
             except KeyError:
                 pass
             else:

Modified: grass/trunk/lib/python/pydispatch/robustapply.py
===================================================================
--- grass/trunk/lib/python/pydispatch/robustapply.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/pydispatch/robustapply.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -54,7 +54,7 @@
     if not (codeObject.co_flags & 8):
         # fc does not have a **kwds type parameter, therefore
         # remove unacceptable arguments.
-        for arg in named.keys():
+        for arg in list(named):
             if arg not in acceptable:
                 del named[arg]
     return receiver(*arguments, **named)

Modified: grass/trunk/lib/python/pygrass/modules/interface/module.py
===================================================================
--- grass/trunk/lib/python/pygrass/modules/interface/module.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/pygrass/modules/interface/module.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -8,6 +8,7 @@
 
 from grass.exceptions import CalledModuleError, GrassError, ParameterError
 from grass.script.core import Popen, PIPE, use_temp_region, del_temp_region
+from grass.script.utils import encode, decode
 from .docstring import docstring_property
 from .parameter import Parameter
 from .flag import Flag
@@ -778,7 +779,11 @@
         :return: A reference to this object
         """
         if self._finished is False:
+            if self.stdin:
+                self.stdin = encode(self.stdin)
             stdout, stderr = self.popen.communicate(input=self.stdin)
+            stdout = decode(stdout)
+            stderr = decode(stderr)
             self.outputs['stdout'].value = stdout if stdout else ''
             self.outputs['stderr'].value = stderr if stderr else ''
             self.time = time.time() - self.start_time

Modified: grass/trunk/lib/python/pygrass/modules/interface/parameter.py
===================================================================
--- grass/trunk/lib/python/pygrass/modules/interface/parameter.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/pygrass/modules/interface/parameter.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -22,7 +22,7 @@
 
     def raiseexcpet(exc, param, ptype, value):
         """Function to modifa the error message"""
-        msg = req % (param.name, param.typedesc, ptype, value, exc.message)
+        msg = req % (param.name, param.typedesc, ptype, value, str(exc))
         if isinstance(exc, ValueError):
             raise ValueError(msg)
         elif isinstance(exc, TypeError):

Modified: grass/trunk/lib/python/pygrass/raster/abstract.py
===================================================================
--- grass/trunk/lib/python/pygrass/raster/abstract.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/pygrass/raster/abstract.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -64,7 +64,7 @@
         """
         self.name = name
         self.mapset = mapset
-        self.c_region = ctypes.pointer(libgis.Cell_head())
+        self.c_region = ctypes.pointer(libraster.struct_Cell_head())
         self.c_range = None
 
     def _get_range(self):

Modified: grass/trunk/lib/python/pygrass/raster/history.py
===================================================================
--- grass/trunk/lib/python/pygrass/raster/history.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/pygrass/raster/history.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -7,6 +7,7 @@
 import ctypes
 import grass.lib.raster as libraster
 import datetime
+from grass.script.utils import encode
 
 
 class History(object):
@@ -57,6 +58,7 @@
                                           libraster.HIST_CREATOR)
 
     def _set_creator(self, creator):
+        creator = encode(creator)
         return libraster.Rast_set_history(self.c_hist,
                                           libraster.HIST_CREATOR,
                                           ctypes.c_char_p(creator))
@@ -71,6 +73,7 @@
                                           libraster.HIST_DATSRC_1)
 
     def _set_src1(self, src1):
+        src1 = encode(src1)
         return libraster.Rast_set_history(self.c_hist,
                                           libraster.HIST_DATSRC_1,
                                           ctypes.c_char_p(src1))
@@ -85,6 +88,7 @@
                                           libraster.HIST_DATSRC_2)
 
     def _set_src2(self, src2):
+        src2 = encode(src2)
         return libraster.Rast_set_history(self.c_hist,
                                           libraster.HIST_DATSRC_2,
                                           ctypes.c_char_p(src2))
@@ -99,6 +103,7 @@
                                           libraster.HIST_KEYWRD)
 
     def _set_keyword(self, keyword):
+        keyword = encode(keyword)
         return libraster.Rast_set_history(self.c_hist,
                                           libraster.HIST_KEYWRD,
                                           ctypes.c_char_p(keyword))
@@ -120,6 +125,7 @@
     def _set_date(self, datetimeobj):
         if datetimeobj:
             date_str = datetimeobj.strftime(self.date_fmt)
+            date_str = encode(date_str)
             return libraster.Rast_set_history(self.c_hist,
                                               libraster.HIST_MAPID,
                                               ctypes.c_char_p(date_str))
@@ -134,6 +140,7 @@
                                           libraster.HIST_MAPSET)
 
     def _set_mapset(self, mapset):
+        mapset = encode(mapset)
         return libraster.Rast_set_history(self.c_hist,
                                           libraster.HIST_MAPSET,
                                           ctypes.c_char_p(mapset))
@@ -148,6 +155,7 @@
                                           libraster.HIST_MAPTYPE)
 
     def _set_maptype(self, maptype):
+        maptype = encode(maptype)
         return libraster.Rast_set_history(self.c_hist,
                                           libraster.HIST_MAPTYPE,
                                           ctypes.c_char_p(maptype))
@@ -177,6 +185,7 @@
                                           libraster.HIST_TITLE)
 
     def _set_title(self, title):
+        title = encode(title)
         return libraster.Rast_set_history(self.c_hist,
                                           libraster.HIST_TITLE,
                                           ctypes.c_char_p(title))

Modified: grass/trunk/lib/python/pygrass/raster/segment.py
===================================================================
--- grass/trunk/lib/python/pygrass/raster/segment.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/pygrass/raster/segment.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -61,7 +61,7 @@
         """
         if file_name == '':
             file_name = libgis.G_tempfile()
-        mapobj.temp_file = file(file_name, 'w')
+        mapobj.temp_file = open(file_name, 'w')
         size = ctypes.sizeof(RTYPE[mapobj.mtype]['ctypes'])
         if fill:
             libseg.Segment_format(mapobj.temp_file.fileno(), self.rows(),

Modified: grass/trunk/lib/python/pygrass/raster/testsuite/test_history.py
===================================================================
--- grass/trunk/lib/python/pygrass/raster/testsuite/test_history.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/pygrass/raster/testsuite/test_history.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -10,6 +10,7 @@
 
 from grass.pygrass.raster import RasterRow
 from grass.pygrass.raster.history import History
+from grass.script.utils import decode
 
 
 class RasterHistoryTestCate(TestCase):
@@ -40,22 +41,22 @@
         r = RasterRow(self.name)
         r.open("r")
         hist = r.hist
-        
-        self.assertEqual(hist.title, "A test map")
-        self.assertEqual(hist.keyword, "This is a test map")
-        
+
+        self.assertEqual(decode(hist.title), self.name)
+        self.assertEqual(decode(hist.keyword), "This is a test map")
+
         hist1 = History(self.name)
         hist1.read()
 
-        self.assertEqual(hist1.title, "A test map")
-        self.assertEqual(hist1.keyword, "This is a test map")
-        
+        self.assertEqual(decode(hist1.title), self.name)
+        self.assertEqual(decode(hist1.keyword), "This is a test map")
+
         self.assertEqual(hist, hist1)
-        self.assertEqual(hist.creator, hist1.creator)
+        self.assertEqual(decode(hist.creator), decode(hist1.creator))
         hist1.creator = "Markus"
-        self.assertNotEqual(hist.creator, hist1.creator)
+        self.assertNotEqual(decode(hist.creator), decode(hist1.creator))
         r.close()
-        
+
         hist1.title = "No such title"
         hist1.keyword = "No such description"
         hist1.src1 = "No such source 1"
@@ -65,12 +66,12 @@
         r.open("r")
         hist = r.hist
 
-        self.assertEqual(hist.title, "No such title")
-        self.assertEqual(hist.keyword, "No such description")
-        self.assertEqual(hist.creator, "Markus")
-        self.assertEqual(hist.creator, "Markus")
-        self.assertEqual(hist.src1, "No such source 1")
-        self.assertEqual(hist.src2, "No such source 2")
+        self.assertEqual(decode(hist.title), "No such title")
+        self.assertEqual(decode(hist.keyword), "No such description")
+        self.assertEqual(decode(hist.creator), "Markus")
+        self.assertEqual(decode(hist.creator), "Markus")
+        self.assertEqual(decode(hist.src1), "No such source 1")
+        self.assertEqual(decode(hist.src2), "No such source 2")
         r.close()
 
 if __name__ == '__main__':

Modified: grass/trunk/lib/python/pygrass/vector/geometry.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/geometry.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/pygrass/vector/geometry.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -721,7 +721,8 @@
                                           pnt.c_points.contents.x,
                                           pnt.c_points.contents.y,
                                           pnt.c_points.contents.z,
-                                          angle, slope):
+                                          ctypes.c_double(angle),
+                                          ctypes.c_double(slope)):
             raise ValueError("Vect_point_on_line give an error.")
         pnt.is2D = self.is2D
         return pnt

Modified: grass/trunk/lib/python/pygrass/vector/table.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/table.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/pygrass/vector/table.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -30,8 +30,10 @@
 from grass.pygrass.utils import table_exist
 from grass.script.db import db_table_in_vector
 from grass.script.core import warning
+from grass.script.utils import decode
 
 from grass.pygrass.vector import sql
+from grass.lib.ctypes_preamble import String
 
 # For test purposes
 test_vector_name = "table_doctest_map"
@@ -70,6 +72,8 @@
         path = path.replace('$LOCATION_NAME', mapset.location)
         path = path.replace('$MAPSET', mapset.name)
         if vect_name is not None:
+            if isinstance(vect_name, String):
+                vect_name = vect_name.data
             path = path.replace('$MAP', vect_name)
         return path
 
@@ -638,7 +642,7 @@
         return self.c_fieldinfo.contents.name
 
     def _set_name(self, name):
-        self.c_fieldinfo.contents.name = name
+        self.c_fieldinfo.contents.name = String(name)
 
     name = property(fget=_get_name, fset=_set_name,
                     doc="Set and obtain name vale")
@@ -647,7 +651,7 @@
         return self.c_fieldinfo.contents.table
 
     def _set_table(self, new_name):
-        self.c_fieldinfo.contents.table = new_name
+        self.c_fieldinfo.contents.table = String(new_name)
 
     table_name = property(fget=_get_table, fset=_set_table,
                           doc="Set and obtain table name value")
@@ -656,7 +660,7 @@
         return self.c_fieldinfo.contents.key
 
     def _set_key(self, key):
-        self.c_fieldinfo.contents.key = key
+        self.c_fieldinfo.contents.key = String(key)
 
     key = property(fget=_get_key, fset=_set_key,
                    doc="Set and obtain cat value")
@@ -665,7 +669,7 @@
         return self.c_fieldinfo.contents.database
 
     def _set_database(self, database):
-        self.c_fieldinfo.contents.database = database
+        self.c_fieldinfo.contents.database = String(database)
 
     database = property(fget=_get_database, fset=_set_database,
                         doc="Set and obtain database value")
@@ -677,7 +681,7 @@
         if driver not in ('sqlite', 'pg'):
             str_err = "Driver not supported, use: %s." % ", ".join(DRIVERS)
             raise TypeError(str_err)
-        self.c_fieldinfo.contents.driver = driver
+        self.c_fieldinfo.contents.driver = String(driver)
 
     driver = property(fget=_get_driver, fset=_set_driver,
                       doc="Set and obtain driver value. The drivers supported \
@@ -746,7 +750,10 @@
         >>> conn.close()
 
         """
-        if self.driver == 'sqlite':
+        driver = self.driver
+        if isinstance(driver, String):
+            driver = decode(driver.data)
+        if driver == 'sqlite':
             import sqlite3
             # Numpy is using some custom integer data types to efficiently
             # pack data into memory. Since these types aren't familiar to
@@ -756,10 +763,14 @@
                 sqlite3.register_adapter(t, long)
             dbpath = get_path(self.database, self.table_name)
             dbdirpath = os.path.split(dbpath)[0]
+            if isinstance(dbpath, String):
+                dbpath = dbpath.data
+            if isinstance(dbdirpath, String):
+                dbdirpath = dbdirpath.data
             if not os.path.exists(dbdirpath):
                 os.mkdir(dbdirpath)
             return sqlite3.connect(dbpath)
-        elif self.driver == 'pg':
+        elif driver == 'pg':
             try:
                 import psycopg2
                 psycopg2.paramstyle = 'qmark'

Modified: grass/trunk/lib/python/script/core.py
===================================================================
--- grass/trunk/lib/python/script/core.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/script/core.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -29,7 +29,7 @@
 import random
 import types as python_types
 
-from .utils import KeyValue, parse_key_val, basename, encode
+from .utils import KeyValue, parse_key_val, basename, encode, decode
 from grass.exceptions import ScriptError, CalledModuleError
 
 # i18N
@@ -40,14 +40,14 @@
     # python2
     import __builtin__
     from os import environ
+    __builtin__.__dict__['_'] = __builtin__.__dict__['_'].__self__.ugettext
 except ImportError:
     # python3
     import builtins as __builtin__
     from os import environb as environ
     unicode = str
-__builtin__.__dict__['_'] = __builtin__.__dict__['_'].__self__.lgettext
+    __builtin__.__dict__['_'] = __builtin__.__dict__['_'].__self__.gettext
 
-
 # subprocess wrapper that uses shell on Windows
 
 
@@ -108,6 +108,21 @@
     return bytes(val)
 
 
+def _make_unicode(val, enc):
+    """Convert value to unicode with given encoding
+
+    :param val: value to be converted
+    :param enc: encoding to be used
+    """
+    if val is None or enc is None:
+        return val
+    else:
+        if enc == 'default':
+            return decode(val)
+        else:
+            return decode(val, encoding=enc)
+
+
 def get_commands():
     """Create list of available GRASS commands to use when parsing
     string from the command line
@@ -303,7 +318,8 @@
             continue
         # convert string to bytes
         opt = encode(opt)
-        if val != None:
+        prog = encode(prog)
+        if val is not None:
             if opt.startswith(b'_'):
                 opt = opt[1:]
                 warning(_("To run the module <%s> add underscore at the end"
@@ -330,7 +346,8 @@
     else:
         # TODO: construction of the whole command is far from perfect
         args = make_command(*args, **kwargs)
-        raise CalledModuleError(module=None, code=repr(args),
+        code = ''.join([decode(each) for each in args])
+        raise CalledModuleError(module=None, code=code,
                                 returncode=returncode)
 
 def start_command(prog, flags=b"", overwrite=False, quiet=False,
@@ -362,6 +379,9 @@
 
     :return: Popen object
     """
+    if 'encoding' in kwargs.keys():
+        encoding = kwargs.pop('encoding')
+
     options = {}
     popts = {}
     for opt, val in kwargs.items():
@@ -381,7 +401,6 @@
         sys.stderr.flush()
     return Popen(args, **popts)
 
-
 def run_command(*args, **kwargs):
     """Execute a module synchronously
 
@@ -410,11 +429,18 @@
 
     :raises: ``CalledModuleError`` when module returns non-zero return code
     """
+    encoding = 'default'
+    if 'encoding' in kwargs:
+        encoding = kwargs['encoding']
+
     if _capture_stderr and 'stderr' not in kwargs.keys():
         kwargs['stderr'] = PIPE
     ps = start_command(*args, **kwargs)
     if _capture_stderr:
         stdout, stderr = ps.communicate()
+        if encoding is not None:
+            stdout = _make_unicode(stdout, encoding)
+            stderr = _make_unicode(stderr, encoding)
         returncode = ps.poll()
         if returncode:
             sys.stderr.write(stderr)
@@ -468,10 +494,17 @@
 
     :return: stdout
     """
+    encoding = 'default'
+    if 'encoding' in kwargs:
+        encoding = kwargs['encoding']
+
     if _capture_stderr and 'stderr' not in kwargs.keys():
         kwargs['stderr'] = PIPE
     process = pipe_command(*args, **kwargs)
     stdout, stderr = process.communicate()
+    if encoding is not None:
+        stdout = _make_unicode(stdout, encoding)
+        stderr = _make_unicode(stderr, encoding)
     returncode = process.poll()
     if _capture_stderr and returncode:
         sys.stderr.write(stderr)
@@ -541,12 +574,22 @@
 
     :raises: ``CalledModuleError`` when module returns non-zero return code
     """
+    encoding = 'default'
+    if 'encoding' in kwargs:
+        encoding = kwargs['encoding']
     # TODO: should we delete it from kwargs?
     stdin = kwargs['stdin']
+    if encoding is None or encoding == 'default':
+        stdin = encode(stdin)
+    else:
+        stdin = encode(stdin, encoding=encoding)
     if _capture_stderr and 'stderr' not in kwargs.keys():
         kwargs['stderr'] = PIPE
     process = feed_command(*args, **kwargs)
     unused, stderr = process.communicate(stdin)
+    if encoding is not None:
+        unused = _make_unicode(unused, encoding)
+        stderr = _make_unicode(stderr, encoding)
     returncode = process.poll()
     if _capture_stderr and returncode:
         sys.stderr.write(stderr)
@@ -740,14 +783,15 @@
             break
         try:
             [var, val] = line.split(b'=', 1)
+            [var, val] = [decode(var), decode(val)]
         except:
             raise SyntaxError("invalid output from g.parser: %s" % line)
 
-        if var.startswith(b'flag_'):
+        if var.startswith('flag_'):
             flags[var[5:]] = bool(int(val))
-        elif var.startswith(b'opt_'):
+        elif var.startswith('opt_'):
             options[var[4:]] = val
-        elif var in [b'GRASS_OVERWRITE', b'GRASS_VERBOSE']:
+        elif var in ['GRASS_OVERWRITE', 'GRASS_VERBOSE']:
             os.environ[var] = val
         else:
             raise SyntaxError("invalid output from g.parser: %s" % line)
@@ -1296,7 +1340,7 @@
 
     :return: directory of mapsets/elements
     """
-    if isinstance(type, python_types.StringTypes) or len(type) == 1:
+    if isinstance(type, str) or len(type) == 1:
         types = [type]
         store_types = False
     else:

Modified: grass/trunk/lib/python/script/db.py
===================================================================
--- grass/trunk/lib/python/script/db.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/script/db.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -40,6 +40,10 @@
 
     :return: parsed module output
     """
+    if 'database' in args and args['database'] == '':
+        args.pop('database')
+    if 'driver' in args and args['driver'] == '':
+        args.pop('driver')
     s = read_command('db.describe', flags='c', table=table, **args)
     if not s:
         fatal(_("Unable to describe table <%s>") % table)
@@ -80,7 +84,7 @@
 
     :return: True for success, False otherwise
     """
-    nuldev = file(os.devnull, 'w+')
+    nuldev = open(os.devnull, 'w+')
     ok = True
     try:
         run_command('db.describe', flags='c', table=table,
@@ -105,7 +109,7 @@
     :return: parsed output of db.connect
     """
     try:
-        nuldev = file(os.devnull, 'w')
+        nuldev = open(os.devnull, 'w')
         conn = parse_command('db.connect', flags='g', stderr=nuldev)
         nuldev.close()
     except CalledModuleError:
@@ -187,7 +191,7 @@
     :param str table: name of table to query
     """
     from .vector import vector_db
-    nuldev = file(os.devnull, 'w')
+    nuldev = open(os.devnull, 'w')
     used = []
     vects = list_strings('vector', mapset=mapset)
     for vect in vects:

Modified: grass/trunk/lib/python/script/task.py
===================================================================
--- grass/trunk/lib/python/script/task.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/script/task.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -430,7 +430,8 @@
         """Get node text"""
         p = node.find(tag)
         if p is not None:
-            return string.join(string.split(p.text), ' ')
+            res = ' '.join(p.text.split())
+            return res
 
         return default
 
@@ -444,17 +445,19 @@
 
     # modify: fetch encoding from the interface description text(xml)
     # e.g. <?xml version="1.0" encoding="GBK"?>
-    pattern = re.compile('<\?xml[^>]*\Wencoding="([^"]*)"[^>]*\?>')
+    pattern = re.compile(b'<\?xml[^>]*\Wencoding="([^"]*)"[^>]*\?>')
     m = re.match(pattern, xml_text)
     if m is None:
         return xml_text
     #
     enc = m.groups()[0]
+    # for Python 3
+    enc_decoded = enc.decode('ascii')
 
     # modify: change the encoding to "utf-8", for correct parsing
-    xml_text_utf8 = xml_text.decode(enc).encode("utf-8")
-    p = re.compile('encoding="' + enc + '"', re.IGNORECASE)
-    xml_text_utf8 = p.sub('encoding="utf-8"', xml_text_utf8)
+    xml_text_utf8 = xml_text.decode(enc_decoded).encode("utf-8")
+    p = re.compile(b'encoding="' + enc + b'"', re.IGNORECASE)
+    xml_text_utf8 = p.sub(b'encoding="utf-8"', xml_text_utf8)
 
     return xml_text_utf8
 
@@ -493,18 +496,18 @@
                 del sys.path[0]  # remove gui/scripts from the path
 
         if p.returncode != 0:
-            raise ScriptError(_("Unable to fetch interface description for command '%(cmd)s'."
-                                 "\n\nDetails: %(det)s") % {'cmd': cmd, 'det': cmderr})
+            raise ScriptError(_("Unable to fetch interface description for command '<{cmd}>'."
+                                "\n\nDetails: <{det}>".format(cmd=cmd, det=decode(cmderr))))
 
     except OSError as e:
-        raise ScriptError(_("Unable to fetch interface description for command '%(cmd)s'."
-                             "\n\nDetails: %(det)s") % {'cmd': cmd, 'det': e})
+        raise ScriptError(_("Unable to fetch interface description for command '<{cmd}>'."
+                            "\n\nDetails: <{det}>".format(cmd=cmd, det=e)))
 
-    desc = cmdout.replace('grass-interface.dtd',
-                          os.path.join(os.getenv('GISBASE'),
-                                       'gui', 'xml',
-                                       'grass-interface.dtd'))
-    return convert_xml_to_utf8(desc)
+    desc = convert_xml_to_utf8(cmdout)
+    desc = desc.replace(b'grass-interface.dtd',
+                        os.path.join(os.getenv('GISBASE'), 'gui', 'xml',
+                                     'grass-interface.dtd').encode('utf-8'))
+    return desc
 
 
 def parse_interface(name, parser=processTask, blackList=None):

Modified: grass/trunk/lib/python/script/testsuite/test_start_command_functions.py
===================================================================
--- grass/trunk/lib/python/script/testsuite/test_start_command_functions.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/script/testsuite/test_start_command_functions.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -2,10 +2,13 @@
 # the utf-8 is important because we do use the characters
 """Tests of start_command function family (location independent)"""
 
+import sys
 from grass.gunittest.case import TestCase
 from grass.gunittest.main import test
 
-from grass.script.core import start_command, PIPE, run_command
+from grass.script.core import start_command, PIPE, run_command, write_command
+from grass.script.core import read_command, find_program
+from grass.script.utils import encode
 
 
 class TestPythonKeywordsInParameters(TestCase):
@@ -22,7 +25,7 @@
         stderr = proc.communicate()[1]
         self.assertNotIn(b'_raster', stderr)
         self.assertIn(self.raster, stderr,
-            msg="Raster map name should appear in the error output")
+                      msg="Raster map name should appear in the error output")
 
     def test_suffixed_underscore(self):
         proc = start_command(
@@ -30,7 +33,7 @@
         stderr = proc.communicate()[1]
         self.assertNotIn(b'raster_', stderr)
         self.assertIn(self.raster, stderr,
-            msg="Raster map name should appear in the error output")
+                      msg="Raster map name should appear in the error output")
 
     def test_multiple_underscores(self):
         proc = start_command(
@@ -52,11 +55,16 @@
 
     def test_python_module_ascii(self):
         """This tests if Python module works"""
-        run_command('g.search.modules', keyword=b'Priserny kun')
+        run_command('g.search.modules', keyword='Priserny kun', encoding=None)
 
+    def test_python_module_ascii_with_encoding(self):
+        """This tests if Python module works with user-specified encoding"""
+        run_command('g.search.modules', keyword='Priserny kun',
+                    encoding='utf-16')
+
     def test_python_module_czech_nonascii(self):
         """This likely fails on non-UTF-8 systems (i.e. MS Win)"""
-        run_command('g.search.modules', keyword=b'Příšerný kůň')
+        run_command('g.search.modules', keyword='Příšerný kůň')
 
     def test_python_module_czech_unicode(self):
         """This likely fails on non-UTF-8 systems (i.e. MS Win)"""
@@ -63,5 +71,42 @@
         run_command('g.search.modules', keyword=u'Příšerný kůň')
 
 
+class TestPythonModuleWithStdinStdout(TestCase):
+    raster = 'rand_raster'
+
+    @classmethod
+    def setUpClass(cls):
+        cls.runModule('g.region', s=0, n=10, w=0, e=10, res=1)
+        cls.runModule("r.mapcalc", expression="{} = rand(1, 5)".
+                      format(cls.raster), seed=1, overwrite=True)
+
+    @classmethod
+    def tearDownClass(cls):
+        cls.runModule("g.remove", type='raster', name=cls.raster,
+                      flags='f')
+
+    def test_write_labels_unicode(self):
+        """This tests if Python module works"""
+        find_program('ls', '--version')
+        write_command('r.category', map=self.raster, rules='-',
+                      stdin='1:kůň\n2:kráva\n3:ovečka\n4:býk', separator=':')
+        res = read_command('r.category', map=self.raster,
+                           separator=':').strip()
+        self.assertEquals(res, u'1:kůň\n2:kráva\n3:ovečka\n4:býk')
+        if sys.version_info.major >= 3:
+            self.assertIsInstance(res, str)
+        else:
+            self.assertIsInstance(res, unicode)
+
+    def test_write_labels_bytes(self):
+        """This tests if Python module works"""
+        write_command('r.category', map=self.raster, rules='-',
+                      stdin='1:kůň\n2:kráva\n3:ovečka\n4:býk',
+                      separator=':', encoding=None)
+        res = read_command('r.category', map=self.raster,
+                           separator=':', encoding=None).strip()
+        self.assertEquals(res, encode('1:kůň\n2:kráva\n3:ovečka\n4:býk'))
+        self.assertIsInstance(res, bytes)
+
 if __name__ == '__main__':
     test()

Modified: grass/trunk/lib/python/script/testsuite/test_utils.py
===================================================================
--- grass/trunk/lib/python/script/testsuite/test_utils.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/script/testsuite/test_utils.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -1,5 +1,6 @@
 # -*- coding: utf-8 -*-
 import os
+import sys
 
 from grass.gunittest.case import TestCase
 from grass.gunittest.main import test
@@ -39,25 +40,35 @@
     def test_unicode(self):
         self.assertEqual(b'text', utils.encode(u'text'))
 
-    def test_bytes_grabage_in_out(self):
+    def test_bytes_garbage_in_out(self):
         """If the input is bytes we should not touch it for encoding"""
-        self.assertEqual(b'Příšerný kůň', utils.encode(b'Příšerný kůň'))
+        self.assertEqual(b'P\xc5\x99\xc3\xad\xc5\xa1ern\xc3\xbd k\xc5\xaf\xc5\x88',
+                         utils.encode('Příšerný kůň'))
 
     def test_int(self):
         """If the input is an integer return bytes"""
-        self.assertEqual(b'1234567890', utils.encode(1234567890))
+        if sys.version_info.major >= 3:
+            self.assertRaises(TypeError, utils.encode, 1234567890)
+        else:
+            self.assertEqual('1234567890', utils.encode(1234567890))
 
     def test_float(self):
         """If the input is a float return bytes"""
-        self.assertEqual(b'12345.6789', utils.encode(12345.6789))
+        if sys.version_info.major >= 3:
+            self.assertRaises(TypeError, utils.encode, 12345.6789)
+        else:
+            self.assertEqual('12345.6789', utils.encode(12345.6789))
 
     def test_none(self):
         """If the input is a boolean return bytes"""
-        self.assertEqual(b'None', utils.encode(None))
+        if sys.version_info.major >= 3:
+            self.assertRaises(TypeError, utils.encode, None)
+        else:
+            self.assertEqual('None', utils.encode(None))
 
 
 class TestDecode(TestCase):
-    """Tests function `encode` that convert value to unicode."""
+    """Tests function `decode` that converts value to unicode."""
 
     def test_bytes(self):
         self.assertEqual(u'text', utils.decode(b'text'))
@@ -67,15 +78,24 @@
 
     def test_int(self):
         """If the input is an integer return bytes"""
-        self.assertEqual(u'1234567890', utils.decode(1234567890))
+        if sys.version_info.major >= 3:
+            self.assertRaises(TypeError, utils.decode, 1234567890)
+        else:
+            self.assertEqual(u'1234567890', utils.decode(1234567890))
 
     def test_float(self):
         """If the input is a float return bytes"""
-        self.assertEqual(u'12345.6789', utils.decode(12345.6789))
+        if sys.version_info.major >= 3:
+            self.assertRaises(TypeError, utils.decode, 12345.6789)
+        else:
+            self.assertEqual(u'12345.6789', utils.decode(12345.6789))
 
     def test_none(self):
         """If the input is a boolean return bytes"""
-        self.assertEqual(u'None', utils.decode(None))
+        if sys.version_info.major >= 3:
+            self.assertRaises(TypeError, utils.decode, None)
+        else:
+            self.assertEqual(u'None', utils.decode(None))
 
 
 class TestEncodeLcAllC(TestEncode, LcAllC):

Modified: grass/trunk/lib/python/script/utils.py
===================================================================
--- grass/trunk/lib/python/script/utils.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/script/utils.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -163,12 +163,13 @@
     return encoding
 
 
-def decode(bytes_):
+def decode(bytes_, encoding=None):
     """Decode bytes with default locale and return (unicode) string
 
     No-op if parameter is not bytes (assumed unicode string).
 
     :param bytes bytes_: the bytes to decode
+    :param encoding: encoding to be used, default value is None
 
     Example
     -------
@@ -183,12 +184,21 @@
     if isinstance(bytes_, unicode):
         return bytes_
     if isinstance(bytes_, bytes):
-        enc = _get_encoding()
+        if encoding is None:
+            enc = _get_encoding()
+        else:
+            enc = encoding
         return bytes_.decode(enc)
-    return unicode(bytes_)
+    # if something else than text
+    if sys.version_info.major >= 3:
+        # only text should be used
+        raise TypeError("can only accept types str and bytes")
+    else:
+        # for backwards compatibility
+        return unicode(bytes_)
 
 
-def encode(string):
+def encode(string, encoding=None):
     """Encode string with default locale and return bytes with that encoding
 
     No-op if parameter is bytes (assumed already encoded).
@@ -195,6 +205,7 @@
     This ensures garbage in, garbage out.
 
     :param str string: the string to encode
+    :param encoding: encoding to be used, default value is None
 
     Example
     -------
@@ -208,10 +219,20 @@
     """
     if isinstance(string, bytes):
         return string
+    # this also tests str in Py3:
     if isinstance(string, unicode):
-        enc = _get_encoding()
+        if encoding is None:
+            enc = _get_encoding()
+        else:
+            enc = encoding
         return string.encode(enc)
-    return bytes(string)
+    # if something else than text
+    if sys.version_info.major >= 3:
+        # only text should be used
+        raise TypeError("can only accept types str and bytes")
+    else:
+        # for backwards compatibility
+        return bytes(string)
 
 
 def parse_key_val(s, sep='=', dflt=None, val_type=None, vsep=None):

Modified: grass/trunk/lib/python/temporal/c_libraries_interface.py
===================================================================
--- grass/trunk/lib/python/temporal/c_libraries_interface.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/temporal/c_libraries_interface.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -27,6 +27,7 @@
 from grass.pygrass.rpc.base import RPCServerBase
 from grass.pygrass.raster import RasterRow
 from grass.pygrass.vector import VectorTopo
+from grass.script.utils import encode, decode
 
 ###############################################################################
 
@@ -238,7 +239,7 @@
         mapset = libgis.G_mapset()
 
     drstring = libtgis.tgis_get_mapset_driver_name(mapset)
-    conn.send(drstring)
+    conn.send(drstring.data)
 
 ###############################################################################
 
@@ -258,13 +259,14 @@
         if not mapset:
             mapset = libgis.G_mapset()
         dbstring = libtgis.tgis_get_mapset_database_name(mapset)
+        dbstring = dbstring.data
 
         if dbstring:
             # We substitute GRASS variables if they are located in the database string
             # This behavior is in conjunction with db.connect
-            dbstring = dbstring.replace("$GISDBASE", libgis.G_gisdbase())
-            dbstring = dbstring.replace("$LOCATION_NAME", libgis.G_location())
-            dbstring = dbstring.replace("$MAPSET", mapset)
+            dbstring = dbstring.replace(encode("$GISDBASE"), libgis.G_gisdbase())
+            dbstring = dbstring.replace(encode("$LOCATION_NAME"), libgis.G_location())
+            dbstring = dbstring.replace(encode("$MAPSET"), encode(mapset))
     except:
         raise
     finally:
@@ -297,8 +299,9 @@
             in_search_path = libgis.G_is_mapset_in_search_path(mapset)
 
             c = 0
-            while mapset[c] != "\x00":
-                char_list += mapset[c]
+            while mapset[c] != b"\x00":
+                val = decode(mapset[c])
+                char_list += val
                 c += 1
 
             if permission >= 0 and in_search_path == 1:
@@ -311,7 +314,7 @@
 
         # We need to sort the mapset list, but the first one should be
         # the current mapset
-        current_mapset = libgis.G_mapset()
+        current_mapset = decode(libgis.G_mapset())
         if current_mapset in mapset_list:
             mapset_list.remove(current_mapset)
         mapset_list.sort()
@@ -566,7 +569,7 @@
         return None
 
     # Read the region information
-    region = libgis.Cell_head()
+    region = libraster.struct_Cell_head()
     libraster.Rast_get_cellhd(name, mapset, byref(region))
 
     kvp["north"] = region.north

Modified: grass/trunk/lib/python/temporal/core.py
===================================================================
--- grass/trunk/lib/python/temporal/core.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/temporal/core.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -41,6 +41,7 @@
 
 from .c_libraries_interface import *
 from grass.pygrass import messages
+from grass.script.utils import decode, encode
 # Import all supported database backends
 # Ignore import errors since they are checked later
 try:
@@ -453,6 +454,7 @@
     tgis_mapsets = {}
 
     for mapset in mapsets:
+        mapset = decode(mapset)
         driver = c_library_interface.get_driver_name(mapset)
         database = c_library_interface.get_database_name(mapset)
 
@@ -464,12 +466,12 @@
             # Check if the temporal sqlite database exists
             # We need to set non-existing databases in case the mapset is the current mapset
             # to create it
-            if (driver == "sqlite" and os.path.exists(database)) or mapset == get_current_mapset() :
+            if (encode(driver) == "sqlite" and os.path.exists(database)) or encode(mapset) == get_current_mapset() :
                 tgis_mapsets[mapset] = (driver,  database)
 
             # We need to warn if the connection is defined but the database does not
             # exists
-            if driver == "sqlite" and not os.path.exists(database):
+            if encode(driver) == "sqlite" and not os.path.exists(database):
                 message_interface.warning("Temporal database connection defined as:\n" + \
                                           database + "\nBut database file does not exist.")
 
@@ -583,6 +585,7 @@
             msgr.warning("TGIS_DISABLE_TIMESTAMP_WRITE is True")
 
     if driver_string is not None and driver_string is not "":
+        driver_string = decode(driver_string)
         if driver_string == "sqlite":
             tgis_backend = driver_string
             try:
@@ -892,6 +895,8 @@
     def get_dbmi(self,  mapset=None):
         if mapset is None:
             mapset = self.current_mapset
+
+        mapset = decode(mapset)
         return self.connections[mapset].dbmi
 
     def rollback(self,  mapset=None):
@@ -945,6 +950,7 @@
         if mapset is None:
             mapset = self.current_mapset
 
+        mapset = decode(mapset)
         if mapset not in self.tgis_mapsets.keys():
             self.msgr.fatal(_("Unable to mogrify sql statement. " +
                               self._create_mapset_error_message(mapset)))
@@ -967,6 +973,7 @@
         if mapset is None:
             mapset = self.current_mapset
 
+        mapset = decode(mapset)
         if mapset not in self.tgis_mapsets.keys():
             self.msgr.fatal(_("Unable to check table. " +
                               self._create_mapset_error_message(mapset)))
@@ -983,6 +990,7 @@
         if mapset is None:
             mapset = self.current_mapset
 
+        mapset = decode(mapset)
         if mapset not in self.tgis_mapsets.keys():
             self.msgr.fatal(_("Unable to execute sql statement. " +
                               self._create_mapset_error_message(mapset)))
@@ -993,6 +1001,7 @@
         if mapset is None:
             mapset = self.current_mapset
 
+        mapset = decode(mapset)
         if mapset not in self.tgis_mapsets.keys():
             self.msgr.fatal(_("Unable to fetch one. " +
                               self._create_mapset_error_message(mapset)))
@@ -1003,6 +1012,7 @@
         if mapset is None:
             mapset = self.current_mapset
 
+        mapset = decode(mapset)
         if mapset not in self.tgis_mapsets.keys():
             self.msgr.fatal(_("Unable to fetch all. " +
                               self._create_mapset_error_message(mapset)))
@@ -1020,6 +1030,7 @@
         if mapset is None:
             mapset = self.current_mapset
 
+        mapset = decode(mapset)
         if mapset not in self.tgis_mapsets.keys():
             self.msgr.fatal(_("Unable to execute transaction. " +
                               self._create_mapset_error_message(mapset)))
@@ -1032,7 +1043,7 @@
                  "access mapset <%(mapset)s>, or "
                  "mapset <%(mapset)s> has no temporal database. "
                  "Accessible mapsets are: <%(mapsets)s>" % \
-                 {"mapset": mapset,
+                 {"mapset": decode(mapset),
                   "mapsets":','.join(self.tgis_mapsets.keys())})
 
 ###############################################################################
@@ -1057,12 +1068,12 @@
         self.connected = False
         if backend is None:
             global tgis_backend
-            if tgis_backend == "sqlite":
+            if decode(tgis_backend) == "sqlite":
                 self.dbmi = sqlite3
             else:
                 self.dbmi = psycopg2
         else:
-            if backend == "sqlite":
+            if decode(backend) == "sqlite":
                 self.dbmi = sqlite3
             else:
                 self.dbmi = psycopg2
@@ -1108,6 +1119,9 @@
         # Connection in the current mapset
         if dbstring is None:
             dbstring = self.dbstring
+        
+        dbstring = decode(dbstring)
+
         try:
             if self.dbmi.__name__ == "sqlite3":
                 self.connection = self.dbmi.connect(dbstring,

Modified: grass/trunk/lib/python/temporal/temporal_algebra.py
===================================================================
--- grass/trunk/lib/python/temporal/temporal_algebra.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/temporal/temporal_algebra.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -462,9 +462,9 @@
 from .factory import dataset_factory
 from .open_stds import open_new_stds, open_old_stds
 from .temporal_operator import TemporalOperatorParser
-from spatio_temporal_relationships import SpatioTemporalTopologyBuilder
+from .spatio_temporal_relationships import SpatioTemporalTopologyBuilder
 from .datetime_math import time_delta_to_relative_time, string_to_datetime
-from abstract_space_time_dataset import AbstractSpaceTimeDataset
+from .abstract_space_time_dataset import AbstractSpaceTimeDataset
 from .temporal_granularity import compute_absolute_time_granularity
 
 from .datetime_math import create_suffix_from_datetime

Modified: grass/trunk/lib/python/temporal/temporal_raster_base_algebra.py
===================================================================
--- grass/trunk/lib/python/temporal/temporal_raster_base_algebra.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/temporal/temporal_raster_base_algebra.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -56,7 +56,7 @@
 from .abstract_dataset import AbstractDatasetComparisonKeyStartTime
 from .factory import dataset_factory
 from .open_stds import open_new_stds
-from spatio_temporal_relationships import SpatioTemporalTopologyBuilder
+from .spatio_temporal_relationships import SpatioTemporalTopologyBuilder
 from .space_time_datasets import Raster3DDataset, RasterDataset
 from .temporal_granularity import compute_absolute_time_granularity
 

Modified: grass/trunk/lib/python/temporal/temporal_vector_algebra.py
===================================================================
--- grass/trunk/lib/python/temporal/temporal_vector_algebra.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/temporal/temporal_vector_algebra.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -56,7 +56,7 @@
 from .core import init_dbif, get_current_mapset
 from .abstract_dataset import AbstractDatasetComparisonKeyStartTime
 from .open_stds import open_new_stds
-from spatio_temporal_relationships import SpatioTemporalTopologyBuilder
+from .spatio_temporal_relationships import SpatioTemporalTopologyBuilder
 from .space_time_datasets import VectorDataset
 
 

Modified: grass/trunk/lib/python/temporal/testsuite/test_register_function.py
===================================================================
--- grass/trunk/lib/python/temporal/testsuite/test_register_function.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/lib/python/temporal/testsuite/test_register_function.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -222,7 +222,7 @@
         map_3 = tgis.RasterDataset("register_map_null@" + tgis.get_current_mapset())
         map_3.select()
         start, end = map_3.get_absolute_time()
-        self.assertEqual(start, datetime.datetime(2001, 1, 2, 02, 30, 1))
+        self.assertEqual(start, datetime.datetime(2001, 1, 2, 2, 30, 1))
 
         map_list = [map_1, map_2, map_3]
 

Modified: grass/trunk/locale/grass_po_stats.py
===================================================================
--- grass/trunk/locale/grass_po_stats.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/locale/grass_po_stats.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -22,6 +22,7 @@
 import glob
 import codecs
 
+
 def read_po_files(inputdirpath):
     """Return a dictionary with for each language the list of *.po files"""
     originalpath = os.getcwd()
@@ -36,7 +37,7 @@
 
         # if keys is not in languages add it and the file's name
         if lang not in languages:
-            languages[lang] = [pofile,]
+            languages[lang] = [pofile, ]
         # add only files name
         else:
             languages[lang].append(pofile)
@@ -48,7 +49,7 @@
     """Return a dictionary, and the good, fuzzy and bad values from a string"""
     langdict = {}
     # split the output
-    out = msg.split(',')
+    out = msg.split(b',')
     # TODO maybe check using regex
     # check for each answer
     for o in out:
@@ -55,22 +56,23 @@
         o = o.lower().strip()
         # each answer is written into dictionary and
         # the value add to variable for the sum
-        if 'untranslated' in o:
-            val = int(o.split(' ')[0])
+        if b'untranslated' in o:
+            val = int(o.split(b' ')[0])
             langdict['bad'] = val
             lbad += val
-        elif 'fuzzy' in o:
-            val = int(o.split(' ')[0])
+        elif b'fuzzy' in o:
+            val = int(o.split(b' ')[0])
             langdict['fuzzy'] = val
             lfuzzy += val
         else:
-            val = int(o.split(' ')[0])
+            val = int(o.split(b' ')[0])
             langdict['good'] = val
             lgood += val
     return langdict, lgood, lfuzzy, lbad
 
+
 def langDefinition(fil):
-    f = codecs.open(fil,encoding = 'utf-8', errors='replace', mode = 'r')
+    f = codecs.open(fil, encoding='utf-8', errors='replace', mode='r')
     for l in f.readlines():
         if '"Language-Team:' in l:
             lang = l.split(' ')[1:-1]
@@ -83,6 +85,7 @@
     else:
         return ""
 
+
 def get_stats(languages, directory):
     """Return a dictionary with the statistic for each language"""
     # output dictionary to transform in json file
@@ -93,10 +96,10 @@
     # all the information about each lang
     output['langs'] = {}
     # for each language
-    for lang, pofilelist in languages.iteritems():
+    for lang, pofilelist in languages.items():
         output['langs'][lang] = {}
         output['langs'][lang]['total'] = {}
-        output['langs'][lang]['name'] = langDefinition(os.path.join(directory,pofilelist[0]))
+        output['langs'][lang]['name'] = langDefinition(os.path.join(directory, pofilelist[0]))
         # variables to create sum for each language
         lgood = 0
         lfuzzy = 0
@@ -108,11 +111,11 @@
             # run msgfmt for statistics
             # TODO check if it's working on windows
             process = subprocess.Popen(['msgfmt', '--statistics',
-                                os.path.join(directory,flang)],
-                                stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+                                        os.path.join(directory,flang)],
+                                    stdout=subprocess.PIPE, stderr=subprocess.PIPE)
             msg = process.communicate()[1].strip()
             # check if some errors occurs
-            if msg.find('error') != -1:
+            if msg.find(b'error') != -1:
                 # TODO CHECK IF grass.warning()
                 print("WARNING: file <%s> has some problems: <%s>" % (flang, msg))
                 continue
@@ -130,9 +133,9 @@
     # load dictionary into json format
     fjson = json.dumps(stats, sort_keys=True, indent=4)
     # write a string with pretty style
-    outjson = os.linesep.join([l.rstrip() for l in  fjson.splitlines()])
+    outjson = os.linesep.join([l.rstrip() for l in fjson.splitlines()])
     # write out file
-    fout = open(outfile,'w')
+    fout = open(outfile, 'w')
     fout.write(outjson)
     fout.write(os.linesep)
     fout.close()
@@ -141,6 +144,7 @@
     except:
         pass
 
+
 def main(in_dirpath, out_josonpath):
     languages = read_po_files(in_dirpath)
     stats = get_stats(languages, in_dirpath)
@@ -152,5 +156,5 @@
 
 if __name__ == "__main__":
     directory = 'po/'
-    outfile = os.path.join(os.environ['GISBASE'],'translation_status.json')
+    outfile = os.path.join(os.environ['GISBASE'], 'translation_status.json')
     sys.exit(main(directory, outfile))

Modified: grass/trunk/man/build_class.py
===================================================================
--- grass/trunk/man/build_class.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/man/build_class.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -25,7 +25,7 @@
 
 filename = modclass + ".html"
 
-f = open(filename + ".tmp", 'wb')
+f = open(filename + ".tmp", 'w')
 
 write_html_header(f, "GRASS GIS %s Reference Manual: %s" % (grass_version, modclass))
 modclass_lower = modclass.lower()

Modified: grass/trunk/man/build_class_graphical.py
===================================================================
--- grass/trunk/man/build_class_graphical.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/man/build_class_graphical.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -122,8 +122,7 @@
             return image
         if basename == module:
             return image
-    return sorted(candidates,
-                  lambda first, second: cmp(len(first), len(second)))[0]
+    return sorted(candidates, key=len)[0]
 
 
 def generate_page_for_category(short_family, module_family, imgs, year,
@@ -130,7 +129,7 @@
                                skip_no_image=False):
     filename = module_family + "_graphical.html"
 
-    output = open(filename + ".tmp", 'wb')
+    output = open(filename + ".tmp", 'w')
 
     output.write(header1_tmpl.substitute(
         title="GRASS GIS %s Reference "

Modified: grass/trunk/man/build_full_index.py
===================================================================
--- grass/trunk/man/build_full_index.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/man/build_full_index.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -38,7 +38,7 @@
 
 #begin full index:
 filename = "full_index.html"
-f = open(filename + ".tmp", 'wb')
+f = open(filename + ".tmp", 'w')
 
 write_html_header(f, "GRASS GIS %s Reference Manual: Full index" % grass_version, body_width="80%")
 

Modified: grass/trunk/man/build_html.py
===================================================================
--- grass/trunk/man/build_html.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/man/build_html.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -350,13 +350,13 @@
     return desc_override.get(basename)
 
 def read_file(name):
-    f = open(name, 'rb')
+    f = open(name, 'r')
     s = f.read()
     f.close()
     return s
 
 def write_file(name, contents):
-    f = open(name, 'wb')
+    f = open(name, 'w')
     f.write(contents)
     f.close()
 

Modified: grass/trunk/man/build_index.py
===================================================================
--- grass/trunk/man/build_index.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/man/build_index.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -12,7 +12,7 @@
 os.chdir(html_dir)
 
 filename = "index.html"
-f = open(filename + ".tmp", 'wb')
+f = open(filename + ".tmp", 'w')
 
 year = None
 if len(sys.argv) > 1:

Modified: grass/trunk/man/build_index_rest.py
===================================================================
--- grass/trunk/man/build_index_rest.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/man/build_index_rest.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -12,7 +12,7 @@
 os.chdir(rest_dir)
 
 filename = "index.txt"
-f = open(filename + ".tmp", 'wb')
+f = open(filename + ".tmp", 'w')
 
 write_rest_header(f, "GRASS GIS %s Reference Manual" % grass_version, True)
 write_rest_cmd_overview(f)

Modified: grass/trunk/man/build_keywords.py
===================================================================
--- grass/trunk/man/build_keywords.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/man/build_keywords.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -76,8 +76,7 @@
 keywordsfile.write(headerkeywords_tmpl)
 keywordsfile.write('<dl>')
 
-sortedKeys = keywords.keys()
-sortedKeys.sort(key=lambda s: s.lower())
+sortedKeys = sorted(keywords.keys(), key=lambda s: s.lower())
 
 for key in sortedKeys:
     keyword_line = '<dt><b><a name="%s" class="urlblack">%s</a></b></dt>' \

Modified: grass/trunk/man/build_manual_gallery.py
===================================================================
--- grass/trunk/man/build_manual_gallery.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/man/build_manual_gallery.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -168,7 +168,7 @@
                                                "Manual: Manual gallery" % grass_version))
         output.write(header_graphical_index_tmpl)
         output.write('<ul class="img-list">\n')
-        for image, html_file in img_html_files.iteritems():
+        for image, html_file in img_html_files.items():
             name = get_module_name(html_file)
             title = title_from_names(name, image)
             output.write(

Modified: grass/trunk/man/build_rest.py
===================================================================
--- grass/trunk/man/build_rest.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/man/build_rest.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -265,13 +265,13 @@
     return desc_override.get(basename)
 
 def read_file(name):
-    f = open(name, 'rb')
+    f = open(name, 'r')
     s = f.read()
     f.close()
     return s
 
 def write_file(name, contents):
-    f = open(name, 'wb')
+    f = open(name, 'w')
     f.write(contents)
     f.close()
 

Modified: grass/trunk/man/build_topics.py
===================================================================
--- grass/trunk/man/build_topics.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/man/build_topics.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -47,7 +47,7 @@
                         "%s Reference Manual: Topics index" % grass_version))
 topicsfile.write(headertopics_tmpl)
 
-for key, values in sorted(keywords.iteritems(), key=lambda s: s[0].lower()):
+for key, values in sorted(keywords.items(), key=lambda s: s[0].lower()):
     keyfile = open(os.path.join(path, 'topic_%s.html' % key), 'w')
     keyfile.write(header1_tmpl.substitute(title = "GRASS GIS " \
                         "%s Reference Manual: Topic %s" % (grass_version,
@@ -54,7 +54,7 @@
                                                     key.replace('_', ' '))))
     keyfile.write(headerkey_tmpl.substitute(keyword=key.replace('_', ' ')))
     num_modules = 0
-    for mod, desc in sorted(values.iteritems()):
+    for mod, desc in sorted(values.items()):
         num_modules += 1
         keyfile.write(desc1_tmpl.substitute(cmd=mod, desc=desc,
                                             basename=mod.replace('.html', '')))

Modified: grass/trunk/man/parser_standard_options.py
===================================================================
--- grass/trunk/man/parser_standard_options.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/man/parser_standard_options.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -7,7 +7,12 @@
 from __future__ import print_function
 import argparse
 import sys
-from urllib import urlopen
+
+try:
+    from urllib.request import urlopen
+except ImportError:
+    from urllib2 import urlopen
+
 from build_html import *
 
 def parse_options(lines, startswith='Opt'):

Modified: grass/trunk/scripts/db.droptable/db.droptable.py
===================================================================
--- grass/trunk/scripts/db.droptable/db.droptable.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/db.droptable/db.droptable.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -44,6 +44,7 @@
 
 import sys
 import grass.script as grass
+from grass.script.utils import encode
 
 # i18N
 import os
@@ -94,7 +95,7 @@
 
     p = grass.feed_command('db.execute', input='-', database=database,
                            driver=driver)
-    p.stdin.write("DROP TABLE " + table)
+    p.stdin.write(encode("DROP TABLE " + table))
     p.stdin.close()
     p.wait()
     if p.returncode != 0:

Modified: grass/trunk/scripts/db.in.ogr/db.in.ogr.py
===================================================================
--- grass/trunk/scripts/db.in.ogr/db.in.ogr.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/db.in.ogr/db.in.ogr.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -60,6 +60,7 @@
 
 import os
 import grass.script as grass
+from grass.script.utils import decode
 from grass.exceptions import CalledModuleError
 
 # i18N
@@ -85,7 +86,7 @@
 
     # check if table exists
     try:
-        nuldev = file(os.devnull, 'w+')
+        nuldev = open(os.devnull, 'w+')
         s = grass.read_command('db.tables', flags='p', quiet=True, stderr=nuldev)
         nuldev.close()
     except CalledModuleError:
@@ -93,7 +94,7 @@
         grass.read_command('db.connect', flags='c')
         s = grass.read_command('db.tables', flags='p', quiet=True)
 
-    for l in s.splitlines():
+    for l in decode(s).splitlines():
         if l == output:
             if grass.overwrite():
                 grass.warning(_("Table <%s> already exists and will be "
@@ -142,7 +143,7 @@
                           name=output)
 
     # get rid of superfluous auto-added cat column (and cat_ if present)
-    nuldev = file(os.devnull, 'w+')
+    nuldev = open(os.devnull, 'w+')
     grass.run_command('db.dropcolumn', quiet=True, flags='f', table=output,
                       column='cat', stdout=nuldev, stderr=nuldev)
     nuldev.close()

Modified: grass/trunk/scripts/db.test/db.test.py
===================================================================
--- grass/trunk/scripts/db.test/db.test.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/db.test/db.test.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -48,7 +48,7 @@
     gcore.message(_("Using DB driver: %s") % dbconn['driver'])
 
     infile = os.path.join(os.environ['GISBASE'], 'etc', 'db.test', test_file)
-    inf = file(infile)
+    inf = open(infile)
 
     while True:
         type = inf.readline()
@@ -64,7 +64,7 @@
             if type == 'X':
                 gcore.write_command('db.execute', input='-', stdin=sql + '\n')
             else:
-                resf = file(result, 'w')
+                resf = open(result, 'w')
                 gcore.write_command('db.select', input='-', flags='c',
                                     stdin=sql + '\n', stdout=resf)
                 resf.close()
@@ -74,7 +74,7 @@
         else:
             gcore.message(_("EXECUTE: OK"))
 
-        expf = file(expected, 'w')
+        expf = open(expected, 'w')
         while True:
             res = inf.readline().rstrip('\r\n')
             if not res:

Modified: grass/trunk/scripts/db.univar/db.univar.py
===================================================================
--- grass/trunk/scripts/db.univar/db.univar.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/db.univar/db.univar.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -73,8 +73,8 @@
 
 
 def sortfile(infile, outfile):
-    inf = file(infile, 'r')
-    outf = file(outfile, 'w')
+    inf = open(infile, 'r')
+    outf = open(outfile, 'w')
 
     if gscript.find_program('sort', '--help'):
         gscript.run_command('sort', flags='n', stdin=inf, stdout=outf)
@@ -134,7 +134,7 @@
     if not driver:
         driver = None
 
-    tmpf = file(tmp, 'w')
+    tmpf = open(tmp, 'w')
     gscript.run_command('db.select', flags='c', table=table,
                         database=database, driver=driver, sql=sql,
                         stdout=tmpf)
@@ -141,7 +141,7 @@
     tmpf.close()
 
     # check if result is empty
-    tmpf = file(tmp)
+    tmpf = open(tmp)
     if tmpf.read(1) == '':
         gscript.fatal(_("Table <%s> contains no data.") % table)
         tmpf.close()
@@ -157,7 +157,7 @@
     minv = 1e300
     maxv = -1e300
 
-    tmpf = file(tmp)
+    tmpf = open(tmp)
     for line in tmpf:
         if len(line.rstrip('\r\n')) == 0:
             continue
@@ -237,7 +237,7 @@
             ppos[i] = 1
         pval[i] = 0
 
-    inf = file(tmp + ".sort")
+    inf = open(tmp + ".sort")
     l = 1
     for line in inf:
         if l == q25pos:

Modified: grass/trunk/scripts/g.extension/g.extension.py
===================================================================
--- grass/trunk/scripts/g.extension/g.extension.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/g.extension/g.extension.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -138,12 +138,12 @@
 from distutils.dir_util import copy_tree
 
 try:
-    from urllib2 import HTTPError, URLError
+    from urllib2 import HTTPError, URLError, ProxyHandler, build_opener
     from urllib import urlopen, urlretrieve
 except ImportError:
     # there is also HTTPException, perhaps change to list
     from urllib.error import HTTPError, URLError
-    from urllib.request import urlopen, urlretrieve
+    from urllib.request import urlopen, urlretrieve, ProxyHandler, build_opener
 
 try:
     import xml.etree.ElementTree as etree
@@ -160,6 +160,7 @@
 import grass.script as gscript
 from grass.script.utils import try_rmdir
 from grass.script import core as grass
+from grass.script.utils import decode
 
 # i18N
 import gettext
@@ -178,8 +179,14 @@
 
 def etree_fromurl(url, proxies=None):
     """Create XML element tree from a given URL"""
-    file_ = urlopen(url, proxies=proxies)
-    return etree.fromstring(file_.read())
+    if proxies:
+        proxy_handler = ProxyHandler(PROXIES)
+        opener = build_opener(proxy_handler)
+        with opener.open(url) as file_:
+            return etree.fromstring(file_.read())
+    else:
+        file_ = urlopen(url)
+        return etree.fromstring(file_.read())
 
 
 def check_progs():
@@ -527,7 +534,9 @@
         file_url = '%s/%s' % (url, modclass)
         grass.debug("url = %s" % file_url, debug=2)
         try:
-            file_ = urlopen(file_url, proxies=PROXIES)
+            proxy_handler = ProxyHandler(PROXIES)
+            opener = build_opener(proxy_handler)
+            file_ = opener.open(url)
         except (HTTPError, IOError, OSError):
             grass.debug(_("Unable to fetch '%s'") % file_url, debug=1)
             continue
@@ -559,7 +568,9 @@
     # construct a full URL of a file
     url = '%s/%s' % (url, 'gui/wxpython')
     grass.debug("url = %s" % url, debug=2)
-    file_ = urlopen(url, proxies=PROXIES)
+    proxy_handler = ProxyHandler(PROXIES)
+    opener = build_opener(proxy_handler)
+    file_ = opener.open(url)
     if not file_:
         grass.warning(_("Unable to fetch '%s'") % url)
         return
@@ -1030,6 +1041,7 @@
         for name in files:
             filename = os.path.join(root, name)
             data = open(filename, 'rb').read()
+            data = decode(data)
             if '\0' in data:
                 continue  # ignore binary files
             # we don't expect there would be CRLF file by purpose

Modified: grass/trunk/scripts/g.extension/testsuite/test_addons_modules.py
===================================================================
--- grass/trunk/scripts/g.extension/testsuite/test_addons_modules.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/g.extension/testsuite/test_addons_modules.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -16,6 +16,7 @@
 from grass.gunittest.main import test
 from grass.gunittest.gmodules import SimpleModule
 from grass.gunittest.utils import silent_rmtree
+from grass.script.utils import decode
 
 import os
 
@@ -54,7 +55,7 @@
         """List individual extensions/modules/addons"""
         module = SimpleModule('g.extension', flags='l', url=self.url)
         self.assertModule(module)
-        stdout = module.outputs.stdout
+        stdout = decode(module.outputs.stdout)
         self.assertMultiLineEqual(stdout, MODULES_OUTPUT)
 
 

Modified: grass/trunk/scripts/g.extension/testsuite/test_addons_toolboxes.py
===================================================================
--- grass/trunk/scripts/g.extension/testsuite/test_addons_toolboxes.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/g.extension/testsuite/test_addons_toolboxes.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -15,6 +15,7 @@
 from grass.gunittest.case import TestCase
 from grass.gunittest.main import test
 from grass.gunittest.gmodules import SimpleModule
+from grass.script.utils import decode
 
 import os
 
@@ -44,8 +45,8 @@
         """List toolboxes and their content"""
         module = SimpleModule('g.extension', flags='lt', url=self.url)
         self.assertModule(module)
-        stdout = module.outputs.stdout
-        self.assertLooksLike(stdout, FULL_TOOLBOXES_OUTPUT)
+        stdout = decode(module.outputs.stdout)
+        self.assertMultiLineEqual(stdout, FULL_TOOLBOXES_OUTPUT)
 
 
 if __name__ == '__main__':

Modified: grass/trunk/scripts/g.search.modules/testsuite/test_g_search_modules.py
===================================================================
--- grass/trunk/scripts/g.search.modules/testsuite/test_g_search_modules.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/g.search.modules/testsuite/test_g_search_modules.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -15,10 +15,17 @@
 from grass.gunittest.case import TestCase
 from grass.gunittest.main import test
 from grass.gunittest.gmodules import SimpleModule
+from grass.script.utils import decode
 
-import termcolor
+import unittest
 
+try:
+    has_termcolor = True
+    import termcolor
+except ImportError:
+    has_termcolor = False
 
+
 class TestSearchModule(TestCase):
 
     def test_terminal_output(self):
@@ -25,7 +32,7 @@
         """ """
         module = SimpleModule('g.search.modules', keyword="water")
         self.assertModule(module)
-        stdout = module.outputs.stdout
+        stdout = decode(module.outputs.stdout)
         self.assertEqual(stdout.split()[0], 'r.basins.fill')
 
     def test_json_output(self):
@@ -32,7 +39,7 @@
         import json
         module = SimpleModule('g.search.modules', keyword="water", flags="j")
         self.assertModule(module)
-        stdout = json.loads(module.outputs.stdout)
+        stdout = json.loads(decode(module.outputs.stdout))
         self.assertEqual(len(stdout), 6, 'Six modules found')
         self.assertEqual(stdout[3]['name'], 'r.water.outlet', 'r.water.outlet')
         self.assertTrue('keywords' in stdout[3]['attributes'])
@@ -40,14 +47,16 @@
     def test_shell_outout(self):
         module = SimpleModule('g.search.modules', keyword="water", flags="g")
         self.assertModule(module)
-        stdout = module.outputs.stdout.split()
+        stdout = decode(module.outputs.stdout).split()
         self.assertEqual(len(stdout), 6)
         self.assertEqual(stdout[3], 'r.water.outlet')
 
+    @unittest.skipUnless(has_termcolor,
+                         "not supported in this library version")
     def test_colored_terminal(self):
         module = SimpleModule('g.search.modules', keyword="water", flags="c")
         self.assertModule(module)
-        stdout = module.outputs.stdout.split()
+        stdout = decode(module.outputs.stdout).split()
         self.assertEqual(stdout[0],
                          termcolor.colored('r.basins.fill',
                                            attrs=['bold']))
@@ -55,7 +64,7 @@
     def test_manual_pages(self):
         module = SimpleModule('g.search.modules', keyword="kapri", flags="gm")
         self.assertModule(module)
-        stdout = module.outputs.stdout.split()
+        stdout = decode(module.outputs.stdout).split()
         self.assertEqual(len(stdout), 2)
 
 if __name__ == '__main__':

Modified: grass/trunk/scripts/i.in.spotvgt/i.in.spotvgt.py
===================================================================
--- grass/trunk/scripts/i.in.spotvgt/i.in.spotvgt.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/i.in.spotvgt/i.in.spotvgt.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -77,7 +77,7 @@
 
 
 def create_VRT_file(projfile, vrtfile, infile):
-    fh = file(projfile)
+    fh = open(projfile)
     kv = {}
     for l in fh:
         f = l.rstrip('\r\n').split()
@@ -104,7 +104,7 @@
     s = t.substitute(NORTHCORNER=north_corner, WESTCORNER=west_corner,
                      XSIZE=xsize, YSIZE=ysize, RESOLUTION=map_proj_res,
                      FILENAME=infile)
-    outf = file(vrtfile, 'w')
+    outf = open(vrtfile, 'w')
     outf.write(s)
     outf.close()
 

Modified: grass/trunk/scripts/i.oif/i.oif.py
===================================================================
--- grass/trunk/scripts/i.oif/i.oif.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/i.oif/i.oif.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -156,7 +156,7 @@
         for v, p in oif:
             sys.stdout.write(fmt % (p + (v,)))
     else:
-        outf = file(output, 'w')
+        outf = open(output, 'w')
         for v, p in oif:
             outf.write(fmt % (p + (v,)))
         outf.close()

Modified: grass/trunk/scripts/i.pansharpen/i.pansharpen.py
===================================================================
--- grass/trunk/scripts/i.pansharpen/i.pansharpen.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/i.pansharpen/i.pansharpen.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -89,6 +89,7 @@
     hasNumPy = False
 
 import grass.script as grass
+from grass.script.utils import decode
 
 # i18N
 import gettext
@@ -373,7 +374,7 @@
         # calculate number of cells for each grey value for for each image
         stats_out = grass.pipe_command('r.stats', flags='cin', input=i,
                                        sep=':')
-        stats = stats_out.communicate()[0].split('\n')[:-1]
+        stats = decode(stats_out.communicate()[0]).split('\n')[:-1]
         stats_dict = dict(s.split(':', 1) for s in stats)
         total_cells = 0  # total non-null cells
         for j in stats_dict:

Modified: grass/trunk/scripts/i.tasscap/i.tasscap.py
===================================================================
--- grass/trunk/scripts/i.tasscap/i.tasscap.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/i.tasscap/i.tasscap.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -165,7 +165,7 @@
     for i, band in enumerate(inputs):
         band_num = i + 1
         bands['in' + str(band_num) + 'band'] = band
-    grass.debug(1, bands)
+    grass.debug(bands, 1)
 
     # core tasseled cap components computation
     calcN(output_basename, bands, satellite)

Modified: grass/trunk/scripts/m.proj/m.proj.py
===================================================================
--- grass/trunk/scripts/m.proj/m.proj.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/m.proj/m.proj.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -95,7 +95,7 @@
 import sys
 import os
 import threading
-from grass.script.utils import separator, parse_key_val
+from grass.script.utils import separator, parse_key_val, encode, decode
 from grass.script import core as gcore
 
 # i18N
@@ -117,6 +117,7 @@
             if not line:
                 break
             line = line.replace(self.ifs, ' ')
+            line = encode(line)
             self.outf.write(line)
             self.outf.flush()
 
@@ -231,7 +232,7 @@
         fd = open(tmpfile, "w")
         fd.write("%s%s%s\n" % (x, ifs, y))
         fd.close()
-        inf = file(tmpfile)
+        inf = open(tmpfile)
     else:
         if input == '-':
             infile = None
@@ -240,7 +241,7 @@
             infile = input
             if not os.path.exists(infile):
                 gcore.fatal(_("Unable to read input data"))
-            inf = file(infile)
+            inf = open(infile)
             gcore.debug("input file=[%s]" % infile)
 
     # set up output file
@@ -279,7 +280,7 @@
             outf.write("x%sy%sz\n" % (ofs, ofs))
         for line in p.stdout:
             try:
-                xy, z = line.split(' ', 1)
+                xy, z = decode(line).split(' ', 1)
                 x, y = xy.split('\t')
             except ValueError:
                 gcore.fatal(line)
@@ -290,7 +291,7 @@
         if include_header:
             outf.write("input_x%sinput_y%sx%sy%sz\n" % (ofs, ofs, ofs, ofs))
         for line in p.stdout:
-            inXYZ, x, rest = line.split('\t')
+            inXYZ, x, rest = decode(line).split('\t')
             inX, inY = inXYZ.split(' ')[:2]
             y, z = rest.split(' ', 1)
             outf.write('%s%s%s%s%s%s%s%s%s\n' %

Modified: grass/trunk/scripts/r.buffer.lowmem/r.buffer.lowmem.py
===================================================================
--- grass/trunk/scripts/r.buffer.lowmem/r.buffer.lowmem.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/r.buffer.lowmem/r.buffer.lowmem.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -46,6 +46,7 @@
 import atexit
 import math
 import grass.script as grass
+from grass.script.utils import encode
 
 # i18N
 import gettext
@@ -124,10 +125,12 @@
 
     p = grass.feed_command('r.category', map=output,
                            separator=':', rules='-')
-    p.stdin.write("1:distances calculated from these locations\n")
+    msg = "1:distances calculated from these locations\n"
+    p.stdin.write(encode(msg))
     d0 = "0"
     for n, d in enumerate(distances):
-        p.stdin.write("%d:%s-%s %s\n" % (n + 2, d0, d, units))
+        msg = "%d:%s-%s %s\n" % (n + 2, d0, d, units)
+        p.stdin.write(encode(msg))
         d0 = d
     p.stdin.close()
     p.wait()

Modified: grass/trunk/scripts/r.colors.stddev/r.colors.stddev.py
===================================================================
--- grass/trunk/scripts/r.colors.stddev/r.colors.stddev.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/r.colors.stddev/r.colors.stddev.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -34,6 +34,7 @@
 import atexit
 
 import grass.script as gscript
+from grass.script.utils import decode
 
 
 def z(n):
@@ -56,7 +57,7 @@
 
     if not zero:
         s = gscript.read_command('r.univar', flags='g', map=map)
-        kv = gscript.parse_key_val(s)
+        kv = gscript.parse_key_val(decode(s))
         global mean, stddev
         mean = float(kv['mean'])
         stddev = float(kv['stddev'])
@@ -103,7 +104,7 @@
                                  percentile=[95.45,
                                              68.2689,
                                              99.7300])
-        kv = gscript.parse_key_val(s)
+        kv = gscript.parse_key_val(decode(s))
 
         stddev1 = float(kv['percentile_68_2689'])
         stddev2 = float(kv['percentile_95_45'])

Modified: grass/trunk/scripts/r.fillnulls/r.fillnulls.py
===================================================================
--- grass/trunk/scripts/r.fillnulls/r.fillnulls.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/r.fillnulls/r.fillnulls.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -246,7 +246,7 @@
             file=cats_file_name,
             quiet=quiet)
         cat_list = list()
-        cats_file = file(cats_file_name)
+        cats_file = open(cats_file_name)
         for line in cats_file:
             cat_list.append(line.rstrip('\n'))
         cats_file.close()

Modified: grass/trunk/scripts/r.in.srtm/r.in.srtm.py
===================================================================
--- grass/trunk/scripts/r.in.srtm/r.in.srtm.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/r.in.srtm/r.in.srtm.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -262,13 +262,13 @@
 
     header = tmpl % (ulxmap, ulymap)
     hdrfile = tile + '.hdr'
-    outf = file(hdrfile, 'w')
+    outf = open(hdrfile, 'w')
     outf.write(header)
     outf.close()
 
     # create prj file: To be precise, we would need EGS96! But who really cares...
     prjfile = tile + '.prj'
-    outf = file(prjfile, 'w')
+    outf = open(prjfile, 'w')
     outf.write(proj)
     outf.close()
 

Modified: grass/trunk/scripts/r.in.wms/r.in.wms.py
===================================================================
--- grass/trunk/scripts/r.in.wms/r.in.wms.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/r.in.wms/r.in.wms.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -177,6 +177,7 @@
 sys.path.insert(1, os.path.join(os.path.dirname(sys.path[0]), 'etc', 'r.in.wms'))
 
 import grass.script as grass
+from grass.script.utils import decode
 
 # i18N
 import gettext
@@ -200,7 +201,7 @@
                                quiet=True,
                                flags='ug',
                                region=opt_region)
-        region_params = grass.parse_key_val(s, val_type=float)
+        region_params = grass.parse_key_val(decode(s), val_type=float)
     else:
         region_params = grass.region()
 

Modified: grass/trunk/scripts/r.in.wms/wms_base.py
===================================================================
--- grass/trunk/scripts/r.in.wms/wms_base.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/r.in.wms/wms_base.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -133,7 +133,8 @@
         else:
             self.proj_srs = grass.read_command('g.proj',
                                                flags='jf',
-                                               epsg=str(GetEpsg(self.params['srs']))).rstrip('\n')
+                                               epsg=str(GetEpsg(self.params['srs'])))
+        self.proj_srs = decode(self.proj_srs).rstrip('\n')
 
         self.proj_srs = self._modifyProj(self.proj_srs)
 
@@ -383,7 +384,7 @@
             self.temp_warpmap = grass.tempfile()
 
             if int(os.getenv('GRASS_VERBOSE', '2')) <= 2:
-                nuldev = file(os.devnull, 'w+')
+                nuldev = open(os.devnull, 'w+')
             else:
                 nuldev = None
 

Modified: grass/trunk/scripts/r.in.wms/wms_drv.py
===================================================================
--- grass/trunk/scripts/r.in.wms/wms_drv.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/r.in.wms/wms_drv.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -227,7 +227,8 @@
         # georeferencing and setting projection of temp_map
         projection = grass.read_command('g.proj',
                                         flags='wf',
-                                        epsg=self.params['srs']).rstrip('\n')
+                                        epsg=self.params['srs'])
+        projection = projection.rstrip('\n')
         temp_map_dataset.SetProjection(projection)
 
         pixel_x_length = (map_region['maxx'] - map_region['minx']) / int(map_region['cols'])

Modified: grass/trunk/scripts/r.mask/r.mask.py
===================================================================
--- grass/trunk/scripts/r.mask/r.mask.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/r.mask/r.mask.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -71,6 +71,7 @@
 import atexit
 
 import grass.script as grass
+from grass.script.utils import encode
 from grass.exceptions import CalledModuleError
 
 # i18N
@@ -141,7 +142,8 @@
                 output='MASK',
                 overwrite=True,
                 rules='-')
-            p.stdin.write("%s = 1" % maskcats)
+            res = "%s = 1" % maskcats
+            p.stdin.write(encode(res))
             p.stdin.close()
             p.wait()
         elif vector:

Modified: grass/trunk/scripts/r.reclass.area/r.reclass.area.py
===================================================================
--- grass/trunk/scripts/r.reclass.area/r.reclass.area.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/r.reclass.area/r.reclass.area.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -76,6 +76,7 @@
 import os
 import atexit
 import grass.script as grass
+from grass.script.utils import decode, encode
 
 # i18N
 import gettext
@@ -93,6 +94,7 @@
     diagonal = diag
 
     s = grass.read_command("g.region", flags='p')
+    s = decode(s)
     kv = grass.parse_key_val(s, sep=':')
     s = kv['projection'].strip().split()
     if s == '0':
@@ -142,7 +144,7 @@
                             rules='-')
     rules = ''
     for line in p1.stdout:
-        f = line.rstrip(os.linesep).split(';')
+        f = decode(line).rstrip(os.linesep).split(';')
         if len(f) < 5:
             continue
         hectares = float(f[4]) * 0.0001
@@ -153,7 +155,7 @@
         if test:
             rules += "%s = %s %s\n" % (f[0], f[2], f[3])
     if rules:
-        p2.stdin.write(rules)
+        p2.stdin.write(encode(rules))
     p1.wait()
     p2.stdin.close()
     p2.wait()

Modified: grass/trunk/scripts/r.tileset/r.tileset.py
===================================================================
--- grass/trunk/scripts/r.tileset/r.tileset.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/r.tileset/r.tileset.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -114,6 +114,7 @@
 
 from grass.script.utils import separator
 from grass.script import core as gcore
+from grass.script.utils import decode
 from grass.exceptions import CalledModuleError
 
 # i18N
@@ -171,6 +172,7 @@
                                  proj_out=dest['proj'],
                                  sep=';',
                                  input=file)
+        ret = decode(ret)
     except CalledModuleError:
         gcore.fatal(cs2cs + ' failed')
 
@@ -255,7 +257,8 @@
     if not options['destproj']:
         dest_proj = gcore.read_command('g.proj',
                                        quiet=True,
-                                       flags='jf').rstrip('\n')
+                                       flags='jf')
+        dest_proj = decode(dest_proj).rstrip('\n')
         if not dest_proj:
             gcore.fatal(_('g.proj failed'))
     else:

Modified: grass/trunk/scripts/v.db.addcolumn/v.db.addcolumn.py
===================================================================
--- grass/trunk/scripts/v.db.addcolumn/v.db.addcolumn.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/v.db.addcolumn/v.db.addcolumn.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -43,6 +43,7 @@
 import sys
 import os
 import grass.script as grass
+from grass.script.utils import encode
 
 # i18N
 import gettext
@@ -81,9 +82,11 @@
             grass.error(_("Column <%s> is already in the table. Skipping.") % col_name)
             continue
         grass.verbose(_("Adding column <%s> to the table") % col_name)
-        p = grass.feed_command('db.execute', input='-', database=database, driver=driver)
-        p.stdin.write("ALTER TABLE %s ADD COLUMN %s" % (table, col))
-        grass.debug("ALTER TABLE %s ADD COLUMN %s" % (table, col))
+        p = grass.feed_command('db.execute', input='-',
+                               database=database, driver=driver)
+        res = "ALTER TABLE {} ADD COLUMN {}".format(table, col)
+        p.stdin.write(encode(res))
+        grass.debug(res)
         p.stdin.close()
         if p.wait() != 0:
             grass.fatal(_("Unable to add column <%s>.") % col)

Modified: grass/trunk/scripts/v.db.addtable/v.db.addtable.py
===================================================================
--- grass/trunk/scripts/v.db.addtable/v.db.addtable.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/v.db.addtable/v.db.addtable.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -56,6 +56,7 @@
 import sys
 import os
 import grass.script as grass
+from grass.script.utils import decode
 from grass.exceptions import CalledModuleError
 
 # i18N
@@ -99,7 +100,7 @@
     schema = kv['schema']
 
     # maybe there is already a table linked to the selected layer?
-    nuldev = file(os.devnull, 'w')
+    nuldev = open(os.devnull, 'w')
     try:
         grass.vector_db(map_name, stderr=nuldev)[int(layer)]
         grass.fatal(_("There is already a table linked to layer <%s>") % layer)
@@ -109,6 +110,7 @@
     # maybe there is already a table with that name?
     tables = grass.read_command('db.tables', flags='p', database=database, driver=driver,
                                 stderr=nuldev)
+    tables = decode(tables)
 
     if not table in tables.splitlines():
         colnames = []
@@ -137,15 +139,15 @@
         except CalledModuleError:
             grass.fatal(_("Unable to create table <%s>") % table)
 
-	# create index, see db/driver/*/index.c
+        # create index, see db/driver/*/index.c
         if driver != "dbf":
             sql = "CREATE UNIQUE INDEX %s_%s ON %s (%s)" % (table, key, table, key)
             try:
-		grass.run_command('db.execute',
-				  database=database, driver=driver, sql=sql)
-	    except:
-		grass.warning(_("Unable to create index on table <%s>") % table)
-		pass
+                grass.run_command('db.execute',
+                                  database=database, driver=driver, sql=sql)
+            except:
+                grass.warning(_("Unable to create index on table <%s>") % table)
+                pass
 
     # connect the map to the DB:
     if schema:

Modified: grass/trunk/scripts/v.db.droptable/v.db.droptable.py
===================================================================
--- grass/trunk/scripts/v.db.droptable/v.db.droptable.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/v.db.droptable/v.db.droptable.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -91,7 +91,7 @@
 
     gscript.message(_("Current attribute table link(s):"))
     # silently test first to avoid confusing error messages
-    nuldev = file(os.devnull, 'w')
+    nuldev = open(os.devnull, 'w')
     try:
         gscript.run_command('v.db.connect', flags='p', map=map, quiet=True,
                             stdout=nuldev, stderr=nuldev)

Modified: grass/trunk/scripts/v.db.reconnect.all/v.db.reconnect.all.py
===================================================================
--- grass/trunk/scripts/v.db.reconnect.all/v.db.reconnect.all.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/v.db.reconnect.all/v.db.reconnect.all.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -284,5 +284,5 @@
 
 if __name__ == "__main__":
     options, flags = gscript.parser()
-    nuldev = file(os.devnull, 'w')
+    nuldev = open(os.devnull, 'w')
     sys.exit(main())

Modified: grass/trunk/scripts/v.db.univar/v.db.univar.py
===================================================================
--- grass/trunk/scripts/v.db.univar/v.db.univar.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/v.db.univar/v.db.univar.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -101,5 +101,5 @@
 
 if __name__ == "__main__":
     options, flags = gscript.parser()
-    nuldev = file(os.devnull, 'w')
+    nuldev = open(os.devnull, 'w')
     main()

Modified: grass/trunk/scripts/v.dissolve/v.dissolve.py
===================================================================
--- grass/trunk/scripts/v.dissolve/v.dissolve.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/v.dissolve/v.dissolve.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -46,7 +46,7 @@
 
 
 def cleanup():
-    nuldev = file(os.devnull, 'w')
+    nuldev = open(os.devnull, 'w')
     grass.run_command(
         'g.remove', flags='f', type='vector', name='%s_%s' %
         (output, tmp), quiet=True, stderr=nuldev)

Modified: grass/trunk/scripts/v.in.e00/v.in.e00.py
===================================================================
--- grass/trunk/scripts/v.in.e00/v.in.e00.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/v.in.e00/v.in.e00.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -109,14 +109,14 @@
     if merging:
         files.sort()
         filename = "%s.cat.%s.e00" % (e00name, e00tmp)
-        outf = file(filename, 'wb')
+        outf = open(filename, 'wb')
         for f in files:
-            inf = file(f, 'rb')
+            inf = open(f, 'rb')
             shutil.copyfileobj(inf, outf)
             inf.close()
         outf.close()
 
-    nuldev = file(os.devnull, 'w+')
+    nuldev = open(os.devnull, 'w+')
 
     gcore.message(_("An error may appear next which will be ignored..."))
     if gcore.call(['avcimport', filename, e00shortname], stdout=nuldev,

Modified: grass/trunk/scripts/v.in.lines/v.in.lines.py
===================================================================
--- grass/trunk/scripts/v.in.lines/v.in.lines.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/v.in.lines/v.in.lines.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -77,7 +77,7 @@
 
     if not infile:
         # read from stdin and write to tmpfile (v.in.mapgen wants a real file)
-        outf = file(tmp, 'w')
+        outf = open(tmp, 'w')
         for line in inf:
             if len(line.lstrip()) == 0 or line[0] == '#':
                 continue
@@ -90,8 +90,8 @@
         if fs == ' ':
             runfile = infile
         else:
-            inf = file(infile)
-            outf = file(tmp, 'w')
+            inf = open(infile)
+            outf = open(tmp, 'w')
 
             for line in inf:
                 if len(line.lstrip()) == 0 or line[0] == '#':
@@ -103,7 +103,7 @@
             runfile = tmp
 
     # check that there are at least two columns (three if -z is given)
-    inf = file(runfile)
+    inf = open(runfile)
     for line in inf:
         if len(line.lstrip()) == 0 or line[0] == '#':
             continue

Modified: grass/trunk/scripts/v.in.mapgen/v.in.mapgen.py
===================================================================
--- grass/trunk/scripts/v.in.mapgen/v.in.mapgen.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/v.in.mapgen/v.in.mapgen.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -95,8 +95,8 @@
     tmp = grass.tempfile()
 
     # create ascii vector file
-    inf = file(infile)
-    outf = file(tmp, 'w')
+    inf = open(infile)
+    outf = open(tmp, 'w')
 
     grass.message(_("Importing data..."))
     cat = 1
@@ -163,7 +163,7 @@
 
     # create digit header
     digfile = tmp + '.dig'
-    outf = file(digfile, 'w')
+    outf = open(digfile, 'w')
     t = string.Template(
         """ORGANIZATION: GRASSroots organization
 DIGIT DATE:   $date
@@ -186,7 +186,7 @@
     outf.write(s)
 
     # process points list to ascii vector file (merge in vertices)
-    inf = file(tmp)
+    inf = open(tmp)
     shutil.copyfileobj(inf, outf)
     inf.close()
 
@@ -194,7 +194,7 @@
 
     if not name:
         # if no name for vector file given, cat to stdout
-        inf = file(digfile)
+        inf = open(digfile)
         shutil.copyfileobj(inf, sys.stdout)
         inf.close()
     else:

Modified: grass/trunk/scripts/v.in.wfs/v.in.wfs.py
===================================================================
--- grass/trunk/scripts/v.in.wfs/v.in.wfs.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/v.in.wfs/v.in.wfs.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -136,9 +136,8 @@
     except URLError as e:
         # GTC WFS request network failure
         grass.fatal(_("Failed to reach the server.\nReason: %s") % e.reason)
-        
-    
-    outf = file(tmpxml, 'wb')
+
+    outf = open(tmpxml, 'wb')
     while True:
         s = inf.read()
         if not s:

Modified: grass/trunk/scripts/v.rast.stats/v.rast.stats.py
===================================================================
--- grass/trunk/scripts/v.rast.stats/v.rast.stats.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/v.rast.stats/v.rast.stats.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -72,6 +72,7 @@
 import os
 import atexit
 import grass.script as grass
+from grass.script.utils import decode
 from grass.exceptions import CalledModuleError
 
 # i18N
@@ -96,7 +97,7 @@
     # we need a random name
     tmpname = grass.basename(tmp)
 
-    nuldev = file(os.devnull, 'w')
+    nuldev = open(os.devnull, 'w')
 
     raster = options['raster']
     colprefix = options['column_prefix']
@@ -161,6 +162,7 @@
     cats = []
 
     for line in p.stdout:
+        line = decode(line)
         cats.append(line.rstrip('\r\n').split(';')[0])
     p.wait()
 
@@ -247,7 +249,7 @@
     # get rid of any earlier attempts
     grass.try_remove(sqltmp)
 
-    f = file(sqltmp, 'w')
+    f = open(sqltmp, 'w')
 
     # do the stats
     p = grass.pipe_command('r.univar', flags='t' + extstat, map=raster,
@@ -261,7 +263,7 @@
             first_line = 0
             continue
 
-        vars = line.rstrip('\r\n').split(';')
+        vars = decode(line).rstrip('\r\n').split(';')
 
         f.write("UPDATE %s SET" % fi['table'])
         first_var = 1

Modified: grass/trunk/scripts/v.report/v.report.py
===================================================================
--- grass/trunk/scripts/v.report/v.report.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/v.report/v.report.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -46,6 +46,7 @@
 import sys
 import os
 import grass.script as grass
+from grass.script.utils import decode
 
 # i18N
 import gettext
@@ -68,7 +69,7 @@
     layer = options['layer']
     units = options['units']
 
-    nuldev = file(os.devnull, 'w')
+    nuldev = open(os.devnull, 'w')
 
     if not grass.find_file(mapname, 'vector')['file']:
         grass.fatal(_("Vector map <%s> not found") % mapname)
@@ -99,7 +100,7 @@
         records1 = []
         catcol = -1
         for line in p.stdout:
-            cols = line.rstrip('\r\n').split('|')
+            cols = decode(line).rstrip('\r\n').split('|')
             if catcol == -1:
                 for i in range(0, len(cols)):
                     if cols[i] == f['key']:
@@ -132,7 +133,7 @@
                                layer=layer, units=unitsp)
         records2 = []
         for line in p.stdout:
-            fields = line.rstrip('\r\n').split('|')
+            fields = decode(line).rstrip('\r\n').split('|')
             if fields[0] in ['cat', '-1', '0']:
                 continue
             records2.append([int(fields[0])] + fields[1:])
@@ -144,13 +145,15 @@
         # v.db.select can return attributes that are not linked to features.
         records3 = []
         for r2 in records2:
-            records3.append(filter(lambda r1: r1[catcol] == r2[0], records1)[0] + r2[1:])
+            res = list(filter(lambda r1: r1[catcol] == r2[0],
+                              records1))[0] + r2[1:]
+            records3.append(res)
     else:
         catcol = 0
         records1 = []
         p = grass.pipe_command('v.category', inp=mapname, layer=layer, option='print')
         for line in p.stdout:
-            field = int(line.rstrip())
+            field = int(decode(line).rstrip())
             if field > 0:
                 records1.append(field)
         p.wait()
@@ -163,7 +166,7 @@
                                layer=layer, units=unitsp)
         records3 = []
         for line in p.stdout:
-            fields = line.rstrip('\r\n').split('|')
+            fields = decode(line).rstrip('\r\n').split('|')
             if fields[0] in ['cat', '-1', '0']:
                 continue
             records3.append([int(fields[0])] + fields[1:])

Modified: grass/trunk/scripts/v.to.lines/v.to.lines.py
===================================================================
--- grass/trunk/scripts/v.to.lines/v.to.lines.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/v.to.lines/v.to.lines.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -41,6 +41,7 @@
 #%end
 
 import grass.script as grass
+from grass.script.utils import decode
 from grass.exceptions import CalledModuleError
 import os
 
@@ -127,7 +128,8 @@
                           name=remove_names, quiet=quiet)
         grass.fatal(_("Error converting polygon to line"))
     report = grass.read_command('v.category', flags='g', input=out_type,
-                                option='report', quiet=quiet).split('\n')
+                                option='report', quiet=quiet)
+    report = decode(report).split('\n')
     for r in report:
         if r.find('centroid') != -1:
             min_cat = report[0].split()[-2]

Modified: grass/trunk/scripts/v.what.strds/testsuite/test_what_strds.py
===================================================================
--- grass/trunk/scripts/v.what.strds/testsuite/test_what_strds.py	2018-09-02 08:48:49 UTC (rev 73228)
+++ grass/trunk/scripts/v.what.strds/testsuite/test_what_strds.py	2018-09-03 02:04:19 UTC (rev 73229)
@@ -10,8 +10,10 @@
 """
 
 from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 from grass.gunittest.gmodules import SimpleModule
 import grass.script as gscript
+from grass.script.utils import decode
 
 
 class TestWhatStrds(TestCase):
@@ -63,8 +65,7 @@
 2|100|200|300|400
 3|100|200|300|400
 """
-        self.assertLooksLike(output, db_sel.outputs.stdout)
+        self.assertMultiLineEqual(output, decode(db_sel.outputs.stdout))
 
 if __name__ == '__main__':
-    from grass.gunittest.main import test
     test()



More information about the grass-commit mailing list