def finish_if_server_ready(other_condition): server_busy = is_server_busy() debugger("server_busy = {}".format(server_busy)) debugger('other_condition = {}'.format(other_condition)) will_finish = (not server_busy and other_condition) debugger('will finish = {}'.format(will_finish)) return will_finish
def send_text(self, string): '''Sends a string through the pipe to the GUI ''' if not is_server_busy(): data = {'hint': string} t = threading.Thread(target=launch_client, args=(data,)) t.daemon = True t.start()
def send_hint(self, hint=None): '''Sends a hint string through the pipe to the GUI ''' if not is_server_busy(): if not hint: hint = '\n' + self.hints[0] else: hint = '\n' + hint data = {'hint': hint} t = threading.Thread(target=launch_client, args=(data,)) t.daemon = True t.start() # TODO: This should only be run is a hint is not provided if len(self.hints) > 1: self.hints.pop(0)