Просмотр исходного кода

wxGUI: fix deprecated wx.NewId

Anna Petrasova 5 лет назад
Родитель
Сommit
2f5c06a50a
36 измененных файлов с 172 добавлено и 182 удалено
  1. 1 1
      gui/wxpython/animation/controller.py
  2. 2 3
      gui/wxpython/datacatalog/toolbars.py
  3. 13 13
      gui/wxpython/datacatalog/tree.py
  4. 30 30
      gui/wxpython/dbmgr/base.py
  5. 2 3
      gui/wxpython/gcp/toolbars.py
  6. 6 6
      gui/wxpython/gmodeler/dialogs.py
  7. 2 2
      gui/wxpython/gmodeler/frame.py
  8. 4 4
      gui/wxpython/gui_core/dialogs.py
  9. 2 2
      gui/wxpython/gui_core/forms.py
  10. 2 1
      gui/wxpython/gui_core/mapdisp.py
  11. 2 2
      gui/wxpython/gui_core/query.py
  12. 2 2
      gui/wxpython/gui_core/simplelmgr.py
  13. 2 2
      gui/wxpython/gui_core/toolbars.py
  14. 3 3
      gui/wxpython/gui_core/widgets.py
  15. 5 0
      gui/wxpython/gui_core/wrap.py
  16. 2 2
      gui/wxpython/iclass/dialogs.py
  17. 2 3
      gui/wxpython/iclass/toolbars.py
  18. 2 3
      gui/wxpython/image2target/ii2t_toolbars.py
  19. 22 31
      gui/wxpython/iscatt/frame.py
  20. 2 2
      gui/wxpython/lmgr/layertree.py
  21. 2 2
      gui/wxpython/location_wizard/wizard.py
  22. 2 2
      gui/wxpython/mapswipe/mapwindow.py
  23. 2 3
      gui/wxpython/mapswipe/toolbars.py
  24. 7 7
      gui/wxpython/mapwin/buffered.py
  25. 2 1
      gui/wxpython/mapwin/decorations.py
  26. 2 1
      gui/wxpython/mapwin/graphics.py
  27. 2 2
      gui/wxpython/modules/extensions.py
  28. 2 2
      gui/wxpython/modules/histogram.py
  29. 2 2
      gui/wxpython/nviz/mapwindow.py
  30. 2 3
      gui/wxpython/photo2image/ip2i_toolbars.py
  31. 17 17
      gui/wxpython/psmap/dialogs.py
  32. 8 8
      gui/wxpython/psmap/frame.py
  33. 5 4
      gui/wxpython/psmap/instructions.py
  34. 3 7
      gui/wxpython/rdigit/toolbars.py
  35. 4 4
      gui/wxpython/vdigit/dialogs.py
  36. 2 2
      gui/wxpython/vdigit/mapwindow.py

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

@@ -44,7 +44,7 @@ class AnimationController(wx.EvtHandler):
         self.temporalMode = None
         self.temporalMode = None
         self.animationData = []
         self.animationData = []
 
 
-        self.timer = wx.Timer(self, id=wx.NewId())
+        self.timer = wx.Timer(self, id=wx.ID_ANY)
 
 
         self.animations = animations
         self.animations = animations
         self.bitmapPool = bitmapPool
         self.bitmapPool = bitmapPool

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

@@ -45,8 +45,7 @@ class DataCatalogToolbar(BaseToolbar):
         BaseToolbar.__init__(self, parent)
         BaseToolbar.__init__(self, parent)
 
 
         self.InitToolbar(self._toolbarData())
         self.InitToolbar(self._toolbarData())
