def getFolderTree(self, fromDb=True): if fromDb: proj = database.getProjectDict() self.projectName = proj['projectName'] self.folderTreeDict = proj[self.type + 'Folders'] allKeys = self.folderTreeDict.keys() parentList = [x for x in self.folderTreeDict if self.folderTreeDict[x]['parent'] == ''] parentList.sort() pm.treeView(self.widgetName, e=True, ra=True) for item in parentList: pm.treeView(self.widgetName, e=True, addItem=(item, ''), ei=(item, False)) pm.treeView(self.widgetName, e=True, displayLabel=(item, item.split('_')[-1])) count = 0 while allKeys: allKeys = [x for x in allKeys if not x in parentList] parentList = [x for x in self.folderTreeDict if self.folderTreeDict[x]['parent'] in parentList] parentList.sort() for item in parentList: pm.treeView(self.widgetName, e=True, addItem=(item, self.folderTreeDict[item]['parent']), ei=(item, False)) pm.treeView(self.widgetName, e=True, displayLabel=(item, item.split('_')[-1])) count += 1 if count > 1000: break
def editNameCallback(self, *args): if args[0].split('_')[-1] == args[1]: print 'mesmo nome' return None par = pm.treeView(self.widgetName, q=True, itemParent=args[0]) newName = self.nextFolderName(args[1], par) pm.treeView(self.widgetName, e=True, displayLabel=(args[0], newName.split('_')[-1])) print 'editName: oldName %s, newName %s ' % (args[0], newName) return newName
def get_selected_layers( self ): selection = [ ] if pmc.treeView( self.__layer_tree, q = True, si = True ) == None: return [ ] else: for item in pmc.treeView( self.__layer_tree, q = True, si = True ) : selection.append( utils.get_bake_layer( item ) ) return selection
def addMultipleFolders(self, *args): sel = pm.treeView(self.widgetName, q=True, si=True) name = pm.textFieldGrp('addMulti_nameField', q=True, tx=True) start = pm.intFieldGrp('addMulti_rangeField', q=True, value1=True) end = pm.intFieldGrp('addMulti_rangeField', q=True, value2=True) step = pm.intFieldGrp('addMulti_rangeField', q=True, value3=True) zeroPad = pm.intFieldGrp('addMulti_zeroField',q=True, value1=True) if sel: for folder in sel: par = folder for i in range(start, end + 1, step): itemName = self.nextFolderName(name, par) + '{number:0{width}d}'.format(width=zeroPad, number=i) print itemName pm.treeView(self.widgetName, e=True, addItem=(itemName, par)) pm.treeView(self.widgetName, e=True, displayLabel=(itemName, itemName.split('_')[-1])) else: par = '' for i in range(start, end + 1, step): itemName = self.nextFolderName(name, par) + '{number:0{width}d}'.format(width=zeroPad, number=i) print itemName pm.treeView(self.widgetName, e=True, addItem=(itemName, par)) pm.treeView(self.widgetName, e=True, displayLabel=(itemName, itemName.split('_')[-1])) self.putFolderTree() pm.layoutDialog(dismiss='ok')
def highlite_treeView_item(treeView_name, item): assetList = self.assetList searchFilter = self.widgets['searchFilter_textField'].getText() for asset in assetList: if re.search(searchFilter, asset): if asset == assetName: pm.treeView(self.widgets['assets_treeView'], e=True, labelBackgroundColor=[asset, 0.35, 0.35, 0.35]) else: pm.treeView(self.widgets['assets_treeView'], e=True, labelBackgroundColor=[asset, -1, -1, -1])
def createFolderTree(self, parent): self.parentWidget = parent self.widgetName = pm.treeView(p=self.parentWidget, numberOfButtons=0, abr=False) pm.treeView(self.widgetName, e=True, selectionChangedCommand=self.selChangedCallBack, allowDragAndDrop=False, editLabelCommand=self.editNameCallback) self.getFolderTree()
def getSelectedPath(self): path = '' sel = pm.treeView(self.widgetName, q=True, si=True) if sel: child = sel[0] parent = 'start' path = [child.split('_')[-1]] while parent: parent = pm.treeView(self.widgetName, q=True, ip=child) child = parent if child: path.append(child.split('_')[-1]) return list(reversed(path))
def populate_treeView(treeView_name, treeView_dict, parent=''): for key, value in treeView_dict.iteritems(): pm.treeView( treeView_name, edit=True, addItem=(key, parent)) if isinstance(value, dict): populate_treeView(treeView_name, value, parent=key) else : if not ( isinstance(value, list) or isinstance(value, tuple) ): value = [value] for v in value: if v: pm.treeView( treeView_name, edit=True, addItem=(v, key) )
def populate_fileDirectory_treeView(treeView_name, treeView_dict, parent='', filters=[]): for key, value in treeView_dict.iteritems(): displayLabel = key.split('\\')[-1] valid = True for filter in filters: if displayLabel.find(filter) != -1: valid = False if valid: pm.treeView( treeView_name, edit=True, addItem=(key, parent)) pm.treeView( treeView_name, edit=True, displayLabel=(key, displayLabel) , selectionColor=(key, 0.4, 0.4, 0.4)) if isinstance(value, dict): populate_fileDirectory_treeView(treeView_name, value, parent=key, filters=filters)
def populate_selection_layout(self): pm.setParent(self.widgets['selectionSet_vertical']) self.widgets['selectionSet_vertical'].clear() treeViewSelected = pm.treeView (self.widgets["directory_treeView"], q=True, selectItem=True) if not treeViewSelected: return pm.scrollLayout(cr=True) path = os.path.abspath(treeViewSelected[0]) set_paths = [] for dir in os.listdir(path): if dir.find(self.library_objects_suffix[2]) != -1: #.set set_paths.append(os.path.abspath(os.path.join(path, dir))) for set_path in set_paths: print "create button" set_obj = Set(set_path) infos = set_obj.get_info() label = infos['name'].split('.')[0] pm.iconTextButton(style='textOnly',label=label, c=pm.Callback(self.selection_set_button_load, set_obj)) pm.popupMenu() pm.menuItem(label='Save Pose', c=pm.Callback(self.selection_set_button_save, set_obj)) pm.menuItem(label='Load Pose', c=pm.Callback(self.selection_set_button_load, set_obj)) self.widgets["selectionSet_vertical"].redistribute()
def button_layer_select( self, item, state ): prev_selection = pmc.melGlobals[ 'selected_bake_layers' ] # Until I can figure out how to get shift/ctl detection working, this will # be only single selection pmc.treeView( self.__layer_tree, e = True, selectItem = ( item, state ) ) selection = [ ] pmc.melGlobals[ 'selected_bake_layers' ] = selection self.refresh_button_state( )
def fillObjectTree(self): pm.treeView(self.objectTree, edit=True, removeAll=True) selection = pm.ls(sl=True) for key in mantra_node_attributes.keys(): pm.treeView(self.objectTree, edit=True, addItem=(key, None)) pm.treeView(self.objectTree, edit=True, expandItem=(key, False)) for entry in mantra_node_attributes[key]: pm.treeView(self.objectTree, edit=True, addItem=(entry, key))
def fillObjectTree(self): pm.treeView(self.objectTree, edit=True, removeAll = True) selection = pm.ls(sl=True) for key in mantra_node_attributes.keys(): pm.treeView(self.objectTree, edit=True, addItem = (key, None)) pm.treeView(self.objectTree, edit=True, expandItem = (key, False)) for entry in mantra_node_attributes[key]: pm.treeView(self.objectTree, edit=True, addItem = (entry, key))
def putFolderTree(self): allItems = pm.treeView(self.widgetName, q=True, children=True) if not allItems: return {} folderTreeDict = {} for item in allItems: par = pm.treeView(self.widgetName, q=True, itemParent=item) if par: newName = par.split('_')[-1]+'_'+item.split('_')[-1] if newName != item: folderTreeDict[newName] = {'parent': par} else: folderTreeDict[item] = {'parent': par} else: folderTreeDict[item] = {'parent': ''} self.folderTreeDict = folderTreeDict return folderTreeDict
def get_active_directory(self): treeViewSelected = pm.treeView (self.widgets["directory_treeView"], q=True, selectItem=True) if treeViewSelected: result = treeViewSelected[0] else: result = None return result
def selChangedCallBack(self, *args): sel = pm.treeView(self.widgetName, q=True, si=True) if sel: if self.itemListWidget: self.itemListWidget.path = self.getSelectedPath() self.itemListWidget.type = self.type self.itemListWidget.refreshList(path=self.itemListWidget.path, task=self.itemListWidget.task, code=None)
def refresh_button_state( self ): bake_layers = pmc.ls( typ = 'BakeLayer' ) one_selected = False if pmc.treeView( self.__layer_tree, q = True, si = True ) == None: pass elif len( pmc.treeView( self.__layer_tree, q = True, si = True ) ) == 1: one_selected = True sel_layer = pmc.treeView( self.__layer_tree, q = True, si = True )[ 0 ] connected_layers = [ ] if one_selected: selected_is_high = utils.is_high( sel_layer ) if selected_is_high: connected_layers = utils.get_connected_low_layers( sel_layer ) else: connected_layers = utils.get_connected_high_layers( sel_layer ) for layer in bake_layers: if one_selected == True: if selected_is_high == utils.is_high( layer ): pmc.treeView( self.__layer_tree, e = True, eb = ( layer, 2, False ), i = ( layer, 2, '' ) ) else: if utils.get_bake_layer( layer ) in connected_layers: image = bake_layer_tool.get_image( 'link_icon.png' ) else: image = bake_layer_tool.get_image( 'unlink_icon.png' ) pmc.treeView( self.__layer_tree, e = True, eb = ( layer, 2, True ), i = ( layer, 2, image ) ) else: pmc.treeView( self.__layer_tree, e = True, eb = ( layer, 2, False ), i = ( layer, 2, '' ) )
def populate_directory_layout(self): pm.setParent(self.widgets['directory_vertical']) self.widgets['directory_vertical'].clear() self.widgets['directory_treeView'] = pm.treeView( numberOfButtons = 0, scc=pm.Callback(self.directory_treeView_selectionChanged)) treeView_dict = {} treeView_keys = [] utils.fileDirectory_to_treeViewDict(treeView_dict, self.library_path, treeView_keys) utils.populate_fileDirectory_treeView(self.widgets['directory_treeView'], treeView_dict, filters=self.library_objects_suffix) for key in treeView_keys: try: pm.treeView(self.widgets['directory_treeView'], e=True, expandItem=(key, False)) except: pass self.widgets['directory_vertical'].redistribute()
def removeFolderCallBack(self, *args): print 'new remove folder' sel = pm.treeView(self.widgetName, q=True, si=True) if sel: folderList = [x for x in sel if self.folderTreeDict[x]['parent'] not in sel] for folder in folderList: del self.folderTreeDict[folder] children = self.getChildren(folder) for child in children: del self.folderTreeDict[child] else: print 'select a folder to remove!!' self.getFolderTree(fromDb=False)
def __init__(self): #pm.scriptJob(event = ["SelectionChanged", pm.Callback(self.updateObjectSelection)], parent=self) self.title = "MantraAttributeManager" pm.setUITemplate("DefaultTemplate", pushTemplate=True) self.height = 500 #with pm.paneLayout( configuration='vertical2') as pane: with pm.frameLayout(collapsable = False, labelVisible = False) as frame: self.objectTree = pm.treeView(abr=False, height = 150) self.fillObjectTree() pm.button(label = "Assign Selected Attributes", c = pm.Callback(self.setAttributes, "assignSelected")) pm.button(label = "Remove Selected Attributes", c = pm.Callback(self.setAttributes, "removeSelected")) pm.button(label = "Remove All Attributes from Scene", c = pm.Callback(self.setAttributes, "removeAllAttr")) self.show()
def addFolderCallBack(self, *args): print 'add folder' sel = pm.treeView(self.widgetName, q=True, si=True) if sel: newName = self.nextFolderName('newFolder', sel[0]) pm.treeView(self.widgetName, e=True, addItem=(newName, sel[0])) else: newName = self.nextFolderName('newFolder', '') pm.treeView(self.widgetName, e=True, addItem=(newName, '')) pm.treeView(self.widgetName, e=True, displayLabel=(newName, newName.split('_')[-1])) self.putFolderTree()
def button_connection_edit( self, layer, arg ): selected_layer = pmc.treeView( self.__layer_tree, q = True, si = True )[ 0 ] if utils.are_connected( layer, selected_layer ): utils.disconnect_layers( [ layer, selected_layer ] ) else: if utils.is_high( selected_layer ): utils.connect_layers( layer, selected_layer ) else: utils.connect_layers( selected_layer, layer ) self.refresh_button_state()
def __init__(self): #pm.scriptJob(event = ["SelectionChanged", pm.Callback(self.updateObjectSelection)], parent=self) self.title = "MantraAttributeManager" pm.setUITemplate("DefaultTemplate", pushTemplate=True) self.height = 500 #with pm.paneLayout( configuration='vertical2') as pane: with pm.frameLayout(collapsable=False, labelVisible=False) as frame: self.objectTree = pm.treeView(abr=False, height=150) self.fillObjectTree() pm.button(label="Assign Selected Attributes", c=pm.Callback(self.setAttributes, "assignSelected")) pm.button(label="Remove Selected Attributes", c=pm.Callback(self.setAttributes, "removeSelected")) pm.button(label="Remove All Attributes from Scene", c=pm.Callback(self.setAttributes, "removeAllAttr")) self.show()
def removeFolderCallBack(self, *args): sel = pm.treeView(self.widgetName, q=True, si=True) if sel: folderList = [ x for x in sel if self.folderTreeDict[x]['parent'] not in sel ] for folder in folderList: del self.folderTreeDict[folder] children = self.getChildren(folder) for child in children: del self.folderTreeDict[child] else: pm.confirmDialog(title='error', ma='center', message='Select a folder to remove', button=['OK'], defaultButton='OK', dismissString='OK') self.getFolderTree(fromDb=False)
def refresh( self ): bake_layers = pmc.ls( typ = 'BakeLayer' ) for layer in bake_layers: pass # Build the new layout pmc.treeView( self.__layer_tree, e = True, removeAll = True ) for layer in bake_layers: # Create Button if utils.is_high( layer ): h_l_button = 'H' low = False rd_button = False else: h_l_button = 'L' low = True rd_button = bake_layer_tool.get_image( 'ray_dist.png' ) pmc.treeView( self.__layer_tree, e = True, addItem = ( layer.name( ), '' ) ) pmc.treeView( self.__layer_tree, e = True, bti = ( layer.name( ), 1, h_l_button ) ) pmc.treeView( self.__layer_tree, e = True, eb = ( layer, 3, low ), i = ( layer, 3, rd_button ) ) self.refresh_button_state()
def create_new_selection_prompt(self): result = pm.promptDialog( title='Create New Selection', message='Enter Selection Name:', button=['OK', 'Cancel'], defaultButton='OK', cancelButton='Cancel', dismissString='Cancel') if result == 'OK': name = pm.promptDialog(query=True, text=True) treeViewSelected = pm.treeView (self.widgets["directory_treeView"], q=True, selectItem=True) directory = self.get_active_directory() path = os.path.join(directory, "%s.set" %name) set_obj = Set(path) set_obj.create() set_obj.save_set() self.populate_selection_layout()
def populate_library_layout(self): pm.setParent(self.widgets['library_vertical']) self.widgets['library_vertical'].clear() treeViewSelected = pm.treeView (self.widgets["directory_treeView"], q=True, selectItem=True) if not treeViewSelected: return pm.scrollLayout(cr=True) pm.rowColumnLayout(numberOfColumns=4) path = os.path.abspath(treeViewSelected[0]) pose_paths = [] for dir in os.listdir(path): if dir.find(self.library_objects_suffix[0]) != -1: #.pose pose_paths.append(os.path.abspath(os.path.join(path, dir))) for pose_path in pose_paths: pose_obj = Pose(pose_path) infos = pose_obj.get_info() label = infos['name'].split('.')[0] image = pose_obj.thumbnail_path pm.columnLayout(adj=True) pm.iconTextButton( w=80, h=80, style='iconOnly', image=image, label=label, c=pm.Callback(self.library_button_load_pose, pose_obj)) pm.popupMenu() pm.menuItem(label='Save Pose', c=pm.Callback(self.library_button_save_pose, pose_obj)) pm.menuItem(label='Load Pose', c=pm.Callback(self.library_button_load_pose, pose_obj)) pm.text(label, bgc=[0.1,0.1,0.1]) pm.setParent('..') self.widgets["library_vertical"].redistribute()
def select_ctrls_in_selected_animlayer(): """Select all controls in the current active animation layer""" current_anim_layers = pm.treeView(anim_layer_editor, q=True, si=True) pm.mel.layerEditorSelectObjectAnimLayer(current_anim_layers)
def setAttributes(self, cmd): print "AttibuteManager:setAttributes command", cmd if cmd == "assignSelected": attributeSelected = pm.treeView(self.objectTree, query=True, si = True) if not attributeSelected or len(attributeSelected) == 0: print "No attr selected" return # It is possible to select the parent Menu entry or the child. # I need the parent entry to decide if is a mesh, light or other type # and the attribute itself print "Selected attributes:", attributeSelected leafAttributes = [] typeList = [] for att in attributeSelected: if not pm.treeView(self.objectTree, query=True, il = att): children = pm.treeView(self.objectTree, query=True, ch = att) if children and len(children) > 1: #print "Children of ", att, children leafAttributes.extend(children[1:]) else: #print "Att", att, "is leaf" leafAttributes.append(att) leafAttributes = list(set(leafAttributes)) print "LeafAttributes", leafAttributes for leaf in leafAttributes: parent = pm.treeView(self.objectTree, query=True, ip = leaf) typeList.append(parent) selection = pm.ls(sl=True) relatives = pm.listRelatives(ad=True) # give me all children print "selection", relatives for element in relatives: print "Check", element, element.type() eType = element.type() if eType == 'mesh': for att in leafAttributes: if att in mantra_node_attributes['mesh']: print "Adding attribute to mesh", element if att == 'Render As Subdiv': if not element.hasAttr('mtm_renderAsSubdiv'): element.addAttr('mtm_renderAsSubdiv', at='bool') if 'Light' in eType: for att in leafAttributes: if att in mantra_node_attributes['light']: print "Adding attribute to light", element if att == 'Sampling Quality': if not element.hasAttr('mtm_samplingQuality'): element.addAttr('mtm_samplingQuality', at='float') for element in selection: if element.type() in ['lambert', 'phong', 'phongE', 'blinn']: for att in leafAttributes: if att in mantra_node_attributes['shader']: print "Adding attribute to shader", element if att == 'Reflection Options': if not element.hasAttr('mtm_reflBlur'): element.addAttr('mtm_reflBlur', at='float') if not element.hasAttr('mtm_reflSamples'): element.addAttr('mtm_reflSamples', at='long') if att == 'Refraction Options': if not element.hasAttr('mtm_refrBlur'): element.addAttr('mtm_refrBlur', at='float') if not element.hasAttr('mtm_refrSamples'): element.addAttr('mtm_refrSamples', at='long') pm.select(selection) if cmd == "removeSelected": selection = pm.ls(sl=True) relatives = pm.listRelatives(ad=True) # give me all children if relatives: for a in relatives: attrs = pm.listAttr(a, ud=True, leaf=False, sn=False, string="mtm_*") for att in attrs: pm.deleteAttr(a, at=att) for a in selection: attrs = pm.listAttr(a, ud=True, leaf=False, sn=False, string="mtm_*") for att in attrs: pm.deleteAttr(a, at=att) if cmd == "removeAllAttr": all = pm.ls() attrList = [] for a in all: attrs = pm.listAttr(a, ud=True, leaf=False, sn=False, string="mtm_*") for att in attrs: pm.deleteAttr(a, at=att)
def setAttributes(self, cmd): print "AttibuteManager:setAttributes command", cmd if cmd == "assignSelected": attributeSelected = pm.treeView(self.objectTree, query=True, si=True) if not attributeSelected or len(attributeSelected) == 0: print "No attr selected" return # It is possible to select the parent Menu entry or the child. # I need the parent entry to decide if is a mesh, light or other type # and the attribute itself print "Selected attributes:", attributeSelected leafAttributes = [] typeList = [] for att in attributeSelected: if not pm.treeView(self.objectTree, query=True, il=att): children = pm.treeView(self.objectTree, query=True, ch=att) if children and len(children) > 1: #print "Children of ", att, children leafAttributes.extend(children[1:]) else: #print "Att", att, "is leaf" leafAttributes.append(att) leafAttributes = list(set(leafAttributes)) print "LeafAttributes", leafAttributes for leaf in leafAttributes: parent = pm.treeView(self.objectTree, query=True, ip=leaf) typeList.append(parent) selection = pm.ls(sl=True) relatives = pm.listRelatives(ad=True) # give me all children print "selection", relatives for element in relatives: print "Check", element, element.type() eType = element.type() if eType == 'mesh': for att in leafAttributes: if att in mantra_node_attributes['mesh']: print "Adding attribute to mesh", element if att == 'Render As Subdiv': if not element.hasAttr('mtm_renderAsSubdiv'): element.addAttr('mtm_renderAsSubdiv', at='bool') if 'Light' in eType: for att in leafAttributes: if att in mantra_node_attributes['light']: print "Adding attribute to light", element if att == 'Sampling Quality': if not element.hasAttr('mtm_samplingQuality'): element.addAttr('mtm_samplingQuality', at='float') for element in selection: if element.type() in ['lambert', 'phong', 'phongE', 'blinn']: for att in leafAttributes: if att in mantra_node_attributes['shader']: print "Adding attribute to shader", element if att == 'Reflection Options': if not element.hasAttr('mtm_reflBlur'): element.addAttr('mtm_reflBlur', at='float') if not element.hasAttr('mtm_reflSamples'): element.addAttr('mtm_reflSamples', at='long') if att == 'Refraction Options': if not element.hasAttr('mtm_refrBlur'): element.addAttr('mtm_refrBlur', at='float') if not element.hasAttr('mtm_refrSamples'): element.addAttr('mtm_refrSamples', at='long') pm.select(selection) if cmd == "removeSelected": selection = pm.ls(sl=True) relatives = pm.listRelatives(ad=True) # give me all children if relatives: for a in relatives: attrs = pm.listAttr(a, ud=True, leaf=False, sn=False, string="mtm_*") for att in attrs: pm.deleteAttr(a, at=att) for a in selection: attrs = pm.listAttr(a, ud=True, leaf=False, sn=False, string="mtm_*") for att in attrs: pm.deleteAttr(a, at=att) if cmd == "removeAllAttr": all = pm.ls() attrList = [] for a in all: attrs = pm.listAttr(a, ud=True, leaf=False, sn=False, string="mtm_*") for att in attrs: pm.deleteAttr(a, at=att)
def build(self): self.build_menu_bar( ) # Form layout for rest of window self.__form = pmc.formLayout( ) # Buttons for quick access to things # TODO: Enable layer ordering btn_move_layer_up = pmc.symbolButton( image = 'moveLayerUp.png', annotation = 'Move Layer up', command = self.move_layer_up, enable = False ) btn_move_layer_down = pmc.symbolButton( image = 'moveLayerDown.png', annotation = 'Move Layer down', command = self.move_layer_down, enable = False ) btn_new_empty_layer = pmc.symbolButton( image = 'newLayerEmpty.png', annotation = 'New Empty Bake Layer', command = self.new_empty ) btn_new_selected_layer = pmc.symbolButton( image = 'newLayerSelected.png', annotation = 'New Bake Layer from Selection', command = self.new_selected ) pmc.setParent( self.__form ) self.__layer_tree = pmc.treeView( parent = self.__form, width = 350, abr = False, numberOfButtons = 3 ) pmc.treeView( self.__layer_tree, e = True, selectCommand = self.button_layer_select ) pmc.treeView( self.__layer_tree, e = True, elc = self.button_layer_editor_rename ) pmc.treeView( self.__layer_tree, e = True, pc = ( 1, self.button_type_change ) ) pmc.treeView( self.__layer_tree, e = True, pc = ( 2, self.button_connection_edit ) ) pmc.treeView( self.__layer_tree, e = True, pc = ( 3, self.button_quick_edit_window ) ) left_click_menu = pmc.popupMenu( button = 3, parent = self.__layer_tree ) pmc.treeView( self.__layer_tree, e = True, contextMenuCommand = pmc.CallbackWithArgs( self.show_left_click_menu, left_click_menu ) ) self.__form.attachForm( btn_new_selected_layer, 'top', 1 ) self.__form.attachForm( btn_new_selected_layer, 'right', 2 ) self.__form.attachNone( btn_new_selected_layer, 'bottom' ) self.__form.attachNone( btn_new_selected_layer, 'left' ) self.__form.attachForm( btn_new_empty_layer, 'top', 1 ) self.__form.attachControl( btn_new_empty_layer, 'right', 1, btn_new_selected_layer ) self.__form.attachNone( btn_new_empty_layer, 'bottom' ) self.__form.attachNone( btn_new_empty_layer, 'left' ) self.__form.attachForm( btn_move_layer_down, 'top', 1 ) self.__form.attachControl( btn_move_layer_down, 'right', 4, btn_new_empty_layer ) self.__form.attachNone( btn_move_layer_down, 'bottom' ) self.__form.attachNone( btn_move_layer_down, 'left' ) self.__form.attachForm( btn_move_layer_up, 'top', 1 ) self.__form.attachControl( btn_move_layer_up, 'right', 1, btn_move_layer_down ) self.__form.attachNone( btn_move_layer_up, 'bottom' ) self.__form.attachNone( btn_move_layer_up, 'left' ) self.__form.attachControl( self.__layer_tree, 'top', 1, btn_new_empty_layer ) self.__form.attachForm( self.__layer_tree, 'left', 0 ) self.__form.attachForm( self.__layer_tree, 'bottom', 0 ) self.__form.attachForm( self.__layer_tree, 'right', 0 )