def start_server(self): """ Starts a Server if there isn't one running """ print 'Starting server...' try: sc_server = Server() sc_server.silent = True sc_server.ui_open = True server_thread = New_Thread(func=sc_server.loop) server_thread.start() except: print 'failed'
def start(self): """ Starts the CLI loop """ self.server_check() message_thread = New_Thread(self.get_message_loop) message_thread.start() print "ShakeCast> ", sys.stdout.flush() user_in = None while self.stop_ui is not True: if self.stop_ui is not False: self.stop_ui = True user_in = self.get_input() if user_in is not None: sent = self.send(user_in) print "\nShakeCast> ", sys.stdout.flush() time.sleep(.1)