  
  
  def get_tooltip(widget, text, wraplength=600):
      """ Store the tooltip layout and widget id in _TOOLTIPS and return a tooltip """
      _TOOLTIPS[str(widget)] = {"text": text,
                                "wraplength": wraplength}
      logger.debug("Adding to tooltips dict: (widget: %s. text: '%s', wraplength: %s)",
                   widget, text, wraplength)
      return Tooltip(widget, text=text, wraplength=wraplength)
  
  
 
</s> remove # We store Tooltips globally when they are created
# Because we need to add them back to newly cloned widgets
_TOOLTIPS = dict()

# We store commands globally when they are created
# Because we need to add them back to newly cloned widgets
_COMMANDS = dict()
 </s> add # We store Tooltips, ContextMenus and Commands globally when they are created
# Because we need to add them back to newly cloned widgets (they are not easily accessible from
# original config or are prone to getting destroyed when the original widget is destroyed)
_RECREATE_OBJECTS = dict(tooltips=dict(), commands=dict(), contextmenus=dict()) </s> remove         logger.debug("Add control to Options Frame: (title: '%s', control: %s, choices: %s)",
                     self.title, self.control, choices)
        if self.control == ttk.Checkbutton:
            ctl = self.control(self.frame, variable=self.tk_var, text=None)
 </s> add         logger.debug("Add control to Options Frame: (widget: '%s', control: %s, choices: %s)",
                     self.option.name, self.option.control, self.option.choices)
        if self.option.control == ttk.Checkbutton:
            ctl = self.option.control(self.frame, variable=self.option.tk_var, text=None) </s> remove         logger.debug("Add slider control to Options Frame: (title: '%s', dtype: %s, rounding: %s, "
                     "min_max: %s)", self.title, dtype, rounding, min_max)
 </s> add         logger.debug("Add slider control to Options Frame: (widget: '%s', dtype: %s, "
                     "rounding: %s, min_max: %s)", self.option.name, self.option.dtype,
                     self.option.rounding, self.option.min_max) </s> remove     def format_helptext(self, helptext):
        """ Format the help text for tooltips """
        if helptext is None:
            return helptext
        logger.debug("Format control help: '%s'", self.title)
        if helptext.startswith("R|"):
            helptext = helptext[2:].replace("\nL|", "\n - ").replace("\n", "\n\n")
        else:
            helptext = helptext.replace("\n\t", "\n - ").replace("%%", "%")
        helptext = ". ".join(i.capitalize() for i in helptext.split(". "))
        helptext = self.title + " - " + helptext
        logger.debug("Formatted control help: (title: '%s', help: '%s'", self.title, helptext)
        return helptext

    def set_control(self, dtype, choices, is_radio):
        """ Set the correct control type based on the datatype or for this option """
        if choices and is_radio:
            control = ttk.Radiobutton
        elif 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_tk_var(self, dtype, selected_value, blank_nones):
 </s> add     def set_tk_var(self, blank_nones):
    _RECREATE_OBJECTS["tooltips"][str(widget)] = {"text": text,
                                                  "wraplength": wraplength}
  
  
  def get_tooltip(widget, text, wraplength=600):
      """ Store the tooltip layout and widget id in _TOOLTIPS and return a tooltip """
    _RECREATE_OBJECTS["tooltips"][str(widget)] = {"text": text,
                                                  "wraplength": wraplength}
    _RECREATE_OBJECTS["tooltips"][str(widget)] = {"text": text,
                                                  "wraplength": wraplength}
      logger.debug("Adding to tooltips dict: (widget: %s. text: '%s', wraplength: %s)",
                   widget, text, wraplength)
      return Tooltip(widget, text=text, wraplength=wraplength)
  
  
keep keep keep keep replace replace keep keep keep keep keep
 GUI Fixups

- GUI Bugfix: Startup options - fix min/max thresholds
- GUI Bugfix: Make console read-only
- GUI Bugfix: Rightclick menu for recreated widgets
- Enhancement: Create ControlPanelOptions Class + migrate options 
lib/gui/control_helper.py