-        self.filterId = wx.NewId()
-        self.filter = TextCtrl(parent=self, id=self.filterId)
+        self.filter = TextCtrl(parent=self)
         self.filter.SetSize((120, self.filter.GetBestSize()[1]))
         self.filter.SetSize((120, self.filter.GetBestSize()[1]))
         self.filter.Bind(wx.EVT_TEXT,
         self.filter.Bind(wx.EVT_TEXT,
                          lambda event: self.parent.Filter(
                          lambda event: self.parent.Filter(
@@ -57,7 +56,7 @@ class DataCatalogToolbar(BaseToolbar):
                  "Use prefix 'r:', 'v:' and 'r3:'"
                  "Use prefix 'r:', 'v:' and 'r3:'"
                  "to show only raster, vector or 3D raster data, respectively. "
                  "to show only raster, vector or 3D raster data, respectively. "
                  "Use Python regular expressions to refine your search.")
                  "Use Python regular expressions to refine your search.")
-        self.SetToolShortHelp(self.filterId, help)
+        self.SetToolShortHelp(self.filter.GetId(), help)
         # realize the toolbar
         # realize the toolbar
         self.Realize()
         self.Realize()
 
 

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

@@ -991,32 +991,32 @@ class DataCatalogTree(LocationMapTree):
         genv = gisenv()
         genv = gisenv()
         currentLocation, currentMapset = self._isCurrent(genv)
         currentLocation, currentMapset = self._isCurrent(genv)
 
 
-        item = wx.MenuItem(menu, wx.NewId(), _("&Cut"))
+        item = wx.MenuItem(menu, wx.ID_ANY, _("&Cut"))
         menu.AppendItem(item)
         menu.AppendItem(item)
         self.Bind(wx.EVT_MENU, self.OnMoveMap, item)
         self.Bind(wx.EVT_MENU, self.OnMoveMap, item)
         if not currentMapset:
         if not currentMapset:
             item.Enable(False)
             item.Enable(False)
 
 
-        item = wx.MenuItem(menu, wx.NewId(), _("&Copy"))
+        item = wx.MenuItem(menu, wx.ID_ANY, _("&Copy"))
         menu.AppendItem(item)
         menu.AppendItem(item)
         self.Bind(wx.EVT_MENU, self.OnCopyMap, item)
         self.Bind(wx.EVT_MENU, self.OnCopyMap, item)
 
 
-        item = wx.MenuItem(menu, wx.NewId(), _("Copy &name"))
+        item = wx.MenuItem(menu, wx.ID_ANY, _("Copy &name"))
         menu.AppendItem(item)
         menu.AppendItem(item)
         self.Bind(wx.EVT_MENU, self.OnCopyName, item)
         self.Bind(wx.EVT_MENU, self.OnCopyName, item)
 
 
-        item = wx.MenuItem(menu, wx.NewId(), _("&Paste"))
+        item = wx.MenuItem(menu, wx.ID_ANY, _("&Paste"))
         menu.AppendItem(item)
         menu.AppendItem(item)
         self.Bind(wx.EVT_MENU, self.OnPasteMap, item)
         self.Bind(wx.EVT_MENU, self.OnPasteMap, item)
         if not(currentMapset and self.copy_layer):
         if not(currentMapset and self.copy_layer):
             item.Enable(False)
             item.Enable(False)
 
 
-        item = wx.MenuItem(menu, wx.NewId(), _("&Delete"))
+        item = wx.MenuItem(menu, wx.ID_ANY, _("&Delete"))
         menu.AppendItem(item)
         menu.AppendItem(item)
         self.Bind(wx.EVT_MENU, self.OnDeleteMap, item)
         self.Bind(wx.EVT_MENU, self.OnDeleteMap, item)
         item.Enable(currentMapset)
         item.Enable(currentMapset)
 
 
-        item = wx.MenuItem(menu, wx.NewId(), _("&Rename"))
+        item = wx.MenuItem(menu, wx.ID_ANY, _("&Rename"))
         menu.AppendItem(item)
         menu.AppendItem(item)
         self.Bind(wx.EVT_MENU, self.OnRenameMap, item)
         self.Bind(wx.EVT_MENU, self.OnRenameMap, item)
         item.Enable(currentMapset and len(self.selected_layer) == 1)
         item.Enable(currentMapset and len(self.selected_layer) == 1)
@@ -1026,13 +1026,13 @@ class DataCatalogTree(LocationMapTree):
         if not isinstance(self._giface, StandaloneGrassInterface):
         if not isinstance(self._giface, StandaloneGrassInterface):
             if all([each.label == genv['LOCATION_NAME'] for each in self.selected_location]):
             if all([each.label == genv['LOCATION_NAME'] for each in self.selected_location]):
                 if len(self.selected_layer) > 1:
                 if len(self.selected_layer) > 1:
-                    item = wx.MenuItem(menu, wx.NewId(), _("&Display layers"))
+                    item = wx.MenuItem(menu, wx.ID_ANY, _("&Display layers"))
                 else:
                 else:
-                    item = wx.MenuItem(menu, wx.NewId(), _("&Display layer"))
+                    item = wx.MenuItem(menu, wx.ID_ANY, _("&Display layer"))
                 menu.AppendItem(item)
                 menu.AppendItem(item)
                 self.Bind(wx.EVT_MENU, self.OnDisplayLayer, item)
                 self.Bind(wx.EVT_MENU, self.OnDisplayLayer, item)
 
 
-        item = wx.MenuItem(menu, wx.NewId(), _("Show &metadata"))
+        item = wx.MenuItem(menu, wx.ID_ANY, _("Show &metadata"))
         menu.AppendItem(item)
         menu.AppendItem(item)
         self.Bind(wx.EVT_MENU, self.OnMetadata, item)
         self.Bind(wx.EVT_MENU, self.OnMetadata, item)
 
 
@@ -1045,13 +1045,13 @@ class DataCatalogTree(LocationMapTree):
         genv = gisenv()
         genv = gisenv()
         currentLocation, currentMapset = self._isCurrent(genv)
         currentLocation, currentMapset = self._isCurrent(genv)
 
 
-        item = wx.MenuItem(menu, wx.NewId(), _("&Paste"))
+        item = wx.MenuItem(menu, wx.ID_ANY, _("&Paste"))
         menu.AppendItem(item)
         menu.AppendItem(item)
         self.Bind(wx.EVT_MENU, self.OnPasteMap, item)
         self.Bind(wx.EVT_MENU, self.OnPasteMap, item)
         if not(currentMapset and self.copy_layer):
         if not(currentMapset and self.copy_layer):
             item.Enable(False)
             item.Enable(False)
 
 
-        item = wx.MenuItem(menu, wx.NewId(), _("&Switch mapset"))
+        item = wx.MenuItem(menu, wx.ID_ANY, _("&Switch mapset"))
         menu.AppendItem(item)
         menu.AppendItem(item)
         self.Bind(wx.EVT_MENU, self.OnSwitchLocationMapset, item)
         self.Bind(wx.EVT_MENU, self.OnSwitchLocationMapset, item)
         if (self.selected_location[0].label == genv['LOCATION_NAME']
         if (self.selected_location[0].label == genv['LOCATION_NAME']
@@ -1063,7 +1063,7 @@ class DataCatalogTree(LocationMapTree):
     def _popupMenuElement(self):
     def _popupMenuElement(self):
         """Create popup menu for elements"""
         """Create popup menu for elements"""
         menu = Menu()
         menu = Menu()
-        item = wx.MenuItem(menu, wx.NewId(), _("&Paste"))
+        item = wx.MenuItem(menu, wx.ID_ANY, _("&Paste"))
         menu.AppendItem(item)
         menu.AppendItem(item)
         self.Bind(wx.EVT_MENU, self.OnPasteMap, item)
         self.Bind(wx.EVT_MENU, self.OnPasteMap, item)
         genv = gisenv()
         genv = gisenv()
@@ -1077,7 +1077,7 @@ class DataCatalogTree(LocationMapTree):
     def _popupMenuEmpty(self):
     def _popupMenuEmpty(self):
         """Create empty popup when multiple different types of items are selected"""
         """Create empty popup when multiple different types of items are selected"""
         menu = Menu()
         menu = Menu()
-        item = wx.MenuItem(menu, wx.NewId(), _("No available options"))
+        item = wx.MenuItem(menu, wx.ID_ANY, _("No available options"))
         menu.AppendItem(item)
         menu.AppendItem(item)
         item.Enable(False)
         item.Enable(False)
         self.PopupMenu(menu)
         self.PopupMenu(menu)

+ 30 - 30
gui/wxpython/dbmgr/base.py

@@ -63,7 +63,7 @@ from core.debug import Debug
 from dbmgr.dialogs import ModifyTableRecord, AddColumnDialog
 from dbmgr.dialogs import ModifyTableRecord, AddColumnDialog
 from core.settings import UserSettings
 from core.settings import UserSettings
 from gui_core.wrap import SpinCtrl, Button, TextCtrl, ListCtrl, CheckBox, \
 from gui_core.wrap import SpinCtrl, Button, TextCtrl, ListCtrl, CheckBox, \
-    StaticText, StaticBox, Menu
+    StaticText, StaticBox, Menu, NewId
 from core.utils import cmp
 from core.utils import cmp
 
 
 if sys.version_info.major >= 3:
 if sys.version_info.major >= 3:
@@ -441,20 +441,20 @@ class VirtualAttributeList(ListCtrl,
         popupMenu = Menu()
         popupMenu = Menu()
 
 
         if not hasattr(self, "popupID"):
         if not hasattr(self, "popupID"):
-            self.popupId = {'sortAsc': wx.NewId(),
-                            'sortDesc': wx.NewId(),
-                            'calculate': wx.NewId(),
-                            'area': wx.NewId(),
-                            'length': wx.NewId(),
-                            'compact': wx.NewId(),
-                            'fractal': wx.NewId(),
-                            'perimeter': wx.NewId(),
-                            'ncats': wx.NewId(),
-                            'slope': wx.NewId(),
-                            'lsin': wx.NewId(),
-                            'lazimuth': wx.NewId(),
-                            'calculator': wx.NewId(),
-                            'stats': wx.NewId()}
+            self.popupId = {'sortAsc': NewId(),
+                            'sortDesc': NewId(),
+                            'calculate': NewId(),
+                            'area': NewId(),
+                            'length': NewId(),
+                            'compact': NewId(),
+                            'fractal': NewId(),
+                            'perimeter': NewId(),
+                            'ncats': NewId(),
+                            'slope': NewId(),
+                            'lsin': NewId(),
+                            'lazimuth': NewId(),
+                            'calculator': NewId(),
+                            'stats': NewId()}
 
 
         popupMenu.Append(self.popupId['sortAsc'], text=_("Sort ascending"))
         popupMenu.Append(self.popupId['sortAsc'], text=_("Sort ascending"))
         popupMenu.Append(self.popupId['sortDesc'], text=_("Sort descending"))
         popupMenu.Append(self.popupId['sortDesc'], text=_("Sort descending"))
@@ -470,7 +470,7 @@ class VirtualAttributeList(ListCtrl,
 
 
         if not self.pages['manageTable']:
         if not self.pages['manageTable']:
             popupMenu.AppendSeparator()
             popupMenu.AppendSeparator()
-            self.popupId['addCol'] = wx.NewId()
+            self.popupId['addCol'] = NewId()
             popupMenu.Append(self.popupId['addCol'], text=_("Add column"))
             popupMenu.Append(self.popupId['addCol'], text=_("Add column"))
             if not self.dbMgrData['editable']:
             if not self.dbMgrData['editable']:
                 popupMenu.Enable(self.popupId['addCol'], False)
                 popupMenu.Enable(self.popupId['addCol'], False)
@@ -1373,17 +1373,17 @@ class DbMgrBrowsePage(DbMgrNotebookBase):
     def OnDataRightUp(self, event):
     def OnDataRightUp(self, event):
         """Table description area, context menu"""
         """Table description area, context menu"""
         if not hasattr(self, "popupDataID1"):
         if not hasattr(self, "popupDataID1"):
-            self.popupDataID1 = wx.NewId()
-            self.popupDataID2 = wx.NewId()
-            self.popupDataID3 = wx.NewId()
-            self.popupDataID4 = wx.NewId()
-            self.popupDataID5 = wx.NewId()
-            self.popupDataID6 = wx.NewId()
-            self.popupDataID7 = wx.NewId()
-            self.popupDataID8 = wx.NewId()
-            self.popupDataID9 = wx.NewId()
-            self.popupDataID10 = wx.NewId()
-            self.popupDataID11 = wx.NewId()
+            self.popupDataID1 = NewId()
+            self.popupDataID2 = NewId()
+            self.popupDataID3 = NewId()
+            self.popupDataID4 = NewId()
+            self.popupDataID5 = NewId()
+            self.popupDataID6 = NewId()
+            self.popupDataID7 = NewId()
+            self.popupDataID8 = NewId()
+            self.popupDataID9 = NewId()
+            self.popupDataID10 = NewId()
+            self.popupDataID11 = NewId()
 
 
             self.Bind(wx.EVT_MENU, self.OnDataItemEdit, id=self.popupDataID1)
             self.Bind(wx.EVT_MENU, self.OnDataItemEdit, id=self.popupDataID1)
             self.Bind(wx.EVT_MENU, self.OnDataItemAdd, id=self.popupDataID2)
             self.Bind(wx.EVT_MENU, self.OnDataItemAdd, id=self.popupDataID2)
@@ -2576,9 +2576,9 @@ class DbMgrTablesPage(DbMgrNotebookBase):
     def OnTableRightUp(self, event):
     def OnTableRightUp(self, event):
         """Table description area, context menu"""
         """Table description area, context menu"""
         if not hasattr(self, "popupTableID"):
         if not hasattr(self, "popupTableID"):
-            self.popupTableID1 = wx.NewId()
-            self.popupTableID2 = wx.NewId()
-            self.popupTableID3 = wx.NewId()
+            self.popupTableID1 = NewId()
+            self.popupTableID2 = NewId()
+            self.popupTableID3 = NewId()
             self.Bind(
             self.Bind(
                 wx.EVT_MENU,
                 wx.EVT_MENU,
                 self.OnTableItemDelete,
                 self.OnTableItemDelete,

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

@@ -89,14 +89,13 @@ class GCPDisplayToolbar(BaseToolbar):
         self._default = self.gcpset
         self._default = self.gcpset
 
 
         # add tool to toggle active map window
         # add tool to toggle active map window
-        self.togglemapid = wx.NewId()
-        self.togglemap = wx.Choice(parent=self, id=self.togglemapid,
+        self.togglemap = wx.Choice(parent=self, id=wx.ID_ANY,
                                    choices=[_('source'), _('target')])
                                    choices=[_('source'), _('target')])
 
 
         self.InsertControl(10, self.togglemap)
         self.InsertControl(10, self.togglemap)
 
 
         self.SetToolShortHelp(
         self.SetToolShortHelp(
-            self.togglemapid, '%s %s %s' %
+            self.togglemap.GetId(), '%s %s %s' %
             (_('Set map canvas for '),
             (_('Set map canvas for '),
              BaseIcons["zoomBack"].GetLabel(),
              BaseIcons["zoomBack"].GetLabel(),
              _(' / Zoom to map')))
              _(' / Zoom to map')))

+ 6 - 6
gui/wxpython/gmodeler/dialogs.py

@@ -40,7 +40,7 @@ from gui_core.gselect import Select, ElementSelect
 from gmodeler.model import *
 from gmodeler.model import *
 from lmgr.menudata import LayerManagerMenuData
 from lmgr.menudata import LayerManagerMenuData
 from gui_core.wrap import Button, StaticText, StaticBox, TextCtrl, \
 from gui_core.wrap import Button, StaticText, StaticBox, TextCtrl, \
-    Menu, ListCtrl
+    Menu, ListCtrl, NewId
 
 
 from grass.script import task as gtask
 from grass.script import task as gtask
 
 
@@ -836,9 +836,9 @@ class VariableListCtrl(ModelListCtrl):
     def OnRightUp(self, event):
     def OnRightUp(self, event):
         """Mouse right button up"""
         """Mouse right button up"""
         if not hasattr(self, "popupID1"):
         if not hasattr(self, "popupID1"):
-            self.popupID1 = wx.NewId()
-            self.popupID2 = wx.NewId()
-            self.popupID3 = wx.NewId()
+            self.popupID1 = NewId()
+            self.popupID2 = NewId()
+            self.popupID3 = NewId()
             self.Bind(wx.EVT_MENU, self.OnRemove, id=self.popupID1)
             self.Bind(wx.EVT_MENU, self.OnRemove, id=self.popupID1)
             self.Bind(wx.EVT_MENU, self.OnRemoveAll, id=self.popupID2)
             self.Bind(wx.EVT_MENU, self.OnRemoveAll, id=self.popupID2)
             self.Bind(wx.EVT_MENU, self.OnReload, id=self.popupID3)
             self.Bind(wx.EVT_MENU, self.OnReload, id=self.popupID3)
@@ -1007,8 +1007,8 @@ class ItemListCtrl(ModelListCtrl):
 
 
         if not hasattr(self, "popupId"):
         if not hasattr(self, "popupId"):
             self.popupID = dict()
             self.popupID = dict()
-            self.popupID['remove'] = wx.NewId()
-            self.popupID['reload'] = wx.NewId()
+            self.popupID['remove'] = NewId()
+            self.popupID['reload'] = NewId()
             self.Bind(wx.EVT_MENU, self.OnRemove, id=self.popupID['remove'])
             self.Bind(wx.EVT_MENU, self.OnRemove, id=self.popupID['remove'])
             self.Bind(wx.EVT_MENU, self.OnReload, id=self.popupID['reload'])
             self.Bind(wx.EVT_MENU, self.OnReload, id=self.popupID['reload'])
 
 

+ 2 - 2
gui/wxpython/gmodeler/frame.py

@@ -64,7 +64,7 @@ from gmodeler.giface import GraphicalModelerGrassInterface
 from gmodeler.model import *
 from gmodeler.model import *
 from gmodeler.dialogs import *
 from gmodeler.dialogs import *
 from gui_core.wrap import Button, StaticText, StaticBox, TextCtrl, \
 from gui_core.wrap import Button, StaticText, StaticBox, TextCtrl, \
-    Menu, StockCursor, EmptyBitmap
+    Menu, StockCursor, EmptyBitmap, NewId
 from gui_core.wrap import TextEntryDialog as wxTextEntryDialog
 from gui_core.wrap import TextEntryDialog as wxTextEntryDialog
 
 
 wxModelDone, EVT_MODEL_DONE = NewEvent()
 wxModelDone, EVT_MODEL_DONE = NewEvent()
@@ -1489,7 +1489,7 @@ class ModelEvtHandler(ogl.ShapeEvtHandler):
             for key in ('remove', 'enable', 'addPoint',
             for key in ('remove', 'enable', 'addPoint',
                         'delPoint', 'intermediate', 'display', 'props', 'id',
                         'delPoint', 'intermediate', 'display', 'props', 'id',
                         'label', 'comment'):
                         'label', 'comment'):
-                self.popupID[key] = wx.NewId()
+                self.popupID[key] = NewId()
 
 
         # record coordinates
         # record coordinates
         self.x = x
         self.x = x

+ 4 - 4
gui/wxpython/gui_core/dialogs.py

@@ -53,7 +53,7 @@ from gui_core.widgets import SingleSymbolPanel, GListCtrl, SimpleValidator, MapV
 from core.settings import UserSettings
 from core.settings import UserSettings
 from core.debug import Debug
 from core.debug import Debug
 from gui_core.wrap import SpinCtrl, TextCtrl, Button, CheckListBox, \
 from gui_core.wrap import SpinCtrl, TextCtrl, Button, CheckListBox, \
-    StaticText, StaticBox, Menu
+    StaticText, StaticBox, Menu, NewId
 
 
 
 
 class SimpleDialog(wx.Dialog):
 class SimpleDialog(wx.Dialog):
@@ -1571,9 +1571,9 @@ class MapLayersDialogBase(wx.Dialog):
     def OnMenu(self, event):
     def OnMenu(self, event):
         """Table description area, context menu"""
         """Table description area, context menu"""
         if not hasattr(self, "popupID1"):
         if not hasattr(self, "popupID1"):
-            self.popupDataID1 = wx.NewId()
-            self.popupDataID2 = wx.NewId()
-            self.popupDataID3 = wx.NewId()
+            self.popupDataID1 = NewId()
+            self.popupDataID2 = NewId()
+            self.popupDataID3 = NewId()
 
 
             self.Bind(wx.EVT_MENU, self.OnSelectAll, id=self.popupDataID1)
             self.Bind(wx.EVT_MENU, self.OnSelectAll, id=self.popupDataID1)
             self.Bind(wx.EVT_MENU, self.OnSelectInvert, id=self.popupDataID2)
             self.Bind(wx.EVT_MENU, self.OnSelectInvert, id=self.popupDataID2)

+ 2 - 2
gui/wxpython/gui_core/forms.py

@@ -106,7 +106,7 @@ from gui_core.widgets import FloatValidator, GNotebook, FormNotebook, FormListbo
 from core.giface import Notification
 from core.giface import Notification
 from gui_core.widgets import LayersList
 from gui_core.widgets import LayersList
 from gui_core.wrap import BitmapFromImage, Button, StaticText, StaticBox, SpinCtrl, \
 from gui_core.wrap import BitmapFromImage, Button, StaticText, StaticBox, SpinCtrl, \
-    CheckBox, BitmapButton, TextCtrl
+    CheckBox, BitmapButton, TextCtrl, NewId
 from core.debug import Debug
 from core.debug import Debug
 
 
 wxUpdateDialog, EVT_DIALOG_UPDATE = NewEvent()
 wxUpdateDialog, EVT_DIALOG_UPDATE = NewEvent()
@@ -658,7 +658,7 @@ class TaskFrame(wx.Frame):
             flag=wx.ALIGN_CENTER | wx.LEFT | wx.RIGHT,
             flag=wx.ALIGN_CENTER | wx.LEFT | wx.RIGHT,
             border=30)
             border=30)
         # abort key bindings
         # abort key bindings
-        abortId = wx.NewIdRef()
+        abortId = NewId()
         self.Bind(wx.EVT_MENU, self.OnAbort, id=abortId)
         self.Bind(wx.EVT_MENU, self.OnAbort, id=abortId)
         accelTableList.append((wx.ACCEL_CTRL, ord('S'), abortId))
         accelTableList.append((wx.ACCEL_CTRL, ord('S'), abortId))
         # set accelerator table
         # set accelerator table

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

@@ -28,6 +28,7 @@ import wx
 from core import globalvar
 from core import globalvar
 from core.debug import Debug
 from core.debug import Debug
 from gui_core.toolbars import ToolSwitcher
 from gui_core.toolbars import ToolSwitcher
+from gui_core.wrap import NewId
 
 
 from grass.script import core as grass
 from grass.script import core as grass
 
 
@@ -127,7 +128,7 @@ class MapFrameBase(wx.Frame):
         )
         )
         accelTable = []
         accelTable = []
         for handler, entry, kdb in shortcuts_table:
         for handler, entry, kdb in shortcuts_table:
-            wxId = wx.NewId()
+            wxId = NewId()
             self.Bind(wx.EVT_MENU, handler, id=wxId)
             self.Bind(wx.EVT_MENU, handler, id=wxId)
             accelTable.append((entry, kdb, wxId))
             accelTable.append((entry, kdb, wxId))
 
 

+ 2 - 2
gui/wxpython/gui_core/query.py

@@ -19,7 +19,7 @@ import six
 
 
 from core.gcmd import DecodeString
 from core.gcmd import DecodeString
 from gui_core.treeview import TreeListView
 from gui_core.treeview import TreeListView
-from gui_core.wrap import Button, StaticText, Menu
+from gui_core.wrap import Button, StaticText, Menu, NewId
 from core.treemodel import TreeModel, DictNode
 from core.treemodel import TreeModel, DictNode
 
 
 from grass.pydispatch.signal import Signal
 from grass.pydispatch.signal import Signal
@@ -153,7 +153,7 @@ class QueryDialog(wx.Dialog):
 
 
         ids = []
         ids = []
         for text in texts:
         for text in texts:
-            id = wx.NewId()
+            id = NewId()
             ids.append(id)
             ids.append(id)
             self.Bind(
             self.Bind(
                 wx.EVT_MENU,
                 wx.EVT_MENU,

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

@@ -31,7 +31,7 @@ from gui_core.toolbars import BaseToolbar, BaseIcons
 from icons.icon import MetaIcon
 from icons.icon import MetaIcon
 from gui_core.forms import GUI
 from gui_core.forms import GUI
 from gui_core.dialogs import SetOpacityDialog
 from gui_core.dialogs import SetOpacityDialog
-from gui_core.wrap import CheckListBox, Menu
+from gui_core.wrap import CheckListBox, Menu, NewId
 from core.utils import GetLayerNameFromCmd
 from core.utils import GetLayerNameFromCmd
 from core.gcmd import GError
 from core.gcmd import GError
 from core.layerlist import LayerList
 from core.layerlist import LayerList
@@ -149,7 +149,7 @@ class SimpleLayerManager(wx.Panel):
         labels = [_("Copy map names to clipboard (top to bottom)"),
         labels = [_("Copy map names to clipboard (top to bottom)"),
                   _("Copy map names to clipboard (bottom to top)")]
                   _("Copy map names to clipboard (bottom to top)")]
         for label, text in zip(labels, texts):
         for label, text in zip(labels, texts):
-            id = wx.NewId()
+            id = NewId()
             self.Bind(
             self.Bind(
                 wx.EVT_MENU,
                 wx.EVT_MENU,
                 lambda evt,
                 lambda evt,

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

@@ -26,7 +26,7 @@ from core.debug import Debug
 from icons.icon import MetaIcon
 from icons.icon import MetaIcon
 from collections import defaultdict
 from collections import defaultdict
 from core.globalvar import IMGDIR
 from core.globalvar import IMGDIR
-from gui_core.wrap import ToolBar, Menu, BitmapButton
+from gui_core.wrap import ToolBar, Menu, BitmapButton, NewId
 
 
 from grass.pydispatch.signal import Signal
 from grass.pydispatch.signal import Signal
 
 
@@ -138,7 +138,7 @@ class BaseToolbar(ToolBar):
         bmpDisabled = wx.NullBitmap
         bmpDisabled = wx.NullBitmap
         tool = -1
         tool = -1
         if label:
         if label:
-            tool = vars(self)[label] = wx.NewId()
+            tool = vars(self)[label] = NewId()
             Debug.msg(3, "CreateTool(): tool=%d, label=%s bitmap=%s" %
             Debug.msg(3, "CreateTool(): tool=%d, label=%s bitmap=%s" %
                       (tool, label, bitmap))
                       (tool, label, bitmap))
             if pos < 0:
             if pos < 0:

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

@@ -90,7 +90,7 @@ from core import globalvar
 from core.gcmd import GMessage, GError
 from core.gcmd import GMessage, GError
 from core.debug import Debug
 from core.debug import Debug
 from gui_core.wrap import Button, SearchCtrl, StaticText, StaticBox, \
 from gui_core.wrap import Button, SearchCtrl, StaticText, StaticBox, \
-    TextCtrl, Menu, Rect, EmptyBitmap, ListCtrl
+    TextCtrl, Menu, Rect, EmptyBitmap, ListCtrl, NewId
 
 
 
 
 class NotebookController:
 class NotebookController:
@@ -958,8 +958,8 @@ class GListCtrl(ListCtrl, listmix.ListCtrlAutoWidthMixin,
             return
             return
 
 
         if not hasattr(self, "popupDataID1"):
         if not hasattr(self, "popupDataID1"):
-            self.popupDataID1 = wx.NewId()
-            self.popupDataID2 = wx.NewId()
+            self.popupDataID1 = NewId()
+            self.popupDataID2 = NewId()
 
 
             self.Bind(wx.EVT_MENU, self.OnSelectAll, id=self.popupDataID1)
             self.Bind(wx.EVT_MENU, self.OnSelectAll, id=self.popupDataID1)
             self.Bind(wx.EVT_MENU, self.OnSelectNone, id=self.popupDataID2)
             self.Bind(wx.EVT_MENU, self.OnSelectNone, id=self.popupDataID2)

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

@@ -35,6 +35,11 @@ else:
     ComboPopup = wx.combo.ComboPopup
     ComboPopup = wx.combo.ComboPopup
     wxComboCtrl = wx.combo.ComboCtrl
     wxComboCtrl = wx.combo.ComboCtrl
 
 
+if wxPythonPhoenix:
+    from wx import NewIdRef as NewId
+else:
+    from wx import NewId
+
 
 
 def BitmapFromImage(image, depth=-1):
 def BitmapFromImage(image, depth=-1):
     if wxPythonPhoenix:
     if wxPythonPhoenix:

+ 2 - 2
gui/wxpython/iclass/dialogs.py

@@ -33,7 +33,7 @@ from gui_core import gselect
 from gui_core.widgets import SimpleValidator
 from gui_core.widgets import SimpleValidator
 from iclass.statistics import Statistics, BandStatistics
 from iclass.statistics import Statistics, BandStatistics
 from gui_core.wrap import CheckBox, Button, StaticText, \
 from gui_core.wrap import CheckBox, Button, StaticText, \
-    StaticBox, TextCtrl, Menu
+    StaticBox, TextCtrl, Menu, NewId
 
 
 import grass.script as grass
 import grass.script as grass
 
 
@@ -533,7 +533,7 @@ class CategoryListCtrl(wx.ListCtrl,
             self.rightClickedItemIdx = item
             self.rightClickedItemIdx = item
 
 
         if not hasattr(self, "popupZoomtoAreas"):
         if not hasattr(self, "popupZoomtoAreas"):
-            self.popupZoomtoAreas = wx.NewId()
+            self.popupZoomtoAreas = NewId()
             self.Bind(
             self.Bind(
                 wx.EVT_MENU,
                 wx.EVT_MENU,
                 self.OnZoomToAreasByCat,
                 self.OnZoomToAreasByCat,

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

@@ -73,14 +73,13 @@ class IClassMapToolbar(BaseToolbar):
         self._default = self.pan
         self._default = self.pan
 
 
         # add tool to toggle active map window
         # add tool to toggle active map window
-        self.togglemapid = wx.NewId()
-        self.togglemap = wx.Choice(parent=self, id=self.togglemapid,
+        self.togglemap = wx.Choice(parent=self, id=wx.ID_ANY,
                                    choices=[_('Training'), _('Preview')])
                                    choices=[_('Training'), _('Preview')])
 
 
         self.InsertControl(9, self.togglemap)
         self.InsertControl(9, self.togglemap)
 
 
         self.SetToolShortHelp(
         self.SetToolShortHelp(
-            self.togglemapid, '%s %s %s' %
+            self.togglemap.GetId(), '%s %s %s' %
             (_('Set map canvas for '),
             (_('Set map canvas for '),
              BaseIcons["zoomBack"].GetLabel(),
              BaseIcons["zoomBack"].GetLabel(),
              _('/ Zoom to map')))
              _('/ Zoom to map')))

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

@@ -89,14 +89,13 @@ class GCPDisplayToolbar(BaseToolbar):
         self._default = self.gcpset
         self._default = self.gcpset
 
 
         # add tool to toggle active map window
         # add tool to toggle active map window
-        self.togglemapid = wx.NewId()
-        self.togglemap = wx.Choice(parent=self, id=self.togglemapid,
+        self.togglemap = wx.Choice(parent=self, id=wx.ID_ANY,
                                    choices=[_('source'), _('target')])
                                    choices=[_('source'), _('target')])
 
 
         self.InsertControl(10, self.togglemap)
         self.InsertControl(10, self.togglemap)
 
 
         self.SetToolShortHelp(
         self.SetToolShortHelp(
-            self.togglemapid, '%s %s %s' %
+            self.togglemap.GetId(), '%s %s %s' %
             (_('Set map canvas for '),
             (_('Set map canvas for '),
              BaseIcons["zoomBack"].GetLabel(),
              BaseIcons["zoomBack"].GetLabel(),
              _(' / Zoom to map')))
              _(' / Zoom to map')))

+ 22 - 31
gui/wxpython/iscatt/frame.py

@@ -573,66 +573,57 @@ class CategoryListCtrl(wx.ListCtrl,
 
 
         menu = Menu()
         menu = Menu()
 
 
-        item_id = wx.NewId()
-        menu.Append(item_id, text=_("Rename class"))
-        self.Bind(wx.EVT_MENU, self.OnRename, id=item_id)
+        item = menu.Append(wx.ID_ANY, text=_("Rename class"))
+        self.Bind(wx.EVT_MENU, self.OnRename, item)
 
 
-        item_id = wx.NewId()
-        menu.Append(item_id, text=_("Set color"))
-        self.Bind(wx.EVT_MENU, self.OnSetColor, id=item_id)
+        item = menu.Append(wx.ID_ANY, text=_("Set color"))
+        self.Bind(wx.EVT_MENU, self.OnSetColor, item)
 
 
-        item_id = wx.NewId()
-        menu.Append(item_id, text=_("Change opacity level"))
-        self.Bind(wx.EVT_MENU, self.OnPopupOpacityLevel, id=item_id)
+        item = menu.Append(item_id, text=_("Change opacity level"))
+        self.Bind(wx.EVT_MENU, self.OnPopupOpacityLevel, item)
 
 
         if showed:
         if showed:
             text = _("Hide")
             text = _("Hide")
         else:
         else:
             text = _("Show")
             text = _("Show")
 
 
-        item_id = wx.NewId()
-        menu.Append(item_id, text=text)
+        item = menu.Append(wx.ID_ANY, text=text)
         self.Bind(
         self.Bind(
             wx.EVT_MENU,
             wx.EVT_MENU,
             lambda event: self._setCatAttrs(
             lambda event: self._setCatAttrs(
                 cat_id=cat_id,
                 cat_id=cat_id,
                 attrs={
                 attrs={
                     'show': not showed}),
                     'show': not showed}),
-            id=item_id)
+            item)
 
 
         menu.AppendSeparator()
         menu.AppendSeparator()
 
 
-        item_id = wx.NewId()
-        menu.Append(item_id, text=_("Move to top"))
-        self.Bind(wx.EVT_MENU, self.OnMoveTop, id=item_id)
+        item = menu.Append(wx.ID_ANY, text=_("Move to top"))
+        self.Bind(wx.EVT_MENU, self.OnMoveTop, item)
         if cat_idx == 0:
         if cat_idx == 0:
-            menu.Enable(item_id, False)
+            menu.Enable(item.GetId(), False)
 
 
-        item_id = wx.NewId()
-        menu.Append(item_id, text=_("Move to bottom"))
-        self.Bind(wx.EVT_MENU, self.OnMoveBottom, id=item_id)
+        item = menu.Append(wx.ID_ANY, text=_("Move to bottom"))
+        self.Bind(wx.EVT_MENU, self.OnMoveBottom, item)
         if cat_idx == len(cats) - 1:
         if cat_idx == len(cats) - 1:
-            menu.Enable(item_id, False)
+            menu.Enable(item.GetId(), False)
 
 
         menu.AppendSeparator()
         menu.AppendSeparator()
 
 
-        item_id = wx.NewId()
-        menu.Append(item_id, text=_("Move category up"))
-        self.Bind(wx.EVT_MENU, self.OnMoveUp, id=item_id)
+        item = menu.Append(wx.ID_ANY, text=_("Move category up"))
+        self.Bind(wx.EVT_MENU, self.OnMoveUp, item)
         if cat_idx == 0:
         if cat_idx == 0:
-            menu.Enable(item_id, False)
+            menu.Enable(item.GetId(), False)
 
 
-        item_id = wx.NewId()
-        menu.Append(item_id, text=_("Move category down"))
-        self.Bind(wx.EVT_MENU, self.OnMoveDown, id=item_id)
+        item = menu.Append(wx.ID_ANY, text=_("Move category down"))
+        self.Bind(wx.EVT_MENU, self.OnMoveDown, item)
         if cat_idx == len(cats) - 1:
         if cat_idx == len(cats) - 1:
-            menu.Enable(item_id, False)
+            menu.Enable(item.GetId(), False)
 
 
         menu.AppendSeparator()
         menu.AppendSeparator()
 
 
-        item_id = wx.NewId()
-        menu.Append(item_id, text=_("Export class raster"))
-        self.Bind(wx.EVT_MENU, self.OnExportCatRast, id=item_id)
+        item = menu.Append(wx.ID_ANY, text=_("Export class raster"))
+        self.Bind(wx.EVT_MENU, self.OnExportCatRast, item)
 
 
         self.PopupMenu(menu)
         self.PopupMenu(menu)
         menu.Destroy()
         menu.Destroy()

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

@@ -47,7 +47,7 @@ from core.gcmd import GWarning, GError, RunCommand
 from icons.icon import MetaIcon
 from icons.icon import MetaIcon
 from web_services.dialogs import SaveWMSLayerDialog
 from web_services.dialogs import SaveWMSLayerDialog
 from gui_core.widgets import MapValidator
 from gui_core.widgets import MapValidator
-from gui_core.wrap import Menu, GenBitmapButton, TextCtrl
+from gui_core.wrap import Menu, GenBitmapButton, TextCtrl, NewId
 from lmgr.giface import LayerManagerGrassInterfaceForMapDisplay
 from lmgr.giface import LayerManagerGrassInterfaceForMapDisplay
 from core.giface import Notification
 from core.giface import Notification
 
 
@@ -444,7 +444,7 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
                     'null', 'zoom1', 'color', 'colori', 'hist', 'univar', 'prof',
                     'null', 'zoom1', 'color', 'colori', 'hist', 'univar', 'prof',
                     'properties', 'sql', 'copy', 'report', 'export-pg',
                     'properties', 'sql', 'copy', 'report', 'export-pg',
                     'export-attr', 'pack'):
                     'export-attr', 'pack'):
-                self.popupID[key] = wx.NewId()
+                self.popupID[key] = NewId()
 
 
         # get current mapset
         # get current mapset
         currentMapset = grass.gisenv()['MAPSET']
         currentMapset = grass.gisenv()['MAPSET']

+ 2 - 2
gui/wxpython/location_wizard/wizard.py

@@ -55,7 +55,7 @@ from core.utils import cmp
 from core.gcmd import RunCommand, GError, GMessage, GWarning
 from core.gcmd import RunCommand, GError, GMessage, GWarning
 from gui_core.widgets import GenericValidator
 from gui_core.widgets import GenericValidator
 from gui_core.wrap import SpinCtrl, SearchCtrl, StaticText, \
 from gui_core.wrap import SpinCtrl, SearchCtrl, StaticText, \
-    TextCtrl, Button, CheckBox, StaticBox
+    TextCtrl, Button, CheckBox, StaticBox, NewId
 from location_wizard.base import BaseClass
 from location_wizard.base import BaseClass
 from location_wizard.dialogs import SelectTransformDialog
 from location_wizard.dialogs import SelectTransformDialog
 
 
@@ -915,7 +915,7 @@ class ProjParamsPage(TitledPage):
             for paramgrp in self.parent.projections[
             for paramgrp in self.parent.projections[
                     self.parent.projpage.proj][1]:
                     self.parent.projpage.proj][1]:
                 # get parameters
                 # get parameters
-                id = wx.NewId()
+                id = NewId()
                 param = self.pparam[id] = {
                 param = self.pparam[id] = {
                     'type': self.parent.paramdesc[
                     'type': self.parent.paramdesc[
                         paramgrp[0]][0], 'proj4': self.parent.paramdesc[
                         paramgrp[0]][0], 'proj4': self.parent.paramdesc[

+ 2 - 2
gui/wxpython/mapswipe/mapwindow.py

@@ -22,7 +22,7 @@ import wx
 from core.debug import Debug
 from core.debug import Debug
 from core.settings import UserSettings
 from core.settings import UserSettings
 from mapwin.buffered import BufferedMapWindow
 from mapwin.buffered import BufferedMapWindow
-from gui_core.wrap import Rect
+from gui_core.wrap import Rect, NewId
 
 
 
 
 EVT_MY_MOUSE_EVENTS = wx.NewEventType()
 EVT_MY_MOUSE_EVENTS = wx.NewEventType()
@@ -48,7 +48,7 @@ class SwipeBufferedWindow(BufferedMapWindow):
         self.imageId = 99
         self.imageId = 99
         self.movingSash = False
         self.movingSash = False
         self._mode = 'swipe'
         self._mode = 'swipe'
-        self.lineid = wx.NewId()
+        self.lineid = NewId()
 
 
     def _bindMouseEvents(self):
     def _bindMouseEvents(self):
         """Binds wx mouse events and custom mouse events"""
         """Binds wx mouse events and custom mouse events"""

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

@@ -111,8 +111,7 @@ class SwipeMainToolbar(BaseToolbar):
         self.InitToolbar(self._toolbarData())
         self.InitToolbar(self._toolbarData())
 
 
         # add tool to toggle active map window
         # add tool to toggle active map window
-        self.toggleModeId = wx.NewId()
-        self.toggleMode = wx.Choice(parent=self, id=self.toggleModeId)
+        self.toggleMode = wx.Choice(parent=self)
         for label, cdata in zip(
         for label, cdata in zip(
                 [_('Swipe mode'),
                 [_('Swipe mode'),
                  _('Mirror mode')],
                  _('Mirror mode')],
@@ -128,7 +127,7 @@ class SwipeMainToolbar(BaseToolbar):
         self.InsertControl(3, self.toggleMode)
         self.InsertControl(3, self.toggleMode)
 
 
         help = _("Choose view mode")
         help = _("Choose view mode")
-        self.SetToolShortHelp(self.toggleModeId, help)
+        self.SetToolShortHelp(self.toggleMode.GetId(), help)
         # realize the toolbar
         # realize the toolbar
         self.Realize()
         self.Realize()
 
 

+ 7 - 7
gui/wxpython/mapwin/buffered.py

@@ -38,7 +38,7 @@ import grass.script as grass
 
 
 from gui_core.dialogs import SavedRegion
 from gui_core.dialogs import SavedRegion
 from gui_core.wrap import DragImage, PseudoDC, EmptyBitmap, BitmapFromImage, \
 from gui_core.wrap import DragImage, PseudoDC, EmptyBitmap, BitmapFromImage, \
-    Window, Menu, Rect
+    Window, Menu, Rect, NewId
 from core.gcmd import RunCommand, GException, GError, GMessage
 from core.gcmd import RunCommand, GException, GError, GMessage
 from core.debug import Debug
 from core.debug import Debug
 from core.settings import UserSettings
 from core.settings import UserSettings
@@ -247,7 +247,7 @@ class BufferedMapWindow(MapWindowBase, Window):
         menu = Menu()
         menu = Menu()
 
 
         if not hasattr(self, "popupCopyCoordinates"):
         if not hasattr(self, "popupCopyCoordinates"):
-            self.popupCopyCoordinates = wx.NewId()
+            self.popupCopyCoordinates = NewId()
             self.Bind(
             self.Bind(
                 wx.EVT_MENU,
                 wx.EVT_MENU,
                 self.OnCopyCoordinates,
                 self.OnCopyCoordinates,
@@ -257,7 +257,7 @@ class BufferedMapWindow(MapWindowBase, Window):
             _("Copy coordinates to clipboard"))
             _("Copy coordinates to clipboard"))
         menu.AppendSeparator()
         menu.AppendSeparator()
         if not hasattr(self, "popupShowAllToolbars"):
         if not hasattr(self, "popupShowAllToolbars"):
-            self.popupShowAllToolbars = wx.NewId()
+            self.popupShowAllToolbars = NewId()
             self.Bind(
             self.Bind(
                 wx.EVT_MENU,
                 wx.EVT_MENU,
                 self.OnShowAllToolbars,
                 self.OnShowAllToolbars,
@@ -266,7 +266,7 @@ class BufferedMapWindow(MapWindowBase, Window):
                     if self._giface.AreAllToolbarsShown() else
                     if self._giface.AreAllToolbarsShown() else
                     _("Show toolbars"))
                     _("Show toolbars"))
         if not hasattr(self, "popupShowStatusbar"):
         if not hasattr(self, "popupShowStatusbar"):
-            self.popupShowStatusbar = wx.NewId()
+            self.popupShowStatusbar = NewId()
             self.Bind(
             self.Bind(
                 wx.EVT_MENU,
                 wx.EVT_MENU,
                 self.OnShowStatusbar,
                 self.OnShowStatusbar,
@@ -278,14 +278,14 @@ class BufferedMapWindow(MapWindowBase, Window):
         idlist = self.pdc.FindObjects(pos[0], pos[1], self.hitradius)
         idlist = self.pdc.FindObjects(pos[0], pos[1], self.hitradius)
         if self.overlays and idlist and [i for i in idlist if i in list(self.overlays.keys())]:  # legend, scale bar, north arrow, dtext
         if self.overlays and idlist and [i for i in idlist if i in list(self.overlays.keys())]:  # legend, scale bar, north arrow, dtext
             menu.AppendSeparator()
             menu.AppendSeparator()
-            removeId = wx.NewId()
+            removeId = NewId()
             self.Bind(wx.EVT_MENU,
             self.Bind(wx.EVT_MENU,
                       lambda evt: self.overlayRemoved.emit(overlayId=idlist[0]),
                       lambda evt: self.overlayRemoved.emit(overlayId=idlist[0]),
                       id=removeId)
                       id=removeId)
             menu.Append(removeId, self.overlays[idlist[0]].removeLabel)
             menu.Append(removeId, self.overlays[idlist[0]].removeLabel)
 
 
             if self.overlays[idlist[0]].name == 'legend':
             if self.overlays[idlist[0]].name == 'legend':
-                resizeLegendId = wx.NewId()
+                resizeLegendId = NewId()
                 self.Bind(wx.EVT_MENU,
                 self.Bind(wx.EVT_MENU,
                           lambda evt: self.overlays[idlist[0]].StartResizing(),
                           lambda evt: self.overlays[idlist[0]].StartResizing(),
                           id=resizeLegendId)
                           id=resizeLegendId)
@@ -303,7 +303,7 @@ class BufferedMapWindow(MapWindowBase, Window):
             elif pdctype == 'clear':
             elif pdctype == 'clear':
                 drawid = None
                 drawid = None
             else:
             else:
-                drawid = wx.NewId()
+                drawid = NewId()
 
 
         # TODO: find better solution
         # TODO: find better solution
         if not pen:
         if not pen:

+ 2 - 1
gui/wxpython/mapwin/decorations.py

@@ -28,6 +28,7 @@ try:
     hasPIL = True
     hasPIL = True
 except ImportError:
 except ImportError:
     hasPIL = False
     hasPIL = False
+from gui_core.wrap import NewId
 
 
 
 
 class OverlayController(object):
 class OverlayController(object):
@@ -45,7 +46,7 @@ class OverlayController(object):
         self._cmd = None   # to be set by user
         self._cmd = None   # to be set by user
         self._name = None  # to be defined by subclass
         self._name = None  # to be defined by subclass
         self._removeLabel = None  # to be defined by subclass
         self._removeLabel = None  # to be defined by subclass
-        self._id = wx.NewId()
+        self._id = NewId()
         self._dialog = None
         self._dialog = None
 
 
         # signals that overlay or its visibility changed
         # signals that overlay or its visibility changed

+ 2 - 1
gui/wxpython/mapwin/graphics.py

@@ -20,6 +20,7 @@ from copy import copy
 
 
 import wx
 import wx
 
 
+from gui_core.wrap import NewId
 
 
 
 
 class GraphicsSet:
 class GraphicsSet:
@@ -405,7 +406,7 @@ class GraphicsSetItem:
                            "brushName": brushName,
                            "brushName": brushName,
                            "hide": hide,
                            "hide": hide,
                            "label": label}
                            "label": label}
-        self.id = wx.NewId()
+        self.id = NewId()
 
 
     def AddProperty(self, propName):
     def AddProperty(self, propName):
         """Adds new property, to set it, call SetPropertyVal afterwards.
         """Adds new property, to set it, call SetPropertyVal afterwards.

+ 2 - 2
gui/wxpython/modules/extensions.py

@@ -33,7 +33,7 @@ from core.menutree import TreeModel, ModuleNode
 from gui_core.widgets import GListCtrl, SearchModuleWidget
 from gui_core.widgets import GListCtrl, SearchModuleWidget
 from gui_core.treeview import CTreeView
 from gui_core.treeview import CTreeView
 from core.toolboxes import toolboxesOutdated
 from core.toolboxes import toolboxesOutdated
-from gui_core.wrap import Button, StaticBox, TextCtrl, Menu
+from gui_core.wrap import Button, StaticBox, TextCtrl, Menu, NewId
 
 
 
 
 class InstallExtensionWindow(wx.Frame):
 class InstallExtensionWindow(wx.Frame):
@@ -231,7 +231,7 @@ class InstallExtensionWindow(wx.Frame):
         if not hasattr(self, "popupID"):
         if not hasattr(self, "popupID"):
             self.popupID = dict()
             self.popupID = dict()
             for key in ('install', 'help'):
             for key in ('install', 'help'):
-                self.popupID[key] = wx.NewId()
+                self.popupID[key] = NewId()
 
 
         data = node.data
         data = node.data
         if data and 'command' in data:
         if data and 'command' in data:

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

@@ -32,7 +32,7 @@ from gui_core.preferences import DefaultFontDialog
 from core.debug import Debug
 from core.debug import Debug
 from core.gcmd import GError
 from core.gcmd import GError
 from gui_core.toolbars import BaseToolbar, BaseIcons
 from gui_core.toolbars import BaseToolbar, BaseIcons
-from gui_core.wrap import PseudoDC, Menu, EmptyBitmap
+from gui_core.wrap import PseudoDC, Menu, EmptyBitmap, NewId
 
 
 
 
 class BufferedWindow(wx.Window):
 class BufferedWindow(wx.Window):
@@ -100,7 +100,7 @@ class BufferedWindow(wx.Window):
             elif pdctype == 'clear':
             elif pdctype == 'clear':
                 drawid is None
                 drawid is None
             else:
             else:
-                drawid = wx.NewId()
+                drawid = NewId()
         else:
         else:
             pdc.SetId(drawid)
             pdc.SetId(drawid)
 
 

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

@@ -210,9 +210,9 @@ class GLWindow(MapWindowBase, glcanvas.GLCanvas):
         self.fly = self.InitFly()
         self.fly = self.InitFly()
 
 
         # timer for flythrough
         # timer for flythrough
-        self.timerFly = wx.Timer(self, id=wx.NewId())
+        self.timerFly = wx.Timer(self)
         # timer for animations
         # timer for animations
-        self.timerAnim = wx.Timer(self, id=wx.NewId())
+        self.timerAnim = wx.Timer(self)
         self.animation = Animation(mapWindow=self, timer=self.timerAnim)
         self.animation = Animation(mapWindow=self, timer=self.timerAnim)
 
 
         self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
         self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)

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

@@ -89,14 +89,13 @@ class GCPDisplayToolbar(BaseToolbar):
         self._default = self.gcpset
         self._default = self.gcpset
 
 
         # add tool to toggle active map window
         # add tool to toggle active map window
-        self.togglemapid = wx.NewId()
-        self.togglemap = wx.Choice(parent=self, id=self.togglemapid,
+        self.togglemap = wx.Choice(parent=self, id=wx.ID_ANY,
                                    choices=[_('source'), _('target')])
                                    choices=[_('source'), _('target')])
 
 
         self.InsertControl(10, self.togglemap)
         self.InsertControl(10, self.togglemap)
 
 
         self.SetToolShortHelp(
         self.SetToolShortHelp(
-            self.togglemapid, '%s %s %s' %
+            self.togglemap.GetId(), '%s %s %s' %
             (_('Set map canvas for '),
             (_('Set map canvas for '),
              BaseIcons["zoomBack"].GetLabel(),
              BaseIcons["zoomBack"].GetLabel(),
              _(' / Zoom to map')))
              _(' / Zoom to map')))

+ 17 - 17
gui/wxpython/psmap/dialogs.py

@@ -73,7 +73,7 @@ from gui_core.gselect import Select
 from core.gcmd import RunCommand, GError, GMessage
 from core.gcmd import RunCommand, GError, GMessage
 from gui_core.dialogs import SymbolDialog
 from gui_core.dialogs import SymbolDialog
 from gui_core.wrap import SpinCtrl, Button, TextCtrl, BitmapButton, \
 from gui_core.wrap import SpinCtrl, Button, TextCtrl, BitmapButton, \
-    StaticText, StaticBox, Rect, EmptyBitmap, TextEntryDialog, ListCtrl
+    StaticText, StaticBox, Rect, EmptyBitmap, TextEntryDialog, ListCtrl, NewId
 from psmap.utils import *
 from psmap.utils import *
 from psmap.instructions import *
 from psmap.instructions import *
 
 
@@ -841,7 +841,7 @@ class MapFramePanel(wx.Panel):
         if self.id is not None:
         if self.id is not None:
             self.mapFrameDict = self.instruction[self.id].GetInstruction()
             self.mapFrameDict = self.instruction[self.id].GetInstruction()
         else:
         else:
-            self.id = wx.NewId()
+            self.id = NewId()
             mapFrame = MapFrame(self.id)
             mapFrame = MapFrame(self.id)
             self.mapFrameDict = mapFrame.GetInstruction()
             self.mapFrameDict = mapFrame.GetInstruction()
             self.mapFrameDict['rect'] = rect
             self.mapFrameDict['rect'] = rect
@@ -1337,7 +1337,7 @@ class MapFramePanel(wx.Panel):
                         if raster:
                         if raster:
                             raster['raster'] = mapFrameDict['map']
                             raster['raster'] = mapFrameDict['map']
                         else:
                         else:
-                            raster = Raster(wx.NewId())
+                            raster = Raster(NewId())
                             raster['raster'] = mapFrameDict['map']
                             raster['raster'] = mapFrameDict['map']
                             raster['isRaster'] = True
                             raster['isRaster'] = True
                             self.instruction.AddInstruction(raster)
                             self.instruction.AddInstruction(raster)
@@ -1374,10 +1374,10 @@ class MapFramePanel(wx.Panel):
                                     mapFrameDict['map'].split('@')) + ')'
                                     mapFrameDict['map'].split('@')) + ')'
 
 
                                 if not vector:
                                 if not vector:
-                                    vector = Vector(wx.NewId())
+                                    vector = Vector(NewId())
                                     vector['list'] = []
                                     vector['list'] = []
                                     self.instruction.AddInstruction(vector)
                                     self.instruction.AddInstruction(vector)
-                                id = wx.NewId()
+                                id = NewId()
                                 vector['list'].insert(
                                 vector['list'].insert(
                                     0, [mapFrameDict['map'], topoType, id, 1, label])
                                     0, [mapFrameDict['map'], topoType, id, 1, label])
                                 vProp = VProperties(id, topoType)
                                 vProp = VProperties(id, topoType)
@@ -1548,7 +1548,7 @@ class RasterPanel(wx.Panel):
             self.id = id
             self.id = id
             self.rasterDict = self.instruction[self.id].GetInstruction()
             self.rasterDict = self.instruction[self.id].GetInstruction()
         else:
         else:
-            self.id = wx.NewId()
+            self.id = NewId()
             raster = Raster(self.id)
             raster = Raster(self.id)
             self.rasterDict = raster.GetInstruction()
             self.rasterDict = raster.GetInstruction()
 
 
@@ -1686,7 +1686,7 @@ class VectorPanel(wx.Panel):
             self.id = id
             self.id = id
             self.vectorList = deepcopy(self.instruction[id]['list'])
             self.vectorList = deepcopy(self.instruction[id]['list'])
         else:
         else:
-            self.id = wx.NewId()
+            self.id = NewId()
             self.vectorList = []
             self.vectorList = []
 
 
         vLegend = self.instruction.FindInstructionByType('vectorLegend')
         vLegend = self.instruction.FindInstructionByType('vectorLegend')
@@ -1865,7 +1865,7 @@ class VectorPanel(wx.Panel):
             idx = self.vectorType.GetSelection()
             idx = self.vectorType.GetSelection()
             ttype = self.topologyTypeList[idx]
             ttype = self.topologyTypeList[idx]
             record = "%s - %s" % (vmap, ttype)
             record = "%s - %s" % (vmap, ttype)
-            id = wx.NewId()
+            id = NewId()
             lpos = 1
             lpos = 1
             label = mapname + mapset
             label = mapname + mapset
             self.vectorList.insert(0, [vmap, ttype, id, lpos, label])
             self.vectorList.insert(0, [vmap, ttype, id, lpos, label])
@@ -3345,7 +3345,7 @@ class LegendDialog(PsmapDialog):
             self.rasterLegend = self.instruction[self.id[0]]
             self.rasterLegend = self.instruction[self.id[0]]
             self.rLegendDict = self.rasterLegend.GetInstruction()
             self.rLegendDict = self.rasterLegend.GetInstruction()
         else:
         else:
-            self.id[0] = wx.NewId()
+            self.id[0] = NewId()
             self.rasterLegend = RasterLegend(self.id[0])
             self.rasterLegend = RasterLegend(self.id[0])
             self.rLegendDict = self.rasterLegend.GetInstruction()
             self.rLegendDict = self.rasterLegend.GetInstruction()
             self.rLegendDict['where'] = currPage['Left'], currPage['Top']
             self.rLegendDict['where'] = currPage['Left'], currPage['Top']
@@ -3354,7 +3354,7 @@ class LegendDialog(PsmapDialog):
         if self.id[1] is not None:
         if self.id[1] is not None:
             self.vLegendDict = self.instruction[self.id[1]].GetInstruction()
             self.vLegendDict = self.instruction[self.id[1]].GetInstruction()
         else:
         else:
-            self.id[1] = wx.NewId()
+            self.id[1] = NewId()
             vectorLegend = VectorLegend(self.id[1])
             vectorLegend = VectorLegend(self.id[1])
             self.vLegendDict = vectorLegend.GetInstruction()
             self.vLegendDict = vectorLegend.GetInstruction()
             self.vLegendDict['where'] = currPage['Left'], currPage['Top']
             self.vLegendDict['where'] = currPage['Left'], currPage['Top']
@@ -4493,7 +4493,7 @@ class MapinfoDialog(PsmapDialog):
             self.mapinfo = self.instruction[self.id]
             self.mapinfo = self.instruction[self.id]
             self.mapinfoDict = self.mapinfo.GetInstruction()
             self.mapinfoDict = self.mapinfo.GetInstruction()
         else:
         else:
-            self.id = wx.NewId()
+            self.id = NewId()
             self.mapinfo = Mapinfo(self.id)
             self.mapinfo = Mapinfo(self.id)
             self.mapinfoDict = self.mapinfo.GetInstruction()
             self.mapinfoDict = self.mapinfo.GetInstruction()
             page = self.instruction.FindInstructionByType(
             page = self.instruction.FindInstructionByType(
@@ -4769,7 +4769,7 @@ class ScalebarDialog(PsmapDialog):
             self.scalebar = self.instruction[id]
             self.scalebar = self.instruction[id]
             self.scalebarDict = self.scalebar.GetInstruction()
             self.scalebarDict = self.scalebar.GetInstruction()
         else:
         else:
-            self.id = wx.NewId()
+            self.id = NewId()
             self.scalebar = Scalebar(self.id)
             self.scalebar = Scalebar(self.id)
             self.scalebarDict = self.scalebar.GetInstruction()
             self.scalebarDict = self.scalebar.GetInstruction()
             page = self.instruction.FindInstructionByType(
             page = self.instruction.FindInstructionByType(
@@ -5155,7 +5155,7 @@ class TextDialog(PsmapDialog):
         if self.id is not None:
         if self.id is not None:
             self.textDict = self.instruction[id].GetInstruction()
             self.textDict = self.instruction[id].GetInstruction()
         else:
         else:
-            self.id = wx.NewId()
+            self.id = NewId()
             text = Text(self.id)
             text = Text(self.id)
             self.textDict = text.GetInstruction()
             self.textDict = text.GetInstruction()
             page = self.instruction.FindInstructionByType(
             page = self.instruction.FindInstructionByType(
@@ -5733,7 +5733,7 @@ class ImageDialog(PsmapDialog):
             self.imageObj = self.instruction[self.id]
             self.imageObj = self.instruction[self.id]
             self.imageDict = self.instruction[id].GetInstruction()
             self.imageDict = self.instruction[id].GetInstruction()
         else:
         else:
-            self.id = wx.NewId()
+            self.id = NewId()
             self.imageObj = self._newObject()
             self.imageObj = self._newObject()
             self.imageDict = self.imageObj.GetInstruction()
             self.imageDict = self.imageObj.GetInstruction()
             page = self.instruction.FindInstructionByType(
             page = self.instruction.FindInstructionByType(
@@ -6292,7 +6292,7 @@ class PointDialog(PsmapDialog):
             self.pointObj = self.instruction[self.id]
             self.pointObj = self.instruction[self.id]
             self.pointDict = self.instruction[id].GetInstruction()
             self.pointDict = self.instruction[id].GetInstruction()
         else:
         else:
-            self.id = wx.NewId()
+            self.id = NewId()
             self.pointObj = Point(self.id)
             self.pointObj = Point(self.id)
             self.pointDict = self.pointObj.GetInstruction()
             self.pointDict = self.pointObj.GetInstruction()
             self.pointDict['where'] = coordinates
             self.pointDict['where'] = coordinates
@@ -6714,7 +6714,7 @@ class RectangleDialog(PsmapDialog):
             self.rectObj = self.instruction[self.id]
             self.rectObj = self.instruction[self.id]
             self.rectDict = self.rectObj.GetInstruction()
             self.rectDict = self.rectObj.GetInstruction()
         else:
         else:
-            self.id = wx.NewId()
+            self.id = NewId()
             if type == 'rectangle':
             if type == 'rectangle':
                 self.rectObj = Rectangle(self.id)
                 self.rectObj = Rectangle(self.id)
             else:
             else:
@@ -6914,7 +6914,7 @@ class LabelsDialog(PsmapDialog):
         if self.id is not None:
         if self.id is not None:
             self.labels = self.instruction[self.id]
             self.labels = self.instruction[self.id]
         else:
         else:
-            self.id = wx.NewId()
+            self.id = NewId()
             self.labels = Labels(self.id)
             self.labels = Labels(self.id)
         self.labelsDict = self.labels.GetInstruction()
         self.labelsDict = self.labels.GetInstruction()
         self.panel = self._labelPanel()
         self.panel = self._labelPanel()

+ 8 - 8
gui/wxpython/psmap/frame.py

@@ -42,7 +42,7 @@ from core.utils import PilImageToWxImage
 from gui_core.forms import GUI
 from gui_core.forms import GUI
 from gui_core.dialogs import HyperlinkDialog
 from gui_core.dialogs import HyperlinkDialog
 from gui_core.ghelp import ShowAboutDialog
 from gui_core.ghelp import ShowAboutDialog
-from gui_core.wrap import ClientDC, PseudoDC, Rect, StockCursor, EmptyBitmap
+from gui_core.wrap import ClientDC, PseudoDC, Rect, StockCursor, EmptyBitmap, NewId
 from psmap.menudata import PsMapMenuData
 from psmap.menudata import PsMapMenuData
 from gui_core.toolbars import ToolSwitcher
 from gui_core.toolbars import ToolSwitcher
 
 
@@ -154,7 +154,7 @@ class PsMapFrame(wx.Frame):
         # open dialogs
         # open dialogs
         self.openDialogs = dict()
         self.openDialogs = dict()
 
 
-        self.pageId = wx.NewId()
+        self.pageId = NewId()
         # current page of flatnotebook
         # current page of flatnotebook
         self.currentPage = 0
         self.currentPage = 0
         # canvas for draft mode
         # canvas for draft mode
@@ -980,7 +980,7 @@ class PsMapFrame(wx.Frame):
             id = None
             id = None
 
 
         if not id:
         if not id:
-            id = wx.NewId()
+            id = NewId()
             initMap = InitMap(id)
             initMap = InitMap(id)
             self.instruction.AddInstruction(initMap)
             self.instruction.AddInstruction(initMap)
         self.instruction[id].SetInstruction(
         self.instruction[id].SetInstruction(
@@ -1287,11 +1287,11 @@ class PsMapBufferedWindow(wx.Window):
         self.SetClientSize((700, 510))  # ?
         self.SetClientSize((700, 510))  # ?
         self._buffer = EmptyBitmap(*self.GetClientSize())
         self._buffer = EmptyBitmap(*self.GetClientSize())
 
 
-        self.idBoxTmp = wx.NewId()
-        self.idZoomBoxTmp = wx.NewId()
-        self.idResizeBoxTmp = wx.NewId()
+        self.idBoxTmp = NewId()
+        self.idZoomBoxTmp = NewId()
+        self.idResizeBoxTmp = NewId()
         # ids of marks for moving line vertices
         # ids of marks for moving line vertices
-        self.idLinePointsTmp = (wx.NewId(), wx.NewId())
+        self.idLinePointsTmp = (NewId(), NewId())
 
 
         self.resizeBoxSize = wx.Size(8, 8)
         self.resizeBoxSize = wx.Size(8, 8)
         self.showResizeHelp = False  # helper for correctly working statusbar
         self.showResizeHelp = False  # helper for correctly working statusbar
@@ -2191,7 +2191,7 @@ class PsMapBufferedWindow(wx.Window):
         :param lineCoords: coordinates of line start, end points (wx.Point, wx.Point)
         :param lineCoords: coordinates of line start, end points (wx.Point, wx.Point)
         """
         """
         if drawid is None:
         if drawid is None:
-            drawid = wx.NewId()
+            drawid = NewId()
         bb = bb.Get()
         bb = bb.Get()
         pdc.BeginDrawing()
         pdc.BeginDrawing()
         pdc.RemoveId(drawid)
         pdc.RemoveId(drawid)

+ 5 - 4
gui/wxpython/psmap/instructions.py

@@ -46,6 +46,7 @@ from grass.script.task import cmdlist_to_tuple
 from core.gcmd import RunCommand, GError, GMessage, GWarning
 from core.gcmd import RunCommand, GError, GMessage, GWarning
 from core.utils import GetCmdString
 from core.utils import GetCmdString
 from dbmgr.vinfo import VectorDBInfo
 from dbmgr.vinfo import VectorDBInfo
+from gui_core.wrap import NewId
 from psmap.utils import *
 from psmap.utils import *
 
 
 
 
@@ -199,7 +200,7 @@ class Instruction:
                     elif instruction in ('text', 'eps', 'point', 'line', 'rectangle'):
                     elif instruction in ('text', 'eps', 'point', 'line', 'rectangle'):
                         kwargs['mapInstruction'] = map
                         kwargs['mapInstruction'] = map
                     elif instruction in ('vpoints', 'vlines', 'vareas'):
                     elif instruction in ('vpoints', 'vlines', 'vareas'):
-                        kwargs['id'] = wx.NewId()
+                        kwargs['id'] = NewId()
                         kwargs['vectorMapNumber'] = vectorMapNumber
                         kwargs['vectorMapNumber'] = vectorMapNumber
                         vectorMapNumber += 1
                         vectorMapNumber += 1
                     elif instruction == 'paper':
                     elif instruction == 'paper':
@@ -384,7 +385,7 @@ class Instruction:
 
 
         page = self.FindInstructionByType('page')
         page = self.FindInstructionByType('page')
         if not page:
         if not page:
-            page = PageSetup(wx.NewId())
+            page = PageSetup(NewId())
             self.AddInstruction(page)
             self.AddInstruction(page)
         else:
         else:
             page['Orientation'] = orientation
             page['Orientation'] = orientation
@@ -438,7 +439,7 @@ class Instruction:
             if i in ('text', 'vProperties', 'image', 'northArrow',
             if i in ('text', 'vProperties', 'image', 'northArrow',
                      'point', 'line', 'rectangle') or not instr:
                      'point', 'line', 'rectangle') or not instr:
 
 
-                id = wx.NewId()  # !vProperties expect subtype
+                id = NewId()  # !vProperties expect subtype
                 if i == 'vProperties':
                 if i == 'vProperties':
                     id = kwargs['id']
                     id = kwargs['id']
                     newInstr = myInstrDict[i](id, subType=instruction[1:])
                     newInstr = myInstrDict[i](id, subType=instruction[1:])
@@ -468,7 +469,7 @@ class Instruction:
 
 
     def SetRegion(self, regionInstruction):
     def SetRegion(self, regionInstruction):
         """Sets region from file comment or sets current region in case of no comment"""
         """Sets region from file comment or sets current region in case of no comment"""
-        map = MapFrame(wx.NewId())
+        map = MapFrame(NewId())
         self.AddInstruction(map)
         self.AddInstruction(map)
         if regionInstruction:
         if regionInstruction:
             cmd = cmdlist_to_tuple(regionInstruction.strip('# ').split())
             cmd = cmdlist_to_tuple(regionInstruction.strip('# ').split())

+ 3 - 7
gui/wxpython/rdigit/toolbars.py

@@ -47,9 +47,8 @@ class RDigitToolbar(BaseToolbar):
         self._giface = giface
         self._giface = giface
         self.InitToolbar(self._toolbarData())
         self.InitToolbar(self._toolbarData())
 
 
-        self._mapSelectionComboId = wx.NewId()
         self._mapSelectionCombo = wx.ComboBox(
         self._mapSelectionCombo = wx.ComboBox(
-            self, id=self._mapSelectionComboId, value=_("Select raster map"),
+            self, id=wx.ID_ANY, value=_("Select raster map"),
             choices=[],
             choices=[],
             size=(120, -1))
             size=(120, -1))
         self._mapSelectionCombo.Bind(wx.EVT_COMBOBOX, self.OnMapSelection)
         self._mapSelectionCombo.Bind(wx.EVT_COMBOBOX, self.OnMapSelection)
@@ -57,7 +56,6 @@ class RDigitToolbar(BaseToolbar):
         self.InsertControl(0, self._mapSelectionCombo)
         self.InsertControl(0, self._mapSelectionCombo)
         self._previousMap = self._mapSelectionCombo.GetValue()
         self._previousMap = self._mapSelectionCombo.GetValue()
 
 
-        self._colorId = wx.NewId()
         self._color = csel.ColourSelect(parent=self, colour=wx.GREEN,
         self._color = csel.ColourSelect(parent=self, colour=wx.GREEN,
                                         size=(30, 30))
                                         size=(30, 30))
         self._color.Bind(
         self._color.Bind(
@@ -68,11 +66,10 @@ class RDigitToolbar(BaseToolbar):
         self.InsertControl(4, self._color)
         self.InsertControl(4, self._color)
 
 
         self._cellValues = set(['1'])
         self._cellValues = set(['1'])
-        self._valueComboId = wx.NewId()
         # validator does not work with combobox, SetBackgroundColor is not
         # validator does not work with combobox, SetBackgroundColor is not
         # working
         # working
         self._valueCombo = wx.ComboBox(
         self._valueCombo = wx.ComboBox(
-            self, id=self._valueComboId, choices=list(
+            self, id=wx.ID_ANY, choices=list(
                 self._cellValues), size=(
                 self._cellValues), size=(
                 80, -1), validator=FloatValidator())
                 80, -1), validator=FloatValidator())
         self._valueCombo.Bind(
         self._valueCombo.Bind(
@@ -86,11 +83,10 @@ class RDigitToolbar(BaseToolbar):
         self.InsertControl(6, labelValue)
         self.InsertControl(6, labelValue)
         self.InsertControl(7, self._valueCombo)
         self.InsertControl(7, self._valueCombo)
 
 
-        self._widthValueId = wx.NewId()
         # validator does not work with combobox, SetBackgroundColor is not
         # validator does not work with combobox, SetBackgroundColor is not
         # working
         # working
         self._widthValue = TextCtrl(
         self._widthValue = TextCtrl(
-            self, id=self._widthValueId, value='0', size=(
+            self, id=wx.ID_ANY, value='0', size=(
                 80, -1), validator=FloatValidator())
                 80, -1), validator=FloatValidator())
         self._widthValue.Bind(wx.EVT_TEXT,
         self._widthValue.Bind(wx.EVT_TEXT,
                               lambda evt: self._widthValueChanged())
                               lambda evt: self._widthValueChanged())

+ 4 - 4
gui/wxpython/vdigit/dialogs.py

@@ -29,7 +29,7 @@ from core.gcmd import RunCommand, GError
 from core.debug import Debug
 from core.debug import Debug
 from core.settings import UserSettings
 from core.settings import UserSettings
 from gui_core.wrap import SpinCtrl, Button, StaticText, \
 from gui_core.wrap import SpinCtrl, Button, StaticText, \
-    StaticBox, Menu, ListCtrl
+    StaticBox, Menu, ListCtrl, NewId
 
 
 
 
 class VDigitCategoryDialog(wx.Dialog, listmix.ColumnSorterMixin):
 class VDigitCategoryDialog(wx.Dialog, listmix.ColumnSorterMixin):
@@ -273,9 +273,9 @@ class VDigitCategoryDialog(wx.Dialog, listmix.ColumnSorterMixin):
         """Mouse right button up
         """Mouse right button up
         """
         """
         if not hasattr(self, "popupID1"):
         if not hasattr(self, "popupID1"):
-            self.popupID1 = wx.NewId()
-            self.popupID2 = wx.NewId()
-            self.popupID3 = wx.NewId()
+            self.popupID1 = NewId()
+            self.popupID2 = NewId()
+            self.popupID3 = NewId()
             self.Bind(wx.EVT_MENU, self.OnItemDelete, id=self.popupID1)
             self.Bind(wx.EVT_MENU, self.OnItemDelete, id=self.popupID1)
             self.Bind(wx.EVT_MENU, self.OnItemDeleteAll, id=self.popupID2)
             self.Bind(wx.EVT_MENU, self.OnItemDeleteAll, id=self.popupID2)
             self.Bind(wx.EVT_MENU, self.OnReload, id=self.popupID3)
             self.Bind(wx.EVT_MENU, self.OnReload, id=self.popupID3)

+ 2 - 2
gui/wxpython/vdigit/mapwindow.py

@@ -29,7 +29,7 @@ from core.utils import ListOfCatsToRange
 from core.globalvar import QUERYLAYER
 from core.globalvar import QUERYLAYER
 from vdigit.dialogs import VDigitCategoryDialog, VDigitZBulkDialog, VDigitDuplicatesDialog
 from vdigit.dialogs import VDigitCategoryDialog, VDigitZBulkDialog, VDigitDuplicatesDialog
 from gui_core import gselect
 from gui_core import gselect
-from gui_core.wrap import PseudoDC
+from gui_core.wrap import PseudoDC, NewId
 
 
 
 
 class VDigitWindow(BufferedMapWindow):
 class VDigitWindow(BufferedMapWindow):
@@ -332,7 +332,7 @@ class VDigitWindow(BufferedMapWindow):
         vertex.
         vertex.
         """
         """
         self.polycoords.append(self.Pixel2Cell(self.mouse['begin']))
         self.polycoords.append(self.Pixel2Cell(self.mouse['begin']))
-        self.moveInfo['id'].append(wx.NewId())
+        self.moveInfo['id'].append(NewId())
         self.DrawLines(pdc=self.pdcTmp)
         self.DrawLines(pdc=self.pdcTmp)
 
 
     def OnLeftDownMoveLine(self, event):
     def OnLeftDownMoveLine(self, event):