taurus taurus

Previous topic

QButtonBox

Next topic

TaurusLauncherButton

This Page

TaurusCommandButton

Inheritance diagram of TaurusCommandButton

class TaurusCommandButton(parent=None, designMode=False, command=None, parameters=None, icon=None, text=None)

Bases: PyQt4.QtGui.QPushButton, taurus.qt.qtgui.base.taurusbase.TaurusBaseWidget

This class provides a button that executes a tango command on its device.

Code examples:

# a button that executes the "status" command for the 'a/b/c' device server
button =  TaurusCommandButton(command = 'Status', icon=':/taurus.png')
button.setModel('a/b/c')

#  a button that executes the "exec" command for the 'a/b/c' device server with one parameter
button =  TaurusCommandButton(command = 'Status', parameters=['2+2'],icon=':/taurus.png')
button.setModel('a/b/c')

See also

TaurusCommandsForm provides a good example of use of TaurusCommandButton (including managing the return value)

Command

returns the command name to be executed when the button is clicked

Return type::class:~`str` or :class:~`None`
Returns:the command name
CustomText

Returns the custom text of the buttom, or None if no custom text is used

DangerMessage

Returns the current apply danger message or None if the apply operation is safe

Return type::class:~`str` or :class:~`None`
Returns:the apply danger message
Model

Returns the model name for this component.

Return type::class:~`str`
Returns:the model name.
Parameters

returns the parameters to be used on command execution

Parameters:parameters (:class:~`sequence`) –
UseParentModel

Returns whether this component is using the parent model

Return type::class:~`bool`
Returns:True if using parent model or False otherwise
getCommand()

returns the command name to be executed when the button is clicked

Return type::class:~`str` or :class:~`None`
Returns:the command name
getCustomText()

Returns the custom text of the buttom, or None if no custom text is used

getDisplayValue()

see TaurusBaseComponent.displayValue()

getParameters()

returns the parameters to be used on command execution

Parameters:parameters (:class:~`sequence`) –
classmethod getQtDesignerPluginInfo()
onClicked(*args, **kwargs)

Slot called when the button is clicked. It executes the command with parameters. It may issue a warning if the command is flagged as dangerous. On successful execution, it returns the command result and it emits a “commandExecuted” signal with the result as well.

Returns:The result of the command. The type depends on the command. It may be None.

See also

setCommand(), setParameters(), TaurusBaseComponent.isDangerous()

resetCommand()

equivalent to self.setCommand(None)

resetCustomText()

Equivalent to setCustomText(None)

resetParameters()

Equivalent to setParameters(None)

setCommand(commandName)

sets the command to be executed when the button is clicked

Parameters:commandName (:class:~`str` or :class:~`None`) – the command name
setCustomText(customText=None)

Sets a custom text for the button (by default it is the command name)

Parameters:customText (:class:~`str` or :class:~`None`) – the custom text. If None passed, it will use the command name
setParameters(parameters)

Sets the parameters to be used on command execution.

Parameters:parameters (:class:~`sequence`) – a sequence of parameters. If the elements of the sequence are not of the right type required for the parameter, an automatic conversion will be attempted on execution time. As a special case, if parameters is a string, it will be splitted on whitespace to obtain a sequence of parameters.
taurus = <module 'taurus' from '/build/buildd/taurus-3.0.0/build/lib.linux-i686-2.7/taurus/__init__.py'>