def updateUI(self): if not self.current_dir == None: chapter, scene, room, mode = common.get_dir_info(self.current_dir) self.ui.lblChapter.setText(common.chapter_to_text(chapter)) if not scene == -1: if chapter == common.CHAPTER_FREETIME: self.ui.lblScene.setText("%03d: %s" % (scene, object_labels.get_char_name(scene, common.editor_config.data01_dir))) elif chapter == common.CHAPTER_ISLAND and scene >= 701 and scene <= 715: scene -= 700 self.ui.lblScene.setText("%03d: %s" % (scene, object_labels.get_char_name(scene, common.editor_config.data01_dir))) else: self.ui.lblScene.setText("%03d" % scene) else: self.ui.lblScene.setText("N/A") if not room == -1: self.ui.lblRoom.setText("%03d: %s" % (room, object_labels.get_map_name(room, common.editor_config.data01_dir))) else: self.ui.lblRoom.setText("N/A") self.ui.lblMode.setText(common.mode_to_text(mode)) else: self.ui.lblChapter.setText("N/A") self.ui.lblScene.setText("N/A") self.ui.lblRoom.setText("N/A") self.ui.lblMode.setText("N/A")
def get_nametag(char_id, x, y, color, vertical = False): w = IMG_W h = IMG_H nametag = get_char_name(char_id, common.editor_config.data01_dir) if nametag == None: nametag = "NAMETAG MISSING" if vertical: nametag_img = QImage(h, w, QImage.Format_ARGB32_Premultiplied) new_x = h - y new_y = x x = new_x y = new_y else: nametag_img = QImage(w, h, QImage.Format_ARGB32_Premultiplied) format = TextFormat(x = x, y = y, w = 25, h = 25, align = TEXT_ALIGN.left, orient = TEXT_ORIENT.hor, clt = 0) nametag_img = print_text(nametag_img, nametag, None, format = format, mangle = False) if vertical: matrix = QTransform() matrix.rotate(-90) nametag_img = nametag_img.transformed(matrix) nametag_img = replace_all_colors(nametag_img, color) return nametag_img
def updateUI(self): if not self.current_dir == None: chapter, scene, room, mode = common.get_dir_info(self.current_dir) self.ui.lblChapter.setText(common.chapter_to_text(chapter)) if not scene == -1: if chapter == common.CHAPTER_FREETIME: self.ui.lblScene.setText( "%03d: %s" % (scene, object_labels.get_char_name( scene, common.editor_config.data01_dir))) elif chapter == common.CHAPTER_ISLAND and scene >= 701 and scene <= 715: scene -= 700 self.ui.lblScene.setText( "%03d: %s" % (scene, object_labels.get_char_name( scene, common.editor_config.data01_dir))) else: self.ui.lblScene.setText("%03d" % scene) else: self.ui.lblScene.setText("N/A") if not room == -1: self.ui.lblRoom.setText( "%03d: %s" % (room, object_labels.get_map_name( room, common.editor_config.data01_dir))) else: self.ui.lblRoom.setText("N/A") self.ui.lblMode.setText(common.mode_to_text(mode)) else: self.ui.lblChapter.setText("N/A") self.ui.lblScene.setText("N/A") self.ui.lblRoom.setText("N/A") self.ui.lblMode.setText("N/A")
def get_nametag(char_id, x, y, color, vertical=False): w = IMG_W h = IMG_H nametag = get_char_name(char_id, common.editor_config.data01_dir) if nametag == None: nametag = "NAMETAG MISSING" if vertical: nametag_img = QImage(h, w, QImage.Format_ARGB32_Premultiplied) new_x = h - y new_y = x x = new_x y = new_y else: nametag_img = QImage(w, h, QImage.Format_ARGB32_Premultiplied) format = TextFormat(x=x, y=y, w=25, h=25, align=TEXT_ALIGN.left, orient=TEXT_ORIENT.hor, clt=0) nametag_img = print_text(nametag_img, nametag, None, format=format, mangle=False) if vertical: matrix = QTransform() matrix.rotate(-90) nametag_img = nametag_img.transformed(matrix) nametag_img = replace_all_colors(nametag_img, color) return nametag_img
def script_to_text(dir, translated = True, strip_clt = False, only_voiced = False, line_numbers = True): script_pack = ScriptPack() if dir[:7] == "nonstop": parser = NonstopParser() parser.load(dir) script_pack = parser.script_pack elif dir[:8] == "hs_mtb_s": parser = MTBParser() parser.load(dir) script_pack = parser.script_pack elif dir[:7] == "anagram": return u"" else: script_pack.load_dir(dir, common.editor_config.data01_dir) # pack = ScriptPack(directory = dir, umdimage = "X:/Danganronpa/Demo_FINAL/umdimage/") output = [] if len(script_pack) > 0: output.append("==================================================\n=== %s" % dir) room = get_map_name(script_pack[0].scene_info.room) if not room == None: output.append("\n=== Room: %s" % room) output.append("\n==================================================\n\n") for script in script_pack: voice = get_voice_file(script.scene_info.voice) if voice == None and only_voiced: continue if script.scene_info.special in [common.SCENE_SPECIAL.checkobj, common.SCENE_SPECIAL.checkchar, common.SCENE_SPECIAL.option, common.SCENE_SPECIAL.showopt]: output.append("********************\n\n") if line_numbers: output.append("[%04d.txt]" % script.scene_info.file_id) output.append("\n") char_name = get_char_name(script.scene_info.speaker) output.append("[%s]\n" % (char_name if char_name else "N/A")) if not voice == None: # output.append(" [Voice: %04d.at3, %s]\n" % (voice, common.CHAR_IDS[script.scene_info.voice.char_id] if script.scene_info.voice.char_id in common.CHAR_IDS else "N/A")) output.append("[Voice: %04d.at3" % (voice)) if script.scene_info.voice.chapter == 0x63: output.append(" (Generic)") output.append("]\n") # output.append("\n") line = "" if translated and script[common.editor_config.lang_trans]: if strip_clt: line = script.notags[common.editor_config.lang_trans] else: line = script[common.editor_config.lang_trans] else: if strip_clt: line = script.notags[common.editor_config.lang_orig] else: line = script[common.editor_config.lang_orig] output.append(" %s" % line.strip().replace("\n", "\n ")) output.append("\n\n") return u''.join(output)
def script_to_text(dir, translated=True, strip_clt=False, only_voiced=False, line_numbers=True): script_pack = ScriptPack() if dir[:7] == "nonstop": parser = NonstopParser() parser.load(dir) script_pack = parser.script_pack elif dir[:8] == "hs_mtb_s": parser = MTBParser() parser.load(dir) script_pack = parser.script_pack elif dir[:7] == "anagram": return u"" else: script_pack.load_dir(dir, common.editor_config.data01_dir) # pack = ScriptPack(directory = dir, umdimage = "X:/Danganronpa/Demo_FINAL/umdimage/") output = [] if len(script_pack) > 0: output.append( "==================================================\n=== %s" % dir) room = get_map_name(script_pack[0].scene_info.room) if not room == None: output.append("\n=== Room: %s" % room) output.append( "\n==================================================\n\n") for script in script_pack: voice = get_voice_file(script.scene_info.voice) if voice == None and only_voiced: continue if script.scene_info.special in [ common.SCENE_SPECIAL.checkobj, common.SCENE_SPECIAL.checkchar, common.SCENE_SPECIAL.option, common.SCENE_SPECIAL.showopt ]: output.append("********************\n\n") if line_numbers: output.append("[%04d.txt]" % script.scene_info.file_id) output.append("\n") char_name = get_char_name(script.scene_info.speaker) output.append("[%s]\n" % (char_name if char_name else "N/A")) if not voice == None: # output.append(" [Voice: %04d.at3, %s]\n" % (voice, common.CHAR_IDS[script.scene_info.voice.char_id] if script.scene_info.voice.char_id in common.CHAR_IDS else "N/A")) output.append("[Voice: %04d.at3" % (voice)) if script.scene_info.voice.chapter == 0x63: output.append(" (Generic)") output.append("]\n") # output.append("\n") line = "" if translated and script[common.editor_config.lang_trans]: if strip_clt: line = script.notags[common.editor_config.lang_trans] else: line = script[common.editor_config.lang_trans] else: if strip_clt: line = script.notags[common.editor_config.lang_orig] else: line = script[common.editor_config.lang_orig] output.append(" %s" % line.strip().replace("\n", "\n ")) output.append("\n\n") return u''.join(output)