# HG changeset patch # User Andrey Skvortsov # Date 1473792131 -10800 # Node ID aca8f43483e9907780ad1b5519666f1793d8cf0a # Parent a191e137a5bb345c710936e2e25ba674cdd7d5b5 fix issues in PLCOpenEditor with moving from wxWidgets 2.8 to 3.0 1) ./PLCOpenEditor.py:63: wxPyDeprecationWarning: Using deprecated class PySimpleApp. app = wx.PySimpleApp() 2) ./PLCOpenEditor.py:475: wxPyDeprecationWarning: Call to deprecated item. wx.InitAllImageHandlers() 3) Traceback (most recent call last): File "./PLCOpenEditor.py", line 480, in frame = PLCOpenEditor(None, fileOpen=fileOpen) File "./PLCOpenEditor.py", line 163, in __init__ IDEFrame.__init__(self, parent) File "/tmp/f/beremiz/IDEFrame.py", line 657, in __init__ self._init_ctrls(parent) File "/tmp/f/beremiz/IDEFrame.py", line 485, in _init_ctrls self._init_icon(prnt) File "/tmp/f/beremiz/IDEFrame.py", line 476, in _init_icon if self.icon: AttributeError: 'PLCOpenEditor' object has no attribute 'icon' diff -r a191e137a5bb -r aca8f43483e9 PLCOpenEditor.py --- a/PLCOpenEditor.py Mon Sep 12 16:49:24 2016 +0300 +++ b/PLCOpenEditor.py Tue Sep 13 21:42:11 2016 +0300 @@ -60,7 +60,11 @@ # Create wxApp (Need to create App before internationalization because of # Windows) - app = wx.PySimpleApp() + if wx.VERSION >= (3, 0, 0): + app = wx.App() + else: + app = wx.PySimpleApp() + from util.misc import InstallLocalRessources InstallLocalRessources(beremiz_dir) @@ -160,6 +164,7 @@ # @param fileOpen The filepath to open if no controler defined (default: None). # @param debug The filepath to open if no controler defined (default: False). def __init__(self, parent, fileOpen = None): + self.icon = wx.Icon(os.path.join(beremiz_dir, "images", "poe.ico"), wx.BITMAP_TYPE_ICO) IDEFrame.__init__(self, parent) result = None @@ -178,7 +183,7 @@ self._Refresh(PROJECTTREE, POUINSTANCEVARIABLESPANEL, LIBRARYTREE) # Define PLCOpenEditor icon - self.SetIcon(wx.Icon(os.path.join(beremiz_dir, "images", "poe.ico"),wx.BITMAP_TYPE_ICO)) + self.SetIcon(self.icon) self.Bind(wx.EVT_CLOSE, self.OnCloseFrame) @@ -472,7 +477,8 @@ sys.excepthook = handle_exception if __name__ == '__main__': - wx.InitAllImageHandlers() + if wx.VERSION < (3, 0, 0): + wx.InitAllImageHandlers() # Install a exception handle for bug reports AddExceptHook(os.getcwd(),__version__)