Exemplo n.º 1
0
        def get_all_data():
            config_data = {}
            data_user_files    = pipefunc.get_file_list(path=self.get_env('DATA_USER_PATH'),    file_type='*' + DATA_FORMAT)
            data_project_files = pipefunc.get_file_list(path=self.get_env('DATA_PROJECT_PATH'), file_type='*' + DATA_FORMAT)

            data_project_files = list(set(data_user_files)|set(data_project_files))
            for each_file in data_project_files: config_data.update({each_file : self.get_data(each_file, user_id)})
            return config_data
Exemplo n.º 2
0
    def setup_env(self):
        LOG.debug('- {} -----------------------------------------------------'.
                  format(self._NAME.upper()))

        sub_path = []
        software_path = []

        for each_path in os.environ['SOFTWARE_SRC_PATH'].split(';'):
            # if not each_path.endswith('software'): each_path = os.path.dirname(each_path)
            tmp_paths = ('/').join([each_path, self._NAME])
            software_path.append(tmp_paths)
            tmp_folder = pipefunc.get_file_list(path=tmp_paths,
                                                exclude='.py',
                                                add_path=True)
            if not tmp_folder: continue
            sub_path.extend(tmp_folder)

        os.environ['SOFTWARE_PATH'] = (';').join(software_path)
        os.environ['SOFTWARE_SUB_PATH'] = (';').join(sub_path)
        LOG.debug("SOFTWARE_PATH: {}".format(os.environ['SOFTWARE_PATH']))

        # GET data
        self._software_data = Tank().data_software
        self._env = self._software_data.get('ENV', '')

        # ADD software ENV
        if (self._env):
            for env, content in self._env.iteritems():
                if isinstance(content, list):
                    for each in content:
                        Tank().add_env(env, each)
                else:
                    Tank().add_env(env, content)

            LOG.debug('{}_ENV: {}'.format(self._NAME.upper(), self._env))
Exemplo n.º 3
0
    def change_lstStatus(self):
        if self.scene_steps < 5: part_path = ''
        else: part_path = self.wgLoad.lstAsset.currentItem().text() + '/'

        if not self.wgLoad.lstStatus.currentItem(
        ) or not self.wgLoad.lstTask.currentItem():
            return

        self.file_dir = self.load_dir + '/' + self.wgLoad.lstSet.currentItem(
        ).text() + '/' + part_path + self.wgLoad.lstTask.currentItem().text(
        ) + '/' + self.wgLoad.lstStatus.currentItem().text()
        tmp_content = pipefunc.get_file_list(self.file_dir, extension=True)

        self.wgLoad.lstFiles.clear()
        if not tmp_content: return

        file_list = []
        for file in tmp_content:
            if os.path.splitext(file)[1][1:] in self.software_keys:
                file_list.append(file)

        if file_list:
            if os.path.exists(self.file_dir +
                              Tank().data_project['META']['file']):
                self.file_data = Tank().get_yml_file(
                    self.file_dir + Tank().data_project['META']['file'])
            else:
                self.file_data = ''

            self.wgLoad.lstFiles.addItems(sorted(file_list, reverse=True))
            self.wgLoad.lstFiles.setCurrentRow(0)
Exemplo n.º 4
0
    def change_lstAsset(self):
        new_path = self.load_dir + '/' + self.wgLoad.lstSet.currentItem().text(
        ) + '/' + self.wgLoad.lstAsset.currentItem().text()
        tmp_content = pipefunc.get_file_list(new_path)

        self.wgLoad.lstTask.clear()
        if tmp_content:
            self.wgLoad.lstTask.addItems(sorted(tmp_content))
            self.wgLoad.lstTask.setCurrentRow(0)
Exemplo n.º 5
0
    def change_lstTask(self):
        if self.scene_steps > 4:
            asset_content = '/' + self.wgLoad.lstAsset.currentItem().text()
        else:
            asset_content = ''

        new_path = self.load_dir + '/' + self.wgLoad.lstSet.currentItem().text(
        ) + asset_content + '/' + self.wgLoad.lstTask.currentItem().text()
        tmp_content = pipefunc.get_file_list(new_path)

        self.wgLoad.lstStatus.clear()
        if tmp_content:
            self.wgLoad.lstStatus.addItems(sorted(tmp_content, reverse=True))
            self.wgLoad.lstStatus.setCurrentRow(0)
Exemplo n.º 6
0
    def change_lstScene(self):
        self.load_dir = self.data['project']['PATH'][
            self.wgLoad.lstScene.currentItem().text()]
        tmp_content = pipefunc.get_file_list(self.load_dir)

        self.scene_steps = len(self.data['project']['SCENES'][
            self.wgLoad.lstScene.currentItem().text()].split('/'))
        if self.scene_steps < 5: self.wgLoad.lstAsset.hide()
        else:
            self.wgLoad.lstAsset.itemSelectionChanged.connect(
                self.change_lstAsset)
            self.wgLoad.lstAsset.show()

        self.wgLoad.lstSet.clear()
        if tmp_content:
            self.wgLoad.lstSet.addItems(sorted(tmp_content))
            self.wgLoad.lstSet.setCurrentRow(0)
Exemplo n.º 7
0
    def change_cbxScene(self):
        self.wgSaveAs.cbxTask.clear()
        if not self.new_file: self.wgSaveAs.cbxTask.addItem(self.all_task)

        self.scene_steps = len(Tank().data_project['SCENES'][
            self.wgSaveAs.cbxScene.currentText()].split('/'))
        if self.scene_steps < 5:
            self.wgSaveAs.cbxSet.hide()
            self.wgSaveAs.lblSet.hide()
        else:
            self.wgSaveAs.cbxSet.show()
            self.wgSaveAs.cbxSet.clear()
            self.wgSaveAs.lblSet.show()

        try:
            if self.wgSaveAs.cbxScene.currentText():
                self.wgSaveAs.cbxTask.addItems(Tank().data_project['TASK'][
                    self.wgSaveAs.cbxScene.currentText()])
        except:
            self.set_status(
                'FAILED adding tasks items: data/project/$project/project.yml : TASK',
                msg_type=3)

        if self.software == 'nuke':
            index = self.wgSaveAs.cbxTask.findText('COMP',
                                                   QtCore.Qt.MatchContains)
            if index >= 0: self.wgSaveAs.cbxTask.setCurrentIndex(index)

        try:
            self.save_dir = Tank().data_project['PATH'][
                self.wgSaveAs.cbxScene.currentText()]
            if self.wgSaveAs.cbxSet.isVisible():
                self.wgSaveAs.cbxSet.addItems(
                    pipefunc.get_file_list(self.save_dir))
        except:
            LOG.error(
                'FAILED adding PATH items: data/project/$project/project.yml : PATH',
                exc_info=True)