          menubar.add_cascade(label="File", menu=filemenu)
          self.gui.config(menu=menubar)
  
      def load_config(self, command=None):
          ''' Load a saved config file '''
          cfgfile = filedialog.askopenfile(mode='r', filetypes=self.filetypes)
          if not cfgfile:
              return
          cfg = self.serializer.unmarshal(cfgfile.read())
          if command is None:
 
</s> remove         ''' Save the current GUI state to a config file in json format '''
        cfgfile = filedialog.asksaveasfile( mode='w',
                                            filetypes=self.filetypes, 
                                            defaultextension='.fsw')
 </s> add         """ Save the current GUI state to a config file in json format """
        cfgfile = filedialog.asksaveasfile(mode='w',
                                           filetypes=self.filetypes,
                                           defaultextension='.fsw') </s> remove # All pages stuff
    def menu(self):
        ''' Menu bar for loading and saving configs '''
        menubar = tk.Menu(self.gui)
        filemenu = tk.Menu(menubar, tearoff=0)
        filemenu.add_command(label='Load full config...', command=self.load_config)
        filemenu.add_command(label='Save full config...', command=self.save_config)
        filemenu.add_separator()
        filemenu.add_command(label='Reset all to default', command=self.reset_config)
        filemenu.add_command(label='Clear all', command=self.clear_config)
        filemenu.add_separator()
        filemenu.add_command(label='Quit', command=self.gui.quit)
        menubar.add_cascade(label="File", menu=filemenu)
        self.gui.config(menu=menubar)
 </s> add         self.lossdict = dict()

    def init_tk(self):
        """ TK System must be on prior to setting tk variables,
        so initialised from GUI """
        pathicons = os.path.join(PATHSCRIPT, 'icons')
        self.icons['folder'] = tk.PhotoImage(
            file=os.path.join(pathicons, 'open_folder.png'))
        self.icons['load'] = tk.PhotoImage(
            file=os.path.join(pathicons, 'open_file.png'))
        self.icons['save'] = tk.PhotoImage(
            file=os.path.join(pathicons, 'save.png'))
        self.icons['reset'] = tk.PhotoImage(
            file=os.path.join(pathicons, 'reset.png'))
        self.icons['clear'] = tk.PhotoImage(
            file=os.path.join(pathicons, 'clear.png'))

        self.guitext['help'] = tk.StringVar()
        self.guitext['status'] = tk.StringVar()

    def action_command(self, command):
        """ The action to perform when the action button is pressed """
        if self.runningtask:
            self.action_terminate()
        else:
            self.action_execute(command)

    def action_execute(self, command):
        """ Execute the task in Faceswap.py """
        self.clear_console()
        self.task.prepare(self.opts, command)
        self.task.execute_script()

    def action_terminate(self):
        """ Terminate the subprocess Faceswap.py task """
        self.task.terminate()
        self.runningtask = False
        self.clear_display_panel()
        self.change_action_button()

    def clear_display_panel(self):
        ''' Clear the preview window and graph '''
        self.delete_preview()
        self.lossdict = dict()

    def change_action_button(self):
        """ Change the action button to relevant control """
        for cmd in self.actionbtns.keys():
            btnact = self.actionbtns[cmd]
            if self.runningtask:
                ttl = 'Terminate'
                hlp = 'Exit the running process'
            else:
                ttl = cmd.title()
                hlp = 'Run the {} script'.format(cmd.title())
            btnact.config(text=ttl)
            Tooltip(btnact, text=hlp, wraplength=200)

    def clear_console(self):
        """ Clear the console output screen """
        self.console.delete(1.0, tk.END) </s> remove         cfgfile.close
 </s> add         cfgfile.close() </s> remove             opts = cfg[command]
            self.set_command_args(command, opts)
                
 </s> add             opts = cfg.get(command, None)
            if opts:
                self.set_command_args(command, opts)
            else:
                self.clear_console()
                print('No ' + command + ' section found in file')
 </s> remove         ''' Pass the saved config items back to the GUI '''
 </s> add         """ Pass the saved config items back to the GUI """
        """ Load a saved config file """
          menubar.add_cascade(label="File", menu=filemenu)
          self.gui.config(menu=menubar)
  
      def load_config(self, command=None):
        """ Load a saved config file """
          cfgfile = filedialog.askopenfile(mode='r', filetypes=self.filetypes)
          if not cfgfile:
              return
          cfg = self.serializer.unmarshal(cfgfile.read())
          if command is None:
keep keep keep keep replace keep keep keep keep keep
 GUI v0.2.1b (#352)

* Code refactor

* Console Added

* Add graphing with matplotlib

* Add GUI preview support

* Improve import handling.

* Add GUI integration for tools.py (Launch tools.py with the gui command)

* Reformat to conform to PEP8.

* Add Tooltips, 

* Make panels user adjustable

* Fix convert.py Sharpen default value 
scripts/gui.py