# `TaurusInputPanel`

digraph inheritancebd0dacda39 { bgcolor=transparent; rankdir=UD; ratio=compress; size="8.0, 12.0"; "QObject" [color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,tooltip="QObject(parent: QObject|None = None)"]; "wrapper" -> "QObject" [arrowsize=0.5,style="setlinewidth(0.5)"]; "QPaintDevice" [color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,tooltip="QPaintDevice()"]; "simplewrapper" -> "QPaintDevice" [arrowsize=0.5,style="setlinewidth(0.5)"]; "QWidget" [color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,tooltip="QWidget(parent: QWidget|None = None, flags: Qt.WindowFlags|Qt.WindowType = Qt.WindowFlags())"]; "QObject" -> "QWidget" [arrowsize=0.5,style="setlinewidth(0.5)"]; "QPaintDevice" -> "QWidget" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TaurusInputPanel" [URL="#taurus.qt.qtgui.panel.TaurusInputPanel",color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,target="_top",tooltip="A panel design to get an input from the user."]; "QWidget" -> "TaurusInputPanel" [arrowsize=0.5,style="setlinewidth(0.5)"]; "simplewrapper" [color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded]; "wrapper" [color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded]; "simplewrapper" -> "wrapper" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

class TaurusInputPanel(input_data, parent=None)

  A panel design to get an input from the user.

  The input_data is a dictionary which contains information on how to build the input dialog. It must contains the following keys:

  > - prompt <str>: message to be displayed

  The following are optional keys (and their corresponding default values):

  > - title <str> (doesn’t have default value)

  > - key <str> (doesn’t have default value): a label to be presented left to the input box represeting the label

  > - unit <str> (doesn’t have default value): a label to be presented right to the input box representing the units

  > - data_type <str or sequence> (‘String’): type of data to be requested. Standard accepted data types are ‘String’, ‘Integer’, ‘Float’, ‘Boolean’, ‘Text’. A list of elements will be interpreted as a selection. Default TaurusInputPanel class will interpret any custom data types as ‘String’ and will display input widget accordingly. Custom data types can be handled differently by supplying a different input_panel_klass.

  > - minimum <int/float>: minimum value (makes sense when data_type is ‘Integer’ or ‘Float’)

  > - maximum <int/float>: maximum value (makes sense when data_type is ‘Integer’ or ‘Float’)

  > - step <int/float> (1): step size value (makes sense when data_type is ‘Integer’ or ‘Float’)

  > - decimals <int> (1): number of decimal places to show (makes sense when data_type is ‘Float’)

  > - default_value <obj> (doesn’t have default value): default value

  > - allow_multiple <bool> (False): allow more than one value to be selected (makes sense when data_type is a sequence of possibilities)

  Example:

      app = Qt.QApplication([])

      class Listener(object):
          def on_accept(self):
              print("user selected", self.panel.value())

      d = dict(
          prompt="What's your favourite car brand?",
          data_type=["Mazda", "Skoda", "Citroen", "Mercedes", "Audi"],
          default_value="Mercedes"
      )
      w = TaurusInputPanel(d)
      l = Listener()
      l.panel = w
      w.connect(w.buttonBox(), Qt.SIGNAL("accepted()"), l.on_accept)
      w.show()
      app.exec_()

  Import from `taurus.qt.qtgui.panel` as:

      from taurus.qt.qtgui.panel import TaurusInputPanel

  addButton(button, role=3)

    Adds the given button with the given to the button box

    Parameters:

      - button (PyQt5.Qt.QPushButton) – the button to be added

      - role (PyQt5.Qt.QDialogButtonBox.ButtonRole) – button role

  buttonBox()

    Returns the button box from this panel

    Returns:

      the button box from this panel

    Return type:

      PyQt5.Qt.QDialogButtonBox

  create_boolean_panel(input_data)
  create_custom_panel(input_data)
  create_float_panel(input_data)
  create_integer_panel(input_data)
  create_selection_panel(input_data)
  create_single_input_panel(input_data)
  create_string_panel(input_data)
  create_text_panel(input_data)
  fill_main_panel(panel, input_data)
  getText()

    Returns the current text of this panel

    Returns:

      the text for this panel

    Return type:

      str

  inputPanel()
  loadUi(filename=None, path=None)
  setIconPixmap(pixmap)

    Sets the icon to the dialog

    Parameters:

      pixmap (PyQt5.Qt.QPixmap) – the icon pixmap

  setInputFocus()
  setText(text)

    Sets the text of this panel

    Parameters:

      text (str) – the new text