Example #1
0
    def saveSettings(self):
        prjTemplate = self.templateStructureProject.text()

        OTLPaths_prj = self.templateOtlPath_prj.text()
        OTLPath_epi = self.templateOtlPath_epi.text()
        OTLPath_shot = self.templateOtlPath_shot.text()

        workPath_prj = self.templateWorkPath_prj.text()
        workPath_epi = self.templateWorkPath_epi.text()
        workPath_shot = self.templateWorkPath_shot.text()

        templatesData = {
            "projectTemplate": prjTemplate,
            "OTLPaths": {
                "OTLPath_prj": OTLPaths_prj,
                "OTLPath_epi": OTLPath_epi,
                "OTLPath_shot": OTLPath_shot
            },
            "Work_Paths": {
                "workPath_prj": workPath_prj,
                "workPath_epi": workPath_epi,
                "workPath_shot": workPath_shot
            }
        }

        path = self.getProjectsFolder(prjTemplate)
        if os.path.exists(path):
            configUtils.saveConfigData(templateConfigFile, templatesData)
            self.close()
        else:
            msg = QMessageBox()
            msg.setText("'{dir}' directory is not exists".format(dir=path))
            msg.setStandardButtons(QMessageBox.Ok)
            msg.exec_()
Example #2
0
def getLocalNukeLocation(ver):

    configFile = configUtils.configLocal
    if not os.path.exists(configFile):
        configUtils.saveConfigData(configFile, dict())

    localNukeLocation = configUtils.loadConfigData(
        configUtils.configLocal).get('NUKE_location')
    nukeLocation = ""
    if localNukeLocation:
        rootDir, nukeDir = os.path.split(localNukeLocation)
        nukeDir = "/".join([rootDir, r"Nuke{ver}"])
        nukeLocation = nukeDir.format(ver=ver)
    return nukeLocation
Example #3
0
    def addConfiFile(self):
        for item in self.selectedItems():
            filePath = self.getItemConfig(item)
            if os.path.exists(filePath) is False:
                configUtils.saveConfigData(filePath, [])

    # def selectItem(self, item):
    #     self.updateDataInfo(item.data(Qt.UserRole))

#    def updateDataInfo(self, data):
#        info = """Project: {}
# Episod: {}
#   Shot: {}""".format(data['project'], data['episod'], data['shot'])
#        self.info_label.setText(info)
Example #4
0
    def setActive(self):
        projectNameList = self.projectListWidget.selectedItems()

        filePath = activeProjectsFile
        data = configUtils.loadConfigData(filePath)
        data = [] if data is None else data

        for projectName in projectNameList:
            if projectName.text() in data:
                data.pop(data.index(projectName.text()))
            else:
                data.append(projectName.text())

            configUtils.saveConfigData(filePath, data)
            self.updateActiveProjectList()
Example #5
0
def getNukeLocation(ver, afRender=False):
    from platform import system
    nukeDir = ""
    if system() is 'Windows':
        nukeDir = "/".join(['C:', 'Program Files', r'Nuke{ver}'])
    elif system() is 'Linux':
        nukeDir = ''
    elif system() == 'Darwin':
        nukeDir = ''

    nukeLocation = nukeDir.format(ver=ver)
    if not os.path.exists(nukeLocation):
        nukeLocation = getLocalNukeLocation(ver)

    if not os.path.exists(nukeLocation):
        if afRender:
            print('===> Nuke location not found!')
            raise FileNotFoundError
        else:
            while not os.path.exists(nukeLocation):
                dialog = simpleDialogs.PathFileDialog()
                text = 'Specify the nuke folder please. \nRecomended verison is: Nuke"{}"'.format(
                    ver)
                nukeLocation = dialog.showDialog(text)
                if nukeLocation is None:
                    return None, None

                localData = configUtils.loadConfigData(configUtils.configLocal)
                localData['NUKE_location'] = nukeLocation
                configUtils.saveConfigData(configUtils.configLocal, localData)

    pattern = r'^Nuke\d{1,2}(\.\d{1,2}(\.\d{1,2})?)?\.exe$'
    try:
        nukeExe = list(
            filter(lambda x: re.search(pattern, x),
                   os.listdir(nukeLocation)))[0]
    except FileNotFoundError as err:
        print('===> Nuke location not found!')
        raise err

    return nukeLocation, nukeExe
Example #6
0
 def saveConfigData(self, configPath):
     currTreeData = self.getVarsTreeData()
     configUtils.saveConfigData(configPath, currTreeData)
 def saveProjectStructureConfigData(self):
     structData = treeWdg_utils.getSimpleStructureData(self)
     configPath = configUtils.projectStructureConfigFile
     configUtils.saveConfigData(configPath, structData)
 def saveTreeData(self):
     treeData = treeWdg_utils.collectTreeData(self)
     path = "/".join([os.path.dirname(__file__), "treeData.json"])
     configUtils.saveConfigData(path, treeData)
Example #9
0
 def collapseAllTree(self):
     treeWdg_utils.collapseAllTree(self)
     # self.setSelectedItem()
     configData = configUtils.loadConfigData(taskManagerConfigFile)
     configData["treeExpand"] = False
     configUtils.saveConfigData(taskManagerConfigFile, configData)
Example #10
0
 def expandAllTree(self):
     treeWdg_utils.expandAllTree(self)
     # self.setSelectedItem()
     configData = configUtils.loadConfigData(taskManagerConfigFile)
     configData["treeExpand"] = True
     configUtils.saveConfigData(taskManagerConfigFile, configData)
Example #11
0
 def saveActiveProject(self, project):
     configData = configUtils.loadConfigData(taskManagerConfigFile)
     configData["activeProject"] = project
     configUtils.saveConfigData(taskManagerConfigFile, configData)
 def saveVariableConfig(self):
     configPath = self.getCurrentConfigPath()
     if configPath is None:
         return None
     currTreeData = self.getTreeData()
     configUtils.saveConfigData(configPath, currTreeData)
Example #13
0
 def saveCredentialData(self, data):
     configUtils.checkAndCreateConfigFile(crPath)
     configUtils.saveConfigData(crPath, data)