83 from editors.Viewer import Viewer |
83 from editors.Viewer import Viewer |
84 from PLCControler import PLCControler |
84 from PLCControler import PLCControler |
85 from dialogs import ProjectDialog |
85 from dialogs import ProjectDialog |
86 from dialogs.AboutDialog import ShowAboutDialog |
86 from dialogs.AboutDialog import ShowAboutDialog |
87 |
87 |
88 #------------------------------------------------------------------------------- |
88 # ------------------------------------------------------------------------------- |
89 # PLCOpenEditor Main Class |
89 # PLCOpenEditor Main Class |
90 #------------------------------------------------------------------------------- |
90 # ------------------------------------------------------------------------------- |
91 |
91 |
92 # Define PLCOpenEditor FileMenu extra items id |
92 # Define PLCOpenEditor FileMenu extra items id |
93 [ |
93 [ |
94 ID_PLCOPENEDITORFILEMENUGENERATE, |
94 ID_PLCOPENEDITORFILEMENUGENERATE, |
95 ] = [wx.NewId() for _init_coll_FileMenu_Items in range(1)] |
95 ] = [wx.NewId() for _init_coll_FileMenu_Items in range(1)] |
156 (wx.ID_PRINT, "print", _(u'Print'), None)]) |
156 (wx.ID_PRINT, "print", _(u'Print'), None)]) |
157 |
157 |
158 def _init_coll_HelpMenu_Items(self, parent): |
158 def _init_coll_HelpMenu_Items(self, parent): |
159 AppendMenu(parent, help='', id=wx.ID_HELP, |
159 AppendMenu(parent, help='', id=wx.ID_HELP, |
160 kind=wx.ITEM_NORMAL, text=_(u'PLCOpenEditor') + '\tF1') |
160 kind=wx.ITEM_NORMAL, text=_(u'PLCOpenEditor') + '\tF1') |
161 #AppendMenu(parent, help='', id=wx.ID_HELP_CONTENTS, |
161 # AppendMenu(parent, help='', id=wx.ID_HELP_CONTENTS, |
162 # kind=wx.ITEM_NORMAL, text=u'PLCOpen\tF2') |
162 # kind=wx.ITEM_NORMAL, text=u'PLCOpen\tF2') |
163 #AppendMenu(parent, help='', id=wx.ID_HELP_CONTEXT, |
163 # AppendMenu(parent, help='', id=wx.ID_HELP_CONTEXT, |
164 # kind=wx.ITEM_NORMAL, text=u'IEC 61131-3\tF3') |
164 # kind=wx.ITEM_NORMAL, text=u'IEC 61131-3\tF3') |
165 |
165 |
166 def handler(event): |
166 def handler(event): |
167 return wx.MessageBox( |
167 return wx.MessageBox( |
168 version.GetCommunityHelpMsg(), |
168 version.GetCommunityHelpMsg(), |
174 self.Bind(wx.EVT_MENU, handler, id=id) |
174 self.Bind(wx.EVT_MENU, handler, id=id) |
175 |
175 |
176 AppendMenu(parent, help='', id=wx.ID_ABOUT, |
176 AppendMenu(parent, help='', id=wx.ID_ABOUT, |
177 kind=wx.ITEM_NORMAL, text=_(u'About')) |
177 kind=wx.ITEM_NORMAL, text=_(u'About')) |
178 self.Bind(wx.EVT_MENU, self.OnPLCOpenEditorMenu, id=wx.ID_HELP) |
178 self.Bind(wx.EVT_MENU, self.OnPLCOpenEditorMenu, id=wx.ID_HELP) |
179 #self.Bind(wx.EVT_MENU, self.OnPLCOpenMenu, id=wx.ID_HELP_CONTENTS) |
179 # self.Bind(wx.EVT_MENU, self.OnPLCOpenMenu, id=wx.ID_HELP_CONTENTS) |
180 self.Bind(wx.EVT_MENU, self.OnAboutMenu, id=wx.ID_ABOUT) |
180 self.Bind(wx.EVT_MENU, self.OnAboutMenu, id=wx.ID_ABOUT) |
181 |
181 |
182 def __init__(self, parent, fileOpen=None): |
182 def __init__(self, parent, fileOpen=None): |
183 """ Constructor of the PLCOpenEditor class. |
183 """ Constructor of the PLCOpenEditor class. |
184 |
184 |
229 if self.Controler is not None: |
229 if self.Controler is not None: |
230 self.SetTitle("%s - %s" % (name, self.Controler.GetFilename())) |
230 self.SetTitle("%s - %s" % (name, self.Controler.GetFilename())) |
231 else: |
231 else: |
232 self.SetTitle(name) |
232 self.SetTitle(name) |
233 |
233 |
234 #------------------------------------------------------------------------------- |
234 # ------------------------------------------------------------------------------- |
235 # File Menu Functions |
235 # File Menu Functions |
236 #------------------------------------------------------------------------------- |
236 # ------------------------------------------------------------------------------- |
237 |
237 |
238 def RefreshFileMenu(self): |
238 def RefreshFileMenu(self): |
239 MenuToolBar = self.Panes["MenuToolBar"] |
239 MenuToolBar = self.Panes["MenuToolBar"] |
240 if self.Controler is not None: |
240 if self.Controler is not None: |
241 selected = self.TabsOpened.GetSelection() |
241 selected = self.TabsOpened.GetSelection() |
399 else: |
399 else: |
400 self.ShowErrorMessage(_("\"%s\" is not a valid folder!") % os.path.dirname(filepath)) |
400 self.ShowErrorMessage(_("\"%s\" is not a valid folder!") % os.path.dirname(filepath)) |
401 self._Refresh(TITLE, FILEMENU, PAGETITLES) |
401 self._Refresh(TITLE, FILEMENU, PAGETITLES) |
402 dialog.Destroy() |
402 dialog.Destroy() |
403 |
403 |
404 #------------------------------------------------------------------------------- |
404 # ------------------------------------------------------------------------------- |
405 # Exception Handler |
405 # Exception Handler |
406 #------------------------------------------------------------------------------- |
406 # ------------------------------------------------------------------------------- |
407 |
407 |
408 |
408 |
409 Max_Traceback_List_Size = 20 |
409 Max_Traceback_List_Size = 20 |
410 |
410 |
411 |
411 |
504 lst = info.keys() |
504 lst = info.keys() |
505 lst.sort() |
505 lst.sort() |
506 for a in lst: |
506 for a in lst: |
507 output.write(a+":\n"+str(info[a])+"\n\n") |
507 output.write(a+":\n"+str(info[a])+"\n\n") |
508 |
508 |
509 #sys.excepthook = lambda *args: wx.CallAfter(handle_exception, *args) |
509 # sys.excepthook = lambda *args: wx.CallAfter(handle_exception, *args) |
510 sys.excepthook = handle_exception |
510 sys.excepthook = handle_exception |
511 |
511 |
512 |
512 |
513 if __name__ == '__main__': |
513 if __name__ == '__main__': |
514 if wx.VERSION < (3, 0, 0): |
514 if wx.VERSION < (3, 0, 0): |