Work
This commit is contained in:
		@@ -1,2 +1,2 @@
 | 
			
		||||
from .recent_project import RecentProject
 | 
			
		||||
from .project import Project
 | 
			
		||||
from .project import Project, ProjectItem, ItemType
 | 
			
		||||
@@ -1,2 +1,2 @@
 | 
			
		||||
class CompositionClip(object):
 | 
			
		||||
    
 | 
			
		||||
    pass
 | 
			
		||||
@@ -1,7 +1,74 @@
 | 
			
		||||
import os
 | 
			
		||||
from enum import Enum
 | 
			
		||||
from typing import List
 | 
			
		||||
 | 
			
		||||
class ItemType(Enum):
 | 
			
		||||
    MISSING = 0
 | 
			
		||||
    DIRECTORY = 1
 | 
			
		||||
    IMAGE = 2
 | 
			
		||||
    AUDIO = 3
 | 
			
		||||
    VIDEO = 4
 | 
			
		||||
    SUBTITLES = 5
 | 
			
		||||
    PROJECT = 6
 | 
			
		||||
    COMPOSITION = 7
 | 
			
		||||
    SEQUENCE = 8
 | 
			
		||||
    UNKNOWN = 1000
 | 
			
		||||
 | 
			
		||||
class ProjectItem(object):
 | 
			
		||||
    def __init__(self, name : str, project : "Project", storage : "ProjectStorage", parent : "ProjectItem" = None):
 | 
			
		||||
        self.__storage = storage
 | 
			
		||||
        self.name = name
 | 
			
		||||
        self.project = project
 | 
			
		||||
        self.parent = parent
 | 
			
		||||
        self.__type : ItemType = None
 | 
			
		||||
        self.__children : list = None
 | 
			
		||||
 | 
			
		||||
    """
 | 
			
		||||
    Gets the path relative to the project directory.
 | 
			
		||||
 | 
			
		||||
    Returns:
 | 
			
		||||
        path relative to the project root folder.
 | 
			
		||||
    """
 | 
			
		||||
    def path(self) -> str:
 | 
			
		||||
        if self.parent:
 | 
			
		||||
            return os.path.join(self.parent.path(), self.name)
 | 
			
		||||
        return self.name
 | 
			
		||||
 | 
			
		||||
    """
 | 
			
		||||
    Gets the absolute path to this project item.
 | 
			
		||||
    """
 | 
			
		||||
    def absolutePath(self) -> str:
 | 
			
		||||
        return os.path.join(self.project.rootDir, self.path())
 | 
			
		||||
 | 
			
		||||
    """
 | 
			
		||||
    Gets the type of this project item.
 | 
			
		||||
    """
 | 
			
		||||
    def itemType(self) -> str:
 | 
			
		||||
        if self.__type is None:
 | 
			
		||||
            self.__type = self.__storage.itemType(self)
 | 
			
		||||
        return self.__type
 | 
			
		||||
 | 
			
		||||
    """
 | 
			
		||||
    Gets the children project items.
 | 
			
		||||
    """
 | 
			
		||||
    def children(self) -> List["ProjectItem"]:
 | 
			
		||||
        if self.__children is None:
 | 
			
		||||
            self.__children = list(self.__storage.itemChildren(self))
 | 
			
		||||
        return self.__children
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Project(object):
 | 
			
		||||
 | 
			
		||||
    def __init__(self, path):
 | 
			
		||||
        self.root_dir = path
 | 
			
		||||
        
 | 
			
		||||
    def get_items(self):
 | 
			
		||||
        pass
 | 
			
		||||
    def __init__(self, path : str, storage : "ProjectStorage"):
 | 
			
		||||
        self.__storage = storage
 | 
			
		||||
        self.projectFile : str = path
 | 
			
		||||
        self.rootDir : str = None
 | 
			
		||||
        self.videoBitsPerChannel : int = 8
 | 
			
		||||
        self.videoColorSpace : str = None
 | 
			
		||||
        self.audioSampleRate : int = 48000
 | 
			
		||||
        self.__items : List[ProjectItem] = None
 | 
			
		||||
 | 
			
		||||
    def items(self) -> List[ProjectItem]:
 | 
			
		||||
        if self.__items is None:
 | 
			
		||||
            self.__items = list(self.__storage.projectItems(self))
 | 
			
		||||
        return self.__items
 | 
			
		||||
@@ -1,6 +0,0 @@
 | 
			
		||||
class ProjectItem(object):
 | 
			
		||||
    
 | 
			
		||||
    def __init__(self, filename):
 | 
			
		||||
        self.filename = filename
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
		Reference in New Issue
	
	Block a user