1
2 """
3 Contains the most important mel-layouts wrapped into easy to use python classes
4 These are specialized and thus more powerful than the default wraps
5 """
6 __docformat__ = "restructuredtext"
7 import base as uibase
8 import maya.cmds as cmds
9 import mrv.maya.util as mutil
10 import util as uiutil
11
12
13 -class Layout( uibase.SizedControl, uiutil.UIContainerBase ):
14 """ Structural base for all Layouts allowing general queries and name handling
15 Layouts may track their children
16 """
17 _properties_ = ( "nch", "numberOfChildren")
18
22
26
28 """ :return: children of this layout """
29 childnames = mutil.noneToList( cmds.layout( self, q=1, ca=1 ) )
30
31 return uibase.wrapUI( [ "%s|%s" % ( self, c ) for c in childnames ] )
32
34 """Set the parent ( layout ) of this layout active - newly created items
35 will be children of the parent layout
36
37 :return: self
38 :note: can safely be called several times """
39 cmds.setParent(self._parentString())
40 return self
41
42
43 p_ca = property(children)
44 p_childArray = p_ca
45
46
47
65
66
68 """Simple wrapper for a frame layout"""
69 _properties_ = ( "bw", "borderVisible",
70 "bs", "borderStyle",
71 "cl", "collapse",
72 "cll", "collapsable",
73 "l", "label",
74 "lw", "labelWidth",
75 "lv", "labelVisible",
76 "la", "labelAlign",
77 "li", "labelIndent",
78 "fn", "font",
79 "mw", "marginWidth",
80 "mh", "marginHeight" )
81
82 _events_ = ( "cc", "collapseCommand",
83 "ec", "expandCommand",
84 "pcc", "preCollapseCommand",
85 "pec", "preExpandCommand" )
86
87
89 """Wrapper for row column layout"""
90 _properties_ = [ "columnWidth", "cw",
91 "columnAttach", "cat",
92 "rowAttach", "rat",
93 "columnAlign", "cal",
94 "adjustableColumn", "adj",
95 "numberOfColumns", "nc" ]
96
97 for flag in ( "columnWidth", "cw", "columnAttach", "ct", "columnOffset",
98 "co", "columnAlign", "cl", "adjustableColumn", "ad" ):
99 for i in range( 1, 7 ):
100 _properties_.append( flag + str( i ) )
101
102
104 _properties_ = ( "columnAlign", "cal",
105 "columnAttach", "cat",
106 "columnOffset", "co" ,
107 "columnWidth", "cw",
108 "rowSpacing", "rs" )
109
111 """Wrapper for row column layout"""
112 _properties_ = ( "numberOfColumns", "nc",
113 "numberOfRows", "nr",
114 "rowHeight", "rh",
115 "rowOffset", "ro",
116 "rowSpacing", "rs" )
117
118
120 """Wrapper class for a simple column layout"""
121
122 _properties_ = ( "adjustableColumn", "adj" )
123
134
136 """Simple wrapper for a tab layout"""
137 _properties_ = ( "tv", "tabsVisible",
138 "st", "selectTab",
139 "sti", "selectTabIndex",
140 "tl", "tabLabel",
141 "tli", "tabLabelIndex",
142 "scr", "scrollable",
143 "hst", "horizontalScrollBarThickness",
144 "vst", "verticalScrollBarThickness",
145 "imw", "innerMarginWidth",
146 "imh", "innerMarginHeight",
147 "i", "image",
148 "iv", "imageVisible",
149 "cr", "childResizable",
150 "mcw", "minChildWidth",
151 "mt", "moveTab" )
152
153 _events_ = ( "cc", "changeCommand",
154 "sc", "selectCommand",
155 "psc", "preSelectCommand",
156 "dcc", "doubleClickCommand" )
157
159 """Simple wrapper for a pane layout"""
160 _properties_ = (
161 "cn", "configuration",
162 "sp", "setPane",
163 "ap", "activePane",
164 "api", "activePaneIndex",
165 "aft", "activeFrameThickness",
166 "st", "separatorThickness",
167 "ps", "paneSize",
168 "p1", "p2", "p3", "p4", "pane1", "pane2", "pane3", "pane4",
169 "pup", "paneUnderPointer",
170 "nvp", "numberOfVisiblePanes",
171
172 "swp", "staticWidthPane",
173 "shp", "staticHeightPane"
174 )
175 _events_ = ("smc", "separatorMovedCommand")
176