I don’t know how to fix your code, I don’t understand this design. If you need to fix somebody’s code it could be a tough thing.
But if you are building your script by yourself, you can re-build UI using the example code below (I guess this is the common way for this) and it would be easier:
import pymel.core as pm
import os, sys, glob
def baseUI(*args):
if pm.window('ANMManager', q = 1, ex = 1):
pm.deleteUI('ANMManager')
win = pm.window('ANMManager', t= 'Animation manager', rtf=True, w = 280 )
with win:
mainLayout = pm.columnLayout()
inputLayout = pm.rowColumnLayout(nc=6, parent = mainLayout)
pm.text (l = ' PART ')
partField = pm.textField(tx = 'REEL_01', w= 60, h = 30)
pm.text (l = ' SEQ ')
sequenceField = pm.textField(tx = '010', w= 45, h = 30)
pm.text (l = ' SHOT ')
shotField = pm.textField(tx = '010', w= 45, h = 30)
pm.separator(h = 5 , style = 'none')
createLayout = pm.rowColumnLayout(nc = 1, parent = mainLayout)
OPANM = pm.button(l = 'OPEN ANIMATION SCENE', w = 280, h = 35)
# OPANM.setCommand(pm.Callback (dna.shotOpen, partField, sequenceField, shotField, listANM ))
pm.separator(h = 6 , style = 'none')
PBLayout = pm.rowColumnLayout(nc = 1, parent = mainLayout)
playblast = pm.button(l = 'PLAYBLAST', w = 280, h= 50)
playblast.setCommand(pm.Callback (PB, 'mov'))
pm.separator(h = 5, style = 'none')
camLayout = pm.rowColumnLayout(nc = 10, parent = mainLayout) # 12, 18, 27, 40, 65, 75, 100, 135, 180
for i in listLens:
LB = pm.button(l = str(i), w = 25, h= 40)
LB.setCommand(pm.Callback (lens, i))
lockCAM = pm.button(l = 'LCM', w = 55)
lockCAM.setCommand(pm.Callback (lockCam))
pm.separator(h = 8, style = 'none')
editLayout = pm.rowColumnLayout(nc = 1, parent = mainLayout)
check = pm.button(l = 'CHECK SCENE', w = 280, h= 45)
# check.setCommand(pm.Callback (dna.checkScene))
addLayout = pm.rowColumnLayout(nc = 3, parent = mainLayout)
add_A = pm.button(l = 'ADD ASSSETS', w = 90, h= 30)
del_A = pm.button(l = 'DEL ASSETS', w = 90)
upd = pm.button(l = 'UPDATE REFS', w = 100)
#add_A.setCommand(pm.Callback (dna.addAsset))
#del_A.setCommand(pm.Callback (dna.delAsset))
#upd.setCommand(pm.Callback (dna.updateRefs))
updLayout = pm.rowColumnLayout(nc = 2, parent = mainLayout)
fixALL = pm.button(l = 'FIX ALL', w = 240, h = 30)
snv = pm.button(l = 'SNV', w = 40)
# fixALL.setCommand(pm.Callback (dna.fixAll))
# snv.setCommand(pm.Callback (saveNext))
win.show()
baseUI()
Run this code in Maya, see how it looks, try to understand how each section was built. Start with an empty window and add necessary widgets one by one.
def baseUI(*args):
if pm.window('ANMManager', q = 1, ex = 1):
pm.deleteUI('ANMManager')
win = pm.window('ANMManager', t= 'Animation manager', rtf=True, w = 280 )
with win:
mainLayout = pm.columnLayout()
win.show()
baseUI()