IDE: fixed/remove checks wxPython versions python3
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Wed, 12 Apr 2023 21:05:00 +0200
branchpython3
changeset 3793 9958cf865da0
parent 3792 365f866ee120
child 3794 36934591f6eb
IDE: fixed/remove checks wxPython versions
Beremiz.py
Beremiz_service.py
IDEFrame.py
PLCOpenEditor.py
controls/DebugVariablePanel/DebugVariableGraphicViewer.py
i18n/mki18n.py
--- a/Beremiz.py	Wed Apr 12 19:32:38 2023 +0200
+++ b/Beremiz.py	Wed Apr 12 21:05:00 2023 +0200
@@ -104,7 +104,7 @@
 
     def CreateApplication(self):
 
-        BeremizAppType = wx.App if wx.VERSION >= (3, 0, 0) else wx.PySimpleApp
+        BeremizAppType = wx.App
 
         class BeremizApp(BeremizAppType):
             def OnInit(_self):  # pylint: disable=no-self-argument
@@ -113,8 +113,6 @@
 
         self.app = BeremizApp(redirect=self.debug)
         self.app.SetAppName('beremiz')
-        if wx.VERSION < (3, 0, 0):
-            wx.InitAllImageHandlers()
 
     def ShowSplashScreen(self):
         class Splash(AdvancedSplash):
--- a/Beremiz_service.py	Wed Apr 12 19:32:38 2023 +0200
+++ b/Beremiz_service.py	Wed Apr 12 21:05:00 2023 +0200
@@ -237,10 +237,7 @@
         import re
         import wx.adv
 
-        if wx.VERSION >= (3, 0, 0):
-            app = wx.App(redirect=False)
-        else:
-            app = wx.PySimpleApp(redirect=False)
+        app = wx.App(redirect=False)
         app.SetTopWindow(wx.Frame(None, -1))
 
         default_locale = None
--- a/IDEFrame.py	Wed Apr 12 19:32:38 2023 +0200
+++ b/IDEFrame.py	Wed Apr 12 21:05:00 2023 +0200
@@ -1406,11 +1406,11 @@
         for child in self.TabsOpened.GetChildren():
             if isinstance(child, wx.aui.AuiTabCtrl):
                 auitabctrl.append(child)
-                if wx.VERSION > (4, 1, 0) and child not in self.AuiTabCtrl:
+                if wx.VERSION >= (4, 1, 0) and child not in self.AuiTabCtrl:
                     child.Bind(wx.EVT_LEFT_DCLICK, self.GetTabsOpenedDClickFunction(child))
         self.AuiTabCtrl = auitabctrl
         # on wxPython 4.0.7, AuiManager has no "RestorePane" method...
-        if wx.VERSION > (4, 1, 0) and self.TabsOpened.GetPageCount() == 0:
+        if wx.VERSION >= (4, 1, 0) and self.TabsOpened.GetPageCount() == 0:
             pane = self.AUIManager.GetPane(self.TabsOpened)
             # on wxPython 4.1.0, AuiPaneInfo has no "IsMaximized" attribute...
             if (not hasattr(pane, "IsMaximized")) or pane.IsMaximized():
--- a/PLCOpenEditor.py	Wed Apr 12 19:32:38 2023 +0200
+++ b/PLCOpenEditor.py	Wed Apr 12 21:05:00 2023 +0200
@@ -424,8 +424,6 @@
         self.SetAppName('plcopeneditor')
         self.ParseCommandLine()
         InstallLocalRessources(beremiz_dir)
-        if wx.VERSION < (3, 0, 0):
-            wx.InitAllImageHandlers()
         util.ExceptionHandler.AddExceptHook(version.app_version)
         self.frame = PLCOpenEditor(None, fileOpen=self.fileOpen)
         return True
--- a/controls/DebugVariablePanel/DebugVariableGraphicViewer.py	Wed Apr 12 19:32:38 2023 +0200
+++ b/controls/DebugVariablePanel/DebugVariableGraphicViewer.py	Wed Apr 12 21:05:00 2023 +0200
@@ -1361,8 +1361,6 @@
 
         # Get bitmap of figure rendered
         self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None)
-        if wx.VERSION < (3, 0, 0):
-            self.bitmap.UseAlpha()
 
         # Create DC for rendering graphics in bitmap
         destDC = wx.MemoryDC()
--- a/i18n/mki18n.py	Wed Apr 12 19:32:38 2023 +0200
+++ b/i18n/mki18n.py	Wed Apr 12 21:05:00 2023 +0200
@@ -120,10 +120,7 @@
 def getlanguageDict():
     languageDict = {}
     getSupportedLanguageDict('Beremiz')
-    if wx.VERSION >= (3, 0, 0):
-        _app = wx.App()
-    else:
-        _app = wx.PySimpleApp()
+    _app = wx.App()
 
     for lang in [x for x in dir(wx) if x.startswith("LANGUAGE")]:
         i = wx.Locale(wx.LANGUAGE_DEFAULT).GetLanguageInfo(getattr(wx, lang))