14 import fnmatch |
14 import fnmatch |
15 import copy |
15 import copy |
16 import zipfile |
16 import zipfile |
17 import re |
17 import re |
18 |
18 |
19 from PyQt4.QtCore import * |
19 from PyQt4.QtCore import QFile, QFileInfo, pyqtSignal, QCryptographicHash, QIODevice, \ |
20 from PyQt4.QtGui import * |
20 QByteArray, QObject, Qt |
|
21 from PyQt4.QtGui import QCursor, QLineEdit, QToolBar, QDialog, QInputDialog, \ |
|
22 QApplication, QMenu |
21 |
23 |
22 from E5Gui.E5Application import e5App |
24 from E5Gui.E5Application import e5App |
23 from E5Gui import E5FileDialog, E5MessageBox |
25 from E5Gui import E5FileDialog, E5MessageBox |
24 |
26 |
25 from Globals import recentNameProject |
27 from Globals import recentNameProject |
811 def __deleteSession(self): |
813 def __deleteSession(self): |
812 """ |
814 """ |
813 Private method to delete the session file. |
815 Private method to delete the session file. |
814 """ |
816 """ |
815 if self.pfile is None: |
817 if self.pfile is None: |
816 if not quiet: |
818 E5MessageBox.critical(self.ui, |
817 E5MessageBox.critical(self.ui, |
819 self.trUtf8("Delete project session"), |
818 self.trUtf8("Delete project session"), |
820 self.trUtf8("Please save the project first.")) |
819 self.trUtf8("Please save the project first.")) |
|
820 return |
821 return |
821 |
822 |
822 fname, ext = os.path.splitext(os.path.basename(self.pfile)) |
823 fname, ext = os.path.splitext(os.path.basename(self.pfile)) |
823 |
824 |
824 for fn in [os.path.join(self.getProjectManagementDir(), "{0}.e4s".format(fname))]: |
825 for fn in [os.path.join(self.getProjectManagementDir(), "{0}.e4s".format(fname))]: |
940 def __deleteDebugProperties(self): |
941 def __deleteDebugProperties(self): |
941 """ |
942 """ |
942 Private method to delete the project debugger properties file (.e4d) |
943 Private method to delete the project debugger properties file (.e4d) |
943 """ |
944 """ |
944 if self.pfile is None: |
945 if self.pfile is None: |
945 if not quiet: |
946 E5MessageBox.critical(self.ui, |
946 E5MessageBox.critical(self.ui, |
947 self.trUtf8("Delete debugger properties"), |
947 self.trUtf8("Delete debugger properties"), |
948 self.trUtf8("Please save the project first.")) |
948 self.trUtf8("Please save the project first.")) |
|
949 return |
949 return |
950 |
950 |
951 fname, ext = os.path.splitext(os.path.basename(self.pfile)) |
951 fname, ext = os.path.splitext(os.path.basename(self.pfile)) |
952 |
952 |
953 for fn in [os.path.join(self.getProjectManagementDir(), "{0}.e4d".format(fname))]: |
953 for fn in [os.path.join(self.getProjectManagementDir(), "{0}.e4d".format(fname))]: |
1753 shutil.rmtree(dn, True) |
1753 shutil.rmtree(dn, True) |
1754 except EnvironmentError: |
1754 except EnvironmentError: |
1755 E5MessageBox.critical(self.ui, |
1755 E5MessageBox.critical(self.ui, |
1756 self.trUtf8("Delete directory"), |
1756 self.trUtf8("Delete directory"), |
1757 self.trUtf8("<p>The selected directory <b>{0}</b> could not be" |
1757 self.trUtf8("<p>The selected directory <b>{0}</b> could not be" |
1758 " deleted.</p>").format(fn)) |
1758 " deleted.</p>").format(dn)) |
1759 return False |
1759 return False |
1760 |
1760 |
1761 self.removeDirectory(dn) |
1761 self.removeDirectory(dn) |
1762 return True |
1762 return True |
1763 |
1763 |
4141 except (IOError, UnicodeError) as why: |
4141 except (IOError, UnicodeError) as why: |
4142 E5MessageBox.critical(self.ui, |
4142 E5MessageBox.critical(self.ui, |
4143 self.trUtf8("Create Plugin Archive"), |
4143 self.trUtf8("Create Plugin Archive"), |
4144 self.trUtf8("""<p>The plugin file <b>{0}</b> could """ |
4144 self.trUtf8("""<p>The plugin file <b>{0}</b> could """ |
4145 """not be read.</p>""" |
4145 """not be read.</p>""" |
4146 """<p>Reason: {1}</p>""").format(archive, str(why))) |
4146 """<p>Reason: {1}</p>""").format(filename, str(why))) |
4147 return b"", "" |
4147 return b"", "" |
4148 |
4148 |
4149 lineno = 0 |
4149 lineno = 0 |
4150 while lineno < len(sourcelines): |
4150 while lineno < len(sourcelines): |
4151 if sourcelines[lineno].startswith("version = "): |
4151 if sourcelines[lineno].startswith("version = "): |
4178 except (IOError, UnicodeError) as why: |
4178 except (IOError, UnicodeError) as why: |
4179 E5MessageBox.critical(self.ui, |
4179 E5MessageBox.critical(self.ui, |
4180 self.trUtf8("Create Plugin Archive"), |
4180 self.trUtf8("Create Plugin Archive"), |
4181 self.trUtf8("""<p>The plugin file <b>{0}</b> could """ |
4181 self.trUtf8("""<p>The plugin file <b>{0}</b> could """ |
4182 """not be read.</p>""" |
4182 """not be read.</p>""" |
4183 """<p>Reason: {1}</p>""").format(archive, str(why))) |
4183 """<p>Reason: {1}</p>""").format(filename, str(why))) |
4184 return "" |
4184 return "" |
4185 |
4185 |
4186 for sourceline in sourcelines: |
4186 for sourceline in sourcelines: |
4187 if sourceline.startswith("version = "): |
4187 if sourceline.startswith("version = "): |
4188 version = sourceline.replace("version = ", "").strip()\ |
4188 version = sourceline.replace("version = ", "").strip()\ |