[GRASS-SVN] r73463 - in grass/trunk/gui/wxpython: gui_core psmap

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Sep 29 13:17:33 PDT 2018


Author: annakrat
Date: 2018-09-29 13:17:33 -0700 (Sat, 29 Sep 2018)
New Revision: 73463

Modified:
   grass/trunk/gui/wxpython/gui_core/dialogs.py
   grass/trunk/gui/wxpython/gui_core/wrap.py
   grass/trunk/gui/wxpython/psmap/dialogs.py
   grass/trunk/gui/wxpython/psmap/frame.py
Log:
wxGUI/psmap: wxPython 4 compatibility

Modified: grass/trunk/gui/wxpython/gui_core/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/dialogs.py	2018-09-29 19:33:40 UTC (rev 73462)
+++ grass/trunk/gui/wxpython/gui_core/dialogs.py	2018-09-29 20:17:33 UTC (rev 73463)
@@ -2072,7 +2072,7 @@
         mainPanel = wx.Panel(self, id=wx.ID_ANY)
         mainSizer = wx.BoxSizer(wx.VERTICAL)
         vSizer = wx.BoxSizer(wx.VERTICAL)
-        fgSizer = wx.FlexGridSizer(rows=2, vgap=5, hgap=5)
+        fgSizer = wx.FlexGridSizer(rows=2, cols=2, vgap=5, hgap=5)
         self.folderChoice = wx.Choice(
             mainPanel,
             id=wx.ID_ANY,

Modified: grass/trunk/gui/wxpython/gui_core/wrap.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/wrap.py	2018-09-29 19:33:40 UTC (rev 73462)
+++ grass/trunk/gui/wxpython/gui_core/wrap.py	2018-09-29 20:17:33 UTC (rev 73463)
@@ -382,7 +382,13 @@
         else:
             return wx.Rect.ContainsRect(self, rect)
 
+    def OffsetXY(self, dx, dy):
+        if wxPythonPhoenix:
+            return wx.Rect.Offset(self, dx, dy)
+        else:
+            return wx.Rect.OffsetXY(self, dx, dy)
 
+
 class CheckBox(wx.CheckBox):
     """Wrapper around wx.CheckBox to have more control
     over the widget on different platforms/wxpython versions"""

Modified: grass/trunk/gui/wxpython/psmap/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/psmap/dialogs.py	2018-09-29 19:33:40 UTC (rev 73462)
+++ grass/trunk/gui/wxpython/psmap/dialogs.py	2018-09-29 20:17:33 UTC (rev 73463)
@@ -53,10 +53,12 @@
 
 if globalvar.wxPythonPhoenix:
     import wx.adv
-    from wx.adv import OwnerDrawnComboBox
+    from wx.adv import OwnerDrawnComboBox, ODCB_PAINTING_CONTROL, ODCB_PAINTING_SELECTED
+    from wx.adv import BitmapComboBox
 else:
     import wx.combo
-    from wx.combo import OwnerDrawnComboBox
+    from wx.combo import OwnerDrawnComboBox, ODCB_PAINTING_CONTROL, ODCB_PAINTING_SELECTED
+    from wx.combo import BitmapComboBox
 
 if globalvar.wxPythonPhoenix:
     from wx import Validator as Validator
@@ -176,9 +178,9 @@
         background area of each item."""
         # If the item is selected, or its item # iseven, or we are painting the
         # combo control itself, then use the default rendering.
-        if (item & 1 == 0 or flags & (wx.combo.ODCB_PAINTING_CONTROL |
-                                      wx.combo.ODCB_PAINTING_SELECTED)):
-            wx.combo.OwnerDrawnComboBox.OnDrawBackground(
+        if (item & 1 == 0 or flags & (ODCB_PAINTING_CONTROL |
+                                      ODCB_PAINTING_SELECTED)):
+            OwnerDrawnComboBox.OnDrawBackground(
                 self, dc, rect, item, flags)
             return
 
@@ -4945,7 +4947,7 @@
         gridBagSizer = wx.GridBagSizer(hgap=5, vgap=5)
 
         sbTypeText = StaticText(panel, id=wx.ID_ANY, label=_("Type:"))
-        self.sbCombo = wx.combo.BitmapComboBox(panel, style=wx.CB_READONLY)
+        self.sbCombo = BitmapComboBox(panel, style=wx.CB_READONLY)
         # only temporary, images must be moved away
         imagePath = os.path.join(
             globalvar.IMGDIR, "scalebar-fancy.png"), os.path.join(

Modified: grass/trunk/gui/wxpython/psmap/frame.py
===================================================================
--- grass/trunk/gui/wxpython/psmap/frame.py	2018-09-29 19:33:40 UTC (rev 73462)
+++ grass/trunk/gui/wxpython/psmap/frame.py	2018-09-29 20:17:33 UTC (rev 73463)
@@ -2137,7 +2137,10 @@
         # redraw preview
         else:  # preview mode
             imageRect = self.pdcImage.GetIdBounds(self.imageId)
-            imageRect.OffsetXY(-view[0], -view[1])
+            if globalvar.wxPythonPhoenix:
+                imageRect.Offset(-view[0], -view[1])
+            else:
+                imageRect.OffsetXY(-view[0], -view[1])
             imageRect = self.ScaleRect(rect=imageRect, scale=zoomFactor)
             self.DrawImage(imageRect)
 



More information about the grass-commit mailing list