This package contains a collection of taurus Qt widgets representing various panels like forms or panels to be inserted in dialogs




get_input(input_data, parent=None, input_panel_klass=None)[source]

Static convenience function to get an input from the user using a dialog. The dialog will be modal.

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> (-sys.maxint): minimum value (makes sence when data_type is ‘Integer’ or ‘Float’)

  • maximum <int/float> (sys.maxint): maximum value (makes sence when data_type is ‘Integer’ or ‘Float’)

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

  • decimals <int> (1): number of decimal places to show (makes sence 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 sence when data_type is a sequence of possibilities)

  • input_data (dict) – a dictionary with information on how to build the input dialog

  • parent (PyQt4.QtGui.QWidget) – parent widget

  • input_panel_klass (TaurusInputPanel) – python class to be used as input panel [default: TaurusInputPanel]


a tuple containing value selected and boolean which is true if user accepted the dialog (pressed Ok) or false otherwise

Return type

tuple< obj, bool >


d1 = dict(prompt="What's your name?", data_type="String")
d2 = dict(prompt="What's your age?", data_type="Integer",
          default_value=4, maximum=100, key="Age", unit="years")
d3 = dict(prompt="What's your favourite number?", data_type="Float",
          default_value=0.1, maximum=88.8, key="Number")
d4 = dict(prompt="What's your favourite car brand?",
          data_type=["Mazda", "Skoda", "Citroen", "Mercedes", "Audi", "Ferrari"],
d5 = dict(prompt="Select some car brands", allow_multiple=True,
          data_type=["Mazda", "Skoda", "Citroen", "Mercedes", "Audi", "Ferrari"],
          default_value=["Mercedes", "Citroen"])
d6 = dict(prompt="What's your favourite color?", key="Color",
          data_type=["blue", "red", "green"], default_value="red")
d7 = dict(prompt="Do you like bears?",
          data_type='Boolean', key="Yes/No", default_value=True)
d8 = dict(prompt="Please write your memo",
          data_type='Text', key="Memo", default_value="By default a memo is a long thing")
for d in [d1, d2, d3, d4, d5, d6, d7, d8]:
    get_input(input_data=d, title=d['prompt'])

The idea of this function is to be used as a decorator on any method you which to protect against exceptions. The handle of the exception is to display a TaurusMessageBox with the exception information. Example:

def turnBeamOn(device_name):
    d = taurus.Device(device_name)