def address_data_changed(self, account: Bip44AccountType, address: Bip44AddressType): account_idx = self.account_index_by_id(account.id) if account_idx is not None: account = self.accounts[account_idx] acc_index = self.index(account_idx, 0) addr_idx = account.address_index_by_id(address.id) if addr_idx is not None: addr_loc = account.address_by_index(addr_idx) if addr_loc != address: addr_loc.update_from(address) addr_index = self.index(addr_idx, 0, parent=acc_index) self.__data_modified = True self.dataChanged.emit(addr_index, addr_index)
def count_prev_zero_received(acc: Bip44AccountType, start_index: int): cnt = 0 index = start_index while index >= 0: a = acc.address_by_index(index) if not a.received: cnt += 1 else: break index -= 1 return cnt
def add_account(self, account: Bip44AccountType): existing_account = self.account_by_id(account.id) self.__data_modified = True if not existing_account: account_loc = Bip44AccountType(None, None, None, None, None) account_loc.copy_from(account) idxs = [a.address_index for a in self.accounts] insert_idx = bisect.bisect_right(idxs, account.address_index) self.beginInsertRows(QModelIndex(), insert_idx, insert_idx) self.accounts.insert(insert_idx, account_loc) self.endInsertRows() else: existing_account.copy_from(account)