def __init__(self, container, package, exit_callback): themedFrame.ThemedFrame.__init__(self, container) self.place(relwidth=1, relheight=1) self.tkraise() self.original_package = package.copy() self.package = package self.assets = [] self.left_column = themedFrame.ThemedFrame( self, background=style.primary_color) self.left_column.place(relheight=1, width=SIDECOLUMNWIDTH) self.column_header = themedLabel.ThemedLabel( self.left_column, text="ASSETS", font=style.mediumboldtext, foreground=style.primary_text_color) self.column_header.place(y=+style.offset, x=+style.offset, relwidth=1, width=style.offset) self.left_column_listboxes = themedFrame.ThemedFrame( self.left_column, background=style.primary_color) self.left_column_listboxes.place(y=30, relheight=1, relwidth=1, height=-60) self.assetsindexlist = scrollingWidgets.ScrolledThemedListBox( self.left_column_listboxes, background=style.primary_color) self.assetsindexlist.place(relheight=1, width=20, x=+2 * style.offset) self.assetstypelist = scrollingWidgets.ScrolledThemedListBox( self.left_column_listboxes, background=style.primary_color) self.assetstypelist.place(relheight=1, relwidth=1, x=20 + 2 * style.offset, width=-(20 + 4 * style.offset)) bindlist = [self.assetsindexlist, self.assetstypelist] if platform.system() == 'Windows' or platform.system() == "Darwin": for b in bindlist: b.bind("<MouseWheel>", self.on_mouse_wheel) elif platform.system() == "Linux": for b in bindlist: b.bind("<Button-4>", self.on_mouse_wheel) b.bind("<Button-5>", self.on_mouse_wheel) self.body = themedFrame.ThemedFrame(self, background=style.secondary_color) self.body.place(relwidth=1, relheight=1, x=SIDECOLUMNWIDTH, width=SIDECOLUMNWIDTH) self.load() self.assetstypelist.bind("<<ListboxSelect>>", self.on_listbox_selection)
def __init__(self, app, parent): self.name = "EXIT" self.app = app tk.Frame.__init__(self, parent, background=style.primary_color) self.usertext = themedLabel.ThemedLabel(self, text="Exit?", font=style.hugeboldtext, anchor="center", background=style.primary_color, foreground="white") self.usertext.place(relwidth=1, relheight=1, height=-(style.buttonsize + 2 * style.offset)) self.yesnobuttonframe = tk.Frame(self, background=style.primary_color, borderwidth=0, highlightthickness=0) self.yesnobuttonframe.place(relx=0.5, rely=1, y=-(style.buttonsize + style.offset), width=300, x=-150, height=style.buttonsize) self.yesbutton = button.Button(self.yesnobuttonframe, callback=self.on_yes, text_string="Yes", background=style.secondary_color) self.yesbutton.place(relx=0.33, relwidth=0.34, relheight=1)
def build_sidebar(self): package = self.package for w in self.destroyables: w.destroy() p = package["package"] w = themedLabel.ThemedLabel(self.column_body, f"Package - {p}", anchor="w", font=style.smallboldtext, foreground=style.primary_text_color, background=style.primary_color) w.place(x=style.offset, width=-style.offset, y=style.offset, relwidth=1, height=SIDEBAR_OFFSET) self.destroyables.append(w) i = 1 self.entries = {} for key in package.keys(): if key in EXCLUDED_SIDEBAR_KEYS: continue w_l = themedLabel.ThemedLabel(self.column_body, key, anchor="w", font=style.smallboldtext, foreground=style.primary_text_color, background=style.primary_color) w_l.place(x=2 * style.offset, y=i * (SIDEBAR_OFFSET + style.offset) + style.offset, relx=0.0, relwidth=0.20, height=SIDEBAR_OFFSET, width=-4 * style.offset) w = themedEntry.ThemedEntry(self.column_body, font=style.smalltext) w.place(x=2 * style.offset, y=i * (SIDEBAR_OFFSET + style.offset) + style.offset, relx=0.20, relwidth=0.80, height=SIDEBAR_OFFSET, width=-4 * style.offset) w.set(package[key]) self.entries[key] = w self.destroyables.extend([w, w_l]) i += 1 self.info_entries = {} for key in package["info"].keys(): if key in EXCLUDED_SIDEBAR_KEYS: continue w_l = themedLabel.ThemedLabel(self.column_body, key, anchor="w", font=style.smallboldtext, foreground=style.primary_text_color, background=style.primary_color) w_l.place(x=2 * style.offset, y=i * (SIDEBAR_OFFSET + style.offset) + style.offset, relx=0.0, relwidth=0.20, height=SIDEBAR_OFFSET, width=-4 * style.offset) w = themedEntry.ThemedEntry(self.column_body, font=style.smalltext) w.place(x=2 * style.offset, y=i * (SIDEBAR_OFFSET + style.offset) + style.offset, relx=0.20, relwidth=0.80, height=SIDEBAR_OFFSET, width=-4 * style.offset) w.set(package["info"][key]) self.info_entries[key] = w self.destroyables.extend([w, w_l]) i += 1
def __init__(self, frame): DetailPage.__init__(self, frame) self.place(relwidth=1, relheight=1) #since page is dynamic, need a trash can self.frame = frame self.destroyables = [] #Want to reuse a lot of the page but need to do some cleanup self.column_downloads.destroy() self.column_title.destroy() self.column_author.destroy() self.column_version.destroy() self.column_license.destroy() self.column_package.destroy() self.column_downloads.destroy() self.column_updated.destroy() self.column_uninstall_button.destroy() self.column_install_button.destroy() self.details.destroy() self.body.place(relwidth=1, relheight=1, width=-2 * style.sidecolumnwidth) self.column.place(relx=1, rely=0, width=2 * style.sidecolumnwidth, relheight=1, x=-2 * style.sidecolumnwidth) #Move buttons to be pretty self.column_open_url_button.place( rely=1, relwidth=1, x=+2 * style.offset, y=-2 * (style.buttonsize + 2 * style.offset), width=-4 * style.offset, height=style.buttonsize) self.column_backbutton.place(rely=1, relx=1, x=-(style.buttonsize + style.offset), y=-(style.buttonsize + 2 * style.offset)) self.text_boxes_frame = themedFrame.ThemedFrame( self.body, background=style.secondary_color) self.text_boxes_frame.place(relwidth=1, relheight=1 - style.details_page_image_fraction, rely=style.details_page_image_fraction, x=2 * style.offset, width=-4 * style.offset, y=+2 * style.offset, height=-4 * style.offset) description_label = themedLabel.ThemedLabel( self.text_boxes_frame, "Description:", anchor="w", font=style.smallboldtext, foreground=style.primary_text_color, background=style.secondary_color) description_label.place(relwidth=1, height=20) self.description = scrollingWidgets.ScrolledThemedText( self.text_boxes_frame, font=style.smalltext, foreground=style.detail_page_label_color) self.description.place(y=20, relwidth=1, height=20) details_label = themedLabel.ThemedLabel( self.text_boxes_frame, "Details:", anchor="w", font=style.smallboldtext, foreground=style.primary_text_color, background=style.secondary_color) details_label.place(y=40 + 2 * style.offset, relwidth=1, height=20) self.details = scrollingWidgets.ScrolledThemedText( self.text_boxes_frame, font=style.smalltext, foreground=style.detail_page_label_color) self.details.place(relheight=0.75, y=60 + 2 * style.offset, relwidth=1, height=-(60 + 4 * style.offset)) changes_label = themedLabel.ThemedLabel( self.text_boxes_frame, "Changelog:", anchor="w", font=style.smallboldtext, foreground=style.primary_text_color, background=style.secondary_color) changes_label.place(rely=0.75, relwidth=1, height=20) self.changes = scrollingWidgets.ScrolledThemedText( self.text_boxes_frame, font=style.smalltext, foreground=style.detail_page_label_color) self.changes.place(relheight=0.25, rely=0.75, relwidth=1, y=+20, height=-20) self.column_save_button = button.Button( self.column_body, callback=self.save_json, text_string="SAVE", font=style.mediumboldtext, background=style.secondary_color) self.column_save_button.place( rely=1, relwidth=1, x=+2 * style.offset, y=-(style.buttonsize + 2 * style.offset), width=-(4 * style.offset + style.buttonsize), height=style.buttonsize) self.editor_button = button.Button(self.column_body, callback=self.spawn_editor, text_string="ASSET EDITOR", font=style.mediumboldtext, background=style.secondary_color) self.editor_button.place(rely=1, relwidth=1, x=+2 * style.offset, y=-3 * (style.buttonsize + 2 * style.offset), width=-(4 * style.offset), height=style.buttonsize)
def __init__(self, parent): themedFrame.ThemedFrame.__init__(self, parent) self.app = parent self.appstore_handler = None self.package_parser = None self.selected_version = None self.version_index = None self.package = None self.bind("<Configure>", self.on_configure) self.body = themedFrame.ThemedFrame(self, background=style.secondary_color) self.body.place(relwidth=1, relheight=1, width=-style.sidecolumnwidth) self.image_frame = themedFrame.ThemedFrame( self.body, background=style.secondary_color) self.image_frame.place(relwidth=1, relheight=style.details_page_image_fraction, x=+2 * style.offset, width=-4 * style.offset, y=+2 * style.offset, height=-2 * style.offset) self.banner_image = themedLabel.ThemedLabel( self.image_frame, "", background=style.secondary_color, anchor="center", wraplength=None) self.banner_image.place(relwidth=1, relheight=1) self.details = scrollingWidgets.ScrolledThemedText( self.body, font=style.smalltext, foreground=style.detail_page_label_color) self.details.place(relwidth=1, relheight=1 - style.details_page_image_fraction, rely=style.details_page_image_fraction, x=2 * style.offset, width=-4 * style.offset, y=+2 * style.offset, height=-4 * style.offset) #RIGHT COLUMN self.column = themedFrame.ThemedFrame(self, background=style.primary_color) self.column.place(relx=1, rely=0, width=style.sidecolumnwidth, relheight=1, x=-style.sidecolumnwidth) self.column_body = themedFrame.ThemedFrame( self.column, background=style.primary_color) self.column_body.place(relwidth=1, relheight=1) self.column_title = themedLabel.ThemedLabel( self.column_body, "", anchor="w", font=style.smallboldtext, foreground=style.primary_text_color, background=style.primary_color) self.column_title.place(x=style.offset, width=-style.offset, rely=0, relwidth=1, height=style.detais_page_title_height) self.column_author = themedLabel.ThemedLabel( self.column_body, "", anchor="w", font=style.smalltext, foreground=style.detail_page_label_color, background=style.primary_color) self.column_author.place( x=style.offset, width=-style.offset, y=style.detais_page_title_height + style.details_item_y_multiplier, relwidth=1, height=0.333 * style.details_item_y_multiplier) self.column_version = themedLabel.ThemedLabel( self.column_body, "", anchor="w", font=style.smalltext, foreground=style.detail_page_label_color, background=style.primary_color) self.column_version.place(x=style.offset, width=-style.offset, y=style.detais_page_title_height + 0.333 * style.details_item_y_multiplier, relwidth=1, height=0.333 * style.details_item_y_multiplier) self.column_license = themedLabel.ThemedLabel( self.column_body, "", anchor="w", font=style.smalltext, foreground=style.detail_page_label_color, background=style.primary_color) self.column_license.place(x=style.offset, width=-style.offset, y=style.detais_page_title_height + 0.666 * style.details_item_y_multiplier, relwidth=1, height=0.333 * style.details_item_y_multiplier) self.column_package = themedLabel.ThemedLabel( self.column_body, "", anchor="w", font=style.smalltext, foreground=style.detail_page_label_color, background=style.primary_color) self.column_package.place(x=style.offset, width=-style.offset, y=style.detais_page_title_height + 1.000 * style.details_item_y_multiplier, relwidth=1, height=0.333 * style.details_item_y_multiplier) self.column_downloads = themedLabel.ThemedLabel( self.column_body, "", anchor="w", font=style.smalltext, foreground=style.detail_page_label_color, background=style.primary_color) self.column_downloads.place(x=style.offset, width=-style.offset, y=style.detais_page_title_height + 1.333 * style.details_item_y_multiplier, relwidth=1, height=0.333 * style.details_item_y_multiplier) self.column_updated = themedLabel.ThemedLabel( self.column_body, "", anchor="w", font=style.smalltext, foreground=style.detail_page_label_color, background=style.primary_color) self.column_updated.place(x=style.offset, width=-style.offset, y=style.detais_page_title_height + 1.666 * style.details_item_y_multiplier, relwidth=1, height=0.333 * style.details_item_y_multiplier) # self.column_separator_top = ThemedLabel(self.column_body, "", background=style.lg) # self.column_separator_top.place(rely=1,relwidth = 1, x = + style.offset, y = - 3 * (style.buttonsize + style.offset) - 3 * style.offset - style.buttonsize - 1 - 0.5 * style.buttonsize, width = - 2 * style.offset, height = 1) # self.column_separator_bot = ThemedLabel(self.column_body, "", background=style.lg) # self.column_separator_bot.place(rely=1,relwidth = 1, x = + style.offset, y = - 3 * (style.buttonsize + style.offset) - style.offset - 1, width = - 2 * style.offset, height = 1) self.column_open_url_button = button.Button( self.column_body, callback=self.trigger_open_tab, text_string="VISIT PAGE", font=style.mediumboldtext, background=style.secondary_color, ).place(rely=1, relwidth=1, x=+2 * style.offset, y=-3 * (style.buttonsize + style.offset), width=-4 * style.offset, height=style.buttonsize) self.column_install_button = button.Button( self.column_body, callback=self.trigger_install, text_string="INSTALL", font=style.mediumboldtext, background=style.secondary_color) self.column_install_button.place(rely=1, relwidth=1, x=+2 * style.offset, y=-2 * (style.buttonsize + style.offset), width=-4 * style.offset, height=style.buttonsize) self.column_uninstall_button = button.Button( self.column_body, callback=self.trigger_uninstall, text_string="UNINSTALL", font=style.mediumboldtext, background=style.secondary_color) self.back_image = ImageTk.PhotoImage( Image.open("gui/assets/return.png").resize( (style.buttonsize, style.buttonsize), Image.ANTIALIAS)) self.column_backbutton = button.Button(self.column_body, image_object=self.back_image, callback=self.leave, background=style.primary_color) self.column_backbutton.place(rely=1, relx=1, x=-(style.buttonsize + style.offset), y=-(style.buttonsize + style.offset)) self.progress_bar = progressFrame.ProgressFrame(self) self.yesnoPage = YesNoPage(self)
def build_listframe(self): self.header = tk.Frame(self, background=style.primary_color) self.header = themedFrame.ThemedFrame(self) self.header.place(relx=0, rely=0, relwidth=1, height=style.searchboxheight) self.content_frame_header_search_bar = searchBox.SearchBox( self.header, command=self.search, entry_background=style.secondary_color, borderwidth=0, entry_foreground=style.primary_text_color) self.selected_sort_method = tk.StringVar() self.selected_sort_method.set(SORT_OPTIONS[0]) self.content_frame_header_sort_method_dropdown = tk.OptionMenu( self.header, self.selected_sort_method, *SORT_OPTIONS) self.content_frame_header_sort_method_dropdown.configure( foreground=style.primary_text_color) self.content_frame_header_sort_method_dropdown.configure( background=style.secondary_color) self.content_frame_header_sort_method_dropdown.configure( highlightthickness=0) self.content_frame_header_sort_method_dropdown.configure(borderwidth=0) self.content_frame_header_sort_method_dropdown.place( relx=1, x=-(style.offset + style.sortdropdownwidth), width=style.sortdropdownwidth, y=+1.5 * style.offset, relheight=1, height=-2 * style.offset) self.content_frame_header_sort_method_dropdown.unbind("<F10>") self.content_frame_header_search_bar.place( x=0, y=+1.5 * style.offset, relheight=1, relwidth=1, width=-(2 * style.offset + style.sortdropdownwidth), height=-2 * style.offset) self.body_frame = tk.Frame(self, background=style.primary_color) self.body_frame.place(y=style.searchboxheight, height=-style.searchboxheight, relwidth=1, relheight=1) self.scrollbar = tk.Scrollbar(self.body_frame, troughcolor=style.primary_color, bg=style.secondary_color) self.scrollbar.place(relheight=1, width=style.scrollbarwidth, relx=1, x=-style.scrollbarwidth, height=-(style.listbox_footer_height), y=+style.listbox_header_height) self.listbox_frame = tk.Frame(self.body_frame, background=style.secondary_color) self.listbox_frame.place(relwidth=1, relheight=1, width=-style.scrollbarwidth) self.scaling_listboxes_frame = tk.Frame( self.listbox_frame, background=style.secondary_color) self.scaling_listboxes_frame.place(relwidth=1, relheight=1) self.scaling_listboxes_frame_header = tk.Frame( self.scaling_listboxes_frame, background=style.secondary_color) self.scaling_listboxes_frame_header.place( relwidth=1, height=style.listbox_header_height) self.scaling_listboxes_frame_body = tk.Frame( self.scaling_listboxes_frame, background=style.secondary_color) self.scaling_listboxes_frame_body.place( relwidth=1, relheight=1, y=style.listbox_header_height, height=-style.listbox_header_height) self.package_listbox = themedListbox.ThemedListbox( self.scaling_listboxes_frame_body, background=style.secondary_color, font=style.smallboldtext, borderwidth=1, foreground=style.primary_text_color) self.package_listbox.place(relx=0, relwidth=0.33333, relheight=1) self.package_listbox_label = themedLabel.ThemedLabel( self.scaling_listboxes_frame_header, text="Package", background=style.primary_color, font=style.mediumboldtext) self.package_listbox_label.place(relx=0, relwidth=0.33333, relheight=1) self.title_listbox = themedListbox.ThemedListbox( self.scaling_listboxes_frame_body, background=style.secondary_color, font=style.smalltext, borderwidth=1) self.title_listbox.place(relx=0.33333, relwidth=0.33333, relheight=1) self.title_listbox_label = themedLabel.ThemedLabel( self.scaling_listboxes_frame_header, text="Title", background=style.primary_color, font=style.mediumboldtext) self.title_listbox_label.place(relx=0.33333, relwidth=0.33333, relheight=1) self.author_listbox = themedListbox.ThemedListbox( self.scaling_listboxes_frame_body, background=style.secondary_color, font=style.smalltext, borderwidth=1) self.author_listbox.place(relx=0.66666, relwidth=0.33333, relheight=1) self.author_listbox_label = themedLabel.ThemedLabel( self.scaling_listboxes_frame_header, text="Author", background=style.primary_color, font=style.mediumboldtext) self.author_listbox_label.place(relx=0.66666, relwidth=0.33333, relheight=1) self.listbox_list = [ self.package_listbox, self.title_listbox, self.author_listbox, ] self.package_listbox.configure({"selectbackground": style.lg}) self.package_listbox.configure({"selectmode": "single"}) self.package_listbox.bind("<<ListboxSelect>>", self.on_listbox_selection) self.scrollbar.config(command=self.on_scroll_bar) self.package_listbox.config(yscrollcommand=self.scrollbar.set) bindlist = [ self, self.package_listbox, self.title_listbox, self.author_listbox, ] if platform.system() == 'Windows' or platform.system() == "Darwin": for b in bindlist: b.bind("<MouseWheel>", self.on_mouse_wheel) elif platform.system() == "Linux": for b in bindlist: b.bind("<Button-4>", self.on_mouse_wheel) b.bind("<Button-5>", self.on_mouse_wheel) self.set_sort_type(None) self.rebuild() self.sort_check_loop()