def close_wallet(self): print_error("trezor: clear session") if self.client: self.client.clear_session() self.client.transport.close() self.client = None self.wallet = None
def give_error(self, message, clear_client = False): print_error(message) if not self.signing: QMessageBox.warning(QDialog(), _('Warning'), _(message), _('OK')) else: self.signing = False if clear_client and self.client is not None: self.client.bad = True self.device_checked = False raise Exception(message)
def load_theme(self): """Load theme retrieved from wallet file.""" try: theme_prefix, theme_path = self.themes[self.theme_name] except KeyError: util.print_error("Theme not found!", self.theme_name) return full_theme_path = "%s/%s/style.css" % (theme_prefix, theme_path) with open(full_theme_path) as style_file: qApp.setStyleSheet(style_file.read())
def run(self): self.is_running = True while self.is_running: if not self.keyhash: time.sleep(2) continue if not self.message: try: self.message = server.get(self.keyhash) except Exception as e: util.print_error("cannot contact cosigner pool") time.sleep(30) continue if self.message: self.parent.win.emit(SIGNAL("cosigner:receive")) # poll every 30 seconds time.sleep(30)
from PyQt4.QtGui import * from PyQt4.QtCore import * import traceback import zlib import json from io import BytesIO import sys import platform try: import amodem.audio import amodem.main import amodem.config print_error('Audio MODEM is available.') amodem.log.addHandler(amodem.logging.StreamHandler(sys.stderr)) amodem.log.setLevel(amodem.logging.INFO) except ImportError: amodem = None print_error('Audio MODEM is not found.') class Plugin(BasePlugin): def __init__(self, config, name): BasePlugin.__init__(self, config, name) if self.is_available(): self.modem_config = amodem.config.slowest() self.library_name = { 'Linux': 'libportaudio.so'
def give_error(message): print_error(message) raise Exception(message)