PLCOpenEditor.py
changeset 4057 cf42c3dbdd5c
parent 3906 f831ff63ca6e
child 4064 f273ee835411
equal deleted inserted replaced
4056:4b2de1a0fbf9 4057:cf42c3dbdd5c
    35 
    35 
    36 import version
    36 import version
    37 import util.paths as paths
    37 import util.paths as paths
    38 import util.ExceptionHandler
    38 import util.ExceptionHandler
    39 from util.misc import InstallLocalRessources
    39 from util.misc import InstallLocalRessources
    40 from docutil.docpdf import open_pdf
       
    41 from IDEFrame import IDEFrame, AppendMenu
    40 from IDEFrame import IDEFrame, AppendMenu
    42 from IDEFrame import \
    41 from IDEFrame import \
    43     TITLE, \
    42     TITLE, \
    44     EDITORTOOLBAR, \
    43     EDITORTOOLBAR, \
    45     FILEMENU, \
    44     FILEMENU, \
   126                                (wx.ID_SAVEAS, "saveas", _('Save As...'), None),
   125                                (wx.ID_SAVEAS, "saveas", _('Save As...'), None),
   127                                (wx.ID_PRINT, "print", _('Print'), None),
   126                                (wx.ID_PRINT, "print", _('Print'), None),
   128                                (ID_PLCOPENEDITORFILEMENUGENERATE, "Build", _('Generate Program'), None)])
   127                                (ID_PLCOPENEDITORFILEMENUGENERATE, "Build", _('Generate Program'), None)])
   129 
   128 
   130     def _init_coll_HelpMenu_Items(self, parent):
   129     def _init_coll_HelpMenu_Items(self, parent):
   131         AppendMenu(parent, help='', id=wx.ID_HELP,
       
   132                    kind=wx.ITEM_NORMAL, text=_('PLCOpenEditor') + '\tF1')
       
   133         # AppendMenu(parent, help='', id=wx.ID_HELP_CONTENTS,
       
   134         #      kind=wx.ITEM_NORMAL, text=u'PLCOpen\tF2')
       
   135         # AppendMenu(parent, help='', id=wx.ID_HELP_CONTEXT,
       
   136         #      kind=wx.ITEM_NORMAL, text=u'IEC 61131-3\tF3')
       
   137 
       
   138         def handler(event):
   130         def handler(event):
   139             return wx.MessageBox(
   131             return wx.MessageBox(
   140                 version.GetCommunityHelpMsg(),
   132                 version.GetCommunityHelpMsg(),
   141                 _('Community support'),
   133                 _('Community support'),
   142                 wx.OK | wx.ICON_INFORMATION)
   134                 wx.OK | wx.ICON_INFORMATION)
   143 
   135 
   144         menu_entry = parent.Append(help='', id=wx.ID_ANY, kind=wx.ITEM_NORMAL, text=_('Community support'))
   136         menu_entry = parent.Append(wx.ID_ANY, _('Community support'), '')
   145         self.Bind(wx.EVT_MENU, handler, menu_entry)
   137         self.Bind(wx.EVT_MENU, handler, menu_entry)
   146 
   138 
   147         AppendMenu(parent, help='', id=wx.ID_ABOUT,
   139         parent.Append(wx.MenuItem(helpString='', id=wx.ID_ABOUT,
   148                    kind=wx.ITEM_NORMAL, text=_('About'))
   140                    kind=wx.ITEM_NORMAL, text=_('About')))
   149         self.Bind(wx.EVT_MENU, self.OnPLCOpenEditorMenu, id=wx.ID_HELP)
       
   150         # self.Bind(wx.EVT_MENU, self.OnPLCOpenMenu, id=wx.ID_HELP_CONTENTS)
       
   151         self.Bind(wx.EVT_MENU, self.OnAboutMenu, id=wx.ID_ABOUT)
   141         self.Bind(wx.EVT_MENU, self.OnAboutMenu, id=wx.ID_ABOUT)
   152 
   142 
   153     def __init__(self, parent, fileOpen=None):
   143     def __init__(self, parent, fileOpen=None):
   154         """ Constructor of the PLCOpenEditor class.
   144         """ Constructor of the PLCOpenEditor class.
   155 
   145 
   347             header, icon = _("Error"), wx.ICON_ERROR
   337             header, icon = _("Error"), wx.ICON_ERROR
   348         message = wx.MessageDialog(self, message_text, header, wx.OK | icon)
   338         message = wx.MessageDialog(self, message_text, header, wx.OK | icon)
   349         message.ShowModal()
   339         message.ShowModal()
   350         message.Destroy()
   340         message.Destroy()
   351 
   341 
   352     def OnPLCOpenEditorMenu(self, event):
       
   353         wx.MessageBox(_("No documentation available.\nComing soon."))
       
   354 
       
   355     def OnPLCOpenMenu(self, event):
       
   356         open_pdf(os.path.join(beremiz_dir, "plcopen", "TC6_XML_V101.pdf"))
       
   357 
       
   358     def OnAboutMenu(self, event):
   342     def OnAboutMenu(self, event):
   359         info = wx.adv.AboutDialogInfo()
   343         info = wx.adv.AboutDialogInfo()
   360         info = version.GetAboutDialogInfo(info)
   344         info = version.GetAboutDialogInfo(info)
   361         info.Name = "PLCOpenEditor"
   345         info.Name = "PLCOpenEditor"
   362         info.Description = _("PLCOpenEditor is part of Beremiz project.\n\n"
   346         info.Description = _("PLCOpenEditor is part of Beremiz project.\n\n"