|
@ -18,7 +18,7 @@ class QEAbstractInvoiceListModel(QAbstractListModel): |
|
|
self.invoices = [] |
|
|
self.invoices = [] |
|
|
|
|
|
|
|
|
# define listmodel rolemap |
|
|
# define listmodel rolemap |
|
|
_ROLE_NAMES=('key','is_lightning','timestamp','date','message','amount','status','status_str','address','expiration') |
|
|
_ROLE_NAMES=('key','is_lightning','timestamp','date','message','amount','status','status_str','address','expiration','type') |
|
|
_ROLE_KEYS = range(Qt.UserRole, Qt.UserRole + len(_ROLE_NAMES)) |
|
|
_ROLE_KEYS = range(Qt.UserRole, Qt.UserRole + len(_ROLE_NAMES)) |
|
|
_ROLE_MAP = dict(zip(_ROLE_KEYS, [bytearray(x.encode()) for x in _ROLE_NAMES])) |
|
|
_ROLE_MAP = dict(zip(_ROLE_KEYS, [bytearray(x.encode()) for x in _ROLE_NAMES])) |
|
|
_ROLE_RMAP = dict(zip(_ROLE_NAMES, _ROLE_KEYS)) |
|
|
_ROLE_RMAP = dict(zip(_ROLE_NAMES, _ROLE_KEYS)) |
|
@ -88,6 +88,7 @@ class QEAbstractInvoiceListModel(QAbstractListModel): |
|
|
item['status_str'] = invoice.get_status_str(status) |
|
|
item['status_str'] = invoice.get_status_str(status) |
|
|
index = self.index(i,0) |
|
|
index = self.index(i,0) |
|
|
self.dataChanged.emit(index, index, [self._ROLE_RMAP['status'], self._ROLE_RMAP['status_str']]) |
|
|
self.dataChanged.emit(index, index, [self._ROLE_RMAP['status'], self._ROLE_RMAP['status_str']]) |
|
|
|
|
|
return |
|
|
i = i + 1 |
|
|
i = i + 1 |
|
|
|
|
|
|
|
|
@abstractmethod |
|
|
@abstractmethod |
|
@ -118,6 +119,8 @@ class QEInvoiceListModel(QEAbstractInvoiceListModel): |
|
|
item['amount'] = QEAmount(amount_sat=invoice.get_amount_sat()) |
|
|
item['amount'] = QEAmount(amount_sat=invoice.get_amount_sat()) |
|
|
item['key'] = invoice.get_id() |
|
|
item['key'] = invoice.get_id() |
|
|
|
|
|
|
|
|
|
|
|
item['type'] = 'invoice' |
|
|
|
|
|
|
|
|
return item |
|
|
return item |
|
|
|
|
|
|
|
|
def get_invoice_for_key(self, key: str): |
|
|
def get_invoice_for_key(self, key: str): |
|
@ -134,11 +137,13 @@ class QERequestListModel(QEAbstractInvoiceListModel): |
|
|
|
|
|
|
|
|
def invoice_to_model(self, req: Invoice): |
|
|
def invoice_to_model(self, req: Invoice): |
|
|
item = self.wallet.export_request(req) |
|
|
item = self.wallet.export_request(req) |
|
|
item['key'] = req.get_id() #self.wallet.get_key_for_receive_request(req) |
|
|
item['key'] = req.get_rhash() if req.is_lightning() else req.get_address() |
|
|
item['is_lightning'] = req.is_lightning() |
|
|
item['is_lightning'] = req.is_lightning() |
|
|
item['date'] = format_time(item['timestamp']) |
|
|
item['date'] = format_time(item['timestamp']) |
|
|
item['amount'] = QEAmount(amount_sat=req.get_amount_sat()) |
|
|
item['amount'] = QEAmount(amount_sat=req.get_amount_sat()) |
|
|
|
|
|
|
|
|
|
|
|
item['type'] = 'request' |
|
|
|
|
|
|
|
|
return item |
|
|
return item |
|
|
|
|
|
|
|
|
def get_invoice_for_key(self, key: str): |
|
|
def get_invoice_for_key(self, key: str): |
|
|