lpcmanager

Parents d7c0471efa16
Children 1d7ccbf5aca9
Edit bug. Create xeye zip file only if build is successfuly created.
  • +16 -11
    LPCManager.py
  • --- a/LPCManager.py Fri Aug 05 13:12:55 2016 +0200
    +++ b/LPCManager.py Mon Aug 22 10:56:36 2016 +0200
    @@ -471,16 +471,21 @@
    def ToZIPFile(self):
    # MD5 = self.GetLastBuildMD5()
    - zf = zipfile.ZipFile(self.BuildPath[:-5] + "\\" + self._builder.exe[:-3] + ".xEye", mode='w')
    + try:
    + path_export_file = self.BuildPath[:-5] + "\\" + self._builder.exe[:-3] + ".xEye"
    + zf = zipfile.ZipFile(path_export_file, mode='w')
    - for extrafilespath in [self._getExtraFilesPath(),
    - self._getProjectFilesPath()]:
    - dir = extrafilespath.split("\\")[-1]
    - for name in os.listdir(extrafilespath):
    - zf.write(extrafilespath + '\\' + str(name), dir + '\\' + str(name), zipfile.ZIP_DEFLATED)
    - zf.write(self._builder.exe_path, self._builder.exe)
    - zf.write(self.BuildPath + '\\lastbuildPLC.md5', 'lastbuildPLC.md5')
    - zf.close()
    + for extrafilespath in [self._getExtraFilesPath(),
    + self._getProjectFilesPath()]:
    + dir = extrafilespath.split("\\")[-1]
    + for name in os.listdir(extrafilespath):
    + zf.write(extrafilespath + '\\' + str(name), dir + '\\' + str(name), zipfile.ZIP_DEFLATED)
    + zf.write(self._builder.exe_path, self._builder.exe)
    + zf.write(self.BuildPath + '\\lastbuildPLC.md5', 'lastbuildPLC.md5')
    + zf.close()
    + self.logger.write(_("Export file is successfully created on location: %s\n") % path_export_file)
    + except Exception, e:
    + self.logger.write(_("Export file is not created because eror: %s\n") % e)
    def _Build(self):
    save = self.ProjectTestModified()
    @@ -489,8 +494,8 @@
    self.AppFrame._Refresh(TITLE, FILEMENU)
    if self.BuildPath is not None:
    mycopytree(self.OrigBuildPath, self.BuildPath)
    - ProjectController._Build(self)
    - self.ToZIPFile()
    + if ProjectController._Build(self):
    + self.ToZIPFile()
    if save:
    wx.CallAfter(self.AppFrame.RefreshAll)