Drop support for wxPython 2.6 and below
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Thu, 07 Jun 2018 16:31:26 +0300
changeset 2177 10aa87518401
parent 2176 748017ca4151
child 2178 bd0d13d10b8e
Drop support for wxPython 2.6 and below
Beremiz_service.py
IDEFrame.py
PLCOpenEditor.py
controls/SearchResultPanel.py
editors/TextViewer.py
editors/Viewer.py
--- a/Beremiz_service.py	Thu Jun 07 14:45:03 2018 +0300
+++ b/Beremiz_service.py	Thu Jun 07 16:31:26 2018 +0300
@@ -205,24 +205,13 @@
         stopicon = wx.Image(Bpath("images", "icostop24.png"))
 
         class ParamsEntryDialog(wx.TextEntryDialog):
-            if wx.VERSION < (2, 6, 0):
-                def Bind(self, event, function, id=None):
-                    if id is not None:
-                        event(self, id, function)
-                    else:
-                        event(self, function)
 
             def __init__(self, parent, message, caption=_("Please enter text"), defaultValue="",
                          style=wx.OK | wx.CANCEL | wx.CENTRE, pos=wx.DefaultPosition):
                 wx.TextEntryDialog.__init__(self, parent, message, caption, defaultValue, style, pos)
 
                 self.Tests = []
-                if wx.VERSION >= (2, 8, 0):
-                    self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.GetAffirmativeId())
-                elif wx.VERSION >= (2, 6, 0):
-                    self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.GetSizer().GetItem(3).GetSizer().GetAffirmativeButton().GetId())
-                else:
-                    self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.GetSizer().GetItem(3).GetSizer().GetChildren()[0].GetSizer().GetChildren()[0].GetWindow().GetId())
+                self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.GetAffirmativeId())
 
             def OnOK(self, event):
                 value = self.GetValue()
--- a/IDEFrame.py	Thu Jun 07 14:45:03 2018 +0300
+++ b/IDEFrame.py	Thu Jun 07 16:31:26 2018 +0300
@@ -211,13 +211,7 @@
 
 
 def AppendMenu(parent, help, id, kind, text):
-    """
-    Compatibility function for wx versions < 2.6
-    """
-    if wx.VERSION >= (2, 6, 0):
-        parent.Append(help=help, id=id, kind=kind, text=text)
-    else:
-        parent.Append(helpString=help, id=id, kind=kind, item=text)
+    parent.Append(help=help, id=id, kind=kind, text=text)
 
 
 [
@@ -341,13 +335,6 @@
 
 class IDEFrame(wx.Frame):
     """IDEFrame Base Class"""
-    # Compatibility function for wx versions < 2.6
-    if wx.VERSION < (2, 6, 0):
-        def Bind(self, event, function, id=None):
-            if id is not None:
-                event(self, id, function)
-            else:
-                event(self, function)
 
     def _init_coll_MenuBar_Menus(self, parent):
         parent.Append(menu=self.FileMenu, title=_(u'&File'))
@@ -2129,10 +2116,7 @@
         EditorToolBar = self.Panes["EditorToolBar"]
 
         for item in self.CurrentEditorToolBar:
-            if wx.VERSION >= (2, 6, 0):
-                self.Unbind(wx.EVT_MENU, id=item)
-            else:
-                self.Disconnect(id=item, eventType=wx.wxEVT_COMMAND_MENU_SELECTED)
+            self.Unbind(wx.EVT_MENU, id=item)
 
             if EditorToolBar:
                 EditorToolBar.DeleteTool(item)
--- a/PLCOpenEditor.py	Thu Jun 07 14:45:03 2018 +0300
+++ b/PLCOpenEditor.py	Thu Jun 07 16:31:26 2018 +0300
@@ -70,14 +70,6 @@
 
 class PLCOpenEditor(IDEFrame):
 
-    # Compatibility function for wx versions < 2.6
-    if wx.VERSION < (2, 6, 0):
-        def Bind(self, event, function, id=None):
-            if id is not None:
-                event(self, id, function)
-            else:
-                event(self, function)
-
     def _init_coll_FileMenu_Items(self, parent):
         AppendMenu(parent, help='', id=wx.ID_NEW,
                    kind=wx.ITEM_NORMAL, text=_(u'New') + '\tCTRL+N')
--- a/controls/SearchResultPanel.py	Thu Jun 07 14:45:03 2018 +0300
+++ b/controls/SearchResultPanel.py	Thu Jun 07 16:31:26 2018 +0300
@@ -58,13 +58,6 @@
 
 class SearchResultPanel(wx.Panel):
 
-    if wx.VERSION < (2, 6, 0):
-        def Bind(self, event, function, id=None):
-            if id is not None:
-                event(self, id, function)
-            else:
-                event(self, function)
-
     def _init_coll_MainSizer_Items(self, parent):
         parent.AddSizer(self.HeaderSizer, 0, border=0, flag=wx.GROW)
         parent.AddWindow(self.SearchResultsTree, 1, border=0, flag=wx.GROW)
--- a/editors/TextViewer.py	Thu Jun 07 14:45:03 2018 +0300
+++ b/editors/TextViewer.py	Thu Jun 07 16:31:26 2018 +0300
@@ -79,13 +79,6 @@
 
     ID = ID_TEXTVIEWER
 
-    if wx.VERSION < (2, 6, 0):
-        def Bind(self, event, function, id=None):
-            if id is not None:
-                event(self, id, function)
-            else:
-                event(self, function)
-
     def _init_Editor(self, prnt):
         self.Editor = CustomStyledTextCtrl(id=ID_TEXTVIEWERTEXTCTRL,
                                            parent=prnt, name="TextViewer", size=wx.Size(0, 0), style=0)
--- a/editors/Viewer.py	Thu Jun 07 14:45:03 2018 +0300
+++ b/editors/Viewer.py	Thu Jun 07 16:31:26 2018 +0300
@@ -66,10 +66,7 @@
 
 
 def AppendMenu(parent, help, id, kind, text):
-    if wx.VERSION >= (2, 6, 0):
-        parent.Append(help=help, id=id, kind=kind, text=text)
-    else:
-        parent.Append(helpString=help, id=id, kind=kind, item=text)
+    parent.Append(help=help, id=id, kind=kind, text=text)
 
 
 if wx.Platform == '__WXMSW__':
@@ -535,13 +532,6 @@
     manipulating graphic elements
     """
 
-    if wx.VERSION < (2, 6, 0):
-        def Bind(self, event, function, id=None):
-            if id is not None:
-                event(self, id, function)
-            else:
-                event(self, function)
-
     # Add list of menu items to the given menu
     def AddMenuItems(self, menu, items):
         for item in items:
@@ -900,10 +890,7 @@
         else:
             dc = wx.ClientDC(self.Editor)
         dc.SetFont(self.GetFont())
-        if wx.VERSION >= (2, 6, 0):
-            self.Editor.DoPrepareDC(dc)
-        else:
-            self.Editor.PrepareDC(dc)
+        self.Editor.DoPrepareDC(dc)
         dc.SetUserScale(self.ViewScale[0], self.ViewScale[1])
         return dc