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 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