[GRASS-SVN] r73480 - grass/branches/releasebranch_7_6/gui/wxpython/gui_core

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Oct 1 19:10:47 PDT 2018


Author: annakrat
Date: 2018-10-01 19:10:47 -0700 (Mon, 01 Oct 2018)
New Revision: 73480

Modified:
   grass/branches/releasebranch_7_6/gui/wxpython/gui_core/preferences.py
   grass/branches/releasebranch_7_6/gui/wxpython/gui_core/widgets.py
Log:
wxGUI: fix loading data to ListCtrl with checkboxes for wxPython 4 (merged from trunk, r73233, r73472)

Modified: grass/branches/releasebranch_7_6/gui/wxpython/gui_core/preferences.py
===================================================================
--- grass/branches/releasebranch_7_6/gui/wxpython/gui_core/preferences.py	2018-10-02 02:01:05 UTC (rev 73479)
+++ grass/branches/releasebranch_7_6/gui/wxpython/gui_core/preferences.py	2018-10-02 02:10:47 UTC (rev 73480)
@@ -47,10 +47,12 @@
 from core.gcmd import RunCommand, GError
 from core.utils import ListOfMapsets, GetColorTables, ReadEpsgCodes, _
 from core.settings import UserSettings
+from core.globalvar import wxPythonPhoenix
 from gui_core.dialogs import SymbolDialog, DefaultFontDialog
 from gui_core.widgets import IntegerValidator, ColorTablesComboBox
 from core.debug import Debug
-from gui_core.wrap import SpinCtrl, Button
+from gui_core.wrap import SpinCtrl, Button, BitmapButton, StaticText, \
+    StaticBox, TextCtrl, ListCtrl
 
 
 class PreferencesBaseDialog(wx.Dialog):
@@ -2176,14 +2178,14 @@
 
 
 class CheckListMapset(
-        wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.CheckListCtrlMixin):
+        ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.CheckListCtrlMixin):
     """List of mapset/owner/group"""
 
     def __init__(self, parent, log=None):
         self.parent = parent
 
-        wx.ListCtrl.__init__(self, parent, wx.ID_ANY,
-                             style=wx.LC_REPORT)
+        ListCtrl.__init__(self, parent, wx.ID_ANY,
+                          style=wx.LC_REPORT)
         listmix.CheckListCtrlMixin.__init__(self)
         self.log = log
 
@@ -2201,7 +2203,12 @@
             gisenv['LOCATION_NAME'])
 
         for mapset in self.parent.all_mapsets_ordered:
-            index = self.InsertStringItem(self.GetItemCount(), mapset)
+            # unclear why this is needed,
+            # wrap.ListrCtrl should do the job but it doesn't in this case
+            if wxPythonPhoenix:
+                index = self.InsertItem(self.GetItemCount(), mapset)
+            else:
+                index = self.InsertStringItem(self.GetItemCount(), mapset)
             mapsetPath = os.path.join(locationPath,
                                       mapset)
             stat_info = os.stat(mapsetPath)

Modified: grass/branches/releasebranch_7_6/gui/wxpython/gui_core/widgets.py
===================================================================
--- grass/branches/releasebranch_7_6/gui/wxpython/gui_core/widgets.py	2018-10-02 02:01:05 UTC (rev 73479)
+++ grass/branches/releasebranch_7_6/gui/wxpython/gui_core/widgets.py	2018-10-02 02:10:47 UTC (rev 73480)
@@ -89,7 +89,8 @@
 from core.utils import _
 from core.gcmd import GMessage, GError
 from core.debug import Debug
-from gui_core.wrap import Button, SearchCtrl
+from gui_core.wrap import Button, SearchCtrl, StaticText, StaticBox, \
+    TextCtrl, Menu, Rect, EmptyBitmap, ListCtrl
 
 
 class NotebookController:
@@ -933,7 +934,7 @@
         self.Refresh()
 
 
-class GListCtrl(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin,
+class GListCtrl(ListCtrl, listmix.ListCtrlAutoWidthMixin,
                 listmix.CheckListCtrlMixin):
     """Generic ListCtrl with popup menu to select/deselect all
     items"""
@@ -941,7 +942,7 @@
     def __init__(self, parent):
         self.parent = parent
 
-        wx.ListCtrl.__init__(self, parent, id=wx.ID_ANY,
+        ListCtrl.__init__(self, parent, id=wx.ID_ANY,
                              style=wx.LC_REPORT)
         listmix.CheckListCtrlMixin.__init__(self)
 
@@ -1033,7 +1034,10 @@
 
         idx = 0
         for item in data:
-            index = self.InsertStringItem(idx, str(item[0]))
+            if wxPythonPhoenix:
+                index = self.InsertItem(idx, str(item[0]))
+            else:
+                index = self.InsertStringItem(idx, str(item[0]))
             for i in range(1, self.GetColumnCount()):
                 self.SetStringItem(index, i, item[i])
             idx += 1



More information about the grass-commit mailing list