class Program: # Class objects global m_CLI global m_NC m_CLI = CLI.UI() m_NC = Network_Delegate.Network_Connector() def ProgramEntry(self): m = Morse.Morse() io = IO_Delegate.IO_Delegate() s = m.TextToMorse("Hello World") io.SendMorse(s) print(s) # Draw menu m_CLI.DrawMainMenu() #print(sys.stdout.encoding) # Prompt for peer information peer = m_CLI.PeerInfoPrompt() # Prompt for local user name local_handle = input("Your name: ") # Try connection while (not m_NC.TryConnection(peer) ): print("Connection Failed. Try again or type \"quit\" to quit :") # Prompt for peer information peer = m_CLI.PeerInfoPrompt() # Try handshake m_NC.Handshake(local_handle) # Print successful connection print(m_NC.Info()) # print(str.format("Active Threads: {0}", threading.active_count())) # trace # Setup message retrieve thread getMessages = ReceiveThread() getMessages.start() # Setup input thread userInput = InputThread() userInput.start() print(str.format("Active Threads: {0}", threading.active_count())) # trace running = True while running: time.sleep(5) # no need to run endlessly pass # # Draw screen #m_CLI.DrawChat() getMessages.kill() userInput.kill() # Exit on disconnect quit()