ProjectController.py
changeset 2505 3487fd4fb9bf
parent 2456 7373e3048167
child 2506 8dbdf20f795b
equal deleted inserted replaced
2504:f3aced6c5f8b 2505:3487fd4fb9bf
   547             dialog = wx.MessageDialog(
   547             dialog = wx.MessageDialog(
   548                 self.AppFrame, message, _("Error"), wx.OK | wx.ICON_ERROR)
   548                 self.AppFrame, message, _("Error"), wx.OK | wx.ICON_ERROR)
   549             dialog.ShowModal()
   549             dialog.ShowModal()
   550             return False
   550             return False
   551         else:
   551         else:
   552             plc_file = os.path.join(new_project_path, "plc.xml")
   552             if not CheckPathPerm(new_project_path):
   553             if os.path.isfile(plc_file):
   553                 dialog = wx.MessageDialog(
   554                 message = (
   554                     self.AppFrame,
   555                     _("Selected directory already contains another project. Overwrite? \n"))
   555                     _('No write permissions in selected directory! \n'),
       
   556                     _("Error"), wx.OK | wx.ICON_ERROR)
       
   557                 dialog.ShowModal()
       
   558                 return False
       
   559             if not os.path.isdir(new_project_path) or len(os.listdir(new_project_path)) > 0:
       
   560                 plc_file = os.path.join(new_project_path, "plc.xml")
       
   561                 if os.path.isfile(plc_file):
       
   562                     message = _("Selected directory already contains another project. Overwrite? \n")
       
   563                 else:
       
   564                     message = _("Selected directory isn't empty. Continue? \n")
   556                 dialog = wx.MessageDialog(
   565                 dialog = wx.MessageDialog(
   557                     self.AppFrame, message, _("Error"), wx.YES_NO | wx.ICON_ERROR)
   566                     self.AppFrame, message, _("Error"), wx.YES_NO | wx.ICON_ERROR)
   558                 answer = dialog.ShowModal()
   567                 answer = dialog.ShowModal()
   559                 return answer == wx.ID_YES
   568                 return answer == wx.ID_YES
   560         return True
   569         return True