def search_poll(self): if self.is_searching: #.4 second delay on search debouncer if (timer() - self.searchtimer) > (0.25): threader.do_async(self.do_search_query, [], priority="low") else: self.controller.after(100, self.search_poll)
def trigger_uninstall(self): if self.package: threader.do_async(self.appstore_handler.uninstall_package, [self.package], priority="high") self.controller.frames["appstorePage"].reload_category_frames() self.schedule_callback(self.reload(), 100)
def update_displayed_buttons(self): if not self.is_displaying: self.is_displaying = True #If frame is visible if self.selected: button_height = self.thumbnailheight + 13 * style.offset canvas_height = self.canvas_frame.winfo_height() if not canvas_height: print("canvas height is zero") return ratio = 1 / canvas_height viewable_buffer = (3 * button_height) * ratio #add a buffer to the range to search for buttons that need placing canvas_top = self.canvas.yview()[0] - viewable_buffer if canvas_top < 0: canvas_top = 0 canvas_bottom = self.canvas.yview()[1] + viewable_buffer if canvas_bottom > 1: canvas_bottom = 1 for button in self.buttons: if not button.placed: #If button has been designated to be placed on the canvas if button.get_xy()[1]: button_y_proportion = button.get_xy()[1] * ratio if canvas_top < button_y_proportion and button_y_proportion < canvas_bottom: threader.do_async(button.build_button, [], priority="low") self.is_displaying = False
def update_page(self, package): self.package = package threader.do_async(self.update_banner) self.column_title.set("Title: {}".format(package["title"])) self.column_author.set("Author: {}".format(package["author"])) self.column_version.set("Latest Version: {}".format( package["version"])) try: self.column_license.set("License: {}".format(package["license"])) except: self.column_license.set("License: N/A") self.column_package.set("Package: {}".format(package["name"])) ttl_dl = 0 try: ttl_dl += package["web_dls"] except: pass try: ttl_dl += package["app_dls"] except: pass self.column_downloads.set("Downloads: {}".format(ttl_dl)) self.column_updated.set("Updated: {}".format(package["updated"])) self.details.set(package["description"].replace("\\n", """ """)) self.update_buttons(package)
def show(self, package, handler): self.appstore_handler = handler self.package_parser = handler self.do_update_banner("gui/assets/notfound.png") threader.do_async(self.update_page, [package], priority="medium") self.tkraise() for child in self.winfo_children(): child.bind("<Escape>", self.leave)
def __init__(self, app, container): basePlugin.BasePlugin.__init__(self, app, "WiiUExploit", container) self.app = app self.container = container #replace the "localhost" with your iPv4 self.server = HTTPServer((get_ip(), 8000), Serv) print("Server is Running :)") threader.do_async(self.server.serve_forever)
def build_frame(self, packages): def do_build_frame(): if not packages: return self.clear() if self.listbox_list: for lb in self.listbox_list: lb.configure(state="normal") installed_packages = self.appstore_handler.get_packages( silent=True) for package in packages: if not package: continue self.package_listbox.insert('end', package["name"]) self.title_listbox.insert('end', package["title"]) self.author_listbox.insert('end', package["author"]) self.updated_listbox.insert('end', package["updated"]) if installed_packages: if package["name"] in installed_packages: if self.appstore_handler.get_package_version( package["name"]) == package["version"]: self.package_listbox.itemconfig( 'end', {"fg": "green"}) else: self.package_listbox.itemconfig( 'end', {"fg": "yellow"}) for lb in self.listbox_list: lb.configure(state="disable") self.package_listbox.configure(state='normal') bindlist = [ self, self.package_listbox, self.title_listbox, self.author_listbox, self.updated_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) threader.do_async(do_build_frame)
def trigger_install(self): if not self.appstore_handler.check_path(): self.set_sd() if self.appstore_handler.check_path(): if self.appstore_handler.check_if_get_init(): if self.package: threader.do_async( self.appstore_handler.handler_install_package, [ self.package, self.progress_bar.update, self.reload_function, self.progress_bar.set_title ], priority="high") else: self.yesnoPage.getanswer( "The homebrew appstore has not been initiated here yet, would you like to initiate it?", self.init_get_then_continue)
def update_page(self, package): self.selected_version = None self.package = package threader.do_async(self.update_banner) version = package["version"] self.column_title.set("Title: {}".format(package["title"])) self.column_author.set("Author: {}".format(package["author"])) self.column_version.set("Latest Version: {}".format( package["version"])) try: self.column_license.set("License: {}".format(package["license"])) except: self.column_license.set("License: N/A") self.column_package.set("Package: {}".format(package["name"])) ttl_dl = 0 try: ttl_dl += package["web_dls"] except: pass try: ttl_dl += package["app_dls"] except: pass self.column_downloads.set("Downloads: {}".format(ttl_dl)) self.column_updated.set("Updated: {}".format(package["updated"])) self.details.configure(state="normal") self.details.delete('1.0', "end") #Makes newlines in details print correctly. Hacky but :shrug: details = package["description"].replace("\\n", """ """) self.details.insert("1.0", details) self.details.configure(state="disabled") self.update_buttons(package) tags = []
def __init__(self, parent, controller, framework, packages): #list of packages to be displayed by this frame self.packages = packages self.parent = parent self.controller = controller #Frame manager self.framework = framework #**Scheduler self.appstore_handler = Store_handler #Tool to get installed package data etc self.current_search = None self.selected = False self.sort_type = None self.listbox_list = [] tk.Frame.__init__(self, parent, background=style.w, border=0, highlightthickness=0) threader.do_async(self.build_listframe)
def run(self): argstring = "" target = self.target_entry_box.get() if not target: self.Print("No target.\n\n") return argstring += target mode = OPTIONMAP[self.selected_option.get()] if mode: argstring += (" " + mode) tid = self.tid_entry_box.get() if tid: argstring += f" -t {tid}" output = self.target_output_entry_box.get() if output: argstring += f" -o {output}" threader.do_async(main(argstring,self.Print))
def __init__(self, parent, controller): self.controller = controller self.appstore_handler = Store_handler self.repo_parser = Parser self.current_frame = None self.current_frame_name = None self.last_selection = None self.last_sort_option = None self.updater = updater activeFrame.__init__(self, parent, controller) self.column = ThemedFrame(self, background=style.color_1) self.column.place(relx=0, rely=0, width=style.sidecolumnwidth, relheight=1) self.column_header = ThemedFrame(self.column, background=style.color_1) self.column_header.place(relx=0, rely=0, relwidth=1, height=style.column_headerheight) self.column_header_title = ThemedLabel(self.column_header, "Appstore\nWorkbench\nGPLv3", anchor="center", font=style.largeboldtext, background=style.color_1) self.column_header_title.place(relx=0, rely=0, relwidth=1, relheight=1, height=-(style.offset + 1), y=+style.offset) self.column_header_separator = ThemedLabel(self.column_header, "", background=style.w) self.column_header_separator.place(x=style.offset, rely=1, y=-1, relwidth=1, width=-2 * style.offset) self.column_body = ThemedFrame(self.column, background=style.color_1) self.column_body.place( relx=0, relwidth=1, y=style.column_headerheight, relheight=1, height=-(style.column_headerheight + style.footerheight)) self.category_listbox = ThemedListbox(self.column_body, foreground=style.w) self.category_listbox.configure(activestyle="none") self.category_listbox.place(relwidth=1, relheight=1) self.category_listbox.bind('<<ListboxSelect>>', self.select_frame) self.column_footer = ThemedFrame(self.column, background=style.color_1) self.column_footer.place(relx=0, rely=1, relwidth=1, height=2 * style.listbox_footer_height, y=-2 * style.listbox_footer_height) self.column_set_sd = button(self.column_footer, callback=self.set_sd, text_string="Select SD Root", font=style.mediumtext, background=style.color_2).place( relwidth=1, y=0, x=style.offset, width=-2 * style.offset, height=style.listbox_footer_height) self.column_sd_status_label = ThemedLabel( self.column_footer, "SD - Not Set", anchor="center", font=style.smalltext, background=style.color_1, foreground=style.pathdisplaytextcolor) self.column_sd_status_label.place( x=style.offset, relwidth=1, width=-2 * style.offset, y=-style.listbox_footer_height, height=style.listbox_footer_height, rely=1, ) self.content_frame = ThemedFrame(self) self.content_frame.place(x=style.sidecolumnwidth, width=-style.sidecolumnwidth, rely=0, relheight=1, relwidth=1) self.content_frame_header = ThemedFrame(self.content_frame) self.content_frame_header.place(relx=0, rely=0, relwidth=1, height=style.searchboxheight) self.category_label = ThemedLabel(self.content_frame_header, "", anchor="nw", font=style.giantboldtext, background=style.color_1, foreground=style.lg) self.category_label.place(x=+style.offset, relx=0, rely=0, relheight=1, height=-(style.offset + 1), y=+style.offset) self.content_frame_header_search_bar = searchBox( self.content_frame_header, command=self.search, entry_background=style.color_2, borderwidth=0, entry_foreground=style.w) self.selected_sort_method = tk.StringVar() self.selected_sort_method.set(SORT_OPTIONS[0]) self.content_frame_header_sort_method_dropdown = tk.OptionMenu( self.content_frame_header, self.selected_sort_method, *SORT_OPTIONS) self.content_frame_header_sort_method_dropdown.configure( foreground=style.w) self.content_frame_header_sort_method_dropdown.configure( background=style.color_2) self.content_frame_header_sort_method_dropdown.configure( highlightthickness=0) self.content_frame_header_sort_method_dropdown.configure(borderwidth=0) #The various content gets stacked on top of each other here. self.content_stacking_frame = ThemedFrame(self.content_frame) self.content_stacking_frame.place( relx=0, y=(style.searchboxheight + style.offset), relwidth=1, relheight=1, height=-(style.searchboxheight + style.offset)) all_frame = categorylistFrame(self.content_stacking_frame, self.controller, self, self.repo_parser.all) tools_frame = categorylistFrame(self.content_stacking_frame, self.controller, self, self.repo_parser.tools) emus_frame = categorylistFrame(self.content_stacking_frame, self.controller, self, self.repo_parser.emus) games_frame = categorylistFrame(self.content_stacking_frame, self.controller, self, self.repo_parser.games) installed_frame = installedcategorylistFrame( self.content_stacking_frame, self.controller, self, self.repo_parser.all) # help_frame = helpFrame(self.content_stacking_frame) # about_frame = aboutFrame(self.content_stacking_frame) # readme_frame = readmeFrame(self.content_stacking_frame) settings_frame = settingsPage(self.content_stacking_frame, self.controller) exit_frame = exitPage(self.content_stacking_frame, self.controller) self.category_frames = [ all_frame, tools_frame, emus_frame, games_frame, installed_frame ] self.frames = [ { "frame": all_frame, "text": "All Apps" }, { "frame": tools_frame, "text": "Tools" }, { "frame": emus_frame, "text": "Emulators" }, { "frame": games_frame, "text": "Games" }, ] if config.CONSOLE in [config.WII, config.WII_OSC]: misc_frame = categorylistFrame(self.content_stacking_frame, self.controller, self, self.repo_parser.misc) self.category_frames.append(misc_frame) self.frames.extend([ { "frame": misc_frame, "text": "Misc" }, ]) elif config.CONSOLE == config.SWITCH: legacy_frame = categorylistFrame(self.content_stacking_frame, self.controller, self, self.repo_parser.legacy) themes_frame = categorylistFrame(self.content_stacking_frame, self.controller, self, self.repo_parser.themes) advanced_frame = categorylistFrame(self.content_stacking_frame, self.controller, self, self.repo_parser.advanced) self.category_frames.append(legacy_frame) self.category_frames.append(themes_frame) self.category_frames.append(advanced_frame) self.frames.extend([ { "frame": advanced_frame, "text": "Advanced Homebrew" }, { "frame": themes_frame, "text": "Themes" }, { "frame": legacy_frame, "text": "Legacy" }, ]) elif config.CONSOLE == config.WIIU: misc_frame = categorylistFrame(self.content_stacking_frame, self.controller, self, self.repo_parser.misc) advanced_frame = categorylistFrame(self.content_stacking_frame, self.controller, self, self.repo_parser.advanced) self.category_frames.append(misc_frame) self.category_frames.append(advanced_frame) self.frames.extend([ { "frame": advanced_frame, "text": "Advanced Homebrew" }, { "frame": misc_frame, "text": "Misc" }, ]) else: raise "Invalid Console" self.frames.extend([ { "frame": installed_frame, "text": "Installed" }, # { # "frame" : help_frame, # "text" : "HELP" # }, # { # "frame" : about_frame, # "text" : "ABOUT" # }, # { # "frame" : readme_frame, # "text" : "README", # }, { "frame": settings_frame, "text": "SETTINGS" }, { "frame": exit_frame, "text": "EXIT" } ]) self.all_frames = [] self.content_frames = {} def make_frames_and_add_to_list(frame_list, listbox): for f in frame_list: page_name = f["text"] frame = f["frame"] self.content_frames[page_name] = frame frame.place(relx=0, rely=0, relwidth=1, relheight=1) listbox.insert("end", " {}".format(page_name)) self.all_frames.append(f) threader.do_async(lambda: make_frames_and_add_to_list( self.frames, self.category_listbox)) self.category_listbox.select_set( 0) #sets focus on the first item in listbox self.category_listbox.event_generate("<<ListboxSelect>>") self.show_frame("All Apps") if self.updater.status: print(self.updater.status) self.yesnoPage = yesnoPage(self) self.yesnoPage.getanswer( "An update is available, would you like to download it?\nPatch notes:\n{}" .format(self.updater.status), self.updater.update) self.loaded() self.add_on_refresh_callback(self.update_sd_path) self.add_on_tick_callback(self.update_sd_path) self.sort_check_loop()
def trigger_install(self): threader.do_async(self.local_packages_handler.install_package, [ self.repo, self.version_index, self.progress_bar.update, self.reload_function, self.progress_bar.set_title ], priority="high")
def reload(self): threader.do_async(self.update_page, [self.package])
def show(self, repo): self.do_update_banner("assets/notfound.png") threader.do_async(self.update_page, [repo], priority="medium") self.tkraise() for child in self.winfo_children(): child.bind("<Escape>", self.leave)
def update_page(self, package): self.selected_version = None self.package = package threader.do_async(self.update_banner) version = package["version"] self.column_title.set("Title: {}".format(package["title"])) self.column_author.set("Author: {}".format(package["author"])) self.column_version.set("Latest Version: {}".format( package["version"])) try: self.column_license.set("License: {}".format(package["license"])) except: self.column_license.set("License: N/A") self.column_package.set("Package: {}".format(package["name"])) ttl_dl = 0 try: ttl_dl += package["web_dls"] except: pass try: ttl_dl += package["app_dls"] except: pass self.column_downloads.set("Downloads: {}".format(ttl_dl)) self.column_updated.set("Updated: {}".format(package["updated"])) self.content_frame_details.configure(state="normal") self.content_frame_details.delete('1.0', "end") #Makes newlines in details print correctly. Hacky but :shrug: details = package["description"].replace("\\n", """ """) self.content_frame_details.insert("1.0", details) self.content_frame_details.configure(state="disabled") self.header_label.set(package["title"]) self.header_author.set(package["author"]) #Hides or places the uninstalll button if not installed or installed respectively #get_package_entry returns none if no package is found or if the sd path is not set if self.appstore_handler.get_package_entry(package["name"]): self.column_uninstall_button.place( rely=1, relwidth=1, x=+style.offset, y=-1 * (style.buttonsize + style.offset), width=-(3 * style.offset + style.buttonsize), height=style.buttonsize) if self.column_install_button: if self.appstore_handler.clean_version( self.appstore_handler.get_package_version( package["name"]), package["title"] ) > self.appstore_handler.clean_version( package["version"], package["title"]): self.column_install_button.settext("UPDATE") else: self.column_install_button.settext("REINSTALL") else: self.column_uninstall_button.place_forget() if self.column_install_button: self.column_install_button.settext("INSTALL") tags = []
def update_page(self, repo): self.selected_version = None self.repo = repo try: package = repo["package"] except: package = repo["software"] self.package = package threader.do_async(self.update_banner) github_content = repo["github_content"] version = github_content[0]["tag_name"] self.column_title.set("Title: {}".format(repo["name"])) self.column_author.set("Author: {}".format(repo["author"])) self.column_version.set("Latest Version: {}".format( github_content[0]["tag_name"])) try: self.column_license.set("License: {}".format(repo["license"])) except: self.column_license.set("License: N/A") installed = self.local_packages_handler.get_package_version( self.repo["package"]) if installed: self.column_installed_version.set( "Downloaded: {}".format(installed)) else: self.column_installed_version.set("Not downloaded") self.column_package.set("Payload package: {}".format(package)) self.column_downloads.set("Downloads: {}".format(repo["downloads"])) self.column_updated.set("Updated: {}".format( github_content[0]["created_at"])) self.content_frame_details.configure(state="normal") self.content_frame_details.delete('1.0', "end") #Makes newlines in details print correctly. Hacky but :shrug: details = repo["description"].replace("\\n", """ """) self.content_frame_details.insert("1.0", details) self.content_frame_details.configure(state="disabled") self.header_label.set(repo["name"]) self.header_author.set(repo["author"]) if not self.column_inject_button: self.column_inject_button = button(self.column_body, callback=self.trigger_inject, text_string="INJECT", font=style.mediumboldtext, background=style.color_2) tags = [] for release in self.repo["github_content"]: tags.append(release["tag_name"]) self.update_option_menu(tags) #Hides or places the uninstalll button if not installed or installed respectively #get_package_entry returns none if no package is found or if the sd path is not set if self.local_packages_handler.get_package_entry(package): self.column_inject_button.place( rely=1, relwidth=1, x=+style.offset, y=-1 * (style.buttonsize + style.offset), width=-(3 * style.offset + style.buttonsize), height=style.buttonsize) self.column_install_button.settext("CHANGE") else: self.column_inject_button.place_forget() if self.column_install_button: self.column_install_button.settext("Download")
def reload(self): threader.do_async(self.update_page, [self.repo])
def __init__(self, app, container): basePlugin.BasePlugin.__init__(self, app, "Switch Serial Checker", container) threader.do_async(self.get_serials)
def update_page(self, package): self.package = package threader.do_async(self.update_body) threader.do_async(self.build_sidebar) threader.do_async(self.update_banner)
print("Getting updated HBUpdater repo file") packages_json = getJson("repos",repo_remote) else: print("Failed to download packages json repo file, falling back on old version") packages_json = os.path.join(sys.path[0], "cache/json/repos.json") else: if parsed_args.repo.lower() == "test": print("Using local json") packages_json = getCachedJson("repos") else: print("Using passed repo json {}".format(parsed_args.repo)) packages_json = parsed_args.repo #Parse the json into categories repo_parser.blacklist_categories(["payloads"]) threader.do_async(repo_parser.load, [packages_json], priority = "high") #Shared tool for installing and managing hbas apps via the switchbru site on the sd card def startGUI(args = None): #frameManager serves to load all pages and stack them on top of each other (all 2 of them) #also serves to make many important objects and functions easily available to children frames gui = frameManager(pagelist, args, { "width" : settings.get_setting("width"), "height" : settings.get_setting("height") } ) #Set title formatted with version