当前位置: 首页>>代码示例>>Python>>正文


Python AmountEdit.text方法代码示例

本文整理汇总了Python中electrum_gui.qt.amountedit.AmountEdit.text方法的典型用法代码示例。如果您正苦于以下问题:Python AmountEdit.text方法的具体用法?Python AmountEdit.text怎么用?Python AmountEdit.text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在electrum_gui.qt.amountedit.AmountEdit的用法示例。


在下文中一共展示了AmountEdit.text方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setup_google_auth

# 需要导入模块: from electrum_gui.qt.amountedit import AmountEdit [as 别名]
# 或者: from electrum_gui.qt.amountedit.AmountEdit import text [as 别名]
    def setup_google_auth(self, window, _id, otp_secret):
        uri = "otpauth://totp/%s?secret=%s"%('trustedcoin.com', otp_secret)
        vbox = QVBoxLayout()
        window.set_layout(vbox)
        vbox.addWidget(QLabel("Please scan this QR code in Google Authenticator."))
        qrw = QRCodeWidget(uri)
        vbox.addWidget(qrw, 1)
        #vbox.addWidget(QLabel(data), 0, Qt.AlignHCenter)

        hbox = QHBoxLayout()
        msg = _('Then, enter your Google Authenticator code:')
        hbox.addWidget(QLabel(msg))
        pw = AmountEdit(None, is_int = True)
        pw.setFocus(True)
        hbox.addWidget(pw)
        hbox.addStretch(1)
        vbox.addLayout(hbox)

        hbox, b = ok_cancel_buttons2(window, _('Next'))
        b.setEnabled(False)
        vbox.addLayout(hbox)
        pw.textChanged.connect(lambda: b.setEnabled(len(pw.text())==6))

        window.exec_()
        otp = pw.get_amount()
        try:
            server.auth(_id, otp)
        except:
            self.window.show_message('Incorrect password, aborting')
            return

        return True
开发者ID:Henne123,项目名称:electrum-wlc,代码行数:34,代码来源:trustedcoin.py

示例2: fiat_dialog

# 需要导入模块: from electrum_gui.qt.amountedit import AmountEdit [as 别名]
# 或者: from electrum_gui.qt.amountedit.AmountEdit import text [as 别名]
    def fiat_dialog(self):
        if not self.config.get('use_exchange_rate'):
          self.gui.main_window.show_message(_("To use this feature, first enable the exchange rate plugin."))
          return
        
        if not self.gui.main_window.network.is_connected():
          self.gui.main_window.show_message(_("To use this feature, you must have a network connection."))
          return

        quote_currency = self.config.get("currency", "EUR")

        d = QDialog(self.gui.main_window)
        d.setWindowTitle("Fiat")
        vbox = QVBoxLayout(d)
        text = "Amount to Send in " + quote_currency
        vbox.addWidget(QLabel(_(text)+':'))

        grid = QGridLayout()
        fiat_e = AmountEdit(self.fiat_unit)
        grid.addWidget(fiat_e, 1, 0)

        r = {}
        self.set_quote_text(100000000, r)
        quote = r.get(0)
        if quote:
          text = "  1 BTC=%s"%quote
          grid.addWidget(QLabel(_(text)), 4, 0, 3, 0)

        vbox.addLayout(grid)
        vbox.addLayout(ok_cancel_buttons(d))

        if not d.exec_():
            return

        fiat = str(fiat_e.text())

        if str(fiat) == "" or str(fiat) == ".":
            fiat = "0"

        r = {}
        self.set_quote_text(100000000, r)
        quote = r.get(0)
        if not quote:
            self.gui.main_window.show_message(_("Exchange rate not available.  Please check your network connection."))
            return
        else:
            quote = quote[:-4]
            btcamount = Decimal(fiat) / Decimal(quote)
            if str(self.gui.main_window.base_unit()) == "mBTC":
                btcamount = btcamount * 1000
            quote = "%.8f"%btcamount
            self.gui.main_window.amount_e.setText( quote )
开发者ID:rdymac,项目名称:electrum,代码行数:54,代码来源:exchange_rate.py

示例3: setup_google_auth

