def reset(self):
        self.resetCache()
        self.version_set = False
        self['Version'] = GenTree()

        self.pub_set = False
        self['PublishedType'] = GenTree()
Exemple #2
0
    def reset(self):
        """reset all caches
        """
        self.resetCache()
        self['Shows'] = GenTree()
        self['FPT'] = GenTree()
        self['Steps'] = StepListInfoDb()
        self['Users'] = UserListInfoDb()

        self._currentshow = ""
Exemple #3
0
 def reset(self):
     self.id = -1
     self.label = ""
     self._currentsequence = ""
     self._currentasset = ""
     self._current_configpipe = ""
     self['Sequences'] = GenTree()
     self['Assets'] = AssetListInfoDb()
     self['PipelineConfig'] = PipeConfigListInfoDb()
     self['TaskAssign'] = GenTree()
     self.shot_order_dict = None
    def set_media_version(self, versions):
        self.version_set = True
        if len(versions) == 0:
            return list()
        type_names = self['Version'].childNames()

        # should maybe be sorted later when in step
        for obj in versions:
            if obj.version_type not in type_names:
                g = GenTree()
                g.setName(obj.version_type)
                self['Version'].addChild(g)
                type_names = self['Version'].childNames()
            self['Version'][obj.version_type].addChild(obj)
        return self.get_media_version()
    def set_media_version2(self, versions, with_belong=True):
        self.version_set = True
        if len(versions) == 0:
            return list()
        type_names = self['Version'].childNames()

        # should maybe be sorted later when in step
        for obj in versions:
            if with_belong:
                key = obj.get_belong_to()
            else:
                key = obj.version_type
            if key not in type_names:
                g = GenTree()
                g.setName(key)
                self['Version'].addChild(g)
                type_names = self['Version'].childNames()
            self['Version'][key].addChild(obj)
        return self.get_media_version()
Exemple #6
0
    def __init__(self,
                 name,
                 aformat="%s",
                 isSub=True,
                 actionName = None,
                 callback=None,
                 checkable=False):

        super(McDataContext, self).__init__()
        self.setName(name)

        self._subActionName = actionName
        self._format = aformat
        self._isSub = isSub

        self._callback = callback
        self._actionList = []
        self._unused = GenTree()

        # action supported
        self._checkAble = checkable
        self._check = True
Exemple #7
0
 def reset_sequences_and_assets(self):
     self['Sequences'].resetChildren()
     self['Assets'].resetChildren()
     self['Sequences'] = GenTree()
     self['Assets'] = AssetListInfoDb()
     self.shot_order_dict = dict()
Exemple #8
0
class McDataContext(BaseDataContext):
    _delimiter = "-@@-"
    _unknown = "unknown"
    _fileList = list()
    _pathsearch = ""

    @staticmethod
    def isSep():
        return False

    @classmethod
    def cleanClassVar(cls):
        cls._fileList = list()
        cls._pathsearch = ""

    @classmethod
    def buildArgSep(cls,str1,str2):
        return "%s%s%s" % (str1,cls._delimiter,str2)

    @classmethod
    def getArgSep(cls,str1):
        return str1.split(cls._delimiter)

    @classmethod
    def unknown(cls):
        return cls._unknown

    def __init__(self,
                 name,
                 aformat="%s",
                 isSub=True,
                 actionName = None,
                 callback=None,
                 checkable=False):

        super(McDataContext, self).__init__()
        self.setName(name)

        self._subActionName = actionName
        self._format = aformat
        self._isSub = isSub

        self._callback = callback
        self._actionList = []
        self._unused = GenTree()

        # action supported
        self._checkAble = checkable
        self._check = True

    # checkability
    def ckeckable(self):
        return self._checkAble

    def setCheckable(self,val):
        self._checkAble = val

    def isChecked(self):
        return self._check

    def setCheck(self,val):
        self._check = val

    def buildDefaultKid(self):
        for mode in self._listMode:
            for tt in self._listType:
                k = "%s_%s" % (mode, tt)
                n = McDataContext(k, k, False,actionName=self.getSubActionName())
                self._unused.addChild(n)

    def actionName(self):
        return self.getName()

    def getSubActionName(self):
        if self._subActionName != None:
            return self._subActionName
        return self.getName()

    def setSubActionName(self,an):
        self._subActionName = an.replace(" ","")

    def actionTitle(self, aname):
        if self._format.find("%s") != -1:
            return self._format % aname
        return self._format

    def isSubmenu(self):
        return self._isSub

    def subAction(self):
        return self.getChildren()

    # to be overloaded
    def hasAction(self):
        if len(self._actionList) > 0:
            return True
        for c in self.subAction():
            if c.hasAction():
                return True
        return False

    def getActions(self):
        return self._actionList

    def setActionList(self, alist):
        self._actionList = alist

    def addActionList(self, alist):
        self._actionList.append(alist)

    def resetAction(self):
        self._actionList = []

    def _initialize(self):
        self.resetAction()
        for i in self.subAction():
            i._initialize()
        for chn in self.getChildren()[:]:
            self._unused.addChild(chn)
        #self.resetChildren()
        self.resetCache()

    # to be overload
    def initialize(self,assetName=None, apathname=None):
        if apathname == None:
            return list()
        self._initialize() # reset the child and the local action
        return McDataContext.updateSearch(apathname,self._listResolution, self._filterListExt)

    def execute(self,subAction, arg):
        msg = self.doIt(subAction,arg)
        if msg != None:
            if self._callback != None:
                self._callback(self,self.getName(),subAction, msg.getFilename())
        return msg

    def getAppSignal(self,signalName):
        return "%s(PyQt_PyObject)" % signalName

    # to be overload
    def doIt(self,subAction,arg):
        log.warning("in doit %s %s" % (subAction,arg))
        log.warning("doIt has to be overloaded for context %s" % self.getName())
        return None