# `TaurusForm`

digraph inheritance65282dc55b { bgcolor=transparent; rankdir=UD; ratio=compress; size="8.0, 12.0"; "BaseConfigurableClass" [URL="taurus.qt.qtcore.configuration-BaseConfigurableClass.html#taurus.qt.qtcore.configuration.BaseConfigurableClass",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 base class defining the API for configurable objects."]; "Logger" [URL="taurus-Logger.html#taurus.Logger",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="The taurus logger class. All taurus pertinent classes should inherit"]; "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)"]; "TaurusBaseComponent" [URL="taurus.qt.qtgui.base-TaurusBaseComponent.html#taurus.qt.qtgui.base.TaurusBaseComponent",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 generic Taurus component."]; "TaurusListener" -> "TaurusBaseComponent" [arrowsize=0.5,style="setlinewidth(0.5)"]; "BaseConfigurableClass" -> "TaurusBaseComponent" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TaurusBaseContainer" [URL="taurus.qt.qtgui.container-TaurusBaseContainer.html#taurus.qt.qtgui.container.TaurusBaseContainer",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="Base class for the Taurus container widgets. This type of taurus"]; "TaurusBaseWidget" -> "TaurusBaseContainer" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TaurusBaseWidget" [URL="taurus.qt.qtgui.base-TaurusBaseWidget.html#taurus.qt.qtgui.base.TaurusBaseWidget",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="The base class for all Qt Taurus widgets."]; "TaurusBaseComponent" -> "TaurusBaseWidget" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TaurusForm" [URL="#taurus.qt.qtgui.panel.TaurusForm",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 form containing specific widgets for interacting with"]; "TaurusWidget" -> "TaurusForm" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TaurusListener" [URL="taurus.core.tauruslistener-TaurusListener.html#taurus.core.tauruslistener.TaurusListener",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="TaurusListener Interface"]; "Logger" -> "TaurusListener" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TaurusWidget" [URL="taurus.qt.qtgui.container-TaurusWidget.html#taurus.qt.qtgui.container.TaurusWidget",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="This is a Qt.QWidget that additionally accepts a model property. This"]; "QWidget" -> "TaurusWidget" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TaurusBaseContainer" -> "TaurusWidget" [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 TaurusForm(parent=None, formWidget=None, buttons=None, withButtons=True, designMode=False)

  A form containing specific widgets for interacting with a given list of taurus attributes and/or devices.

  Its model is a list of attribute and/or device names to be shown. Each item is represented in a row consisting of a label, a read widget, a write widget, a units widget and an “extra” widget (some of them may not be shown) which are vertically aligned with their counterparts from other items.

  By default a `TaurusValue` object is used for each item, but this can be changed and customizations can be provided by enabling/disabling item factories with `setItemFactories()`.

  Item objects can be accessed by index using a list-like notation:

      form = TaurusForm()
      form.model = ['sys/tg_test/1/'+a for a in ('short_image','float_scalar')]
      form[0].labelConfig = 'dev_alias'
      form[-1].writeWidgetClass = 'TaurusWheelEdit'
      print(len(form))
      # --> outputs '2' (the length of the form is the number of items)

  By default, the form provides global Apply and Cancel buttons.

  You can also see some code that exemplifies the use of TaurusForm in Taurus coding examples

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

      from taurus.qt.qtgui.panel import TaurusForm

  addModels(modelNames)

    Adds models to the existing ones:

    Parameters:

      modelNames (sequence<str>) – the names of the models to be added

    See also

    `removeModels()`

  apply()
  chooseAttrs()
  chooseModels()

    launches a model chooser dialog to modify the contents of the form

  compact
    pyqtProperty(type, fget=None, fset=None, freset=None, fdel=None, doc=None,

      designable=True, scriptable=True, stored=True, user=False, constant=False, final=False, notify=None, revision=0) -> property attribute

    type is the type of the property. It is either a type object or a string that is the name of a C++ type. freset is a function for resetting an attribute to its default value. designable sets the DESIGNABLE flag (the default is True for writable properties and False otherwise). scriptable sets the SCRIPTABLE flag. stored sets the STORED flag. user sets the USER flag. constant sets the CONSTANT flag. final sets the FINAL flag. notify is the NOTIFY signal. revision is the REVISION. The other parameters are the same as those required by the standard Python property type. Properties defined using pyqtProperty behave as both Python and Qt properties. Decorators can be used to define new properties or to modify existing ones.

  destroyChildren()
  dropEvent(event)

    reimplemented to support dropping of modelnames in forms

  fillWithChildren()
  getCustomWidgetMap(**kwargs)

    Returns the map used to create custom widgets.

    Returns:

      a dictionary whose keys are device type strings (i.e. see `PyTango.DeviceInfo`) and whose values are tuples of classname,args,kwargs

    Return type:

      dict<str,tuple>

    Deprecated since version 4.6.5: Use item factories instead

  getFormWidget(**kwargs)

    Returns a tuple that can be used for creating a widget for a given model.

    Parameters:

      model (str) – a taurus model name for which the new item of the form will be created

    Returns:

      a tuple containing a class, a list of args and a dict of keyword args. The args and the keyword args can be passed to the class constructor

    Return type:

      tuple<type,list,dict>

    Deprecated since version 4.6.5: Use item factories instead

  getItemByIndex(index)

    returns the child item with at the given index position.

  getItemByModel(model, index=0)

    returns the child item with given model. If there is more than one item with the same model, the index parameter can be used to distinguish among them Please note that his index is only relative to same-model items!

  getItemFactories(return_disabled=False)

    returns the list of item factories entry points currently in use

    Parameters:

      return_disabled – If False (default), it returns only a list of the enabled factories. If True, it returns a tuple containing two lists: the enabled and the available but disabled factories.

  getItems()

    returns a list of the objects that have been created as childs of the form

  getModel(**kwargs)

    Returns the model name for this component.

    Parameters:

      key (object) – the model key. Defaults to first element of .modelKeys

    Returns:

      the model name.

    Return type:

      str

  classmethod getQtDesignerPluginInfo()

    Returns pertinent information in order to be able to build a valid QtDesigner widget plugin.

    The dictionary returned by this method should contain at least the following keys and values:

    - ‘module’ : a string representing the full python module name (ex.: ‘taurus.qt.qtgui.base’)

    - ‘icon’ : a string representing valid resource icon (ex.: ‘designer:combobox.png’)

    - ‘container’a bool telling if this widget is a container widget or

        not.

    This default implementation returns the following dictionary:

        { 'group'     : 'Taurus [Unclassified]',
          'icon'      : 'logos:taurus.png',
          'container' : False }

    Returns:

      a map with pertinent designer information

    Return type:

      dict

  getRegExp()
  isCompact()
  isWithButtons()
  model
    pyqtProperty(type, fget=None, fset=None, freset=None, fdel=None, doc=None,

      designable=True, scriptable=True, stored=True, user=False, constant=False, final=False, notify=None, revision=0) -> property attribute

    type is the type of the property. It is either a type object or a string that is the name of a C++ type. freset is a function for resetting an attribute to its default value. designable sets the DESIGNABLE flag (the default is True for writable properties and False otherwise). scriptable sets the SCRIPTABLE flag. stored sets the STORED flag. user sets the USER flag. constant sets the CONSTANT flag. final sets the FINAL flag. notify is the NOTIFY signal. revision is the REVISION. The other parameters are the same as those required by the standard Python property type. Properties defined using pyqtProperty behave as both Python and Qt properties. Decorators can be used to define new properties or to modify existing ones.

  modifiableByUser
    pyqtProperty(type, fget=None, fset=None, freset=None, fdel=None, doc=None,

      designable=True, scriptable=True, stored=True, user=False, constant=False, final=False, notify=None, revision=0) -> property attribute

    type is the type of the property. It is either a type object or a string that is the name of a C++ type. freset is a function for resetting an attribute to its default value. designable sets the DESIGNABLE flag (the default is True for writable properties and False otherwise). scriptable sets the SCRIPTABLE flag. stored sets the STORED flag. user sets the USER flag. constant sets the CONSTANT flag. final sets the FINAL flag. notify is the NOTIFY signal. revision is the REVISION. The other parameters are the same as those required by the standard Python property type. Properties defined using pyqtProperty behave as both Python and Qt properties. Decorators can be used to define new properties or to modify existing ones.

  onChangeLabelsAction()

    changes the labelConfig of all its items

  onSetFormatter()

    Reimplemented from TaurusBaseWidget

  parentModelChanged(parentmodel_name)

    Invoked when the Taurus parent model changes

    Parameters:

      parentmodel_name (str) – the new name of the parent model

  removeModels(modelNames)

    Removes models from those already in the form.

    Parameters:

      modelNames (sequence<str>) – the names of the models to be removed

    See also

    `addModels()`

  reset()
  resetCompact()
  resetFormWidget(**kwargs)

    Deprecated since version 4.6.5: Use item factories instead

  resetModel(**kwargs)

    Sets the model name to the empty string

    Parameters:

      key (object) – the model key. Defaults to first element of .modelKeys

  resetWithButtons()
  setCompact(compact)
  setCustomWidgetMap(**kwargs)

    Sets a map map for custom widgets.

    Parameters:

      cwmap (dict<str,tuple>) – a dictionary whose keys are device type strings (i.e. see `PyTango.DeviceInfo`) and whose values are tuples of classname,args,kwargs

    Deprecated since version 4.6.5: Use item factories instead

  setFormWidget(**kwargs)

    Deprecated since version 4.6.5: Use item factories instead

  setFormat(format)

    Reimplemented to call setFormat on the taurusvalues

  setItemFactories(include=None, exclude=None)

    Selects and prioritizes the factories to be used to create the form’s items.

    TaurusForm item factories are functions that receive a TaurusModel as their only argument and return either a TaurusValue-like instance or None in case the factory does not handle the given model.

    The factories are selected using their entry point names as registered in the “taurus.form.item_factories” entry point group.

    The factories entry point name is up to the registrar of the entry point (typically a taurus plugin) and should be documented by the registrar to allow for selection and prioritization.

    The selection and prioritization is done using `taurus.core.util.plugin.selectEntryPoints()`. See it for more details.

    The selected list is updated in the form, and returned.

    The default values for the include and exclude arguments are defined in tauruscustomsettings.T_FORM_ITEM_FACTORIES

    Parameters:

      - include (tuple) – The members in the tuple can be: Regexp patterns (in string or compiled form) matching the names to be included in the selection. They can also be item factory functions (which then are wrapped in an EntryPoint-like object and included in the selection).

      - exclude (tuple) – Regexp patterns ( either str or `re.Pattern` objects) matching registered names to be excluded.

    Returns:

      selected item factories entry points

    Return type:

      list

  setModifiableByUser(modifiable)

    sets whether the user can change the contents of the form (e.g., via Modify Contents in the context menu) Reimplemented from `TaurusWidget.setModifiableByUser()`

    Parameters:

      modifiable (bool)

    See also

    `TaurusWidget.setModifiableByUser()`

  setRegExp(regExp)
  setWithButtons(trueFalse)
  sizeHint(self) → QSize
  useParentModel

    (deprecated))

  withButtons
    pyqtProperty(type, fget=None, fset=None, freset=None, fdel=None, doc=None,

      designable=True, scriptable=True, stored=True, user=False, constant=False, final=False, notify=None, revision=0) -> property attribute

    type is the type of the property. It is either a type object or a string that is the name of a C++ type. freset is a function for resetting an attribute to its default value. designable sets the DESIGNABLE flag (the default is True for writable properties and False otherwise). scriptable sets the SCRIPTABLE flag. stored sets the STORED flag. user sets the USER flag. constant sets the CONSTANT flag. final sets the FINAL flag. notify is the NOTIFY signal. revision is the REVISION. The other parameters are the same as those required by the standard Python property type. Properties defined using pyqtProperty behave as both Python and Qt properties. Decorators can be used to define new properties or to modify existing ones.