pymel.core.windows.workspaceControl¶
- workspaceControl(*args, **kwargs)¶
Creates and manages the widget used to host windows in a layout that enables docking and stacking windows together.
Flags:
Long Name / Short Name Argument Types Properties checksPlugins / cp bool Sets whether the UI (as defined by the uiScript) checks the loaded state of one or more plug-ins in its code. The UI will not be loaded until the auto-loading of plug-ins is complete. Default value is false. close / cl bool Closes the workspace control. closeCommand / cc script Command that gets executed when the workspace control is closed. collapse / clp bool Collapse or expand the tab widget parent of the workspace control. defineTemplate / dt unicode Puts the command in a mode where any other flags and arguments are parsed and added to the command template specified in the argument. They will be used as default arguments in any subsequent invocations of the command when templateName is set as the current template. dockToControl / dtc unicode, unicode Dock this workspace control next to the given control. The first argument is the control name, the second is dock position relative to the control (valid values are: left, right, top, bottom). dockToMainWindow / dtm unicode, bool Dock this workspace control into the main window. The first argument is the dock position along the sides of the main window (valid values are: left, right, top, bottom), the second specifies whether the control should be tabbed into the first control found at the dock position. dockToPanel / dtp unicode, unicode, bool Dock this workspace control into the workspace docking panel that the given workspace control is in. The first argument is the control name, the second is dock position along the sides of the panel (valid values are: left, right, top, bottom), the third specifies whether the control should be tabbed into the first control found at the dock position. duplicatable / dup bool Controls whether or not this workspace control can be duplicated. The default duplicate state is controlled by whether or not the panel is unique. Unique panels cannot be duplicated or copied. Workspace controls without a panel also cannot be duplicated, unless specifically set as such using this flag. exists / ex bool Returns whether the specified object exists or not. Other flags are ignored. floating / fl bool Whether the workspace control is floating. height / h bool Query only flag returning the current height of the control. heightProperty / hp unicode Set height property of the workspace control. Valid values are: fixed - Cannot be resized manually and will not be given any extra space while maximizing/dynamically resizingpreferred - Can be resized manually but will not be given any extra space while maximizing/dynamically resizingfree - Can be resized manually and will be given extra space while maximizing/dynamically resizingDefault: free In query mode returns the current height property of the workspace control. horizontal / hr bool Orientation of the control. This flag is true by default, which corresponds to a horizontally oriented widget. Note: currently only Toolboxand Shelfsupport a vertical orientation. initCallback / ic unicode Adds a mel command to be executed when the control is added to the layout. The command should be a mel proc and it will be called with the workspaceControl name as parameter. The mel command should take the form: global proc callbackName(string $workspaceControlName) If saveis appended to the command name, it will be called during the layout save. global proc callbackNameSave(string $workspaceControlName) initialHeight / ih int The initial height of the workspace control when first shown. initialWidth / iw int The initial width of the workspace control when first shown. label / l unicode The label text. The default label is the name of the workspace control. loadImmediately / li bool Sets whether the UI (as defined by the uiScript) will be built immediately on workspace control creation (true) or delayed until the control is actually shown (false). Default value is false. minimumWidth / mw bool Sets the minimum width of control to the initial width. This should be used along with initial width flag. If the parameter is false, the minimum width will be set to 0. r / r bool Whether the workspace control widget is visible and either floating or at the top of its workspace area. requiredControl / rc unicode The name of a workspace control that needs to be open in order for this workspace control to properly function. This workspace control will not be created if the required control is not open, and will be closed when the required control is closed. requiredPlugin / rp unicode The name of a plug-in that needs to be loaded in order to build the workspace control UI. resizeHeight / rsh int Resizes a floating workspace control’s height to the given value. resizeWidth / rsw int Resizes a floating workspace control’s width to the given value. restore / rs bool Restores the control according to the following rules: If collapsed then the control will be expandedIf hidden then the control will be shownIf minimized then the control will be restoredIf the control is an inactive tab into a tab group then it will become the active tab retain / rt bool Sets whether the workspace control is retained (i.e. only hidden) or deleted when closed. Default value is true. stateString / ss unicode String containing the state of the control. Can be used with the initCallback flag. tabPosition / tp unicode, bool Changes the tab position. The possible values are: north, eastand west. The boolean value, if set to true, changes the tab positions of all the controls in the parent widget. If it is not set, only the current control will get its position changed. A control can have a different orientation than the tab widget. If the control tab position is different from the tab widget’s one, the tab position will be changed when the control becomes the only control in the tab widget. On query, only the control’s tab position will be returned, not the tab widget’s position. They may differ. tabToControl / ttc unicode, int Tab this workspace control into the given control. The first argument is the control name, the second is the index position within the containing tab widget (invalid values mean append). uiScript / ui script The specified script will be invoked to build the UI of the workspaceControl. This is a required flag. useTemplate / ut unicode Forces the command to use a command template other than the current one. visible / vis bool The visible state of the workspace control. A control is created visible by default. If the control is created as not visible, the control will be created in a closed state. To make it appear, edit the control to set the flags floating or the flag visible to true. visibleChangeCommand / vcc script Command that gets executed when visible state of the workspace control changes. width / w bool Query only flag returning the current width of the control. widthProperty / wp unicode Set width property of the workspace control. Valid values are: fixed - Cannot be resized manually and will not be given any extra space while maximizing/dynamically resizingpreferred - Can be resized manually but will not be given any extra space while maximizing/dynamically resizingfree - Can be resized manually and will be given extra space while maximizing/dynamically resizingDefault: free In query mode returns the current width property of the workspace control. Flag can have multiple arguments, passed either as a tuple or a list. Derived from mel command maya.cmds.workspaceControl
Example:
- ::
import pymel.core as pm
- def createCustomWorkspaceControlUI(*args):
- pm.columnLayout() pm.button() pm.button() pm.button()
pm.workspaceControl(“myCustomWorkspaceControl”, retain=False, floating=True, uiScript=”createCustomWorkspaceControlUI()”);