def run(self): all_shots_preview = [] for shot_dir in listdir(self.current_project.getDirectory() + "/05_shot/"): if shot_dir != "backup": all_picts_path = self.current_project.getDirectory( ) + "/05_shot/" + shot_dir + "/images/screenshots/" all_picts_path_array = [] for f in listdir(all_picts_path): all_picts_path_array.append(all_picts_path + f) cur_shot = Shot(self.current_project.getDirectory(), shot_dir) if all_picts_path_array: all_shots_preview.append([ cur_shot.getShotNb(), cur_shot.getShotName(), max(all_picts_path_array, key=path.getmtime) ]) else: all_shots_preview.append([ cur_shot.getShotNb(), cur_shot.getShotName(), "img/img_not_available.jpg" ]) self.datas.put(all_shots_preview)
def removeShot(self, shot_name): shot = Shot(self.directory, shot_name) shot.deleteShot() for i in range(len(self.shot_list) - shot.getShotNb()): n = i + shot.getShotNb() cur_shot = Shot(self.directory, self.shot_list[n][1]) cur_shot.renameShot( Resources.makeShotName(self.shot_list[n - 1][0], cur_shot.getSequence())) self.updateShotList()
def moveShotUp(self, shot_name): shot = Shot(self.directory, shot_name) shot_name_backup = shot.getShotName() swap_shot = Shot(self.directory, self.shot_list[shot.getShotNb()][1]) swap_shot_name_backup = swap_shot.getShotName() shot.renameShot("s00p000") swap_shot.renameShot(shot_name_backup) shot.renameShot(swap_shot_name_backup)
def createShot(self, shot_sequence): current_sequence = 1 if self.shot_list: current_sequence = Shot(self.directory, self.shot_list[-1][1]).getSequence() if shot_sequence >= current_sequence: shot_nb = len(self.shot_list) + 1 shot_name = Resources.makeShotName(shot_nb, shot_sequence) shot = Shot(self.directory, shot_name, software=self.default_software) else: shots_to_rename = [] for shot in self.shot_list: if Resources.makeShotNbs(shot[1])[1] > shot_sequence: shots_to_rename.append(shot) shots_to_rename = shots_to_rename[::-1] for shot_to_rename in shots_to_rename: cur_shot = Shot(self.directory, shot_to_rename[1]) cur_shot.renameShot( Resources.makeShotName(shot_to_rename[0] + 1, cur_shot.getSequence())) shot_nb = shots_to_rename[-1][0] shot = Shot(self.directory, Resources.makeShotName(shot_nb, shot_sequence), software=self.default_software) self.shot_list.append((shot.getShotNb(), shot.getShotName())) self.updateShotList() return shot_nb
def updateShotList(self): self.shot_list = [] for shot_name in listdir(self.directory + "/05_shot/"): if re.match(r"s[0-9][0-9]p[0-9][0-9]", shot_name): shot = Shot(self.directory, shot_name) self.shot_list.append((shot.getShotNb(), shot.getShotName()))