I'm having some trouble getting this to work, i'm trying to append GUI texts to a window that allready exists, i'm using the python interpreter for autodesk maya, i attach here part of the host script where i check for multiple connections and try to add the text for each connection.
The problem comes when calling the interpHostData() function from inside the while loop inside the thread, it dosnt add anything to the window;
But whenever i call the function by itself outside of a thread it works correctly.
If anyone has a clue on how can i fix this i would apreciate it, thanks in advance.
def hostUpdate():
global socketHost
global clientL
clientL=[]
cmds.text('mt1',e=1,l='Update Process Started...')
while 1:
connectionMain,addressMain=socketHost.accept()
cmds.text('mt1',e=1,l='Connected with: %s'%str(addressMain))
#----------Different Thread for each connection
tid=thr.start_new_thread(hostRecieve,(connectionMain,addressMain))
clientL.append([connectionMain,addressMain,tid])
cmds.text('mt1',e=1,l='Thread started with: %s'%str(addressMain))
def hostRecieve(connI,addrI):
global clientL
cmds.text('mt1',e=1,l='Recieve Process Started...')
while 1: #------------------------------------Loop to keep listening for connections
try:
cmData=connI.recv(4096)
interpHostData(cmData) #--------------IF I CALL FROM HERE DOSN'T WORK
except:
for cl in clientL:
if connI==cl[0]:
clientL.remove(cl)
cmds.text('mt1',e=1,l='Disconnected from %s'%str(addrI))
break
def interpHostData(cmDataC):
global cliLayout
tplD=cmDataC.split(',')
if tplD[0]=='0':
cID=tplD[2]
cmds.setParent(cliLayout)
cmds.text(cID+'_1',l=tplD[1])
cmds.text(cID+'_2',l=tplD[3])
cmds.text(cID+'_3',l=tplD[4])
cmds.text(cID+'_4',l='_')
cmds.text(cID+'_5',l='_')
cmds.text(cID+'_6',l='_')
cmds.text(cID+'_7',l='_')
cmds.text(cID+'_8',l='_')
cmds.columnLayout(cID+'_9')
cmds.progressBar(cID+'_10',h=10)
cmds.progressBar(cID+'_11',h=10)
cmds.setParent(cliLayout)
cmds.text(cID+'_12',l='_')
cmds.text(cID+'_13',l='Online')