More WxPython 3.x->4.x API update wxPython4
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Sun, 05 Sep 2021 15:24:14 +0200
branchwxPython4
changeset 3307 eeec6e0ea269
parent 3306 841fb2ee1213
child 3308 358ccd42e052
More WxPython 3.x->4.x API update
Beremiz_service.py
controls/DebugVariablePanel/DebugVariableGraphicViewer.py
controls/PouInstanceVariablesPanel.py
--- a/Beremiz_service.py	Sun Sep 05 05:43:17 2021 +0200
+++ b/Beremiz_service.py	Sun Sep 05 15:24:14 2021 +0200
@@ -224,6 +224,7 @@
 
     if havewx:
         import re
+        import wx.adv
 
         if wx.VERSION >= (3, 0, 0):
             app = wx.App(redirect=False)
@@ -265,7 +266,7 @@
             def SetTests(self, tests):
                 self.Tests = tests
 
-        class BeremizTaskBarIcon(wx.TaskBarIcon):
+        class BeremizTaskBarIcon(wx.adv.TaskBarIcon):
             TBMENU_START = wx.NewId()
             TBMENU_STOP = wx.NewId()
             TBMENU_CHANGE_NAME = wx.NewId()
@@ -277,7 +278,7 @@
             TBMENU_QUIT = wx.NewId()
 
             def __init__(self, pyroserver):
-                wx.TaskBarIcon.__init__(self)
+                wx.adv.TaskBarIcon.__init__(self)
                 self.pyroserver = pyroserver
                 # Set the image
                 self.UpdateIcon(None)
@@ -325,7 +326,7 @@
                 elif "wxGTK" in wx.PlatformInfo:
                     img = img.Scale(22, 22)
                 # wxMac can be any size upto 128x128, so leave the source img alone....
-                icon = wx.IconFromBitmap(img.ConvertToBitmap())
+                icon = wx.Icon(img.ConvertToBitmap())
                 return icon
 
             def OnTaskBarStartPLC(self, evt):
--- a/controls/DebugVariablePanel/DebugVariableGraphicViewer.py	Sun Sep 05 05:43:17 2021 +0200
+++ b/controls/DebugVariablePanel/DebugVariableGraphicViewer.py	Sun Sep 05 15:24:14 2021 +0200
@@ -1381,8 +1381,6 @@
         # rendering
         destGC = wx.GCDC(destDC)
 
-        destGC.BeginDrawing()
-
         # Get canvas size and figure bounding box in canvas
         width, height = self.GetSize()
         bbox = self.GetAxesBoundingBox()
@@ -1409,7 +1407,5 @@
         # Draw other Viewer common elements
         self.DrawCommonElements(destGC, self.GetButtons())
 
-        destGC.EndDrawing()
-
         self._isDrawn = True
         self.gui_repaint(drawDC=drawDC)
--- a/controls/PouInstanceVariablesPanel.py	Sun Sep 05 05:43:17 2021 +0200
+++ b/controls/PouInstanceVariablesPanel.py	Sun Sep 05 15:24:14 2021 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#.!/usr/bin/env python
 # -*- coding: utf-8 -*-
 
 # This file is part of Beremiz, a Integrated Development Environment for
@@ -93,7 +93,7 @@
             rect = wx.Rect(images_bbx.x + 4, images_bbx.y + 4,
                            r_image_w, r_image_h)
             for r_image in rightimages:
-                if rect.Inside(point):
+                if rect.Contains(point):
                     return r_image
                 rect.x += r_image_w + 4