コード例 #1
0
ファイル: project.py プロジェクト: Mikfr83/Luna
 def refresh_recent():
     recent_projects = Config.get(ProjectVars.recent_projects)
     existing_projects = []
     for prj in recent_projects:
         if os.path.isdir(prj[1]):
             existing_projects.append(prj)
     Config.set(ProjectVars.recent_projects, existing_projects)
コード例 #2
0
ファイル: project.py プロジェクト: Mikfr83/Luna
    def add_to_recent(self):
        max_recent = Config.get(ProjectVars.recent_max, default=3)
        project_queue = Config.get(ProjectVars.recent_projects,
                                   default=deque(maxlen=max_recent))
        if not isinstance(project_queue, deque):
            project_queue = deque(project_queue, maxlen=max_recent)

        entry = [self.name, self.path]
        if entry in project_queue:
            return

        project_queue.appendleft(entry)
        Config.set(ProjectVars.recent_projects, list(project_queue))
コード例 #3
0
ファイル: project.py プロジェクト: Mikfr83/Luna
    def set(path):
        if not Project.is_project(path):
            Logger.error("Not a project: {0}".format(path))
            return

        project_instance = Project(path)
        project_instance.update_meta()
        # Set enviroment variables and refresh HUD
        environFn.set_project_var(project_instance)
        Config.set(ProjectVars.previous_project, project_instance.path)
        project_instance.add_to_recent()
        LunaHud.refresh()

        return project_instance
コード例 #4
0
ファイル: project.py プロジェクト: Mikfr83/Luna
    def create(path):
        if Project.is_project(path):
            Logger.error("Already a project: {0}".format(path))
            return

        new_project = Project(path)
        # Create missing meta and tag files
        fileFn.create_missing_dir(new_project.path)
        fileFn.create_file(path=new_project.tag_path)
        creation_date = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
        new_project.meta_data = ("created", creation_date)

        # Set enviroment variables and refresh HUD
        environFn.set_project_var(new_project)
        Config.set(ProjectVars.previous_project, new_project.path)
        new_project.add_to_recent()
        LunaHud.refresh()

        return new_project