fusion_addin_framework.AddinCommandBase¶
- class fusion_addin_framework.AddinCommandBase(parent: Optional[Union[fusion_addin_framework.wrapper.Control, List[fusion_addin_framework.wrapper.Control]]] = None, id: str = 'random', name: str = 'random', resourceFolder: Union[str, pathlib.Path] = 'lightbulb', tooltip: str = '', toolClipFileName: Optional[Union[str, pathlib.Path]] = None, isEnabled: bool = True, isVisible: bool = True, isChecked: bool = True, listControlDisplayType: int = adsk.core.ListControlDisplayTypes.RadioButtonlistType)¶
Wraps around Fusions CommandDefinition object and its ControlDefintion attribute. Besides the documented attributes and methods on this page all attributes and methods of the wrapped classes can be accessed with the same attribute and method names as in the wrapped classes. The atributes of the commandDefintion object will be looked up first.
This class does NOT wrap around Fusions Command class. (Thats why its called ‘AddinCommand’ and not ‘Command’ only.)
If an Id of an existing CommandDefintion is provided, all parameters except parent and id will be ignored.
This class also encapsulates the concepts of the event handlers of the Fusion API. Using this class you do not need to connect a handler to the created event of the commandDefintion. Instead of connecting handlers, you simply overwrite the corresponding methods which are exactly named as the events available. Also the same argument will get passed to the overwritten methods.
See the example section for some use cases. Checking out the examples should make the concept od using function-arguments instead of handlers understandable in no time.
- Parameters
parent (Union[Control, List[Control]], optional) – The parent Control this command is connected to. You can also pass a list of controls. In this case the same command/functionality getx connected to multiple controls. If a list of controls is passed you must ensure that all controls are of the same controlType and that all of them are in distinct panels. Defaults to a ComanndControl with the default properties.
id (str, optional) – The unique id of the commandDefintion with respect to all other existing commandDefintions. Defaults to a random id.
name (str, optional) – The visible name of the command as seen in the user interface. This will also be set as the name of the controlDefintione attribute. Defaults to a random name.
resourceFolder (Union[str, Path], optional) – Directory that contains any additional files associated with this command. These are typically the image files that will be used for a button and the HTML files for a tool clip or helps and tips. Alternatively you can provide the name of one of the available default images. Defaults to “lightbulb”.
tooltip (str, optional) – The tooltip string. This is always shown for commands. If the tooltip description and/or tool clip are also specified then the tooltip will progressively display more information as the user hovers the mouse over the control. Defaults to “”.
toolClipFileName (Union[str, Path], optional) – The full filename of the image file (PNG) used for the tool clip. The tooltip is always shown but as the user hovers over the control it will progressively display the tool clip along with the tooltip text. Alternatively you can provide the name of one of the available default images. Defaults to None (no toolclip image is used).
isEnabled (bool, optional) – Sets if this ControlDefinition is enabled or not. This has the effect of enabling and disabling any associated (parental) controls. Defaults to True.
isVisible (bool, optional) – Sets if this ControlDefinition is visible or not. This has the effect of making any associated (parental) controls visible or invisible in the user interface. Defaults to True.
isChecked (bool, optional) – Will be ignored if controlType of the parental Control is not ‘checkbox’. Sets whether the check box of the parental controlDefintions is checked. Changing this will result in changing any associated (parental) controls and will execute the associated command. Defaults to True.
listControlDisplayType (int, optional) – Will be ignored if the controlType of the paerntal Control is not ‘list’. Sets how the parental list control will be displayed; as a standard list, a list of check boxes, or a list of radio buttons. Possible Values can be found in the ListControlDisplayType enumerator. Defaults to RadioButtonListType (1).
Summary¶
Methods
|
|
|
Adds an additional control for acticvating this command. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Attributes
|
The addin instance which manages this instance. |
|
The parent wrapper-instance of this wrapper-instance. |
|
The level this instance is in the user interface hierachy. |