def set_fonts(): """ Set global default font """ tk.font.nametofont("TkFixedFont").configure( size=get_config().default_font[1]) for font in ("TkDefaultFont", "TkHeadingFont", "TkMenuFont"): tk.font.nametofont(font).configure( family=get_config().default_font[0], size=get_config().default_font[1])
def set_geometry(self): """ Set GUI geometry """ scaling_factor = get_config().scaling_factor self.tk.call("tk", "scaling", scaling_factor) width = int(1200 * scaling_factor) height = int(640 * scaling_factor) logger.debug("Geometry: %sx%s", width, height) self.geometry("{}x{}+80+80".format(str(width), str(height)))
def set_layout(self): """ Set initial layout """ self.update_idletasks() root = get_config().root config = get_config().user_config_dict r_width = root.winfo_width() r_height = root.winfo_height() w_ratio = config["options_panel_width"] / 100.0 h_ratio = 1 - (config["console_panel_height"] / 100.0) width = round(r_width * w_ratio) height = round(r_height * h_ratio) logger.debug( "Setting Initial Layout: (root_width: %s, root_height: %s, width_ratio: %s, " "height_ratio: %s, width: %s, height: %s", r_width, r_height, w_ratio, h_ratio, width, height) self.objects["containers"]["top"].sash_place(0, width, 1) self.objects["containers"]["main"].sash_place(0, 1, height) self.update_idletasks()
def set_geometry(self): """ Set GUI geometry """ fullscreen = get_config().user_config_dict["fullscreen"] scaling_factor = get_config().scaling_factor if fullscreen: initial_dimensions = (self.winfo_screenwidth(), self.winfo_screenheight()) else: initial_dimensions = (round(1200 * scaling_factor), round(640 * scaling_factor)) if fullscreen and sys.platform == "win32": self.state('zoomed') elif fullscreen: self.attributes('-zoomed', True) else: self.geometry("{}x{}+80+80".format(str(initial_dimensions[0]), str(initial_dimensions[1]))) logger.debug("Geometry: %sx%s", *initial_dimensions)
def set_initial_focus(): """ Set the tab focus from settings """ config = get_config() tab = config.user_config_dict["tab"] logger.debug("Setting focus for tab: %s", tab) tabs = config.command_tabs if tab in tabs: config.command_notebook.select(tabs[tab]) else: tool_tabs = config.tools_command_tabs if tab in tool_tabs: config.command_notebook.select(tabs["tools"]) config.command_notebook.tools_notebook.select(tool_tabs[tab]) logger.debug("Focus set to: %s", tab)
def close_app(self): """ Close Python. This is here because the graph animation function continues to run even when tkinter has gone away """ logger.debug("Close Requested") confirm = messagebox.askokcancel confirmtxt = "Processes are still running. Are you sure...?" tk_vars = get_config().tk_vars if (tk_vars["runningtask"].get() and not confirm("Close", confirmtxt)): logger.debug("Close Cancelled") return if tk_vars["runningtask"].get(): self.wrapper.task.terminate() get_images().delete_preview() self.quit() logger.debug("Closed GUI") exit()