File tree Expand file tree Collapse file tree
activity_browser/actions/project Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import shutil
2+
13from qtpy import QtWidgets
24
5+ import bw2data as bd
6+ from bw2data .project import ProjectDataset
7+ from bw2data .utils import safe_filename
8+
39from activity_browser import settings , application
410from activity_browser .actions .base import ABAction , exception_dialogs
5- from activity_browser .mod import bw2data as bd
611from activity_browser .ui .icons import qicons
712
813
@@ -74,6 +79,18 @@ def run(project_names: [str] = None):
7479 application .main_window , "Project(s) deleted" , "Project(s) successfully deleted"
7580 )
7681
82+ @staticmethod
83+ def delete_project (name : str , delete_dir : bool ):
84+
85+ ds = ProjectDataset .get (ProjectDataset .name == name )
86+
87+ if delete_dir :
88+ dir_path = bd .projects ._base_data_dir / safe_filename (name , full = ds .full_hash )
89+ assert dir_path .is_dir (), "Can't find project directory"
90+ shutil .rmtree (dir_path )
91+
92+ ds .delete ()
93+
7794
7895class ProjectDeletionDialog (QtWidgets .QDialog ):
7996
You can’t perform that action at this time.
0 commit comments