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 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 hitEnemy(self, enemy): self.targetedEnemy = enemy self.shotcount += 1 if self.turretRotates: self.moveTurret(enemy) Shot.Shot(self, enemy) self.targetTimer = self.towerGroup.targetTimer = self.reload
def fetch_shot(self, m_shot_code): # use the sequence matching regular expression here instead of hard coding m_shot_code[0:5] matchobject = DBAccessGlobals.DBAccessGlobals.g_shot_regexp.search(m_shot_code) shot = None seq = None # make sure this file matches the shot pattern if not matchobject: raise ValueError("Shot name provided %s does not match regular expression!"%m_shot_code) else: shot = matchobject.groupdict()['shot'] seq = matchobject.groupdict()['sequence'] local_seq = Sequence.Sequence(seq, DBAccessGlobals.DBAccessGlobals.get_path_for_sequence(seq), -1) dbseq = self.fetch_sequence(seq) local_seq.g_dbid = dbseq.g_dbid shot_ret = Shot.Shot(shot, DBAccessGlobals.DBAccessGlobals.get_path_for_shot(shot), -1, local_seq, None, 1001, 1009, 1092, 1100, 84) shot_table = self.g_tinydb.table('Shot') shot_query = tinydb.Query() dbshot = shot_table.get(shot_query.code == m_shot_code) if dbshot: shot_ret.g_dbid = dbshot.doc_id shot_ret.g_task_template = dbshot.task_template shot_ret.g_head_in = dbshot.sg_head_in shot_ret.g_cut_in = dbshot.sg_cut_in shot_ret.g_cut_out = dbshot.sg_cut_out shot_ret.g_tail_out = dbshot.sg_tail_out shot_ret.g_cut_duration = dbshot.sg_cut_duration return shot_ret
def read_shot_xml(filename): shots = {} id = '' timestamp = '' searchForMediaTimepoint = False with open(filename, 'r') as f: alllines = f.readlines() for line in alllines: if 'RKF' in line: splits = line.split('"') without_RKF = splits[1].split('_RKF') id = without_RKF[0] searchForMediaTimepoint = True if '<MediaTimePoint' in line: if searchForMediaTimepoint: first = line.split('>') second = first[1].split('<') timestamp = second[0] shot = Shot.Shot(id, timestamp, True) shots[id] = shot searchForMediaTimepoint = False f.close() return shots
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 interact(player): """ Manage interactions and movements of player and his fires @param player: Dictionnary containing all information about one \"Player\" object @type player: dict @return: - @rtype: void """ assertPlayer(player) if (time.time() - player["lastShot"] > player["fireTimeSpace"]): player["shotList"].append( Shot.Shot( Object.getX(player) + Item.getBaseWidth(player), Object.getY(player) + int(Item.getBaseHeight(player) / 2), player["shotSpeed"], player["damageValue"], False, [255, 0, 255])) player["lastShot"] = time.time() for i in range(0, len(player["shotList"])): Item.move(player["shotList"][i], dt) for i in player["shotList"]: if (Object.getX(i) >= Object.SCREEN_WIDTH): player["shotList"].remove(i) del i if (player["isImmute"]): if (time.time() - player["lastDmgTime"] >= player["immuteTime"]): player["isImmute"] = False return
def interact(enemy): """ Manage interactions and movements of enemy and his fires @param enemy: Dictionnary containing all information about one \"Enemy\" object @type enemy: dict @return: Have the enemy to be removed from the enemyList or not @rtype: bool """ assertenemy(enemy) if (time.time() - enemy["lastShot"] > enemy["fireTimeSpace"] and not (enemy["isDead"])): enemy["shotList"].append( Shot.Shot(Object.getX(enemy), Object.getY(enemy) + int(Item.getBaseHeight(enemy) / 2), enemy["shotSpeed"], enemy["damageValue"])) enemy["lastShot"] = time.time() for i in range(0, len(enemy["shotList"])): Item.move(enemy["shotList"][i], dt) for i in enemy["shotList"]: if (Object.getX(i) <= 0): enemy["shotList"].remove(i) del i Item.move(enemy, dt) if (enemy["moveFunction"] != None): nextY = enemy["startY"] + eval(enemy["moveFunction"]) if (nextY < Object.SCREEN_HEIGHT - 5 and nextY >= 0): Object.setY(enemy, nextY) return enemy["isDead"] and len(enemy["shotList"]) == 0
def hitEnemy(self, enemy): self.targetedEnemy = enemy self.moveTurret(enemy) self.shotcount += 1 Shot.Shot(self, self.targetedEnemy) self.targetTimer = self.towerGroup.targetTimer = self.reload if self.upgradePath == 'LifeDamage': self.recharge()
def generate_random_shots(self): for enemy in self.player.enemies: if self.boss: i = random.randint(0, 100) if i < 10: number_of_shots = random.randint(0, 2) while number_of_shots: pos_y = random.randint(enemy.position_Y - 50, enemy.position_Y + 50) self.player.enemies_shots.append(Shot(enemy.position_X - 50, pos_y, self.level)) number_of_shots -= 1 for beams in self.player.enemies_shots: beams.image = pygame.image.load("images/enemy_beam.png") else : i = random.randint(0, 1) while i > 0: self.player.enemies_shots.append(Shot(enemy.position_X - 50 * i, enemy.position_Y + 25, self.level)) i -= 1
def setSelection(self, shot_name=None, asset_name=None, second_path=None): if shot_name: self.selected_shot = Shot(self.directory, shot_name) self.selected_asset = None elif asset_name: self.selected_asset = Asset(self.directory, second_path, asset_name) self.selected_shot = None
def fetch_shot_from_id(self, m_shot_id): shot_ret = Shot.Shot("BLANK", "", m_shot_id, None, None, 1001, 1009, 1092, 1100, 84) shot_ret = Shot.Shot(shot, DBAccessGlobals.DBAccessGlobals.get_path_for_shot(shot), -1, local_seq, None, 1001, 1009, 1092, 1100, 84) shot_table = self.g_tinydb.table('Shot') dbshot = shot_table.get(doc_id=m_shot_id) if dbshot: dbseq = self.fetch_sequence(dbshot.sg_sequence) shot_ret.g_sequence = dbseq shot_ret.g_task_template = dbshot.task_template shot_ret.g_head_in = dbshot.sg_head_in shot_ret.g_cut_in = dbshot.sg_cut_in shot_ret.g_cut_out = dbshot.sg_cut_out shot_ret.g_tail_out = dbshot.sg_tail_out shot_ret.g_cut_duration = dbshot.sg_cut_duration return shot_ret
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 shoot(self, player_obj): shot = Shot.Shot(self.shots, mx=player_obj.cord_x, my=player_obj.cord_y, px=self.cord_x, py=self.cord_y, size=(15, 15), color=(0, 0, 255), owner='Steven') self.shots.append(shot)
def takeTurn(self): if self.active: in_range_air = 0 in_range_ground = 0 towersAnimating = 0 for tower in self.towerSet: if tower.targetedEnemy and tower.turretRotates: if not tower.turret.anim.have_properties_to_animate( tower.turret_rot): tower.moveTurret(tower.targetedEnemy) if tower.animating: towersAnimating += 1 list = Utilities.get_all_in_range( tower, Map.mapvar.enemycontainer.children) if list: for enemy in list: if enemy.isair: in_range_air += 1 if tower.upgradePath == 'WindDamage' and tower.totalUpgradeTime == 0: Shot.Shot(tower, enemy) tower.shotcount += 1 if tower.shotcount >= tower.allowedshots: break else: in_range_ground += 1 if self.animating and towersAnimating == 0: self.animating = False if in_range_air == 0 and self.towerType == 'Wind': self.disable() return elif in_range_ground == 0 and self.towerType != 'Wind': self.disable() return if self.towerType != 'Gravity': self.targetTimer -= Player.player.frametime if self.targetTimer <= 0: self.target() if self.adjacentRoadFlag == True and self.towerType == 'Ice': self.genRoadList() else: self.targetTimer -= Player.player.frametime if self.targetTimer <= 0 and not self.animating: for tower in self.towerSet: self.animateGravity(tower) else: for tower in self.towerSet: if self.towerType == 'Wind' and Utilities.get_all_in_range( tower, Map.mapvar.enemycontainer.children, flyingOnly=True): self.enable() return elif self.towerType != 'Wind' and Utilities.get_all_in_range( tower, Map.mapvar.enemycontainer.children): self.enable() return
def on_event(self, event): if event.type == pygame.QUIT: self._running = False elif event.type == KEYDOWN: if event.key == K_DOWN: if self.player.position_Y + 35 < self.height - 25: self.player.increment_position_Y() elif event.key == K_UP: if self.player.position_Y - 5 > 0: self.player.decrement_position_Y() elif event.key == K_LEFT: if self.player.position_X - 5 > 0: self.player.decrement_position_X() elif event.key == K_RIGHT: if self.player.position_X + 55 < self.weight: self.player.increment_position_X() elif event.key == K_SPACE: if self.player.double_guns: self.player.shots.append(Shot(self.player.position_X, self.player.position_Y + 45, 1)) self.player.shots.append(Shot(self.player.position_X, self.player.position_Y, 1)) shot_music = pygame.mixer.Sound("sounds/shot.wav") shot_music.set_volume(0.05) shot_music.play()
def recive(self): self.__socket = socket(AF_INET, SOCK_STREAM) self.__socket.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) self.__socket.bind((self.__ip, 1234)) self.__socket.listen(1) self.__conn, arrn = self.__socket.accept() # open connection data = json.loads(self.__conn.recv(1024)) # receive data and decode it self.__conn.close() # close connection resultingData = 0 #define received data type if (data["type"] == netPackage.NPTYPE_SHOT): resultingData = Shot.Shot(data["data"]["x"], data["data"]["y"]) elif (data["type"] == netPackage.NPTYPE_SHOTRESPONSE): resultingData = ShotResponse.ShotResponse( data["data"]["shotResult"]) else: raise ValueError("Internal error, invalid data type") return resultingData
def update(self): i = 0 done_shots = 0 animations_states = {"To do": 0, "WIP": 0, "Done": 0} lightings_states = {"To do": 0, "WIP": 0, "Done": 0} renderings_states = {"To do": 0, "WIP": 0, "Done": 0} compositings_states = {"To do": 0, "WIP": 0, "Done": 0} for missing_shot in range( len(self.project.getShotList()) - len(self.shot_text_list)): self.shot_text_list.append(StringVar()) self.shot_frame_range_text_list.append(StringVar()) for shot in self.project.getShotList(): cur_shot = Shot(self.project.getDirectory(), shot[1]) self.shot_text_list[i].set(shot[1]) self.shot_frame_range_text_list[i].set(cur_shot.getFrameRange()) if shot[1] not in self.vars_shot_animation: self.vars_shot_animation[shot[1]] = StringVar() if shot[1] not in self.vars_shot_lighting: self.vars_shot_lighting[shot[1]] = StringVar() if shot[1] not in self.vars_shot_rendering: self.vars_shot_rendering[shot[1]] = StringVar() if shot[1] not in self.vars_shot_compositing: self.vars_shot_compositing[shot[1]] = StringVar() if cur_shot.isDone(): done_shots += 1 i += 1 if done_shots == 1: self.done_shots_text.set( str(done_shots) + " done shot (" + str(round(done_shots / len(self.project.getShotList()) * 100)) + "%)") else: self.done_shots_text.set( str(done_shots) + " done shots (" + str(round(done_shots / len(self.project.getShotList()) * 100)) + "%)")
def read_shots_from_file(filename): shots = {} shot_paths = read_shot_paths('../groundtruth/shot_paths.txt') i = 0 with open(filename, 'r') as f: # alllines = f.readlines() line = f.readline() while line != '': splits = line.split(' ') if len(splits) > 0: shot = Shot.Shot(splits[0], splits[1].split('\n')[0], False) # print i # shot.shot_path = shot_paths[i] shots[shot.name] = shot i += 1 line = f.readline() f.close() return shots
def on_execute(self): if self.on_init() == False: self._running = False while self._running: # # event handling loop # for event in pygame.event.get(): if event.type == pygame.locals.QUIT: pygame.quit() sys.exit() #handling keyboard input #start moving if event.type == pygame.locals.KEYDOWN: if event.key == pygame.locals.K_w: self.pressed_up = True if event.key == pygame.locals.K_d: self.pressed_right = True if event.key == pygame.locals.K_s: self.pressed_down = True if event.key == pygame.locals.K_a: self.pressed_left = True #stop moving elif event.type == pygame.locals.KEYUP: if event.key == pygame.locals.K_w: self.pressed_up = False if event.key == pygame.locals.K_d: self.pressed_right = False if event.key == pygame.locals.K_s: self.pressed_down = False if event.key == pygame.locals.K_a: self.pressed_left = False #handling mouse input #looking around / aiming elif event.type == pygame.MOUSEMOTION: mousePos = event.pos #firing elif event.type == pygame.MOUSEBUTTONDOWN and event.button == 1: self.pressed_lmouse = True mousePos = event.pos shot = Shot.Shot(mousePos, self.player.getPosition()) self.shotList.append(shot) self.lineColor = (0, 0, 255) elif event.type == pygame.MOUSEBUTTONUP and event.button == 1: self.pressed_lmouse = False mousePos = event.pos self.lineColor = (255, 0, 0) #spawning zombies if event.type == self.ZOMBIESPAWN: newZombie = zombie.Zombie() self.zombieList.append(newZombie) newZombie.spawn(self.player.getPosition(), self.displaysurf) print("Zombie spawned") # # moving the player # if self.pressed_up: if self.player.getPosition().top > 0: self.player.move(0, -self.player.pace) if self.pressed_right: if self.player.getPosition( ).right < self.WINDOWWIDTH - self.player.pace: self.player.move(self.player.pace, 0) if self.pressed_down: if self.player.getPosition( ).bottom < self.WINDOWHEIGHT - self.player.pace: self.player.move(0, self.player.pace) if self.pressed_left: if self.player.getPosition().left > 0: self.player.move(-self.player.pace, 0) # # render # self.displaysurf.fill((255, 255, 255)) pygame.draw.line(self.displaysurf, self.lineColor, (self.player.getPosition().left + self.player.appearance.get_width() / 2, self.player.getPosition().top + self.player.appearance.get_height() / 2), mousePos) # # checking shot collision # for shot in self.shotList: #checking if the shot is out of the screen if shot.isOutOfScreen(self.WINDOWWIDTH, self.WINDOWHEIGHT): self.shotList.remove(shot) print("deleting shot") else: shot.move(self.displaysurf) # good style? (regarding the different data types in a single return statement) #checking if the shot is hitting a zombie collisionArray = shot.collisionCheck(self.zombieList) if collisionArray[0] == True: self.shotList.remove(shot) self.zombieList = collisionArray[1] print("deleting shot") # # zombie spawner # for zomb in self.zombieList: zomb.move(self.displaysurf) self.player.draw(self.displaysurf) self.fpsClock.tick(self.FPS) pygame.display.update()
pause = False print "Wave: ", wave handle_keys() spawn_monsters() checklevel() moveandsortmonsters() #loop over all towers to call tryShoot for tower in towers: target = tower.tryShoot(monsters) if target != None: shot = Shot(tower, target) shots.append(shot) #see if shots hit for shot in shots: for monster in monsters: if shot.rect.colliderect(monster.rect): monster.hit(shot.damage) shots.remove(shot) if monster.isdead() == True: monsters.remove(monster) kills += 1 money += monster.value break #shots move
def set(self, project): self.project = project if self.project.getShotList(): self.project_stats_path = self.project.getDirectory( ) + "/project_stats.spi" if not path.isfile(self.project_stats_path): open(self.project_stats_path, "a").close() with open(self.project_stats_path, "r") as f: str_stats = f.read() f.close() stats_label = Label(self, text="STATISTICS", bg=self.theme.main_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 11 bold") stats_label.pack(expand=True, fill=BOTH, pady=10) general_stats_area = Frame(self, bg=self.theme.second_color, bd=0) general_stats_area.pack(expand=True, fill=BOTH) ## HEADER ## separator1_area = Frame(self, bg=self.theme.separator_color, height=2, bd=0) separator1_area.pack(expand=True, fill=BOTH) self.stats_shots_header_area = Frame(self, bg=self.theme.main_color, bd=0) self.stats_shots_header_area.pack(expand=True, fill=BOTH) self.stats_shots_header_area.columnconfigure(0, weight=1) self.stats_shots_header_area.columnconfigure(1, weight=1) self.stats_shots_header_area.columnconfigure(2, weight=1) self.stats_shots_header_area.columnconfigure(3, weight=1) self.stats_shots_header_area.columnconfigure(4, weight=1) self.stats_shots_header_area.columnconfigure(5, weight=1) shot_header_label = Label(self.stats_shots_header_area, text="shot", bg=self.theme.main_color, fg=self.theme.text_color) shot_header_label.grid(row=0, column=0, pady=5, padx=10) shot_frame_range_header_label = Label(self.stats_shots_header_area, text="frame range", bg=self.theme.main_color, fg=self.theme.text_color) shot_frame_range_header_label.grid(row=0, column=1, pady=5, padx=10) shot_frame_range_header_label = Label(self.stats_shots_header_area, text="animation", bg=self.theme.main_color, fg=self.theme.text_color) shot_frame_range_header_label.grid(row=0, column=2, pady=5, padx=10) shot_frame_range_header_label = Label(self.stats_shots_header_area, text="lighting", bg=self.theme.main_color, fg=self.theme.text_color) shot_frame_range_header_label.grid(row=0, column=3, pady=5, padx=10) shot_frame_range_header_label = Label(self.stats_shots_header_area, text="rendering", bg=self.theme.main_color, fg=self.theme.text_color) shot_frame_range_header_label.grid(row=0, column=4, pady=5, padx=10) shot_frame_range_header_label = Label(self.stats_shots_header_area, text="compositing", bg=self.theme.main_color, fg=self.theme.text_color) shot_frame_range_header_label.grid(row=0, column=5, pady=5, padx=10) separator2_area = Frame(self, bg=self.theme.separator_color, height=2, bd=0) separator2_area.pack(expand=True, fill=BOTH) stats_shots_area = Frame(self, bg=self.theme.main_color, bd=0) stats_shots_area.pack(expand=True, fill=BOTH) ## SHOTS STATS ## i = 0 done_shots = 0 animations_states = {"To do": 0, "WIP": 0, "Done": 0} lightings_states = {"To do": 0, "WIP": 0, "Done": 0} renderings_states = {"To do": 0, "WIP": 0, "Done": 0} compositings_states = {"To do": 0, "WIP": 0, "Done": 0} self.shot_label_list = [] self.shot_text_list = [] self.shot_frame_range_label_list = [] self.shot_frame_range_text_list = [] self.animation_menu_list = {} self.lighting_menu_list = {} self.rendering_menu_list = {} self.compositing_menu_list = {} self.vars_shot_animation = {} self.vars_shot_lighting = {} self.vars_shot_rendering = {} self.vars_shot_compositing = {} self.stats_dict = {} for shot in self.project.getShotList(): cur_shot = Shot(self.project.getDirectory(), shot[1]) if i % 2 == 0: shot_line = Frame(self, bg=self.theme.stat_list_color1, bd=0) shot_line.pack(expand=True, fill=BOTH) else: shot_line = Frame(self, bg=self.theme.stat_list_color2, bd=0) shot_line.pack(expand=True, fill=BOTH) shot_line.columnconfigure(0, weight=1) shot_line.columnconfigure(1, weight=1) shot_line.columnconfigure(2, weight=1) shot_line.columnconfigure(3, weight=1) shot_line.columnconfigure(4, weight=1) shot_line.columnconfigure(5, weight=1) shot_text = StringVar() self.shot_text_list.append(shot_text) self.shot_text_list[i].set(shot[1]) shot_label = Label(shot_line, textvariable=self.shot_text_list[i], bg=shot_line.cget("bg"), fg=self.theme.text_color) shot_label.grid(row=shot[0], column=0, pady=5, padx=10) self.shot_label_list.append(shot_label) shot_frame_range_text = StringVar() self.shot_frame_range_text_list.append(shot_frame_range_text) self.shot_frame_range_text_list[i].set( cur_shot.getFrameRange()) shot_frame_range_label = Label( shot_line, textvariable=self.shot_frame_range_text_list[i], bg=shot_line.cget("bg"), fg=self.theme.text_color) shot_frame_range_label.grid(row=shot[0], column=1, pady=5, padx=10) self.shot_frame_range_label_list.append(shot_frame_range_label) self.vars_shot_animation[shot[1]] = StringVar() self.vars_shot_lighting[shot[1]] = StringVar() self.vars_shot_rendering[shot[1]] = StringVar() self.vars_shot_compositing[shot[1]] = StringVar() if str_stats: self.stats_dict = json.loads(str_stats) if self.stats_dict[shot[1]]: self.vars_shot_animation[shot[1]].set( self.stats_dict[shot[1]][0]) if self.stats_dict[shot[1]][0]: animations_states[self.stats_dict[shot[1]][0]] += 1 self.vars_shot_lighting[shot[1]].set( self.stats_dict[shot[1]][1]) if self.stats_dict[shot[1]][1]: lightings_states[self.stats_dict[shot[1]][1]] += 1 self.vars_shot_rendering[shot[1]].set( self.stats_dict[shot[1]][2]) if self.stats_dict[shot[1]][2]: renderings_states[self.stats_dict[shot[1]][2]] += 1 self.vars_shot_compositing[shot[1]].set( self.stats_dict[shot[1]][3]) if self.stats_dict[shot[1]][3]: compositings_states[self.stats_dict[shot[1]] [3]] += 1 else: self.vars_shot_animation[shot[1]].set("To do") self.vars_shot_lighting[shot[1]].set("To do") self.vars_shot_rendering[shot[1]].set("To do") self.vars_shot_compositing[shot[1]].set("To do") else: self.vars_shot_animation[shot[1]].set("To do") self.vars_shot_lighting[shot[1]].set("To do") self.vars_shot_rendering[shot[1]].set("To do") self.vars_shot_compositing[shot[1]].set("To do") animation_menu = OptionMenu(shot_line, self.vars_shot_animation[shot[1]], "To do", "WIP", "Done", command=self.statisticsMenuCommand) animation_menu.config( bg=self.theme.button_color2, activebackground=self.theme.over_button_color2, activeforeground=self.theme.text_color, bd=0, width=8, highlightthickness=0) animation_menu.grid(row=shot[0], column=2, pady=5, padx=10) self.animation_menu_list[shot[1]] = animation_menu lighting_menu = OptionMenu(shot_line, self.vars_shot_lighting[shot[1]], "To do", "WIP", "Done", command=self.statisticsMenuCommand) lighting_menu.config( bg=self.theme.button_color2, activebackground=self.theme.over_button_color2, activeforeground=self.theme.text_color, bd=0, width=8, highlightthickness=0) lighting_menu.grid(row=shot[0], column=3, pady=5, padx=10) self.lighting_menu_list[shot[1]] = lighting_menu rendering_menu = OptionMenu(shot_line, self.vars_shot_rendering[shot[1]], "To do", "WIP", "Done", command=self.statisticsMenuCommand) rendering_menu.config( bg=self.theme.button_color2, activebackground=self.theme.over_button_color2, activeforeground=self.theme.text_color, bd=0, width=8, highlightthickness=0) rendering_menu.grid(row=shot[0], column=4, pady=5, padx=10) self.rendering_menu_list[shot[1]] = rendering_menu compositing_menu = OptionMenu( shot_line, self.vars_shot_compositing[shot[1]], "To do", "WIP", "Done", command=self.statisticsMenuCommand) compositing_menu.config( bg=self.theme.button_color2, activebackground=self.theme.over_button_color2, activeforeground=self.theme.text_color, bd=0, width=8, highlightthickness=0) compositing_menu.grid(row=shot[0], column=5, pady=5, padx=10) self.compositing_menu_list[shot[1]] = compositing_menu if cur_shot.isDone(): done_shots += 1 i += 1 ## GENERAL STATS ## number_of_shots_label = Label( general_stats_area, text=str(len(self.project.getShotList())) + " SHOTS", bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") number_of_shots_label.grid(row=0, column=0, pady=5, padx=10) self.done_shots_text = StringVar() self.done_shots_text.set( str(done_shots) + " done shot (" + str(round(done_shots / len(self.project.getShotList()) * 100)) + "%)") number_of_done_shots_label = Label( general_stats_area, textvariable=self.done_shots_text, bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") number_of_done_shots_label.grid(row=1, column=0, pady=5, padx=10) general_to_do_label = Label(general_stats_area, text="TO DO", bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") general_to_do_label.grid(row=2, column=1, pady=5, padx=10) general_wip_label = Label(general_stats_area, text="WIP", bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") general_wip_label.grid(row=2, column=2, pady=5, padx=10) general_done_label = Label(general_stats_area, text="DONE", bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") general_done_label.grid(row=2, column=3, pady=5, padx=10) #ANIMATION# general_animation_label = Label(general_stats_area, text="ANIMATION", bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") general_animation_label.grid(row=3, column=0, pady=5, padx=10) self.animation_to_do_text = StringVar() self.animation_to_do_text.set( str( round(animations_states["To do"] / len(self.project.getShotList()) * 100)) + "%") animation_to_do_label = Label( general_stats_area, textvariable=self.animation_to_do_text, bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") animation_to_do_label.grid(row=3, column=1, pady=5, padx=10) self.animation_wip_text = StringVar() self.animation_wip_text.set( str( round(animations_states["WIP"] / len(self.project.getShotList()) * 100)) + "%") animation_wip_label = Label(general_stats_area, textvariable=self.animation_wip_text, bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") animation_wip_label.grid(row=3, column=2, pady=5, padx=10) self.animation_done_text = StringVar() self.animation_done_text.set( str( round(animations_states["Done"] / len(self.project.getShotList()) * 100)) + "%") animation_done_label = Label(general_stats_area, textvariable=self.animation_done_text, bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") animation_done_label.grid(row=3, column=3, pady=5, padx=10) #LIGHTING# general_lighting_label = Label(general_stats_area, text="LIGHTING", bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") general_lighting_label.grid(row=4, column=0, pady=5, padx=10) self.lighting_to_do_text = StringVar() self.lighting_to_do_text.set( str( round(lightings_states["To do"] / len(self.project.getShotList()) * 100)) + "%") lighting_to_do_label = Label(general_stats_area, textvariable=self.lighting_to_do_text, bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") lighting_to_do_label.grid(row=4, column=1, pady=5, padx=10) self.lighting_wip_text = StringVar() self.lighting_wip_text.set( str( round(lightings_states["WIP"] / len(self.project.getShotList()) * 100)) + "%") lighting_wip_label = Label(general_stats_area, textvariable=self.lighting_wip_text, bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") lighting_wip_label.grid(row=4, column=2, pady=5, padx=10) self.lighting_done_text = StringVar() self.lighting_done_text.set( str( round(lightings_states["Done"] / len(self.project.getShotList()) * 100)) + "%") lighting_done_label = Label(general_stats_area, textvariable=self.lighting_done_text, bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") lighting_done_label.grid(row=4, column=3, pady=5, padx=10) #RENDERING# general_rendering_label = Label(general_stats_area, text="RENDERING", bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") general_rendering_label.grid(row=5, column=0, pady=5, padx=10) self.rendering_to_do_text = StringVar() self.rendering_to_do_text.set( str( round(renderings_states["To do"] / len(self.project.getShotList()) * 100)) + "%") rendering_to_do_label = Label( general_stats_area, textvariable=self.rendering_to_do_text, bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") rendering_to_do_label.grid(row=5, column=1, pady=5, padx=10) self.rendering_wip_text = StringVar() self.rendering_wip_text.set( str( round(renderings_states["WIP"] / len(self.project.getShotList()) * 100)) + "%") rendering_wip_label = Label(general_stats_area, textvariable=self.rendering_wip_text, bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") rendering_wip_label.grid(row=5, column=2, pady=5, padx=10) self.rendering_done_text = StringVar() self.rendering_done_text.set( str( round(renderings_states["Done"] / len(self.project.getShotList()) * 100)) + "%") rendering_done_label = Label(general_stats_area, textvariable=self.rendering_done_text, bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") rendering_done_label.grid(row=5, column=3, pady=5, padx=10) #COMPOSITING# general_compositing_label = Label(general_stats_area, text="COMPOSITING", bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") general_compositing_label.grid(row=6, column=0, pady=5, padx=10) self.compositing_to_do_text = StringVar() self.compositing_to_do_text.set( str( round(compositings_states["To do"] / len(self.project.getShotList()) * 100)) + "%") compositing_to_do_label = Label( general_stats_area, textvariable=self.compositing_to_do_text, bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") compositing_to_do_label.grid(row=6, column=1, pady=5, padx=10) self.compositing_wip_text = StringVar() self.compositing_wip_text.set( str( round(compositings_states["WIP"] / len(self.project.getShotList()) * 100)) + "%") compositing_wip_label = Label( general_stats_area, textvariable=self.compositing_wip_text, bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") compositing_wip_label.grid(row=6, column=2, pady=5, padx=10) self.compositing_done_text = StringVar() self.compositing_done_text.set( str( round(compositings_states["Done"] / len(self.project.getShotList()) * 100)) + "%") compositing_done_label = Label( general_stats_area, textvariable=self.compositing_done_text, bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") compositing_done_label.grid(row=6, column=3, pady=5, padx=10)
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()))
def setAllShotsRes(self): for shot in listdir(self.getDirectory() + "/05_shot/"): if shot != "backup": cur_shot = Shot(self.getDirectory(), shot) cur_shot.setResolution(self.getResolution())
def getShot(self, shot_name): return Shot(self.directory, shot_name)