コード例 #1
0
ファイル: screens.py プロジェクト: wagerr/Wagerr-Electrum
 def get_card(self, tx_hash, tx_mined_status, value, balance):
     status, status_str = self.app.wallet.get_tx_status(
         tx_hash, tx_mined_status)
     icon = "atlas://electrum/gui/kivy/theming/light/" + TX_ICONS[status]
     label = self.app.wallet.get_label(tx_hash) if tx_hash else _(
         'Pruned transaction outputs')
     ri = {}
     ri['screen'] = self
     ri['tx_hash'] = tx_hash
     ri['icon'] = icon
     ri['date'] = status_str
     ri['message'] = label
     ri['confirmations'] = tx_mined_status.conf
     if value is not None:
         ri['is_mine'] = value < 0
         if value < 0: value = -value
         ri['amount'] = self.app.format_amount_and_units(value)
         if self.app.fiat_unit:
             fx = self.app.fx
             fiat_value = value / Decimal(
                 bitcoin.COIN) * self.app.wallet.price_at_timestamp(
                     tx_hash, fx.timestamp_rate)
             fiat_value = Fiat(fiat_value, fx.ccy)
             ri['quote_text'] = fiat_value.to_ui_string()
     return ri
コード例 #2
0
 def get_card(self, tx_hash, height, conf, timestamp, value, balance):
     status, status_str = self.app.wallet.get_tx_status(
         tx_hash, height, conf, timestamp)
     icon = "atlas://gui/kivy/theming/light/" + TX_ICONS[status]
     label = self.app.wallet.get_label(tx_hash) if tx_hash else _(
         'Pruned transaction outputs')
     ri = self.cards.get(tx_hash)
     if ri is None:
         ri = Factory.HistoryItem()
         ri.screen = self
         ri.tx_hash = tx_hash
         self.cards[tx_hash] = ri
     ri.icon = icon
     ri.date = status_str
     ri.message = label
     ri.confirmations = conf
     if value is not None:
         ri.is_mine = value < 0
         if value < 0: value = -value
         ri.amount = self.app.format_amount_and_units(value)
         if self.app.fiat_unit:
             fx = self.app.fx
             fiat_value = value / Decimal(
                 bitcoin.COIN) * self.app.wallet.price_at_timestamp(
                     tx_hash, fx.timestamp_rate)
             fiat_value = Fiat(fiat_value, fx.ccy)
             ri.quote_text = str(fiat_value)
     return ri