      def cm_bind(self):
          """ Bind the menu to the widget's Right Click event """
          button = "<Button-2>" if platform.system() == "Darwin" else "<Button-3>"
          logger.debug("Binding '%s' to '%s'", button, self.widget.winfo_class())
          x_offset = int(34 * get_config().scaling_factor)
          self.widget.bind(button,
                           lambda event: self.tk_popup(event.x_root + x_offset, event.y_root, 0))
  
      def select_all(self):
          """ Select all for Text or Entry widgets """
 
</s> remove 

class OptionControl():
    """ Build the correct control for the option parsed and place it on the
    frame """

    def __init__(self, title, values, option_frame):
        logger.debug("Initializing %s", self.__class__.__name__)
        self.title = title
        self.values = values
        self.option_frame = option_frame

        self.control = self.set_control()
        self.control_frame = self.set_control_frame()
        self.tk_var = self.set_tk_var()

        self.build_full_control()
        logger.debug("Initialized %s", self.__class__.__name__)

    @property
    def helptext(self):
        """ Format the help text for tooltips """
        logger.debug("Format control help: '%s'", self.title)
        helptext = self.values.get("helptext", "")
        helptext = helptext.replace("\n\t", "\n  - ").replace("%%", "%")
        helptext = self.title + " - " + helptext
        logger.debug("Formatted control help: (title: '%s', help: '%s'", self.title, helptext)
        return helptext

    def set_control(self):
        """ Set the correct control type for this option """
        dtype = self.values["type"]
        choices = self.values["choices"]
        if choices:
            control = ttk.Combobox
        elif dtype == bool:
            control = ttk.Checkbutton
        elif dtype in (int, float):
            control = ttk.Scale
        else:
            control = ttk.Entry
        logger.debug("Setting control '%s' to %s", self.title, control)
        return control

    def set_control_frame(self):
        """ Frame to hold control and it's label """
        logger.debug("Build config control frame")
        frame = ttk.Frame(self.option_frame)
        frame.pack(fill=tk.X, expand=True)
        logger.debug("Built confog control frame")
        return frame

    def set_tk_var(self):
        """ Correct variable type for control """
        logger.debug("Setting config variable type: '%s'", self.title)
        var = tk.BooleanVar if self.control == ttk.Checkbutton else tk.StringVar
        var = var(self.control_frame)
        logger.debug("Set config variable type: ('%s': %s", self.title, type(var))
        return var

    def build_full_control(self):
        """ Build the correct control type for the option passed through """
        logger.debug("Build confog option control")
        self.build_control_label()
        self.build_one_control()
        self.values["selected"] = self.tk_var
        logger.debug("Built option control")

    def build_control_label(self):
        """ Label for control """
        logger.debug("Build config control label: '%s'", self.title)
        title = self.title.replace("_", " ").title()
        lbl = ttk.Label(self.control_frame, text=title, width=20, anchor=tk.W)
        lbl.pack(padx=5, pady=5, side=tk.LEFT, anchor=tk.N)
        logger.debug("Built config control label: '%s'", self.title)

    def build_one_control(self):
        """ Build and place the option controls """
        logger.debug("Build control: (title: '%s', values: %s)", self.title, self.values)
        self.tk_var.set(self.values["value"])

        if self.control == ttk.Scale:
            self.slider_control()
        else:
            self.control_to_optionsframe()
        logger.debug("Built control: '%s'", self.title)

    def slider_control(self):
        """ A slider control with corresponding Entry box """
        logger.debug("Add slider control to Config Options Frame: %s", self.control)
        d_type = self.values["type"]
        rnd = self.values["rounding"]
        min_max = self.values["min_max"]

        tbox = ttk.Entry(self.control_frame, width=8, textvariable=self.tk_var, justify=tk.RIGHT)
        tbox.pack(padx=(0, 5), side=tk.RIGHT)
        ctl = self.control(
            self.control_frame,
            variable=self.tk_var,
            command=lambda val, var=self.tk_var, dt=d_type, rn=rnd, mm=min_max:
            set_slider_rounding(val, var, dt, rn, mm))
        ctl.pack(padx=5, pady=5, fill=tk.X, expand=True)
        rc_menu = ContextMenu(ctl)
        rc_menu.cm_bind()
        ctl["from_"] = min_max[0]
        ctl["to"] = min_max[1]

        Tooltip(ctl, text=self.helptext, wraplength=720)
        Tooltip(tbox, text=self.helptext, wraplength=720)
        logger.debug("Added slider control to Options Frame: %s", self.control)

    def control_to_optionsframe(self):
        """ Standard non-check buttons sit in the main options frame """
        logger.debug("Add control to Options Frame: %s", self.control)
        choices = self.values["choices"]
        if self.control == ttk.Checkbutton:
            ctl = self.control(self.control_frame, variable=self.tk_var, text=None)
        else:
            ctl = self.control(self.control_frame, textvariable=self.tk_var)
        ctl.pack(padx=5, pady=5, fill=tk.X, expand=True)
        rc_menu = ContextMenu(ctl)
        rc_menu.cm_bind()
        if choices:
            logger.debug("Adding combo choices: %s", choices)
            ctl["values"] = [choice for choice in choices]
        Tooltip(ctl, text=self.helptext, wraplength=720)
        logger.debug("Added control to Options Frame: %s", self.control)
 </s> add  </s> remove     def _import(attr, name):
 </s> add     def _import(attr, name, disable_logging):
 </s> remove         if self.args.trainer:
 </s> add         if hasattr(self.args, "trainer") and self.args.trainer:
        scaling_factor = get_config().scaling_factor if get_config() is not None else 1.0
        x_offset = int(34 * scaling_factor)
      def cm_bind(self):
          """ Bind the menu to the widget's Right Click event """
          button = "<Button-2>" if platform.system() == "Darwin" else "<Button-3>"
          logger.debug("Binding '%s' to '%s'", button, self.widget.winfo_class())
        scaling_factor = get_config().scaling_factor if get_config() is not None else 1.0
        x_offset = int(34 * scaling_factor)
          self.widget.bind(button,
                           lambda event: self.tk_popup(event.x_root + x_offset, event.y_root, 0))
  
      def select_all(self):
          """ Select all for Text or Entry widgets """
keep keep keep keep replace keep keep keep keep keep
 Convert settings tool (#737)

* Initial prediction pipeline and display

* Patch faces from convert pipeline. Load configs

* Add tkinter canvas for image display

* Radio buttons to config gui. Standardise config gui. Remove dssim loss from realface

* Add action frame

* Live update cli options

* Live update config changes

* Quicker frame loading. Refresh faces button callback

* remove debug code

* Add saving and reloading config buttons

* Reduce lag with threading

* Busy indicator + geometry updates

* Fix options canvas resizing

* Add global config saving and resetting

* tools to own tab

* Rename tool to 'preview'

* geometry tweak

* pep8 fixes 
lib/gui/utils.py