Open JuliaLozova opened 7 years ago
So aside from the wrapping display I see that once I changed the function inputData
`def inputData(stdscr, message_queues):
#print type(inp)
socket_list = message_queues.keys()
Y,X = stdscr.getyx()
while True:
inpChar = stdscr.getch()
if inpChar in (13, 10):
break
elif inpChar == 263:
y, x = stdscr.getyx
if x > X:
del inpChar[-1]
stdscr.move(y, (x-1))
stdscr.clrtoeol()
stdscr.refresh()
elif inpChar in printable:
inputs.append(chr(inpChar))
stdscr.addch(inpChar)
inp = "".join(inputs)
#print inp
return inp
#print inp
for sock in socket_list:
message_queues[sock].put(inp)
if sock not in outputs:
outputs.append(sock)`
the inp is no longer a stdin. which then sends it to interpretData() `def interpretData(item, message_queues): data = item.recv(1024) if data:
print('Friend:{!r}'.format(data, item.getpeername()))
else:
# Interpret empty result as closed connection
print('closing', server_address)
inputs.remove(item)
item.close()
#Remove message queue
del message_queues[item]`
which, then it doesn't read it as data for some reason. --- so it closes the function
So I added three functions that add the curses module into the messenger. As it stands they work on their own. the client can essentially only talk to themselves, and doesn't connect to anyone.
So I am stuck as to how to integrate it so:
I don't know where to place
wrapper(display)
, because it feels like that should be called first, then the messengerserver/client functions.Also how to integrate the stdscr and items, they are different, but I want stdscr to become and item at some point.... but how do I start. I realize that I have a couple of doubles going on now, such as prompt and writingFunc. The item and stdscr are messing with me.
I'm all tangled up. Help.