# 需要导入模块: from electrum_gui.qt.amountedit import AmountEdit [as 别名]
# 或者: from electrum_gui.qt.amountedit.AmountEdit import text [as 别名]
    def setup_google_auth(self, window, _id, otp_secret):
        vbox = QVBoxLayout()
        window.set_layout(vbox)
        if otp_secret is not None:
            uri = "otpauth://totp/%s?secret=%s" % ("trustedcoin.com", otp_secret)
            vbox.addWidget(QLabel("Please scan this QR code in Google Authenticator."))
            qrw = QRCodeWidget(uri)
            vbox.addWidget(qrw, 1)
            msg = _("Then, enter your Google Authenticator code:")
        else:
            label = QLabel(
                "This wallet is already registered, but it was never authenticated. To finalize your registration, please enter your Google Authenticator Code. If you do not have this code, delete the wallet file and start a new registration"
            )
            label.setWordWrap(1)
            vbox.addWidget(label)
            msg = _("Google Authenticator code:")

        hbox = QHBoxLayout()
        hbox.addWidget(QLabel(msg))
        pw = AmountEdit(None, is_int=True)
        pw.setFocus(True)
        hbox.addWidget(pw)
        hbox.addStretch(1)
        vbox.addLayout(hbox)

        b = OkButton(window, _("Next"))
        b.setEnabled(False)
        vbox.addLayout(Buttons(CancelButton(window), b))
        pw.textChanged.connect(lambda: b.setEnabled(len(pw.text()) == 6))

        while True:
            if not window.exec_():
                return False
            otp = pw.get_amount()
            try:
                server.auth(_id, otp)
                return True
            except:
                QMessageBox.information(self.window, _("Message"), _("Incorrect password"), _("OK"))
                pw.setText("")
开发者ID:badzso,项目名称:electrum,代码行数:42,代码来源:trustedcoin.py

示例4: Plugin

# 需要导入模块: from electrum_gui.qt.amountedit import AmountEdit [as 别名]
# 或者: from electrum_gui.qt.amountedit.AmountEdit import text [as 别名]
class Plugin(BasePlugin):

    def fullname(self):
        return "Exchange rates"

    def description(self):
        return """exchange rates, retrieved from blockchain.info, CoinDesk, or Coinbase"""


    def __init__(self,a,b):
        BasePlugin.__init__(self,a,b)
        self.currencies = [self.fiat_unit()]
        self.exchanges = [self.config.get('use_exchange', "Blockchain")]
        self.exchanger = None

    @hook
    def init_qt(self, gui):
        self.gui = gui
        self.win = self.gui.main_window
        self.win.connect(self.win, SIGNAL("refresh_currencies()"), self.win.update_status)
        self.btc_rate = Decimal("0.0")
        if self.exchanger is None:
            # Do price discovery
            self.exchanger = Exchanger(self)
            self.exchanger.start()
            self.gui.exchanger = self.exchanger #
            self.add_fiat_edit()
            self.win.update_status()

    def close(self):
        self.exchanger.stop()
        self.exchanger = None
        self.win.tabs.removeTab(1)
        self.win.tabs.insertTab(1, self.win.create_send_tab(), _('Send'))
        self.win.update_status()

    def set_currencies(self, currency_options):
        self.currencies = sorted(currency_options)
        self.win.emit(SIGNAL("refresh_currencies()"))
        self.win.emit(SIGNAL("refresh_currencies_combo()"))

    @hook
    def get_fiat_balance_text(self, btc_balance, r):
        # return balance as: 1.23 USD
        r[0] = self.create_fiat_balance_text(Decimal(btc_balance) / 100000000)

    def get_fiat_price_text(self, r):
        # return BTC price as: 123.45 USD
        r[0] = self.create_fiat_balance_text(1)
        quote = r[0]
        if quote:
            r[0] = "%s"%quote

    @hook
    def get_fiat_status_text(self, btc_balance, r2):
        # return status as:   (1.23 USD)    1 BTC~123.45 USD
        text = ""
        r = {}
        self.get_fiat_price_text(r)
        quote = r.get(0)
        if quote:
            price_text = "1 BTC~%s"%quote
            fiat_currency = quote[-3:]
            btc_price = self.btc_rate
            fiat_balance = Decimal(btc_price) * (Decimal(btc_balance)/100000000)
            balance_text = "(%.2f %s)" % (fiat_balance,fiat_currency)
            text = "  " + balance_text + "     " + price_text + " "
        r2[0] = text

    def create_fiat_balance_text(self, btc_balance):
        quote_currency = self.fiat_unit()
        self.exchanger.use_exchange = self.config.get("use_exchange", "Blockchain")
        cur_rate = self.exchanger.exchange(Decimal("1.0"), quote_currency)
        if cur_rate is None:
            quote_text = ""
        else:
            quote_balance = btc_balance * Decimal(cur_rate)
            self.btc_rate = cur_rate
            quote_text = "%.2f %s" % (quote_balance, quote_currency)
        return quote_text

    @hook
    def load_wallet(self, wallet):
        self.wallet = wallet
        tx_list = {}
        for item in self.wallet.get_tx_history(self.wallet.storage.get("current_account", None)):
            tx_hash, conf, is_mine, value, fee, balance, timestamp = item
            tx_list[tx_hash] = {'value': value, 'timestamp': timestamp, 'balance': balance}

        self.tx_list = tx_list


    def requires_settings(self):
        return True


    @hook
    def history_tab_update(self):
        if self.config.get('history_rates', 'unchecked') == "checked":
            cur_exchange = self.config.get('use_exchange', "Blockchain")
#.........这里部分代码省略.........
开发者ID:azhar3339,项目名称:electrum,代码行数:103,代码来源:exchange_rate.py


注:本文中的electrum_gui.qt.amountedit.AmountEdit.text方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。