class_docstr: The DataTypeController manages a DataType setting
class_docstr_tok: ["The","DataTypeController","manages","a","DataType","setting"]
docstr: Change the UI state to match that of the DataTypes setting
docstr_tok: ["Change","the","UI","state","to","match","that","of","the","DataTypes","setting"]
code: def update(self):
      """Change the UI state to match that of the DataTypes setting"""
      d = self.v.get_data_types()
      needs_bind = []
      sizer = self.panel.Sizer
      assert isinstance(sizer, wx.lib.rcsizer.RowColSizer)
      for child in self.panel.GetChildren():
          sizer.Hide(child)
  
      label_header_name = self.get_label_control_name(0)
      choice_header_name = self.get_choice_control_name(0)
      for header_name, column, text in (
          (label_header_name, 0, "Key"),
          (choice_header_name, 1, "Data type"),
      ):
          ctrl = self.panel.FindWindowByName(header_name)
          if ctrl is None:
              ctrl = wx.StaticText(
                  self.panel, label=text, name=header_name
              )
              ctrl.Font = wx.Font(
                  ctrl.Font.GetPointSize(),
                  ctrl.Font.GetFamily(),
                  ctrl.Font.GetStyle(),
                  wx.FONTWEIGHT_BOLD,
                  False,
                  ctrl.Font.GetFaceName(),
              )
              sizer.Add(
                  ctrl,
                  flag=wx.ALIGN_CENTER_HORIZONTAL
                  | wx.ALIGN_CENTER_VERTICAL
                  | wx.BOTTOM,
                  border=1,
                  row=0,
                  col=column,
              )
          else:
              sizer.Show(ctrl)
      for i, feature in enumerate(sorted(d.keys())):
          label_name = self.get_label_control_name(i + 1)
          choice_name = self.get_choice_control_name(i + 1)
          label = self.panel.FindWindowByName(label_name)
          if label is None:
              label = wx.StaticText(
                  self.panel, label=feature, name=label_name
              )
              sizer.Add(
                  label,
                  flag=wx.ALIGN_LEFT | wx.BOTTOM | wx.LEFT | wx.RIGHT,
                  border=3,
                  row=i + 1,
                  col=0,
              )
          else:
              sizer.Show(label)
              if label.Label != feature:
                  label.Label = feature
          choice = self.panel.FindWindowByName(choice_name)
          if choice is None:
              choice = wx.Choice(
                  self.panel,
                  choices=[
                      self.DTC_TEXT,
                      self.DTC_INTEGER,
                      self.DTC_FLOAT,
                      self.DTC_NONE,
                  ],
                  name=choice_name,
              )
              sizer.Add(
                  choice,
                  flag=wx.EXPAND | wx.BOTTOM | wx.RIGHT,
                  border=3,
                  row=i + 1,
                  col=1,
              )
              needs_bind.append(choice)
          else:
              sizer.Show(choice)
          value = self.DT_TO_DTC.get(d[feature], self.DTC_TEXT)
          if choice.GetStringSelection() != value:
              choice.SetStringSelection(value)
      self.n_items = len(list(d.keys()))
      for choice in needs_bind:
          choice.Bind(wx.EVT_CHOICE, self.on_choice_changed)
  
file_path: CellProfiler/src/frontend/cellprofiler/gui/module_view/_data_type_controller.py
imports: import wx
  import wx.lib.rcsizer
  from cellprofiler_core.setting import DataTypes
  from ._module_view import ModuleView
  from ..utilities.module_view import edit_control_name
label_desc: Use image node_id 5 for calling the DataTypeController obj's underlying member method code with example usage: obj.update() without return types