示例#1
0
    def create_new_project(self, name, path, description):
        name = name.strip()
        if name == "":
            raise Exception("project", "no name given")

        # create folders
        project_path = os.path.join(path, name)
        if os.path.exists(project_path):
            raise Exception("project", "directory already exists")

        if not os.access(path, os.W_OK):
            raise Exception("project", "directory is not writable")

        os.mkdir(project_path)

        # create project.dice
        project_dice = os.path.join(project_path, "project.dice")
        pd = JsonOrderedDict(project_dice)
        conf = {
            "projectName": name,
            "apps": [],
            "groups": [],
            "connections": [],
            "description": description
        }
        pd.update(conf)

        self.load_project(project_dice)
示例#2
0
文件: main.py 项目: nxsofsys/dice-dev
    def create_new_project(self, name, path, description):
        name = name.strip()
        if name == "":
            raise Exception("project", "no name given")

        # create folders
        project_path = os.path.join(path, name)
        if os.path.exists(project_path):
            raise Exception("project", "directory already exists")

        if not os.access(path, os.W_OK):
            raise Exception("project", "directory is not writable")

        os.mkdir(project_path)

        # create project.dice
        project_dice = os.path.join(project_path, "project.dice")
        pd = JsonOrderedDict(project_dice)
        conf = {"projectName": name, "apps": [], "groups": [], "connections": [], "description": description}
        pd.update(conf)

        self.load_project(project_dice)