def select_override(self, ind): if ind is not None: current = self.array_connector.cur_selection self.gui.string.entry.config( textvariable=make_str_var(current.code)) self.gui.code.entry.config( textvariable=make_int_var(current.override))
def __init__(self, parent=None): self.gui = TrainerPeoplemonEditorGUI(parent) self.peoplemon = TrainerPeoplemon() self.main_saveable = self.peoplemon int_entry_map = { self.gui.id: self.peoplemon.id, self.gui.level: self.peoplemon.level, self.gui.xp: self.peoplemon.cur_xp, self.gui.next_xp: self.peoplemon.next_level_up_xp, self.gui.cur_hp: self.peoplemon.cur_hp, self.gui.cur_ail: self.peoplemon.cur_ail, self.gui.hold: self.peoplemon.hold_item } for widget, saveable in int_entry_map.items(): widget.entry.config(textvariable=make_int_var(saveable)) moves = (self.peoplemon.move1.id, self.peoplemon.move1.pp, self.peoplemon.move2.id, self.peoplemon.move2.pp, self.peoplemon.move3.id, self.peoplemon.move3.pp, self.peoplemon.move4.id, self.peoplemon.move4.pp) for entry, saveable in zip(self.gui.moves_widgets, moves): entry.config(textvariable=make_int_var(saveable)) for widget, saveable in zip(self.gui.iv_widgets, [x for x in self.peoplemon.ivs]): widget.entry.config(textvariable=make_int_var(saveable)) for widget, saveable in zip(self.gui.ev_widgets, [x for x in self.peoplemon.evs]): widget.entry.config(textvariable=make_int_var(saveable)) self.gui.nick.entry.config( textvariable=make_str_var(self.peoplemon.nickname))
def on_select(self, id): move = self.item_connector.cur_selection gui = self.gui for widget, saveable in ( (gui.id, move.id), (gui.attack, move.attack), (gui.accuracy, move.accuracy), (gui.effect, move.effect), (gui.priority, move.priority), (gui.pp, move.pp), (gui.type, move.type), (gui.chance, move.effect_chance), (gui.intensity, move.effect_intensity), (gui.score, move.effect_score)): widget.entry.config(textvariable=make_int_var(saveable)) for widget, saveable in ( (gui.name.entry, move.name), (gui.attacker_anim.entry, move.attacker_anim), (gui.defender_anim.entry, move.defender_anim), (gui.description, move.description)): widget.config(textvariable=make_str_var(saveable)) for widget, saveable in ( (gui.is_special, move.is_special), (gui.targets_self, move.effect_targets_self)): widget.config(variable=make_check_var(saveable)) gui.classification.combo.config(textvariable=make_combo_var(move.classification, CLASSIFICATIONS))
def credit_changed(self, ind): current = self.array_connector.cur_selection self.gui.multi_widget.change_widget(self.TYPE_MAP[current.type.get()]) widget = self.gui.multi_widget.current_widget if current.type.get() == ImageType: widget.path.entry.configure( textvariable=make_str_var(current.type.image)) elif current.type.get() == TextType: text_credit = current.type.text widget.text.entry.configure( textvariable=make_str_var(text_credit.text)) widget.size.entry.configure( textvariable=make_int_var(text_credit.size)) widget.signal_color_selected.connect(self.on_color_selected) for saveable in (text_credit.blue, ): saveable.signal_changed.connect(self.on_color_changed) self.on_color_changed(None) self.gui.x_pos.entry.config(textvariable=make_int_var(current.x)) self.gui.y_buf.entry.config(textvariable=make_int_var(current.y_buf))
def __init__(self, parent=None): self.gui = TrainerEditorGUI(parent) self.trainer = Trainer() self.main_saveable = self.trainer str_entry_map = { self.gui.name: self.trainer.name, self.gui.anim_name: self.trainer.animation, self.gui.before_convo: self.trainer.before_convo, self.gui.after_convo: self.trainer.after_convo, self.gui.lost_text: self.trainer.lose_message, self.gui.playlist: self.trainer.playlist, self.gui.background: self.trainer.background_image } self.gui.item_list.set_key(lambda item: item.get()) for widget, saveable in str_entry_map.items(): widget.entry.config(textvariable=make_str_var(saveable)) self.gui.sight_range.entry.config( textvariable=make_int_var(self.trainer.sight_range)) self.node_connector = None self.peoplemon_connector = ArrayConnector(self.trainer.peoplemon, self.gui.peoplemon_list, self.gui.add_peoplemon, self.gui.file_name) self.peoplemon_connector.bind_move() self.item_connector = ArrayConnector(self.trainer.items, self.gui.item_list, self.gui.add_item, self.gui.item_id) self.gui.peoplemon_list.signal_select.connect(self.select_peoplemon) self.gui.item_list.signal_select.connect(self.select_item) ai_map = { AI_RANDOM: 0, AI_DUMB: 1, AI_SMART: 2, AI_SUICIDAL: 3, AI_AGGRESSIVE: 4, AI_DEFENSIVE: 5, AI_AVERAGE: 6, AI_ADAPTIVE: 7 } behavior_map = { B_STILL: StandStillBehavior, B_SPIN: SpinInPlaceBehavior, B_FOLLOW: FollowPathBehavior, B_WANDER: WanderBehavior } self.gui.ai_type.config( textvariable=make_combo_var(self.trainer.ai_type, ai_map)) self.gui.motion_type.config( textvariable=make_combo_var(self.trainer.behavior, behavior_map)) self.behavior_connect = BehaviorWidgetConnector( self.gui.behavior_widget, self.trainer.behavior) self.behavior_connect.signal_repack.connect(self.on_repack)
def select_override(self, ind): if ind is not None: current = self.array_connector.cur_selection int_map = { self.gui.entry_x: current.x, self.gui.entry_y: current.y, self.gui.entry_spawn: current.spawn_id } str_map = { self.gui.entry_display: current.display_name, self.gui.entry_ref: current.reference_name, self.gui.entry_map: current.map_name } for entry, saveable in int_map.items(): entry.entry.config(textvariable=make_int_var(saveable)) for entry, saveable in str_map.items(): entry.entry.config(textvariable=make_str_var(saveable))
def on_select(self, id): peoplemon = self.item_connector.cur_selection gui = self.gui int_map = { gui.id: peoplemon.id, gui.base_xp: peoplemon.base_xp_yield, gui.special_id: peoplemon.special_ability_id, gui.type: peoplemon.type, gui.evolve_level: peoplemon.evolve_level, gui.evolve_id: peoplemon.evolve_id } for widget, saveable in int_map.items(): widget.entry.config(textvariable=make_int_var(saveable)) for widget, saveable in ((gui.description, peoplemon.description), (gui.name.entry, peoplemon.name)): widget.config(textvariable=make_str_var(saveable)) gui.xp_group.combo.config( textvariable=make_combo_var(peoplemon.xp_group, XP_MAP)) for stats_gui, stats, in ((self.gui.base_stats, peoplemon.base_stats), (self.gui.ev_stats, peoplemon.ev_stats)): for widget, saveable in ((stats_gui.attack, stats.attack), (stats_gui.defense, stats.defense), (stats_gui.special_attack, stats.special_attack), (stats_gui.special_defense, stats.special_defense), (stats_gui.hp, stats.hp), (stats_gui.speed, stats.speed), (stats_gui.accuracy, stats.accuracy), (stats_gui.evade, stats.evade), (stats_gui.critical, stats.critical)): widget.entry.config(textvariable=make_int_var(saveable)) self.learn_move_connector = ArrayConnector(peoplemon.learn_moves, gui.learn_list, gui.add_learn_move, gui.learn_move_id, gui.learn_level) self.available_move_connector = ArrayConnector( peoplemon.valid_moves, gui.available_list, gui.add_available_button, gui.available_move_id) self.gui.learn_list.signal_select.connect(self.on_learn_move_select) self.gui.available_list.signal_select.connect( self.on_available_move_select)
def __init__(self, parent=None): self.gui = NpcEditorGUI(parent) self.npc = Npc() self.main_saveable = self.npc for widget, saveable in ((self.gui.npc_name, self.npc.name), (self.gui.anim_name, self.npc.animation), (self.gui.conv_name, self.npc.convo_file)): widget.entry.config(textvariable=make_str_var(saveable)) behavior_map = { B_STILL: StandStillBehavior, B_SPIN: SpinInPlaceBehavior, B_FOLLOW: FollowPathBehavior, B_WANDER: WanderBehavior } self.behavior_connector = BehaviorWidgetConnector( self.gui.behavior, self.npc.behahavior) self.gui.motion_type.combo.config( textvariable=make_combo_var(self.npc.behahavior, behavior_map))
def select_peoplemon(self, ind): if ind is not None: current = self.peoplemon_connector.cur_selection self.gui.file_name.entry.config(textvariable=make_str_var(current))
def on_select(self, ind): current = self.connector.cur_selection self.gui.name.entry.config(textvariable=make_str_var(current))