def _init_upper_frame(self): self.insufficiently = ToggleButton(self, text='Insufficiently', width=14, font=(SCP, 8), relief=RIDGE) self.insufficiently.bind( '<Button-1>', lambda event: (self.filter_manager.set_specific_condition( 'unforged', 0 if self.insufficiently.is_selected else CONDITIONLESS, rule=not_match_request), self.update_table()), add='+') self.insufficiently.place(x=380, y=3) Label(self, text='Type:', width=5, font=(MS_JH, 11)).place(x=510, y=3) self.type_selector = FilteredCombobox(self, width=4, font=(MS_JH, 9), justify=CENTER, state='readonly') self.type_selector['values'] = WEAPONS self.type_selector.place(x=558, y=5) self.type_selector.bind( '<<ComboboxSelected>>', lambda event: (self.filter_manager.set_specific_condition( 'weapon_type', self.type_selector.get()), self.update_table())) button = Button(self, text='新增', width=8, font=(MS_JH, 10)) button.place(x=640, y=1) button["command"] = lambda: open_adding_new_character_weapon_window( self, callback=lambda cw: (self.characters.append(cw), self.update_table()))
def _init_widgets(self): self.profession_selector = ProfessionSelector(self, self.updating_request_profession) self.profession_selector.place(x=5, y=5) self.rank_selector = RankSelector(self, self.updating_request_rank) self.rank_selector.place(x=5, y=53) Label(self, text='所屬', width=5, font=("", 10)).place(x=221, y=5) self.belonged_selector = FilteredCombobox(self, width=7, font=("", 11), justify=CENTER) self.belonged_selector['values'] = BELONGEDS self.belonged_selector.place(x=213, y=22) self.belonged_selector.bind('<<ComboboxSelected>>', lambda x: self.updating_request_belonged(self.belonged_selector.get())) self.belonged_selector.bind('<Return>', lambda x: self.character_selector.focus_set()) Label(self, text='篩選', width=5, font=("", 11)).place(x=222, y=54) self.name_request = StringVar(value='') entry = Entry(self, width=8, textvariable=self.name_request, font=("", 12)) entry.place(x=214, y=73) entry.bind('<Return>', lambda x: self.updating_request_name()) entry.bind('<Escape>', lambda x: (self.name_request.set(''), self.updating_request_name())) Label(self, text='Character', width=10, font=("", 12)).place(x=304, y=26) self.character_selector = ttk.Combobox(self, state='readonly', width=10, font=("", 12), justify=CENTER) self.character_selector.place(x=305, y=48) self.character_selector.bind('<Return>', lambda x: self.submitting()) # 熱鍵,直接指過來 self.bind('<f>', lambda x: self.character_selector.focus_set()) y_position = 115 # 送交的按鈕 button = Button(self, text="選擇此角色", width=25, borderwidth=3) button.place(x=17, y=y_position) button["command"] = self.submitting # 新增角色的按鈕 button = Button(self, text="新增角色", width=9, borderwidth=3) button.place(x=225, y=y_position) button["command"] = lambda: open_adding_new_jp_character_window( self, lambda new_character: (self.update_records(), self.updating_character_selector())) # 取消並結束的按鈕 button = Button(self, text="放棄選擇", width=9, borderwidth=3) button.place(x=317, y=y_position) button["command"] = self.destroy
def _init_upper_frame(self): filter_frame = Frame(self, width=self['width'], height=40) filter_frame.place(x=0, y=0) current_x = 45 self.profession_selector = ProfessionSelector(filter_frame, self.updating_profession) self.profession_selector.place(x=current_x, y=-4) current_x += 199 self.rank_selector = RankSelector(filter_frame, self.updating_rank) self.rank_selector.place(x=current_x, y=-4) # 所屬篩選 current_x = 448 Label(filter_frame, text='所屬:', font=(MS_JH, 10)).place(x=current_x + 10, y=-3) self.belonged = FilteredCombobox(filter_frame, width=6, justify=CENTER) self.belonged['values'] = BELONGEDS self.belonged.place(x=current_x, y=16) self.belonged.bind('<<ComboboxSelected>>', lambda event: self.updating_belonged()) # 角色部分名稱篩選 current_x += 75 Label(filter_frame, text='篩選:', font=(MS_JH, 12)).place(x=current_x, y=7) self.request = StringVar() entry = Entry(filter_frame, width=9, textvariable=self.request, font=(MS_JH, 11)) entry.place(x=current_x + 42, y=9) entry.bind('<Return>', lambda event: self.update_table()) # 清空進行篩選的條件 button = Button(filter_frame, text="清空條件", width=7, font=(MS_JH, 11)) button.place(x=667, y=3) button["command"] = self.clearing_filters
def _init_filter_frame(self): basic_x = 20 Label(self, text='E:', font=(MS_JH, 12)).place(x=basic_x, y=3) self.event_filter = FilteredObjectCombobox(self, setter=lambda obj: obj.name, getter=lambda obj: obj.e_id, width=16, justify=CENTER) self.event_filter.set_objects(self.events) self.event_filter.place(x=basic_x + 18, y=3) self.event_filter.bind( '<<ComboboxSelected>>', lambda x: (self.filter_manager.set_specific_condition( 'event_id', self.event_filter.get()), self.update_table()), add='+') self.event_filter.bind( '<Button-2>', lambda event: (open_updating_event_window( self, self.event_filter.selected_object, lambda: self. event_filter.set_objects(self.events)))) basic_x += 158 Label(self, text='C:', font=(MS_JH, 12)).place(x=basic_x, y=3) self.cost_filter = FilteredCombobox(self, width=6, justify=CENTER) self.cost_filter['values'] = DRAW_LOTS_COST self.cost_filter.place(x=basic_x + 20, y=3) self.cost_filter.bind( '<<ComboboxSelected>>', lambda x: (self.filter_manager.set_specific_condition( 'cost', self.cost_filter.get()), self.update_table())) basic_x += 90 Label(self, text='R:', font=(MS_JH, 12)).place(x=basic_x, y=3) self.rank_filter = IntFilteredCombobox(self, width=3, justify=CENTER) self.rank_filter['values'] = [5, 4, 3] self.rank_filter.place(x=basic_x + 20, y=3) self.rank_filter.bind( '<<ComboboxSelected>>', lambda x: (self.filter_manager.set_specific_condition( 'rank', self.rank_filter.get()), self.update_table())) basic_x = 342 Label(self, text='Total:', font=(MS_JH, 12)).place(x=basic_x, y=2) self.total_count = Label(self, font=(MS_JH, 12)) self.total_count.place(x=basic_x + 44, y=2) basic_x += 83 Label(self, text='SSR:', font=(MS_JH, 12)).place(x=basic_x, y=2) self.ssr_count = Label(self, font=(MS_JH, 10)) self.ssr_count.place(x=basic_x + 34, y=-3) self.ssr_ratio = Label(self, font=(MS_JH, 9)) self.ssr_ratio.place(x=basic_x + 44, y=13) basic_x += 80 Label(self, text='SR:', font=(MS_JH, 12)).place(x=basic_x, y=2) self.sr_count = Label(self, font=(MS_JH, 10)) self.sr_count.place(x=basic_x + 25, y=-3) self.sr_ratio = Label(self, font=(MS_JH, 9)) self.sr_ratio.place(x=basic_x + 35, y=13) basic_x += 78 Label(self, text='R:', font=(MS_JH, 12)).place(x=basic_x, y=2) self.r_count = Label(self, font=(MS_JH, 10)) self.r_count.place(x=basic_x + 16, y=-3) self.r_ratio = Label(self, font=(MS_JH, 9)) self.r_ratio.place(x=basic_x + 26, y=13) # 清空進行篩選的條件 button = Button(self, text="清空條件", width=7, font=(MS_JH, 11)) button.place(x=658, y=-1) button["command"] = self.clearing_filter