def clear_shots(self): """ Clear all the shots of the shots viewer """ python.clear_list(self._shots) self.clear()
def find_all_assets(self, force_update=False, force_login=True): """ Returns a list of all assets in the project :param force_update: bool, Whether assets cache updated must be forced or not :param force_login: bool, Whether logging to production tracker is forced or not :return: variant, ArtellaAsset or list(ArtellaAsset) """ self._check_project() if self.__class__._assets and not force_update: return self.__class__._assets python.clear_list(self.__class__._assets) if not artellapipe.Tracker().is_logged() and force_login: artellapipe.Tracker().login() if not artellapipe.Tracker().is_logged(): LOGGER.warning( 'Impossible to find assets of current project because user is not log into production tracker' ) return None tracker = artellapipe.Tracker() assets_list = tracker.all_project_assets() if not assets_list: LOGGER.warning("No assets found in current project!") return None for asset_data in assets_list: new_asset = self.create_asset(asset_data) if not new_asset: continue self.__class__._assets.append(new_asset) return self.__class__._assets
def clear_sequences(self): """ Clear all the sequences of the sequences viewer """ python.clear_list(self._sequences) self.clear()
def find_all_sequences(self, force_update=False, force_login=True): """ Returns a list of all sequences in the current project :param force_update: bool, Whether sequences cache updated must be forced or not :param force_login: bool, Whether logging to production tracker is forced or not :return: list(ArtellaSequence)) """ self._check_project() if self.sequences and not force_update: return self.sequences python.clear_list(self.__class__._sequences) if not artellapipe.Tracker().is_logged() and force_login: artellapipe.Tracker().login() if not artellapipe.Tracker().is_logged(): LOGGER.warning( 'Impossible to find sequences of current project because user is not log into production tracker') return None tracker = artellapipe.Tracker() sequences_list = tracker.all_project_sequences() if not sequences_list: LOGGER.warning('No sequences found in current project!') return None for sequence_data in sequences_list: new_sequence = self.create_sequence(sequence_data) self.__class__._sequences.append(new_sequence) return self.sequences
def remove_all_template_tokens(self): """ Deletes any template tokens saved previously """ python.clear_list(self._templates_tokens) return True
def clear_assets(self): """ Clear all the assets of the asset viewer """ python.clear_list(self._assets) self.clear()
def remove_all_rules(self): """ Deletes any rules saved previosluy """ python.clear_list(self._rules) self._active_rule = None return True
def update_cache(self, force=False): """ Updates internal cache with the current shots located in Artella server """ if self._cache and not force: return self._cache python.clear_list(self._cache) return artellapipe.ShotsMgr().find_all_shots(force_update=force)
def update_cache(self, force=False): """ Updates internal cache with the current assets located in Artella server """ if self._cache and not force: return self._cache python.clear_list(self._cache) self._cache = artellapipe.AssetsMgr().find_all_assets() or list() return self._cache
def update_tracking_info(self): python.clear_list(self.__class__._spreadsheets) self.__class__._worksheets.clear() try: valid_login = self.login() if not valid_login and self.__class__._client: LOGGER.error( "Production Tracking was not loaded successfully!") return False worksheets = drive_lib.config.data.get('worksheets', None) if not worksheets: LOGGER.warning( 'Drive Production Tracking Configuration File does not specifies any worksheet!' ) return False found_worksheets = dict() for sheet in self.__class__._spreadsheets: for worksheet_name, worksheet_data in worksheets.items(): found_worksheets[worksheet_name] = list() try: worksheet = sheet.worksheet(worksheet_name) found_worksheets[worksheet_name].append(worksheet) except gspread.models.WorksheetNotFound as exc: LOGGER.warning( 'Production Tracking Worksheet: "{}" does not exists in sheet: "{}"!' .format(worksheet_name, sheet)) continue for worksheet_name, worksheets_list in found_worksheets.items(): if not worksheets_list: LOGGER.warning( 'No worksheets with name "{}" found in registered spreadsheets: {}' .format(worksheet_name, self.__class__._spreadsheets)) continue if len(worksheets_list) > 1: LOGGER.warning( 'Multiple worksheets found name "{}" in registered spreadsheets: {}. ' 'Only first one will be used'.format( worksheet_name, worksheets_list)) self.__class__._worksheets[worksheet_name] = worksheets_list[0] except Exception as exc: LOGGER.error( 'Error while getting information from Drive: {} | {}'.format( exc, traceback.format_exc())) self._updated = True return True
def set_items(self, data_list): """ Sets the the items of the breadcrumb cleaning old ones :param data_list: :return: """ for btn in self._button_group.buttons(): self._button_group.removeButton(btn) self.main_layout.removeWidget(btn) btn.setVisible(False) btn.deleteLater() for sep in self._separators: self.main_layout.removeWidget(sep) sep.setVisible(False) sep.deleteLater() python.clear_list(self._separators) for index, data_dict in enumerate(data_list): self.add_item(data_dict, index)
def find_all_shots(self, force_update=False, force_login=True): """ Returns all shots of the project :param force_update: bool, Whether shots cache updated must be forced or not :param force_login: bool, Whether logging to production tracker is forced or not :return: list(ArtellaShot) """ self._check_project() if self.shots and not force_update: return self.shots python.clear_list(self.__class__._shots) if not artellapipe.Tracker().is_logged() and force_login: artellapipe.Tracker().login() if not artellapipe.Tracker().is_logged(): LOGGER.warning( 'Impossible to find shots of current project because user is not log into production tracker' ) return None tracker = artellapipe.Tracker() shots_list = tracker.all_project_shots() if not shots_list: LOGGER.warning('No shots found in current project!') return None for shot_data in shots_list: new_shot = self.create_shot(shot_data) self.__class__._shots.append(new_shot) self.__class__._shots.sort(key=lambda x: x.get_start_frame(), reverse=True) return self.shots
def load_session(self, repo=None): self._active_rule = '' python.clear_list(self._rules) python.clear_list(self._tokens) python.clear_list(self._templates) python.clear_list(self._templates_tokens) if self.has_valid_naming_file(): LOGGER.debug('Loading session from Naming File: {}'.format( self._naming_file)) naming_data = self.load_naming_data() if not naming_data: LOGGER.warning('No naming data found!') return rules = naming_data.get(self._rules_key) if rules: for rule_data in rules: self.load_rule_from_dict(rule_data, skip_check=True) tokens = naming_data.get(self._tokens_key) if tokens: for token_data in tokens: self.load_token_from_dict(token_data, skip_check=True) templates = naming_data.get(self._templates_key) if templates: for template_data in templates: self.load_template_from_dict(template_data, skip_check=True) template_tokens = naming_data.get(self._template_tokens_key) if template_tokens: for template_token_data in template_tokens: self.load_template_token_from_dict(template_token_data, skip_check=True) else: repo = repo or self.get_repo()[0] if not repo: return if not os.path.exists(repo): os.mkdir(repo) LOGGER.debug( 'Loading session from directory files: {}'.format(repo)) # Tokens and rules for dir_path, dir_names, file_names in os.walk(repo): for file_name in file_names: file_path = os.path.join(dir_path, file_name) if file_name.endswith('.token'): self.load_token(file_path) elif file_name.endswith('.rule'): self.load_rule(file_path) # Extra configuration file_path = os.path.join(repo, 'naming.conf') if os.path.exists(file_path): with open(file_path) as fp: if self._parser_format == 'yaml': config = yaml.safe_load(fp) else: config = json.load(fp) for k, v in config.items(): globals()[k](v) return True