def __init__(self):
        gui.QWidget.__init__(self)
        BitmsgMsgWatchCallbacks.__init__(self)

        self.saved_keys = []
        try:
            self.saved_keys = pickle.Unpickler(open('keys.dat', 'rb')).load()
        except FileNotFoundError:
            pass
        except:
            traceback.print_exc()

        self.transactions_per_second_deque = deque()
        self.transactions_per_second_deque_lock = threading.Lock()

        self.init()

        self.watch_public()

        for name, algorithm, key in self.saved_keys:
            if algorithm == ENCRYPT_RSA:
                key = load_private_key_from_der(key)
            self.watch_and_add_key(name, algorithm, key)

        self.start()
 def got_transaction(self, tx):
     with self.transactions_per_second_deque_lock:
         self.transactions_per_second_deque.append(time.time())
     return BitmsgMsgWatchCallbacks.got_transaction(self, tx)