[GRASS-SVN] r73481 - grass/branches/releasebranch_7_4/gui/wxpython/gui_core

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Oct 1 19:12:44 PDT 2018


Author: annakrat
Date: 2018-10-01 19:12:44 -0700 (Mon, 01 Oct 2018)
New Revision: 73481

Modified:
   grass/branches/releasebranch_7_4/gui/wxpython/gui_core/preferences.py
   grass/branches/releasebranch_7_4/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_4/gui/wxpython/gui_core/preferences.py
===================================================================
--- grass/branches/releasebranch_7_4/gui/wxpython/gui_core/preferences.py	2018-10-02 02:10:47 UTC (rev 73480)
+++ grass/branches/releasebranch_7_4/gui/wxpython/gui_core/preferences.py	2018-10-02 02:12:44 UTC (rev 73481)
@@ -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):
@@ -2184,14 +2186,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
 
@@ -2209,7 +2211,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_4/gui/wxpython/gui_core/widgets.py
===================================================================
--- grass/branches/releasebranch_7_4/gui/wxpython/gui_core/widgets.py	2018-10-02 02:10:47 UTC (rev 73480)
+++ grass/branches/releasebranch_7_4/gui/wxpython/gui_core/widgets.py	2018-10-02 02:12:44 UTC (rev 73481)
@@ -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