def rebuild(self): """ Rebuild the GUI on config change """ logger.debug("Redrawing GUI") session_state = self._last_session.to_dict() self._config.refresh_config() get_images().__init__() self.set_fonts() self.build_gui(rebuild=True) if session_state is not None: self._last_session.from_dict(session_state) logger.debug("GUI Redrawn")
def __init__(self, pathscript): logger.debug("Initializing %s", self.__class__.__name__) super().__init__() self.initialize_globals(pathscript) self.set_geometry() self.wrapper = ProcessWrapper(pathscript) get_images().delete_preview() self.protocol("WM_DELETE_WINDOW", self.close_app) logger.debug("Initialized %s", self.__class__.__name__)
def build_gui(self, rebuild=False): """ Build the GUI """ logger.debug("Building GUI") if not rebuild: self.tk.call('wm', 'iconphoto', self._w, get_images().icons["favicon"]) self.configure(menu=MainMenuBar(self)) if rebuild: objects = list(self.objects.keys()) for obj in objects: self.objects[obj].destroy() del self.objects[obj] self.objects["taskbar"] = TaskBar(self) self.add_containers() self.objects["command"] = CommandNotebook( self.objects["container_top"]) self.objects["display"] = DisplayNotebook( self.objects["container_top"]) self.objects["console"] = ConsoleOut(self.objects["container_bottom"], self._init_args["debug"]) self.set_initial_focus() self.set_layout() self._config.set_default_options() logger.debug("Built GUI")
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()
def __init__(self, debug): logger.debug("Initializing %s", self.__class__.__name__) super().__init__() self._init_args = dict(debug=debug) self._config = self.initialize_globals() self.set_fonts() self._config.set_geometry(1200, 640, self._config.user_config_dict["fullscreen"]) self.wrapper = ProcessWrapper() self.objects = dict() get_images().delete_preview() preview_trigger().clear() self.protocol("WM_DELETE_WINDOW", self.close_app) self.build_gui() self._last_session = LastSession(self._config) logger.debug("Initialized %s", self.__class__.__name__)
def close_app(self, *args): # pylint: disable=unused-argument """ Close Python. This is here because the graph animation function continues to run even when tkinter has gone away """ logger.debug("Close Requested") if not self._confirm_close_on_running_task(): return if not self._config.project.confirm_close(): return if self._config.tk_vars["runningtask"].get(): self.wrapper.task.terminate() self._last_session.save() get_images().delete_preview() self.quit() logger.debug("Closed GUI") sys.exit(0)
def build_gui(self, debug_console): """ Build the GUI """ logger.debug("Building GUI") self.title("Faceswap.py") self.tk.call('wm', 'iconphoto', self._w, get_images().icons["favicon"]) self.configure(menu=MainMenuBar(self)) topcontainer, bottomcontainer = self.add_containers() CommandNotebook(topcontainer) DisplayNotebook(topcontainer) ConsoleOut(bottomcontainer, debug_console) logger.debug("Built GUI")
def build_gui(self, debug_console): """ Build the GUI """ logger.debug("Building GUI") self.title("Faceswap.py") self.tk.call('wm', 'iconphoto', self._w, get_images().icons["favicon"]) self.configure(menu=MainMenuBar(self)) self.add_containers() self.objects["command"] = CommandNotebook( self.objects["containers"]["top"]) self.objects["display"] = DisplayNotebook( self.objects["containers"]["top"]) self.objects["console"] = ConsoleOut( self.objects["containers"]["bottom"], debug_console) self.set_initial_focus() self.set_layout() logger.debug("Built GUI")