def on_update(self): self.clear() tab = self.tab() if not tab or not self.wallet: return self._recalc_times(tab.times) base_unit = self.main_window.base_unit() for i, u in enumerate(self.utxos): address = u['address'].to_ui_string() value = self.main_window.format_amount( u['value'], whitespaces=True) + " " + base_unit name = get_name(u) ts = self.sent_utxos.get(name) icon = None when_font = None when = '' is_sent = ts is not None if is_sent: status = _("Sent") when = age(ts, include_seconds=True) icon = self.check_icon else: failed_reason = self.failed_utxos.get(name) if failed_reason: status = _("Failed") when = failed_reason icon = self.fail_icon when_font = self.italic_font elif name == self.sending: status = _("Processing") when = status + " ..." when_font = self.italic_font else: status = _("Queued") when = age(max(self.t0 + self.times_secs[i], time.time() + 0.5), include_seconds=True) item = SortableTreeWidgetItem([ address, value, time.strftime('%H:%M', self.times[i]), when, status ]) item.setFont(0, self.monospace_font) item.setFont(1, self.monospace_font) item.setTextAlignment(1, Qt.AlignLeft) if icon: item.setIcon(4, icon) if when_font: item.setFont(3, when_font) self.addChild(item)
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.get(addr) if not req: return expires = age(req['time'] + req['exp']) if req.get('exp') else _('Never') amount = req['amount'] opr = req.get('op_return') or req.get('op_return_raw') opr_is_raw = bool(req.get('op_return_raw')) message = self.wallet.labels.get(addr.to_storage_string(), '') self.parent.receive_address = addr self.parent.receive_address_e.setText(addr.to_full_ui_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.receive_opreturn_rawhex_cb.setChecked(opr_is_raw) self.parent.receive_opreturn_e.setText(opr or '') self.parent.save_request_button.setEnabled(False)
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.get(addr) if not req: return expires = age(req['time'] + req['exp']) if req.get('exp') else _('Never') amount = req['amount'] opr = req.get('op_return') or req.get('op_return_raw') opr_is_raw = bool(req.get('op_return_raw')) message = self.wallet.labels.get(addr.to_storage_string(), '') self.parent.receive_address = addr self.parent.receive_address_e.setText(addr.to_full_ui_string()) self.parent.receive_message_e.setText(message) if req.get('token_id', None): self.parent.gui_object.toggle_cashaddr(Address.FMT_SLPADDR) self.parent.receive_slp_token_type_label.setDisabled(False) self.parent.receive_slp_amount_e.setDisabled(False) self.parent.receive_slp_amount_label.setDisabled(False) index = 0 while index < self.parent.receive_token_type_combo.count(): self.parent.receive_token_type_combo.setCurrentIndex(index) if self.parent.receive_token_type_combo.currentData( ) == req['token_id']: break index += 1 self.parent.receive_amount_e.setText("") self.parent.receive_slp_amount_e.setText(str(amount)) else: self.parent.gui_object.toggle_cashaddr(Address.FMT_CASHADDR) self.parent.receive_token_type_combo.setCurrentIndex(0) self.parent.receive_slp_token_type_label.setDisabled(True) self.parent.receive_slp_amount_e.setDisabled(True) self.parent.receive_slp_amount_label.setDisabled(True) self.parent.receive_slp_amount_e.setText("") 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.receive_opreturn_rawhex_cb.setChecked(opr_is_raw) self.parent.receive_opreturn_e.setText(opr or '') self.parent.save_request_button.setEnabled(False) self.parent.cash_account_e.set_cash_acct()
def item_changed(self, item): if item is None: return if not self.isItemSelected(item): return addr = str(item.text(1)) 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, '') self.parent.receive_address_e.setText(addr) 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 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_storage_string(), '') self.parent.receive_address_e.setText(addr.to_ui_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)