# HG changeset patch # User Andrey Skvortsov # Date 1528378286 -10800 # Node ID 10aa875184017b718428eb8e71c6795687258be9 # Parent 748017ca4151fd32d806c536b24686f447ebec11 Drop support for wxPython 2.6 and below diff -r 748017ca4151 -r 10aa87518401 Beremiz_service.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() diff -r 748017ca4151 -r 10aa87518401 IDEFrame.py --- 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) diff -r 748017ca4151 -r 10aa87518401 PLCOpenEditor.py --- 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') diff -r 748017ca4151 -r 10aa87518401 controls/SearchResultPanel.py --- 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) diff -r 748017ca4151 -r 10aa87518401 editors/TextViewer.py --- 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) diff -r 748017ca4151 -r 10aa87518401 editors/Viewer.py --- 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