equal
deleted
inserted
replaced
58 elif len(args) == 1: |
58 elif len(args) == 1: |
59 fileOpen = args[0] |
59 fileOpen = args[0] |
60 |
60 |
61 # Create wxApp (Need to create App before internationalization because of |
61 # Create wxApp (Need to create App before internationalization because of |
62 # Windows) |
62 # Windows) |
63 app = wx.PySimpleApp() |
63 if wx.VERSION >= (3, 0, 0): |
|
64 app = wx.App() |
|
65 else: |
|
66 app = wx.PySimpleApp() |
|
67 |
64 |
68 |
65 from util.misc import InstallLocalRessources |
69 from util.misc import InstallLocalRessources |
66 InstallLocalRessources(beremiz_dir) |
70 InstallLocalRessources(beremiz_dir) |
67 |
71 |
68 from docutil import * |
72 from docutil import * |
158 # @param parent The parent window. |
162 # @param parent The parent window. |
159 # @param controler The controler been used by PLCOpenEditor (default: None). |
163 # @param controler The controler been used by PLCOpenEditor (default: None). |
160 # @param fileOpen The filepath to open if no controler defined (default: None). |
164 # @param fileOpen The filepath to open if no controler defined (default: None). |
161 # @param debug The filepath to open if no controler defined (default: False). |
165 # @param debug The filepath to open if no controler defined (default: False). |
162 def __init__(self, parent, fileOpen = None): |
166 def __init__(self, parent, fileOpen = None): |
|
167 self.icon = wx.Icon(os.path.join(beremiz_dir, "images", "poe.ico"), wx.BITMAP_TYPE_ICO) |
163 IDEFrame.__init__(self, parent) |
168 IDEFrame.__init__(self, parent) |
164 |
169 |
165 result = None |
170 result = None |
166 |
171 |
167 # Open the filepath if defined |
172 # Open the filepath if defined |
176 self.ProjectTree.Enable(True) |
181 self.ProjectTree.Enable(True) |
177 self.PouInstanceVariablesPanel.SetController(controler) |
182 self.PouInstanceVariablesPanel.SetController(controler) |
178 self._Refresh(PROJECTTREE, POUINSTANCEVARIABLESPANEL, LIBRARYTREE) |
183 self._Refresh(PROJECTTREE, POUINSTANCEVARIABLESPANEL, LIBRARYTREE) |
179 |
184 |
180 # Define PLCOpenEditor icon |
185 # Define PLCOpenEditor icon |
181 self.SetIcon(wx.Icon(os.path.join(beremiz_dir, "images", "poe.ico"),wx.BITMAP_TYPE_ICO)) |
186 self.SetIcon(self.icon) |
182 |
187 |
183 self.Bind(wx.EVT_CLOSE, self.OnCloseFrame) |
188 self.Bind(wx.EVT_CLOSE, self.OnCloseFrame) |
184 |
189 |
185 self._Refresh(TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU) |
190 self._Refresh(TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU) |
186 |
191 |
470 |
475 |
471 #sys.excepthook = lambda *args: wx.CallAfter(handle_exception, *args) |
476 #sys.excepthook = lambda *args: wx.CallAfter(handle_exception, *args) |
472 sys.excepthook = handle_exception |
477 sys.excepthook = handle_exception |
473 |
478 |
474 if __name__ == '__main__': |
479 if __name__ == '__main__': |
475 wx.InitAllImageHandlers() |
480 if wx.VERSION < (3, 0, 0): |
|
481 wx.InitAllImageHandlers() |
476 |
482 |
477 # Install a exception handle for bug reports |
483 # Install a exception handle for bug reports |
478 AddExceptHook(os.getcwd(),__version__) |
484 AddExceptHook(os.getcwd(),__version__) |
479 |
485 |
480 frame = PLCOpenEditor(None, fileOpen=fileOpen) |
486 frame = PLCOpenEditor(None, fileOpen=fileOpen) |