                      break
          
      def save_config(self, command=None):
          ''' Save the current GUI state to a config file in json format '''
          config_file = filedialog.asksaveasfile(mode='w', filetypes=self.filetypes, defaultextension='.fsw')
          if not config_file:
              return
          if command is None:
              config = {command: {option['control_title']: option['value'].get() for option in options} for command, options in self.opts.items()}
          else:
              config = {command: {option['control_title']: option['value'].get() for option in self.opts[command]}}
 
</s> remove             config = {command: {option['control_title']: option['value'].get() for option in options} for command, options in self.opts.items()}
 </s> add             cfg = {cmd: {opt['control_title']: opt['value'].get() for opt in opts} 
                   for cmd, opts in self.opts.items()} </s> remove             config = {command: {option['control_title']: option['value'].get() for option in self.opts[command]}}
        config_file.write(self.serializer.marshal(config))
        config_file.close
 </s> add             cfg = {command: {opt['control_title']: opt['value'].get()
                   for opt in self.opts[command]}}
        cfgfile.write(self.serializer.marshal(cfg))
        cfgfile.close </s> remove         for src_option, src_value in options.items():
            for dst_options in self.opts[command]:
                if dst_options['control_title'] == src_option:
                    dst_options['value'].set(src_value)
 </s> add         for srcopt, srcval in options.items():
            for dstopts in self.opts[command]:
                if dstopts['control_title'] == srcopt:
                    dstopts['value'].set(srcval) </s> remove         config_file = filedialog.askopenfile(mode='r', filetypes=self.filetypes)
        if not config_file:
 </s> add         cfgfile = filedialog.askopenfile(mode='r', filetypes=self.filetypes)
        if not cfgfile: </s> remove         config = self.serializer.unmarshal(config_file.read())
 </s> add         cfg = self.serializer.unmarshal(cfgfile.read())
        cfgfile = filedialog.asksaveasfile( mode='w',
                                            filetypes=self.filetypes, 
                                            defaultextension='.fsw')
        if not cfgfile:
                      break
          
      def save_config(self, command=None):
          ''' Save the current GUI state to a config file in json format '''
        cfgfile = filedialog.asksaveasfile( mode='w',
                                            filetypes=self.filetypes, 
                                            defaultextension='.fsw')
        if not cfgfile:
        cfgfile = filedialog.asksaveasfile( mode='w',
                                            filetypes=self.filetypes, 
                                            defaultextension='.fsw')
        if not cfgfile:
              return
          if command is None:
              config = {command: {option['control_title']: option['value'].get() for option in options} for command, options in self.opts.items()}
          else:
              config = {command: {option['control_title']: option['value'].get() for option in self.opts[command]}}
keep keep keep keep replace replace keep keep keep keep keep
 GUI v0.1.0a (#336)

* Code clean up

* Code refactor

* bugfix: Find paths to icons when launched from outside faceswap dir

* Bugfix: Disable GUI if TkInter app not available

* BugFix: Disable GUI if $DISPLAY not detected

* Minor code ammends

* Code Refactor

* DISPLAY check fix 
scripts/gui.py