PLCOpenEditor.py
changeset 1744 69dfdb26f600
parent 1742 92932cd370a4
child 1745 f9d32913bad4
equal deleted inserted replaced
1743:c3c3d1318130 1744:69dfdb26f600
    96 
    96 
    97 class PLCOpenEditor(IDEFrame):
    97 class PLCOpenEditor(IDEFrame):
    98 
    98 
    99     # Compatibility function for wx versions < 2.6
    99     # Compatibility function for wx versions < 2.6
   100     if wx.VERSION < (2, 6, 0):
   100     if wx.VERSION < (2, 6, 0):
   101         def Bind(self, event, function, id = None):
   101         def Bind(self, event, function, id=None):
   102             if id is not None:
   102             if id is not None:
   103                 event(self, id, function)
   103                 event(self, id, function)
   104             else:
   104             else:
   105                 event(self, function)
   105                 event(self, function)
   106 
   106 
   178     ## Constructor of the PLCOpenEditor class.
   178     ## Constructor of the PLCOpenEditor class.
   179     #  @param parent The parent window.
   179     #  @param parent The parent window.
   180     #  @param controler The controler been used by PLCOpenEditor (default: None).
   180     #  @param controler The controler been used by PLCOpenEditor (default: None).
   181     #  @param fileOpen The filepath to open if no controler defined (default: None).
   181     #  @param fileOpen The filepath to open if no controler defined (default: None).
   182     #  @param debug The filepath to open if no controler defined (default: False).
   182     #  @param debug The filepath to open if no controler defined (default: False).
   183     def __init__(self, parent, fileOpen = None):
   183     def __init__(self, parent, fileOpen=None):
   184         self.icon = wx.Icon(os.path.join(beremiz_dir, "images", "poe.ico"), wx.BITMAP_TYPE_ICO)
   184         self.icon = wx.Icon(os.path.join(beremiz_dir, "images", "poe.ico"), wx.BITMAP_TYPE_ICO)
   185         IDEFrame.__init__(self, parent)
   185         IDEFrame.__init__(self, parent)
   186 
   186 
   187         result = None
   187         result = None
   188 
   188 
   206 
   206 
   207         self._Refresh(TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU)
   207         self._Refresh(TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU)
   208 
   208 
   209         if result is not None:
   209         if result is not None:
   210             (num, line) = result
   210             (num, line) = result
   211             self.ShowErrorMessage(_("PLC syntax error at line {a1}:\n{a2}").format(a1 = num, a2 = line))
   211             self.ShowErrorMessage(_("PLC syntax error at line {a1}:\n{a2}").format(a1=num, a2=line))
   212 
   212 
   213     def OnCloseFrame(self, event):
   213     def OnCloseFrame(self, event):
   214         if self.Controler is None or self.CheckSaveBeforeClosing(_("Close Application")):
   214         if self.Controler is None or self.CheckSaveBeforeClosing(_("Close Application")):
   215             self.AUIManager.UnInit()
   215             self.AUIManager.UnInit()
   216 
   216 
   319             self._Refresh(TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU)
   319             self._Refresh(TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU)
   320         dialog.Destroy()
   320         dialog.Destroy()
   321 
   321 
   322         if result is not None:
   322         if result is not None:
   323             (num, line) = result
   323             (num, line) = result
   324             self.ShowErrorMessage(_("PLC syntax error at line {a1}:\n{a2}").format(a1 = num, a2 = line))
   324             self.ShowErrorMessage(_("PLC syntax error at line {a1}:\n{a2}").format(a1=num, a2=line))
   325 
   325 
   326     def OnCloseProjectMenu(self, event):
   326     def OnCloseProjectMenu(self, event):
   327         if not self.CheckSaveBeforeClosing():
   327         if not self.CheckSaveBeforeClosing():
   328             return
   328             return
   329         self.ResetView()
   329         self.ResetView()