MultiProject/MultiProject.py

branch
maintenance
changeset 6693
3629d88ae235
parent 6653
ac800d2700d2
child 6836
93b8c77502e0
diff -r 2a11e1b2dcbe -r 3629d88ae235 MultiProject/MultiProject.py
--- a/MultiProject/MultiProject.py	Thu Jan 10 14:23:49 2019 +0100
+++ b/MultiProject/MultiProject.py	Sat Feb 02 11:12:54 2019 +0100
@@ -10,6 +10,7 @@
 from __future__ import unicode_literals
 
 import os
+import shutil
 
 from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QFileInfo, QFile, \
     QIODevice, QObject
@@ -303,11 +304,14 @@
         self.__projects[project['uid']] = project
     
     @pyqtSlot()
-    def addNewProject(self, startdir=None):
+    def addNewProject(self, startdir="", category=""):
         """
         Public slot used to add a new project to the multi-project.
         
-        @param startdir start directory for the selection dialog (string)
+        @param startdir start directory for the selection dialog
+        @type str
+        @param category category to be preset
+        @type str
         """
         from .AddProjectDialog import AddProjectDialog
         if not startdir:
@@ -315,7 +319,7 @@
         if not startdir:
             startdir = Preferences.getMultiProject("Workspace")
         dlg = AddProjectDialog(self.ui, startdir=startdir,
-                               categories=self.categories)
+                               categories=self.categories, category=category)
         if dlg.exec_() == QDialog.Accepted:
             name, filename, isMaster, description, category, uid = \
                 dlg.getData()
@@ -414,6 +418,21 @@
             self.projectRemoved.emit(project)
             self.setDirty(True)
     
+    def deleteProject(self, uid):
+        """
+        Public slot to delete project(s) from the multi project and disk.
+        
+        @param uid UID of the project to be removed from the multi
+            project
+        @type str
+        """
+        if uid in self.__projects:
+            project = self.__projects[uid]
+            projectPath = os.path.dirname(project["file"])
+            shutil.rmtree(projectPath, True)
+            
+            self.removeProject(uid)
+    
     def __newMultiProject(self):
         """
         Private slot to build a new multi project.

eric ide

mercurial