class_docstr: Display a dialog for configuring readers
  
  The dialog handles fetching current defaults and setting the
  defaults when the user hits OK.
class_docstr_tok: ["Display","a","dialog","for","configuring","readers","The","dialog","handles","fetching","current","defaults","and","setting","the","defaults","when","the","user","hits","OK","."]
code: def display_functional_reader(self, reader_class):
      self.reset_control_frame()
      reader_name = reader_class.reader_name
      reader_description = reader_class.__doc__
      nm = wx.StaticText(self.control_panel, label=reader_name)
  
      nm.SetFont(self.header_font)
      self.control_sizer.Add(nm, 0, wx.ALIGN_CENTER_HORIZONTAL)
      self.control_sizer.AddSpacer(10)
      text_chunk = AutoWrapStaticText(
          self.control_panel, label=reader_description
      )
      self.control_sizer.Add(text_chunk, 0, wx.EXPAND)
      self.control_sizer.AddSpacer(5)
      enabled_checkbox = wx.CheckBox(
          self.control_panel, label="Enabled:", style=wx.ALIGN_RIGHT
      )
      enabled_checkbox.SetFont(self.header_font)
      enabled_key = f"Reader.{reader_name}.enabled"
      is_enabled = self.fetch_preference(enabled_key, bool)
      if is_enabled or is_enabled is None:
          is_enabled = True
      else:
          is_enabled = False
      enabled_checkbox.SetValue(is_enabled)
  
      def toggle_callback(event):
          enabled = enabled_checkbox.GetValue()
          self.changed_settings[enabled_key] = enabled
          if enabled:
              self.active_readers.Insert(reader_name, 0)
              self.active_readers.SetSelection(0)
              self.active_readers.SetFocus()
              tgt = self.inactive_readers.FindString(reader_name)
              self.inactive_readers.Delete(tgt)
              self.inactive_readers.SetSelection(-1)
          else:
              self.inactive_readers.Insert(reader_name, 0)
              self.inactive_readers.SetSelection(0)
              self.inactive_readers.SetFocus()
              tgt = self.active_readers.FindString(reader_name)
              self.active_readers.Delete(tgt)
              self.active_readers.SetSelection(-1)
  
      self.Bind(wx.EVT_CHECKBOX, toggle_callback, enabled_checkbox)
      self.control_sizer.Add(enabled_checkbox)
  
      self.control_sizer.AddSpacer(5)
      ver = wx.StaticText(self.control_panel)
      ver.SetLabelMarkup(
          f"<b>Version:</b> {reader_class.variable_revision_number}"
      )
      self.control_sizer.Add(ver)
  
      self.control_sizer.AddSpacer(5)
      ext_desc = f"<b>Supported extensions:</b> {', '.join(reader_class.supported_filetypes)}"
      ext_desc = textwrap.fill(
          ext_desc, self.control_sizer.GetSize().GetWidth() // 6
      )
      ext_st = wx.StaticText(self.control_panel, label="")
      ext_st.SetLabelMarkup(ext_desc)
      self.control_sizer.Add(ext_st, 0, wx.EXPAND | wx.TE_RICH)
  
      self.control_sizer.AddSpacer(5)
      scheme_desc = f"<b>Supported schemes:</b> {', '.join(reader_class.supported_schemes)}"
      scheme_desc = textwrap.fill(
          scheme_desc, self.control_sizer.GetSize().GetWidth() // 6
      )
      scheme_st = wx.StaticText(self.control_panel, label="")
      scheme_st.SetLabelMarkup(scheme_desc)
      self.control_sizer.Add(scheme_st, 0, wx.EXPAND | wx.TE_RICH)
  
      settings = reader_class.get_settings()
      if settings:
          self.control_sizer.AddSpacer(5)
          settings_head = wx.StaticText(
              self.control_panel, label="Settings:"
          )
          settings_head.SetFont(self.header_font)
          self.control_sizer.Add(settings_head)
          for key, name, desc, setting_type, default in settings:
              ident = wx.NewId()
              self.control_sizer.AddSpacer(5)
              setting_sizer = wx.BoxSizer(orient=wx.HORIZONTAL)
              self.control_sizer.Add(
                  setting_sizer, flag=wx.EXPAND, border=5
              )
              setting_sizer.AddSpacer(10)
              setting_sizer.Add(
                  wx.StaticText(self.control_panel, label=f"{name}:  ")
              )
              widget_key = f"Reader.{reader_name}.{key}"
              current_value = self.fetch_preference(
                  widget_key, setting_type
              )
              if current_value is None:
                  current_value = default
  
              if setting_type == bool:
                  widget = wx.CheckBox(self.control_panel, id=ident)
                  widget.SetValue(bool(current_value))
  
                  def callback(
                      event, obj=widget, config_key=widget_key
                  ):
                      self.changed_settings[config_key] = obj.GetValue()
  
                  self.Bind(wx.EVT_CHECKBOX, callback, widget, id=ident)
              elif setting_type == int:
                  widget = wx.SpinCtrl(
                      self.control_panel,
                      min=-65536,
                      max=65536,
                      id=ident,
                  )
                  widget.SetValue(int(current_value))
  
                  def callback(
                      event, obj=widget, config_key=widget_key
                  ):
                      self.changed_settings[config_key] = obj.GetValue()
  
                  self.Bind(wx.EVT_SPINCTRL, callback, widget, id=ident)
              elif setting_type == float:
                  widget = wx.SpinCtrlDouble(
                      self.control_panel,
                      id=ident,
                      min=-65536,
                      max=65536,
                  )
                  widget.SetValue(float(current_value))
  
                  def callback(
                      event, obj=widget, config_key=widget_key
                  ):
                      self.changed_settings[config_key] = obj.GetValue()
  
                  self.Bind(
                      wx.EVT_SPINCTRLDOUBLE, callback, widget, id=ident
                  )
              else:
                  widget = wx.TextCtrl(
                      self.control_panel, value=current_value, id=ident
                  )
  
                  def callback(
                      event, obj=widget, config_key=widget_key
                  ):
                      self.changed_settings[config_key] = obj.GetValue()
  
                  self.Bind(wx.EVT_TEXT, callback, widget, id=ident)
              widget.Refresh()
              setting_sizer.Add(widget, proportion=1)
  
              help_button = wx.Button(
                  self.control_panel, -1, "?", (0, 0), (30, -1)
              )
  
              def on_help(event, help_text=desc):
                  dlg = HTMLDialog(
                      self,
                      "Preferences help",
                      rst_to_html_fragment(help_text),
                  )
                  dlg.Show()
  
              setting_sizer.AddStretchSpacer()
              setting_sizer.Add(help_button)
              self.Bind(wx.EVT_BUTTON, on_help, help_button)
  
      self.control_sizer.Layout()
  
file_path: CellProfiler/src/frontend/cellprofiler/gui/readers_dialog/_readers_dialog.py
imports: import logging
  import textwrap
  import wx
  import wx.lib.scrolledpanel
  from wx.lib.agw.infobar import AutoWrapStaticText
  from cellprofiler_core.preferences import config_write_typed, config_read_typed
  from cellprofiler_core.reader import activate_readers
  from cellprofiler_core.constants.reader import ALL_READERS, BAD_READERS, AVAILABLE_READERS
  from ..html.utils import rst_to_html_fragment
  from ..htmldialog import HTMLDialog
label_desc: Use image node_id 4 for calling the ReadersDialog obj's underlying member method code with example usage: obj.display_functional_reader(reader_class) without return types