beremiz

IDE: fix again ruberband with gtk3.
wxPython4
2023-03-12, Edouard Tisserant
41be039fbb8c
Parents 8a393ba12cd7
Children 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.
--- 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()