def _on_save_project_as(self, info):
     """ Saving project as a folder containing pickled data, and script
     """
     project = info.object.project
     base_dir = self._get_current_project_dir(project)
     project_name = create_unique_project_name(base_dir, 'Converge Project')
     pfui = ProjectFolderUI(base_dir = base_dir,
                            project_name = project_name)
     ui = pfui.edit_traits(kind = 'livemodal')
     if ui.result:
         project_dir = os.path.join(pfui.base_dir, pfui.project_name)
         self._save_project_graphically(info.ui.control, project, project_dir)
     return
    def save_project_to_file(self, file_path):
        """ Save block and context as a project to a file.

            Parameters:
            -----------
            file_path: Str
                Complete file-path where the project file is to be saved.

        """

        # Make a directory to save the pickled context and the script
        pathsplit = os.path.split(file_path)
        path_ext = os.path.splitext(pathsplit[1])
        dir_name = pathsplit[0]
        project_name = create_unique_project_name(dir_name, path_ext[0])

        self._save_project(dir_name, project_name)
        return
    def save_new_project(self):
        """ Save a new project

            Save it in the user-directory.
        """

        # Save afresh in the user directory
        project_dir = ETSConfig.user_data
        project_name = 'converge_project'
        project_name = create_unique_project_name(project_dir,
                                                  project_name)
        pfui = ProjectFolderUI(project_dir = project_dir,
                               project_name = project_name)
        ui = pfui.edit_traits(kind = 'livemodal')
        if ui.result:
            file_path = os.path.join(pfui.project_dir,
                                     pfui.project_name+'.prj')
            if file_path != '':
                self.save_project_to_file(file_path)

        return