IDE: fix again ruberband with gtk3. wxPython4
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Sun, 12 Mar 2023 00:51:53 +0100
branchwxPython4
changeset 3746 41be039fbb8c
parent 3745 8a393ba12cd7
child 3747 1db10e9df882
IDE: fix again ruberband with gtk3.

DC logical functions are now disabled when using GTK3.
Apparently using XOR was still having an effect.
Use regular black pen with no logical funciton instead.
graphics/RubberBand.py
--- a/graphics/RubberBand.py	Fri Mar 10 13:00:31 2023 +0100
+++ b/graphics/RubberBand.py	Sun Mar 12 00:51:53 2023 +0100
@@ -139,6 +139,11 @@
 
         self.Redraw()
 
+    def SetRubberBandPen(self, dc):
+        # Set DC drawing style
+        dc.SetPen(wx.Pen(wx.WHITE, style=wx.DOT))
+        dc.SetLogicalFunction(wx.XOR)
+
     def DrawBoundingBoxes(self, bboxes, dc=None):
         """
         Draw a list of bounding box on Viewer in the order given using XOR
@@ -155,10 +160,9 @@
         scalex, scaley = dc.GetUserScale()
         dc.SetUserScale(1, 1)
 
-        # Set DC drawing style
-        dc.SetPen(wx.Pen(wx.WHITE, style=wx.DOT))
+        self.SetRubberBandPen(dc)
+
         dc.SetBrush(wx.TRANSPARENT_BRUSH)
-        dc.SetLogicalFunction(wx.XOR)
 
         # Draw the bounding boxes using viewer scale factor
         for bbox in bboxes:
@@ -214,6 +218,10 @@
 
     RubberBand.Erase = Erase
 
+    def SetRubberBandPen(self, dc):
+        dc.SetPen(wx.Pen(wx.BLACK, style=wx.DOT))
+
+    RubberBand.SetRubberBandPen = SetRubberBandPen
 
 if "gtk3" in wx.PlatformInfo:
     PatchRubberBandForGTK3()