Forráskód Böngészése

Fix missing checkboxes in ListCtrl (#204)

Also replaces all wx.ListCtrl with ListCtrl wrapper
Anna Petrasova 5 éve
szülő
commit
ad4836c73c

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

@@ -2727,10 +2727,10 @@ class DbMgrTablesPage(DbMgrNotebookBase):
         # add item to the list of table columns
         tlist = self.FindWindowById(self.layerPage[self.selLayer]['tableData'])
 
-        index = tlist.InsertStringItem(tlist.GetItemCount(), str(name))
-        tlist.SetStringItem(index, 0, str(name))
-        tlist.SetStringItem(index, 1, str(ctype))
-        tlist.SetStringItem(index, 2, str(length))
+        index = tlist.InsertItem(tlist.GetItemCount(), str(name))
+        tlist.SetItem(index, 0, str(name))
+        tlist.SetItem(index, 1, str(ctype))
+        tlist.SetItem(index, 2, str(length))
 
         self.AddColumn(name, ctype, length)
 
@@ -2917,10 +2917,10 @@ class TableListCtrl(ListCtrl,
 
         i = 0
         for column in self.columns:
-            index = self.InsertStringItem(i, str(column))
-            self.SetStringItem(index, 0, str(column))
-            self.SetStringItem(index, 1, str(self.table[column]['type']))
-            self.SetStringItem(index, 2, str(self.table[column]['length']))
+            index = self.InsertItem(i, str(column))
+            self.SetItem(index, 0, str(column))
+            self.SetItem(index, 1, str(self.table[column]['type']))
+            self.SetItem(index, 2, str(self.table[column]['length']))
             self.SetItemData(index, i)
             itemData[i] = (str(column),
                            str(self.table[column]['type']),
@@ -2975,16 +2975,16 @@ class LayerListCtrl(ListCtrl,
 
         i = 0
         for layer in self.layers.keys():
-            index = self.InsertStringItem(i, str(layer))
-            self.SetStringItem(index, 0, str(layer))
+            index = self.InsertItem(i, str(layer))
+            self.SetItem(index, 0, str(layer))
             database = str(self.layers[layer]['database'])
             driver = str(self.layers[layer]['driver'])
             table = str(self.layers[layer]['table'])
             key = str(self.layers[layer]['key'])
-            self.SetStringItem(index, 1, driver)
-            self.SetStringItem(index, 2, database)
-            self.SetStringItem(index, 3, table)
-            self.SetStringItem(index, 4, key)
+            self.SetItem(index, 1, driver)
+            self.SetItem(index, 2, database)
+            self.SetItem(index, 3, table)
+            self.SetItem(index, 4, key)
             self.SetItemData(index, i)
             itemData[i] = (str(layer),
                            driver,

+ 20 - 20
gui/wxpython/gcp/manager.py

@@ -59,7 +59,7 @@ from core.settings import UserSettings
 from gcp.mapdisplay import MapFrame
 from core.giface import Notification
 from gui_core.wrap import SpinCtrl, Button, StaticText, StaticBox, \
-    CheckListBox, TextCtrl, Menu
+    CheckListBox, TextCtrl, Menu, ListCtrl
 
 from location_wizard.wizard import TitledPage as TitledPage
 
@@ -1205,7 +1205,7 @@ class GCP(MapFrame, ColumnSorterMixin):
         for newkey in range(key, len(self.mapcoordlist)):
             index = self.list.FindItemData(-1, newkey + 1)
             self.mapcoordlist[newkey][0] = newkey
-            self.list.SetStringItem(index, 0, str(newkey))
+            self.list.SetItem(index, 0, str(newkey))
             self.list.SetItemData(index, newkey)
 
         # update selected
@@ -1241,9 +1241,9 @@ class GCP(MapFrame, ColumnSorterMixin):
         key = self.list.GetItemData(index)
 
         for i in range(1, 5):
-            self.list.SetStringItem(index, i, '0.0')
-        self.list.SetStringItem(index, 5, '')
-        self.list.SetStringItem(index, 6, '')
+            self.list.SetItem(index, i, '0.0')
+        self.list.SetItem(index, 5, '')
+        self.list.SetItem(index, 6, '')
         self.list.CheckItem(index, False)
 
         # GCP number, source E, source N, target E, target N, fwd error, bkwd
@@ -1358,21 +1358,21 @@ class GCP(MapFrame, ColumnSorterMixin):
                 return
 
         if coordtype == 'source':
-            self.list.SetStringItem(index, 1, str(coord0))
-            self.list.SetStringItem(index, 2, str(coord1))
+            self.list.SetItem(index, 1, str(coord0))
+            self.list.SetItem(index, 2, str(coord1))
             self.mapcoordlist[key][1] = coord[0]
             self.mapcoordlist[key][2] = coord[1]
             self.pointsToDrawSrc.GetItem(key - 1).SetCoords([coord0, coord1])
 
         elif coordtype == 'target':
-            self.list.SetStringItem(index, 3, str(coord0))
-            self.list.SetStringItem(index, 4, str(coord1))
+            self.list.SetItem(index, 3, str(coord0))
+            self.list.SetItem(index, 4, str(coord1))
             self.mapcoordlist[key][3] = coord[0]
             self.mapcoordlist[key][4] = coord[1]
             self.pointsToDrawTgt.GetItem(key - 1).SetCoords([coord0, coord1])
 
-        self.list.SetStringItem(index, 5, '0')
-        self.list.SetStringItem(index, 6, '0')
+        self.list.SetItem(index, 5, '0')
+        self.list.SetItem(index, 6, '0')
         self.mapcoordlist[key][5] = 0.0
         self.mapcoordlist[key][6] = 0.0
 
@@ -1831,8 +1831,8 @@ class GCP(MapFrame, ColumnSorterMixin):
             key = self.list.GetItemData(index)
             if self.list.IsChecked(index):
                 fwd_err, bkw_err = errlist[GCPcount].split()
-                self.list.SetStringItem(index, 5, fwd_err)
-                self.list.SetStringItem(index, 6, bkw_err)
+                self.list.SetItem(index, 5, fwd_err)
+                self.list.SetItem(index, 6, bkw_err)
                 self.mapcoordlist[key][5] = float(fwd_err)
                 self.mapcoordlist[key][6] = float(bkw_err)
                 self.list.SetItemTextColour(index, wx.BLACK)
@@ -1847,8 +1847,8 @@ class GCP(MapFrame, ColumnSorterMixin):
                 sum_fwd_err += float(fwd_err)
                 GCPcount += 1
             else:
-                self.list.SetStringItem(index, 5, '')
-                self.list.SetStringItem(index, 6, '')
+                self.list.SetItem(index, 5, '')
+                self.list.SetItem(index, 6, '')
                 self.mapcoordlist[key][5] = 0.0
                 self.mapcoordlist[key][6] = 0.0
                 self.list.SetItemTextColour(index, wx.BLACK)
@@ -2112,7 +2112,7 @@ class GCP(MapFrame, ColumnSorterMixin):
         pass
 
 
-class GCPList(wx.ListCtrl,
+class GCPList(ListCtrl,
               CheckListCtrlMixin,
               ListCtrlAutoWidthMixin):
 
@@ -2121,7 +2121,7 @@ class GCPList(wx.ListCtrl,
                  style=wx.LC_REPORT | wx.SUNKEN_BORDER | wx.LC_HRULES |
                  wx.LC_SINGLE_SEL):
 
-        wx.ListCtrl.__init__(self, parent, id, pos, size, style)
+        ListCtrl.__init__(self, parent, id, pos, size, style)
 
         self.gcp = gcp  # GCP class
         self.render = True
@@ -2313,13 +2313,13 @@ class GCPList(wx.ListCtrl,
             else:
                 for i in range(len(values)):
                     if values[i] != coords[i]:
-                        self.SetStringItem(index, i + 1, values[i])
+                        self.SetItem(index, i + 1, values[i])
                         changed = True
 
                 if changed:
                     # reset RMS and update mapcoordlist
-                    self.SetStringItem(index, 5, '')
-                    self.SetStringItem(index, 6, '')
+                    self.SetItem(index, 5, '')
+                    self.SetItem(index, 6, '')
                     key = self.GetItemData(index)
                     self.gcp.mapcoordlist[key] = [key,
                                                   float(values[0]),

+ 2 - 2
gui/wxpython/gis_set.py

@@ -1113,8 +1113,8 @@ class GListBox(ListCtrl, listmix.ListCtrlAutoWidthMixin):
         idx = 0
         count = self.GetItemCount()
         for item in choices:
-            index = self.InsertStringItem(count + idx, item)
-            self.SetStringItem(index, 0, item)
+            index = self.InsertItem(count + idx, item)
+            self.SetItem(index, 0, item)
 
             if idx in disabled:
                 self.SetItemTextColour(idx, wx.Colour(150, 150, 150))

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

@@ -757,11 +757,11 @@ class VariableListCtrl(ModelListCtrl):
         self.DeleteAllItems()
         i = 0
         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)
-            self.SetStringItem(index, 2, value)
-            self.SetStringItem(index, 3, desc)
+            index = self.InsertItem(i, name)
+            self.SetItem(index, 0, name)
+            self.SetItem(index, 1, vtype)
+            self.SetItem(index, 2, value)
+            self.SetItem(index, 3, desc)
             self.SetItemData(index, i)
             i += 1
 
@@ -776,11 +776,11 @@ class VariableListCtrl(ModelListCtrl):
                 return _("Variable <%s> already exists in the model. "
                          "Adding variable failed.") % name
 
-        index = self.InsertStringItem(self.GetItemCount(), name)
-        self.SetStringItem(index, 0, name)
-        self.SetStringItem(index, 1, vtype)
-        self.SetStringItem(index, 2, value)
-        self.SetStringItem(index, 3, desc)
+        index = self.InsertItem(self.GetItemCount(), name)
+        self.SetItem(index, 0, name)
+        self.SetItem(index, 1, vtype)
+        self.SetItem(index, 2, value)
+        self.SetItem(index, 3, desc)
         self.SetItemData(index, self.itemCount)
 
         self.itemDataMap[self.itemCount] = [name, vtype, value, desc]
@@ -942,20 +942,20 @@ class ItemListCtrl(ModelListCtrl):
         i = 0
         if len(self.columns) == 2:
             for name, desc in six.itervalues(self.itemDataMap):
-                index = self.InsertStringItem(i, str(i))
-                self.SetStringItem(index, 0, name)
-                self.SetStringItem(index, 1, desc)
+                index = self.InsertItem(i, str(i))
+                self.SetItem(index, 0, name)
+                self.SetItem(index, 1, desc)
                 self.SetItemData(index, i)
                 if checked[i]:
                     self.CheckItem(index, True)
                 i += 1
         else:
             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)
-                self.SetStringItem(index, 2, param)
-                self.SetStringItem(index, 3, desc)
+                index = self.InsertItem(i, str(i))
+                self.SetItem(index, 0, name)
+                self.SetItem(index, 1, inloop)
+                self.SetItem(index, 2, param)
+                self.SetItem(index, 3, desc)
                 self.SetItemData(index, i)
                 i += 1
 

+ 4 - 6
gui/wxpython/gui_core/preferences.py

@@ -2203,25 +2203,23 @@ class CheckListMapset(
             gisenv['LOCATION_NAME'])
 
         for mapset in self.parent.all_mapsets_ordered:
-            # unclear why this is needed,
-            # wrap.ListrCtrl should do the job but it doesn't in this case
-            index = self.InsertStringItem(self.GetItemCount(), mapset)
+            index = self.InsertItem(self.GetItemCount(), mapset)
             mapsetPath = os.path.join(locationPath,
                                       mapset)
             stat_info = os.stat(mapsetPath)
             if havePwd:
                 try:
-                    self.SetStringItem(
+                    self.SetItem(
                         index, 1, "%s" %
                         pwd.getpwuid(
                             stat_info.st_uid)[0])
                 except KeyError:
-                    self.SetStringItem(index, 1, "nobody")
+                    self.SetItem(index, 1, "nobody")
                 # FIXME: get group name
                 ### self.SetStringItem(index, 2, "%-8s" % stat_info.st_gid)
             else:
                 # FIXME: no pwd under MS Windows (owner: 0, group: 0)
-                self.SetStringItem(index, 1, "%-8s" % stat_info.st_uid)
+                self.SetItem(index, 1, "%-8s" % stat_info.st_uid)
                 ### self.SetStringItem(index, 2, "%-8s" % stat_info.st_gid)
 
         self.SetColumnWidth(col=0, width=wx.LIST_AUTOSIZE)

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

@@ -57,8 +57,8 @@ class VectorSelectList(ListCtrl, listmix.ListCtrlAutoWidthMixin):
         if 'Category' not in item:
             return
 
-        pos = self.InsertStringItem(0, str(item['Category']))
-        self.SetStringItem(pos, 1, str(item['Type']))
+        pos = self.InsertItem(0, str(item['Category']))
+        self.SetItem(pos, 1, str(item['Type']))
         self.dictIndex[str(item['Category'])] = pos
 
     def RemoveItem(self, item):

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

@@ -1034,9 +1034,9 @@ class GListCtrl(ListCtrl, listmix.ListCtrlAutoWidthMixin,
 
         idx = 0
         for item in data:
-            index = self.InsertStringItem(idx, str(item[0]))
+            index = self.InsertItem(idx, str(item[0]))
             for i in range(1, self.GetColumnCount()):
-                self.SetStringItem(index, i, item[i])
+                self.SetItem(index, i, item[i])
             idx += 1
 
         # check by default only on one item

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

@@ -258,13 +258,13 @@ class ListCtrl(wx.ListCtrl):
     def __init__(self, *args, **kwargs):
         wx.ListCtrl.__init__(self, *args, **kwargs)
 
-    def InsertStringItem(self, index, label, imageIndex=-1):
+    def InsertItem(self, index, label, imageIndex=-1):
         if wxPythonPhoenix:
             return wx.ListCtrl.InsertItem(self, index=index, label=label, imageIndex=imageIndex)
         else:
             return wx.ListCtrl.InsertStringItem(self, index=index, label=label, imageIndex=imageIndex)
 
-    def SetStringItem(self, index, column, label, imageId=-1):
+    def SetItem(self, index, column, label, imageId=-1):
         if wxPythonPhoenix:
             return wx.ListCtrl.SetItem(self, index=index, column=column, label=label, imageId=imageId)
         else:

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

@@ -33,7 +33,7 @@ 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, NewId
+    StaticBox, TextCtrl, Menu, NewId, ListCtrl
 
 import grass.script as grass
 
@@ -370,7 +370,7 @@ class IClassCategoryManagerDialog(wx.Dialog):
         return self.catList
 
 
-class CategoryListCtrl(wx.ListCtrl,
+class CategoryListCtrl(ListCtrl,
                        listmix.ListCtrlAutoWidthMixin,
                        listmix.TextEditMixin):
     """Widget for controling list of classes (categories).
@@ -390,7 +390,7 @@ class CategoryListCtrl(wx.ListCtrl,
         :param stats_data: StatisticsData instance (defined in statistics.py)
         :param id: wx id
         """
-        wx.ListCtrl.__init__(
+        ListCtrl.__init__(
             self, parent, id, style=wx.LC_REPORT | wx.LC_VIRTUAL | wx.LC_HRULES |
             wx.LC_VRULES)
         self.columns = ((_('Class name'), 'name'),

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

@@ -1119,8 +1119,8 @@ class GListBox(ListCtrl, listmix.ListCtrlAutoWidthMixin):
         idx = 0
         count = self.GetItemCount()
         for item in choices:
-            index = self.InsertStringItem(count + idx, item)
-            self.SetStringItem(index, 0, item)
+            index = self.InsertItem(count + idx, item)
+            self.SetItem(index, 0, item)
 
             if idx in disabled:
                 self.SetItemTextColour(idx, wx.Colour(150, 150, 150))

+ 21 - 21
gui/wxpython/image2target/ii2t_manager.py

@@ -62,7 +62,7 @@ from core.settings import UserSettings
 from gcp.mapdisplay import MapFrame
 from core.giface import Notification
 from gui_core.wrap import SpinCtrl, Button, StaticText, StaticBox, \
-    CheckListBox, TextCtrl, Menu
+    CheckListBox, TextCtrl, Menu, ListCtrl
 
 from location_wizard.wizard import TitledPage as TitledPage
 
@@ -1236,7 +1236,7 @@ class GCP(MapFrame, ColumnSorterMixin):
         for newkey in range(key, len(self.mapcoordlist)):
             index = self.list.FindItemData(-1, newkey + 1)
             self.mapcoordlist[newkey][0] = newkey
-            self.list.SetStringItem(index, 0, str(newkey))
+            self.list.SetItem(index, 0, str(newkey))
             self.list.SetItemData(index, newkey)
 
         # update selected
@@ -1271,9 +1271,9 @@ class GCP(MapFrame, ColumnSorterMixin):
         index = self.list.GetSelected()
         key = self.list.GetItemData(index)
         for i in range(1, 7):
-            self.list.SetStringItem(index, i, '0.0')
-        self.list.SetStringItem(index, 7, '')
-        self.list.SetStringItem(index, 8, '')
+            self.list.SetItem(index, i, '0.0')
+        self.list.SetItem(index, 7, '')
+        self.list.SetItem(index, 8, '')
         self.list.CheckItem(index, False)
 
         # GCP number, source E, source N, target E, target N, fwd error, bkwd
@@ -1388,15 +1388,15 @@ class GCP(MapFrame, ColumnSorterMixin):
                 return
 
         if coordtype == 'source':
-            self.list.SetStringItem(index, 1, str(coord0))
-            self.list.SetStringItem(index, 2, str(coord1))
+            self.list.SetItem(index, 1, str(coord0))
+            self.list.SetItem(index, 2, str(coord1))
             self.mapcoordlist[key][1] = coord[0]
             self.mapcoordlist[key][2] = coord[1]
             self.pointsToDrawSrc.GetItem(key - 1).SetCoords([coord0, coord1])
 
         elif coordtype == 'target':
-            self.list.SetStringItem(index, 4, str(coord0))
-            self.list.SetStringItem(index, 5, str(coord1))
+            self.list.SetItem(index, 4, str(coord0))
+            self.list.SetItem(index, 5, str(coord1))
             self.mapcoordlist[key][4] = coord[0]
             self.mapcoordlist[key][5] = coord[1]
             #ADD ELEVATION FROM MAP AS HEIGHT PARAMETER
@@ -1423,12 +1423,12 @@ class GCP(MapFrame, ColumnSorterMixin):
                                   coordinates=[coord[0],coord[1]],
                                   stdout_=PIPE)
                 self.mapcoordlist[key][6] = rwhat.outputs.stdout.split('|')[3].rstrip('\n')
-                self.list.SetStringItem(index, 6, str(self.mapcoordlist[key][6]))
+                self.list.SetItem(index, 6, str(self.mapcoordlist[key][6]))
 
             self.pointsToDrawTgt.GetItem(key - 1).SetCoords([coord0, coord1])
 
-        self.list.SetStringItem(index, 7, '0')
-        self.list.SetStringItem(index, 8, '0')
+        self.list.SetItem(index, 7, '0')
+        self.list.SetItem(index, 8, '0')
         self.mapcoordlist[key][7] = 0.0
         self.mapcoordlist[key][8] = 0.0
 
@@ -1895,8 +1895,8 @@ class GCP(MapFrame, ColumnSorterMixin):
             key = self.list.GetItemData(index)
             if self.list.IsChecked(index):
                 fwd_err, bkw_err = errlist[GCPcount].split()
-                self.list.SetStringItem(index, 7, fwd_err)
-                self.list.SetStringItem(index, 8, bkw_err)
+                self.list.SetItem(index, 7, fwd_err)
+                self.list.SetItem(index, 8, bkw_err)
                 self.mapcoordlist[key][7] = float(fwd_err)
                 self.mapcoordlist[key][8] = float(bkw_err)
                 self.list.SetItemTextColour(index, wx.BLACK)
@@ -1911,8 +1911,8 @@ class GCP(MapFrame, ColumnSorterMixin):
                 sum_fwd_err += float(fwd_err)
                 GCPcount += 1
             else:
-                self.list.SetStringItem(index, 7, '')
-                self.list.SetStringItem(index, 8, '')
+                self.list.SetItem(index, 7, '')
+                self.list.SetItem(index, 8, '')
                 self.mapcoordlist[key][7] = 0.0
                 self.mapcoordlist[key][8] = 0.0
                 self.list.SetItemTextColour(index, wx.BLACK)
@@ -2174,7 +2174,7 @@ class GCP(MapFrame, ColumnSorterMixin):
         pass
 
 
-class GCPList(wx.ListCtrl,
+class GCPList(ListCtrl,
               CheckListCtrlMixin,
               ListCtrlAutoWidthMixin):
 
@@ -2183,7 +2183,7 @@ class GCPList(wx.ListCtrl,
                  style=wx.LC_REPORT | wx.SUNKEN_BORDER | wx.LC_HRULES |
                  wx.LC_SINGLE_SEL):
 
-        wx.ListCtrl.__init__(self, parent, id, pos, size, style)
+        ListCtrl.__init__(self, parent, id, pos, size, style)
 
         self.gcp = gcp  # GCP class
         self.render = True
@@ -2381,13 +2381,13 @@ class GCPList(wx.ListCtrl,
             else:
                 for i in range(len(values)):
                     if values[i] != coords[i]:
-                        self.SetStringItem(index, i + 1, values[i])
+                        self.SetItem(index, i + 1, values[i])
                         changed = True
 
                 if changed:
                     # reset RMS and update mapcoordlist
-                    self.SetStringItem(index, 7, '')
-                    self.SetStringItem(index, 8, '')
+                    self.SetItem(index, 7, '')
+                    self.SetItem(index, 8, '')
                     key = self.GetItemData(index)
                     self.gcp.mapcoordlist[key] = [key,
                                                   float(values[0]),

+ 3 - 3
gui/wxpython/iscatt/frame.py

@@ -33,7 +33,7 @@ from core.gcmd import GException, GError, RunCommand
 
 from gui_core.gselect import Select
 from gui_core.dialogs import SetOpacityDialog
-from gui_core.wrap import StaticBox, Menu
+from gui_core.wrap import StaticBox, Menu, ListCtrl
 from iscatt.controllers import ScattsManager
 from iscatt.toolbars import MainToolbar, EditingToolbar, CategoryToolbar
 from iscatt.iscatt_core import idScattToidBands
@@ -406,13 +406,13 @@ class ScatterPlotsPanel(scrolled.ScrolledPanel):
         return self.scatt_mgr
 
 
-class CategoryListCtrl(wx.ListCtrl,
+class CategoryListCtrl(ListCtrl,
                        listmix.ListCtrlAutoWidthMixin):
                        # listmix.TextEditMixin):
 
     def __init__(self, parent, cats_mgr, sel_cats_in_iscatt, id=wx.ID_ANY):
 
-        wx.ListCtrl.__init__(
+        ListCtrl.__init__(
             self, parent, id, style=wx.LC_REPORT | wx.LC_VIRTUAL | wx.LC_HRULES |
             wx.LC_VRULES | wx.LC_SINGLE_SEL | wx.LC_NO_HEADER)
         self.columns = ((_('Class name'), 'name'), )

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

@@ -55,7 +55,7 @@ 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, StaticText, \
-    TextCtrl, Button, CheckBox, StaticBox, NewId
+    TextCtrl, Button, CheckBox, StaticBox, NewId, ListCtrl
 from location_wizard.base import BaseClass
 from location_wizard.dialogs import SelectTransformDialog
 
@@ -576,13 +576,13 @@ class ProjectionsPage(TitledPage):
         event.Skip()
 
 
-class ItemList(wx.ListCtrl,
+class ItemList(ListCtrl,
                listmix.ListCtrlAutoWidthMixin,
                listmix.ColumnSorterMixin):
     """Generic list (for projections, ellipsoids, etc.)"""
 
     def __init__(self, parent, columns, data=None):
-        wx.ListCtrl.__init__(self, parent=parent, id=wx.ID_ANY,
+        ListCtrl.__init__(self, parent=parent, id=wx.ID_ANY,
                              style=wx.LC_REPORT |
                              wx.LC_VIRTUAL |
                              wx.LC_HRULES |

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

@@ -535,7 +535,7 @@ class CheckListExtension(GListCtrl):
                               quiet=True, parent=self, read=True,
                               flags='a').splitlines():
             if ext:
-                self.InsertStringItem(self.GetItemCount(), ext)
+                self.InsertItem(self.GetItemCount(), ext)
 
     def GetExtensions(self):
         """Get extensions to be un-installed

+ 20 - 20
gui/wxpython/photo2image/ip2i_manager.py

@@ -54,7 +54,7 @@ from core.settings import UserSettings
 from photo2image.ip2i_mapdisplay import MapFrame
 from core.giface import Notification
 from gui_core.wrap import SpinCtrl, Button, StaticText, StaticBox, \
-    TextCtrl, Menu
+    TextCtrl, Menu, ListCtrl
 
 from location_wizard.wizard import TitledPage as TitledPage
 
@@ -627,7 +627,7 @@ class GCP(MapFrame, ColumnSorterMixin):
         for newkey in range(key, len(self.mapcoordlist)):
             index = self.list.FindItemData(-1, newkey + 1)
             self.mapcoordlist[newkey][0] = newkey
-            self.list.SetStringItem(index, 0, str(newkey))
+            self.list.SetItem(index, 0, str(newkey))
             self.list.SetItemData(index, newkey)
 
         # update selected
@@ -663,9 +663,9 @@ class GCP(MapFrame, ColumnSorterMixin):
         key = self.list.GetItemData(index)
 
         for i in range(1, 5):
-            self.list.SetStringItem(index, i, '0.0')
-        self.list.SetStringItem(index, 5, '')
-        self.list.SetStringItem(index, 6, '')
+            self.list.SetItem(index, i, '0.0')
+        self.list.SetItem(index, 5, '')
+        self.list.SetItem(index, 6, '')
         self.list.CheckItem(index, False)
 
         # GCP number, source E, source N, target E, target N, fwd error, bkwd
@@ -780,21 +780,21 @@ class GCP(MapFrame, ColumnSorterMixin):
                 return
 
         if coordtype == 'source':
-            self.list.SetStringItem(index, 1, str(coord0))
-            self.list.SetStringItem(index, 2, str(coord1))
+            self.list.SetItem(index, 1, str(coord0))
+            self.list.SetItem(index, 2, str(coord1))
             self.mapcoordlist[key][1] = coord[0]
             self.mapcoordlist[key][2] = coord[1]
             self.pointsToDrawSrc.GetItem(key - 1).SetCoords([coord0, coord1])
 
         elif coordtype == 'target':
-            self.list.SetStringItem(index, 3, str(coord0))
-            self.list.SetStringItem(index, 4, str(coord1))
+            self.list.SetItem(index, 3, str(coord0))
+            self.list.SetItem(index, 4, str(coord1))
             self.mapcoordlist[key][3] = coord[0]
             self.mapcoordlist[key][4] = coord[1]
             self.pointsToDrawTgt.GetItem(key - 1).SetCoords([coord0, coord1])
 
-        self.list.SetStringItem(index, 5, '0')
-        self.list.SetStringItem(index, 6, '0')
+        self.list.SetItem(index, 5, '0')
+        self.list.SetItem(index, 6, '0')
         self.mapcoordlist[key][5] = 0.0
         self.mapcoordlist[key][6] = 0.0
 
@@ -1218,8 +1218,8 @@ class GCP(MapFrame, ColumnSorterMixin):
             key = self.list.GetItemData(index)
             if self.list.IsChecked(index):
                 fwd_err, bkw_err = errlist[GCPcount].split()
-                self.list.SetStringItem(index, 5, fwd_err)
-                self.list.SetStringItem(index, 6, bkw_err)
+                self.list.SetItem(index, 5, fwd_err)
+                self.list.SetItem(index, 6, bkw_err)
                 self.mapcoordlist[key][5] = float(fwd_err)
                 self.mapcoordlist[key][6] = float(bkw_err)
                 self.list.SetItemTextColour(index, wx.BLACK)
@@ -1234,8 +1234,8 @@ class GCP(MapFrame, ColumnSorterMixin):
                 sum_fwd_err += float(fwd_err)
                 GCPcount += 1
             else:
-                self.list.SetStringItem(index, 5, '')
-                self.list.SetStringItem(index, 6, '')
+                self.list.SetItem(index, 5, '')
+                self.list.SetItem(index, 6, '')
                 self.mapcoordlist[key][5] = 0.0
                 self.mapcoordlist[key][6] = 0.0
                 self.list.SetItemTextColour(index, wx.BLACK)
@@ -1499,7 +1499,7 @@ class GCP(MapFrame, ColumnSorterMixin):
         pass
 
 
-class GCPList(wx.ListCtrl,
+class GCPList(ListCtrl,
               CheckListCtrlMixin,
               ListCtrlAutoWidthMixin):
 
@@ -1508,7 +1508,7 @@ class GCPList(wx.ListCtrl,
                  style=wx.LC_REPORT | wx.SUNKEN_BORDER | wx.LC_HRULES |
                  wx.LC_SINGLE_SEL):
 
-        wx.ListCtrl.__init__(self, parent, id, pos, size, style)
+        ListCtrl.__init__(self, parent, id, pos, size, style)
 
         self.gcp = gcp  # GCP class
         self.render = True
@@ -1700,13 +1700,13 @@ class GCPList(wx.ListCtrl,
             else:
                 for i in range(len(values)):
                     if values[i] != coords[i]:
-                        self.SetStringItem(index, i + 1, values[i])
+                        self.SetItem(index, i + 1, values[i])
                         changed = True
 
                 if changed:
                     # reset RMS and update mapcoordlist
-                    self.SetStringItem(index, 5, '')
-                    self.SetStringItem(index, 6, '')
+                    self.SetItem(index, 5, '')
+                    self.SetItem(index, 6, '')
                     key = self.GetItemData(index)
                     self.gcp.mapcoordlist[key] = [key,
                                                   float(values[0]),

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

@@ -3653,9 +3653,9 @@ class LegendDialog(PsmapDialog):
                 key=lambda x: x[3])
 
             for vector in vectors:
-                index = self.vectorListCtrl.InsertStringItem(
+                index = self.vectorListCtrl.InsertItem(
                     self.vectorListCtrl.GetItemCount(), vector[0].split('@')[0])
-                self.vectorListCtrl.SetStringItem(index, 1, vector[4])
+                self.vectorListCtrl.SetItem(index, 1, vector[4])
                 self.vectorListCtrl.SetItemData(index, index)
                 self.vectorListCtrl.CheckItem(index, True)
                 if vector[3] == 0:
@@ -4153,7 +4153,7 @@ class LegendDialog(PsmapDialog):
                 style=wx.OK | wx.CANCEL | wx.CENTRE)
             if dlg.ShowModal() == wx.ID_OK:
                 new = dlg.GetValue()
-                self.vectorListCtrl.SetStringItem(idx, 1, new)
+                self.vectorListCtrl.SetItem(idx, 1, new)
             dlg.Destroy()
 
     def OnSpan(self, event):
@@ -4462,9 +4462,9 @@ class LegendDialog(PsmapDialog):
                 key=lambda x: x[3])
             self.vectorListCtrl.DeleteAllItems()
             for vector in vectors:
-                index = self.vectorListCtrl.InsertStringItem(
+                index = self.vectorListCtrl.InsertItem(
                     self.vectorListCtrl.GetItemCount(), vector[0].split('@')[0])
-                self.vectorListCtrl.SetStringItem(index, 1, vector[4])
+                self.vectorListCtrl.SetItem(index, 1, vector[4])
                 self.vectorListCtrl.SetItemData(index, index)
                 self.vectorListCtrl.CheckItem(index, True)
                 if vector[3] == 0:

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

@@ -242,8 +242,8 @@ class VDigitCategoryDialog(wx.Dialog, listmix.ColumnSorterMixin):
             self.cats[self.fid][layerOld].remove(catOld)
         except:
             event.Veto()
-            self.list.SetStringItem(itemIndex, 0, str(layerNew))
-            self.list.SetStringItem(itemIndex, 1, str(catNew))
+            self.list.SetItem(itemIndex, 0, str(layerNew))
+            self.list.SetItem(itemIndex, 1, str(catNew))
             dlg = wx.MessageDialog(
                 self, _(
                     "Unable to add new layer/category <%(layer)s/%(category)s>.\n"
@@ -583,9 +583,9 @@ class CategoryListCtrl(ListCtrl,
         for layer in cats.keys():
             catsList = cats[layer]
             for cat in catsList:
-                index = self.InsertStringItem(self.GetItemCount(), str(catsList[0]))
-                self.SetStringItem(index, 0, str(layer))
-                self.SetStringItem(index, 1, str(cat))
+                index = self.InsertItem(self.GetItemCount(), str(catsList[0]))
+                self.SetItem(index, 0, str(layer))
+                self.SetItem(index, 1, str(cat))
                 self.SetItemData(index, i)
                 itemData[i] = (str(layer), str(cat))
                 i = i + 1
@@ -802,8 +802,8 @@ class CheckListFeature(
         self.InsertColumn(1, _('Layer (Categories)'))
 
         for item in data:
-            index = self.InsertStringItem(self.GetItemCount(), str(item[0]))
-            self.SetStringItem(index, 1, str(item[1]))
+            index = self.InsertItem(self.GetItemCount(), str(item[0]))
+            self.SetItem(index, 1, str(item[1]))
 
         # enable all items by default
         for item in range(self.GetItemCount()):

+ 3 - 3
gui/wxpython/vnet/dialogs.py

@@ -56,7 +56,7 @@ 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, Button, BitmapButton, StaticText, \
-    StaticBox, TextCtrl
+    StaticBox, TextCtrl, ListCtrl
 
 from vnet.widgets import PointsList
 from vnet.toolbars import MainToolbar, PointListToolbar, AnalysisToolbar
@@ -1901,12 +1901,12 @@ class DefGlobalTurnsDialog(wx.Dialog):
 
 
 class TurnAnglesList(
-        wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.TextEditMixin):
+        ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.TextEditMixin):
     """Virtual editable table with global turns"""
 
     def __init__(self, parent, data, id=wx.ID_ANY,
                  style=wx.LC_REPORT | wx.LC_VIRTUAL, **kwargs):
-        wx.ListCtrl.__init__(self, parent, id, style=style, **kwargs)
+        ListCtrl.__init__(self, parent, id, style=style, **kwargs)
         listmix.ListCtrlAutoWidthMixin.__init__(self)
         listmix.TextEditMixin.__init__(self)
 

+ 8 - 8
gui/wxpython/vnet/widgets.py

@@ -28,13 +28,13 @@ from wx.lib.mixins.listctrl import CheckListCtrlMixin, ColumnSorterMixin, \
     ListCtrlAutoWidthMixin, TextEditMixin
 
 from core import globalvar
-from gui_core.wrap import Button, StaticText, StaticBox, TextCtrl
+from gui_core.wrap import Button, StaticText, StaticBox, TextCtrl, ListCtrl
 
 if sys.version_info.major >= 3:
     basestring = str
 
 
-class PointsList(wx.ListCtrl,
+class PointsList(ListCtrl,
                  CheckListCtrlMixin,
                  ListCtrlAutoWidthMixin,
                  ColumnSorterMixin):
@@ -79,7 +79,7 @@ class PointsList(wx.ListCtrl,
         @endcode
         """
 
-        wx.ListCtrl.__init__(self, parent, id, pos, size, style)
+        ListCtrl.__init__(self, parent, id, pos, size, style)
 
         # Mixin settings
         CheckListCtrlMixin.__init__(self)
@@ -240,7 +240,7 @@ class PointsList(wx.ListCtrl,
         self.itemDataMap[key][colNum] = cellVal
         if not isinstance(cellVal, basestring):
             cellVal = str(cellVal)
-        self.SetStringItem(index, colNum, cellVal)
+        self.SetItem(index, colNum, cellVal)
 
     def EditCellKey(self, key, colName, cellData):
         """Changes value in list using index (changes during sorting)"""
@@ -260,7 +260,7 @@ class PointsList(wx.ListCtrl,
         if index != -1:
             if not isinstance(cellVal, basestring):
                 cellVal = str(cellVal)
-            self.SetStringItem(index, colNum, cellVal)
+            self.SetItem(index, colNum, cellVal)
 
     def _findIndex(self, key):
         """Find index for key"""
@@ -286,7 +286,7 @@ class PointsList(wx.ListCtrl,
             return
 
         key = self.GetItemData(self.selected)
-        wx.ListCtrl.DeleteItem(self, self.selected)
+        ListCtrl.DeleteItem(self, self.selected)
 
         del self.itemDataMap[key]
         self.selIdxs.pop(key)
@@ -300,7 +300,7 @@ class PointsList(wx.ListCtrl,
         for newkey in range(key, len(self.itemDataMap)):
             index = self.FindItemData(-1, newkey + 1)
             self.itemDataMap[newkey][0] = newkey
-            self.SetStringItem(index, 0, str(newkey + 1))
+            self.SetItem(index, 0, str(newkey + 1))
             self.SetItemData(index, newkey)
 
         # update selected
@@ -394,7 +394,7 @@ class PointsList(wx.ListCtrl,
                         value = editedCell[1]
                         if not isinstance(editedCell[1], basestring):
                             value = str(editedCell[1])
-                        self.SetStringItem(index, editedCell[0], value)
+                        self.SetItem(index, editedCell[0], value)
                         self.itemDataMap[key][editedCell[0]] = editedCell[1]
                         changed = True
                     i += 1