Mon, 28 Apr 2014 19:18:51 +0200
Improved the multi project manager.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DTDs/MultiProject-5.1.dtd Mon Apr 28 19:18:51 2014 +0200 @@ -0,0 +1,22 @@ +<!-- This is the DTD for eric5's multi project file version 5.1 --> + +<!ELEMENT Description (#PCDATA)> + +<!ELEMENT ProjectName (#PCDATA)> +<!ELEMENT ProjectFile (#PCDATA)> +<!ELEMENT ProjectDescription (#PCDATA)> +<!ELEMENT ProjectCategory (#PCDATA)> +<!ELEMENT Project (ProjectName, + ProjectFile, + ProjectDescription, + ProjectCategory)> +<!ATTLIST Project + isMaster CDATA #REQUIRED + uid CDATA #REQUIRED> + +<!ELEMENT Projects (Project*)> + +<!ELEMENT MultiProject (Description, + Projects)> +<!ATTLIST MultiProject + version CDATA #REQUIRED>
--- a/Documentation/Source/eric5.MultiProject.MultiProject.html Sun Apr 27 19:40:48 2014 +0200 +++ b/Documentation/Source/eric5.MultiProject.MultiProject.html Mon Apr 28 19:18:51 2014 +0200 @@ -123,7 +123,7 @@ <td>Private method to open a multi project from the list of rencently opened multi projects.</td> </tr><tr> <td><a href="#MultiProject.__readMultiProject">__readMultiProject</a></td> -<td>Private method to read in a multi project (.e4m) file.</td> +<td>Private method to read in a multi project (.e4m, .e5m) file.</td> </tr><tr> <td><a href="#MultiProject.__saveRecent">__saveRecent</a></td> <td>Private method to save the list of recently opened filenames.</td> @@ -165,7 +165,7 @@ <td>Public method to get the list of defined categories.</td> </tr><tr> <td><a href="#MultiProject.getDependantProjectFiles">getDependantProjectFiles</a></td> -<td>Public method to get the filenames of the dependant projects.</td> +<td>Public method to get the filenames of the dependent projects.</td> </tr><tr> <td><a href="#MultiProject.getMasterProjectFile">getMasterProjectFile</a></td> <td>Public method to get the filename of the master project.</td> @@ -309,7 +309,7 @@ <h4>MultiProject.__readMultiProject</h4> <b>__readMultiProject</b>(<i>fn</i>) <p> - Private method to read in a multi project (.e4m) file. + Private method to read in a multi project (.e4m, .e5m) file. </p><dl> <dt><i>fn</i></dt> <dd> @@ -439,11 +439,11 @@ <h4>MultiProject.getDependantProjectFiles</h4> <b>getDependantProjectFiles</b>(<i></i>) <p> - Public method to get the filenames of the dependant projects. + Public method to get the filenames of the dependent projects. </p><dl> <dt>Returns:</dt> <dd> -names of the dependant project files (list of strings) +names of the dependent project files (list of strings) </dd> </dl><a NAME="MultiProject.getMasterProjectFile" ID="MultiProject.getMasterProjectFile"></a> <h4>MultiProject.getMasterProjectFile</h4>
--- a/E5XML/Config.py Sun Apr 27 19:40:48 2014 +0200 +++ b/E5XML/Config.py Mon Apr 28 19:18:51 2014 +0200 @@ -8,7 +8,7 @@ """ # version number of the multi project file -multiProjectFileFormatVersion = "5.0" +multiProjectFileFormatVersion = "5.1" # version number of the project file projectFileFormatVersion = "5.1"
--- a/E5XML/MultiProjectReader.py Sun Apr 27 19:40:48 2014 +0200 +++ b/E5XML/MultiProjectReader.py Mon Apr 28 19:18:51 2014 +0200 @@ -19,7 +19,7 @@ """ Class for reading an XML multi project file. """ - supportedVersions = ["4.2", "5.0"] + supportedVersions = ["4.2", "5.0", "5.1"] def __init__(self, device, multiProject): """ @@ -79,6 +79,13 @@ project = {} project["master"] = self.toBool(self.attribute("isMaster", "False")) + uid = self.attribute("uid", "") + if uid: + project["uid"] = uid + else: + # upgrade from pre 5.1 format + from PyQt4.QtCore import QUuid + project["uid"] = QUuid.createUuid().toString() while not self.atEnd(): self.readNext()
--- a/E5XML/MultiProjectWriter.py Sun Apr 27 19:40:48 2014 +0200 +++ b/E5XML/MultiProjectWriter.py Mon Apr 28 19:18:51 2014 +0200 @@ -65,6 +65,7 @@ for project in self.multiProject.getProjects(): self.writeStartElement("Project") self.writeAttribute("isMaster", str(project['master'])) + self.writeAttribute("uid", project["uid"]) self.writeTextElement("ProjectName", project['name']) self.writeTextElement( "ProjectFile",
--- a/MultiProject/AddProjectDialog.py Sun Apr 27 19:40:48 2014 +0200 +++ b/MultiProject/AddProjectDialog.py Mon Apr 28 19:18:51 2014 +0200 @@ -47,6 +47,7 @@ self.categoryComboBox.addItems(sorted(categories)) self.startdir = startdir + self.uid = "" self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok) self.__okButton.setEnabled(False) @@ -54,9 +55,6 @@ if project is not None: self.setWindowTitle(self.tr("Project Properties")) - self.filenameEdit.setReadOnly(True) - self.fileButton.setEnabled(False) - self.nameEdit.setText(project['name']) self.filenameEdit.setText(project['file']) self.descriptionEdit.setPlainText(project['description']) @@ -65,6 +63,7 @@ if index == -1: index = 0 self.categoryComboBox.setCurrentIndex(index) + self.uid = project["uid"] @pyqtSlot() def on_fileButton_clicked(self): @@ -72,8 +71,9 @@ Private slot to display a file selection dialog. """ startdir = self.filenameEdit.text() - if not startdir and self.startdir is not None: - startdir = self.startdir + if startdir or self.startdir is not None: + if not startdir: + startdir = self.startdir projectFile = E5FileDialog.getOpenFileName( self, self.tr("Add Project"), @@ -93,11 +93,17 @@ telling whether the project shall be the main project, a short description for the project and the project category """ + if not self.uid: + # new project entry + from PyQt4.QtCore import QUuid + self.uid = QUuid.createUuid().toString() + return (self.nameEdit.text(), self.filenameEdit.text(), self.masterCheckBox.isChecked(), self.descriptionEdit.toPlainText(), - self.categoryComboBox.currentText()) + self.categoryComboBox.currentText(), + self.uid) @pyqtSlot(str) def on_nameEdit_textChanged(self, txt):
--- a/MultiProject/MultiProject.py Sun Apr 27 19:40:48 2014 +0200 +++ b/MultiProject/MultiProject.py Mon Apr 28 19:18:51 2014 +0200 @@ -99,6 +99,7 @@ # project # 'description' : description of the project # 'category' : name of the group + # 'uid' : unique identifier self.categories = [] def __loadRecent(self): @@ -213,7 +214,7 @@ def __readMultiProject(self, fn): """ - Private method to read in a multi project (.e4m) file. + Private method to read in a multi project (.e4m, .e5m) file. @param fn filename of the multi project file to be read (string) @return flag indicating success @@ -307,7 +308,8 @@ dlg = AddProjectDialog(self.ui, startdir=startdir, categories=self.categories) if dlg.exec_() == QDialog.Accepted: - name, filename, isMaster, description, category = dlg.getData() + name, filename, isMaster, description, category, uid = \ + dlg.getData() # step 1: check, if project was already added for project in self.projects: @@ -330,6 +332,7 @@ 'master': isMaster, 'description': description, 'category': category, + 'uid': uid, } self.projects.append(project) if category not in self.categories: @@ -347,7 +350,7 @@ if pro['master']: for project in self.projects: if project['master']: - if project['file'] != pro['file']: + if project['uid'] != pro['uid']: project['master'] = False self.projectDataChanged.emit(project) self.setDirty(True) @@ -355,8 +358,9 @@ # step 2: change the entry for project in self.projects: - if project['file'] == pro['file']: - # project file name is not changeable via interface + if project['uid'] == pro['uid']: + # project UID is not changeable via interface + project['file'] = pro['file'] project['name'] = pro['name'] project['master'] = pro['master'] project['description'] = pro['description'] @@ -914,9 +918,9 @@ def getDependantProjectFiles(self): """ - Public method to get the filenames of the dependant projects. + Public method to get the filenames of the dependent projects. - @return names of the dependant project files (list of strings) + @return names of the dependent project files (list of strings) """ files = [] for project in self.projects:
--- a/MultiProject/MultiProjectBrowser.py Sun Apr 27 19:40:48 2014 +0200 +++ b/MultiProject/MultiProjectBrowser.py Mon Apr 28 19:18:51 2014 +0200 @@ -267,14 +267,15 @@ self, project=project, categories=self.multiProject.getCategories()) if dlg.exec_() == QDialog.Accepted: - name, filename, isMaster, description, category = \ - dlg.getData() + (name, filename, isMaster, description, category, + uid) = dlg.getData() project = { 'name': name, 'file': filename, 'master': isMaster, 'description': description, 'category': category, + 'uid': uid, } self.multiProject.changeProjectProperties(project)