def _on_item_changed(self, item) -> None: if item is None: return if not item.isSelected(): return pr_id = item.data(0, Qt.UserRole) with self._account._wallet.get_payment_request_table() as table: pr = table.read_one(pr_id) expires = age(pr.date_created + pr.expiration) if pr.expiration else _('Never') self._receive_view.set_receive_key_id(pr.keyinstance_id) script_template = self._account.get_script_template_for_id(pr.keyinstance_id) address_text = script_template_to_string(script_template) self._receive_view.set_form_contents(address_text, pr.value, pr.description, expires)
def item_changed(self, item): if item is None: return if not item.isSelected(): return addr = item.data(0, Qt.UserRole) req = self.wallet.receive_requests[addr] expires = age(req['time'] + req['exp']) if req.get('exp') else _('Never') amount = req['amount'] message = self.wallet.labels.get(addr.to_string(), '') self.parent.receive_address_e.setText(addr.to_string()) self.parent.receive_message_e.setText(message) self.parent.receive_amount_e.setAmount(amount) self.parent.expires_combo.hide() self.parent.expires_label.show() self.parent.expires_label.setText(expires) self.parent.new_request_button.setEnabled(True)
def item_changed(self, item): if item is None: return if not item.isSelected(): return pr_id = item.data(0, Qt.UserRole) pr = self._account.get_payment_request(pr_id) expires = age(pr.date_created + pr.expiration) if pr.expiration else _('Never') self._main_window._receive_key_id = pr.keyinstance_id script_template = self._account.get_script_template_for_id( pr.keyinstance_id) address_text = script_template_to_string(script_template) self._main_window.receive_destination_e.setText(address_text) self._main_window.receive_message_e.setText(pr.description or "") self._main_window.receive_amount_e.setAmount(pr.value) self._main_window.expires_combo.hide() self._main_window.expires_label.show() self._main_window.expires_label.setText(expires) self._main_window.new_request_button.setEnabled(True)