Project/Project.py

branch
5_1_x
changeset 1113
95d837803666
parent 1045
e219cf36edbe
child 1159
43d3b178ae5b
equal deleted inserted replaced
1111:8f7ebfc5b087 1113:95d837803666
810 def __deleteSession(self): 810 def __deleteSession(self):
811 """ 811 """
812 Private method to delete the session file. 812 Private method to delete the session file.
813 """ 813 """
814 if self.pfile is None: 814 if self.pfile is None:
815 if not quiet: 815 E5MessageBox.critical(self.ui,
816 E5MessageBox.critical(self.ui, 816 self.trUtf8("Delete project session"),
817 self.trUtf8("Delete project session"), 817 self.trUtf8("Please save the project first."))
818 self.trUtf8("Please save the project first."))
819 return 818 return
820 819
821 fname, ext = os.path.splitext(os.path.basename(self.pfile)) 820 fname, ext = os.path.splitext(os.path.basename(self.pfile))
822 821
823 for fn in [os.path.join(self.getProjectManagementDir(), "{0}.e4s".format(fname))]: 822 for fn in [os.path.join(self.getProjectManagementDir(), "{0}.e4s".format(fname))]:
939 def __deleteDebugProperties(self): 938 def __deleteDebugProperties(self):
940 """ 939 """
941 Private method to delete the project debugger properties file (.e4d) 940 Private method to delete the project debugger properties file (.e4d)
942 """ 941 """
943 if self.pfile is None: 942 if self.pfile is None:
944 if not quiet: 943 E5MessageBox.critical(self.ui,
945 E5MessageBox.critical(self.ui, 944 self.trUtf8("Delete debugger properties"),
946 self.trUtf8("Delete debugger properties"), 945 self.trUtf8("Please save the project first."))
947 self.trUtf8("Please save the project first."))
948 return 946 return
949 947
950 fname, ext = os.path.splitext(os.path.basename(self.pfile)) 948 fname, ext = os.path.splitext(os.path.basename(self.pfile))
951 949
952 for fn in [os.path.join(self.getProjectManagementDir(), "{0}.e4d".format(fname))]: 950 for fn in [os.path.join(self.getProjectManagementDir(), "{0}.e4d".format(fname))]:
1752 shutil.rmtree(dn, True) 1750 shutil.rmtree(dn, True)
1753 except EnvironmentError: 1751 except EnvironmentError:
1754 E5MessageBox.critical(self.ui, 1752 E5MessageBox.critical(self.ui,
1755 self.trUtf8("Delete directory"), 1753 self.trUtf8("Delete directory"),
1756 self.trUtf8("<p>The selected directory <b>{0}</b> could not be" 1754 self.trUtf8("<p>The selected directory <b>{0}</b> could not be"
1757 " deleted.</p>").format(fn)) 1755 " deleted.</p>").format(dn))
1758 return False 1756 return False
1759 1757
1760 self.removeDirectory(dn) 1758 self.removeDirectory(dn)
1761 return True 1759 return True
1762 1760
4140 except (IOError, UnicodeError) as why: 4138 except (IOError, UnicodeError) as why:
4141 E5MessageBox.critical(self.ui, 4139 E5MessageBox.critical(self.ui,
4142 self.trUtf8("Create Plugin Archive"), 4140 self.trUtf8("Create Plugin Archive"),
4143 self.trUtf8("""<p>The plugin file <b>{0}</b> could """ 4141 self.trUtf8("""<p>The plugin file <b>{0}</b> could """
4144 """not be read.</p>""" 4142 """not be read.</p>"""
4145 """<p>Reason: {1}</p>""").format(archive, str(why))) 4143 """<p>Reason: {1}</p>""").format(filename, str(why)))
4146 return b"", "" 4144 return b"", ""
4147 4145
4148 lineno = 0 4146 lineno = 0
4149 while lineno < len(sourcelines): 4147 while lineno < len(sourcelines):
4150 if sourcelines[lineno].startswith("version = "): 4148 if sourcelines[lineno].startswith("version = "):
4177 except (IOError, UnicodeError) as why: 4175 except (IOError, UnicodeError) as why:
4178 E5MessageBox.critical(self.ui, 4176 E5MessageBox.critical(self.ui,
4179 self.trUtf8("Create Plugin Archive"), 4177 self.trUtf8("Create Plugin Archive"),
4180 self.trUtf8("""<p>The plugin file <b>{0}</b> could """ 4178 self.trUtf8("""<p>The plugin file <b>{0}</b> could """
4181 """not be read.</p>""" 4179 """not be read.</p>"""
4182 """<p>Reason: {1}</p>""").format(archive, str(why))) 4180 """<p>Reason: {1}</p>""").format(filename, str(why)))
4183 return "" 4181 return ""
4184 4182
4185 for sourceline in sourcelines: 4183 for sourceline in sourcelines:
4186 if sourceline.startswith("version = "): 4184 if sourceline.startswith("version = "):
4187 version = sourceline.replace("version = ", "").strip()\ 4185 version = sourceline.replace("version = ", "").strip()\

eric ide

mercurial