[GRASS-SVN] r73465 - in grass/branches/releasebranch_7_4/gui/wxpython: gui_core psmap

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Sep 29 13:20:42 PDT 2018


Author: annakrat
Date: 2018-09-29 13:20:42 -0700 (Sat, 29 Sep 2018)
New Revision: 73465

Modified:
   grass/branches/releasebranch_7_4/gui/wxpython/gui_core/dialogs.py
   grass/branches/releasebranch_7_4/gui/wxpython/gui_core/wrap.py
   grass/branches/releasebranch_7_4/gui/wxpython/psmap/dialogs.py
   grass/branches/releasebranch_7_4/gui/wxpython/psmap/frame.py
Log:
wxGUI/psmap: wxPython 4 compatibility (merged from trunk, r73463)

Modified: grass/branches/releasebranch_7_4/gui/wxpython/gui_core/dialogs.py
===================================================================
--- grass/branches/releasebranch_7_4/gui/wxpython/gui_core/dialogs.py	2018-09-29 20:19:36 UTC (rev 73464)
+++ grass/branches/releasebranch_7_4/gui/wxpython/gui_core/dialogs.py	2018-09-29 20:20:42 UTC (rev 73465)
@@ -2070,7 +2070,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/branches/releasebranch_7_4/gui/wxpython/gui_core/wrap.py
===================================================================
--- grass/branches/releasebranch_7_4/gui/wxpython/gui_core/wrap.py	2018-09-29 20:19:36 UTC (rev 73464)
+++ grass/branches/releasebranch_7_4/gui/wxpython/gui_core/wrap.py	2018-09-29 20:20:42 UTC (rev 73465)
@@ -307,7 +307,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/branches/releasebranch_7_4/gui/wxpython/psmap/dialogs.py
===================================================================
--- grass/branches/releasebranch_7_4/gui/wxpython/psmap/dialogs.py	2018-09-29 20:19:36 UTC (rev 73464)
+++ grass/branches/releasebranch_7_4/gui/wxpython/psmap/dialogs.py	2018-09-29 20:20:42 UTC (rev 73465)
@@ -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
@@ -175,9 +177,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
 
@@ -4944,7 +4946,7 @@
         gridBagSizer = wx.GridBagSizer(hgap=5, vgap=5)
 
         sbTypeText = wx.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/branches/releasebranch_7_4/gui/wxpython/psmap/frame.py
===================================================================
--- grass/branches/releasebranch_7_4/gui/wxpython/psmap/frame.py	2018-09-29 20:19:36 UTC (rev 73464)
+++ grass/branches/releasebranch_7_4/gui/wxpython/psmap/frame.py	2018-09-29 20:20:42 UTC (rev 73465)
@@ -2134,7 +2134,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