def prompt_auth(self, msg): import getpass print_msg(msg) response = getpass.getpass('') if len(response) == 0: return None return response
def _send(self, parent, blob): def sender_thread(): with self._audio_interface() as interface: src = BytesIO(blob) dst = interface.player() amodem.main.send(config=self.modem_config, src=src, dst=dst) print_msg('Sending:', repr(blob)) blob = zlib.compress(blob.encode('ascii')) kbps = self.modem_config.modem_bps / 1e3 msg = 'Sending to Audio MODEM ({0:.1f} kbps)...'.format(kbps) WaitingDialog(parent, msg, sender_thread)
def get_pin(self, msg): t = { 'a':'7', 'b':'8', 'c':'9', 'd':'4', 'e':'5', 'f':'6', 'g':'1', 'h':'2', 'i':'3'} print_msg(msg) print_msg("a b c\nd e f\ng h i\n-----") o = raw_input() return ''.join(map(lambda x: t[x], o))
def get_passphrase(self, msg, confirm): import getpass print_msg(msg) return getpass.getpass('')
def show_message(self, msg, on_cancel=None): print_msg(msg)
def yes_no_question(self, msg): print_msg(msg) return raw_input() in 'yY'
def debug_msg(*args): if DEBUG: print_msg(*args)
def on_finished(blob): if blob: blob = zlib.decompress(blob).decode('ascii') print_msg('Received:', repr(blob)) parent.setText(blob)