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


Python AmountEdit.setFrozen方法代码示例

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


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

示例1: add_send_edit

# 需要导入模块: from electrum_gui.qt.amountedit import AmountEdit [as 别名]
# 或者: from electrum_gui.qt.amountedit.AmountEdit import setFrozen [as 别名]
 def add_send_edit(self):
     fiat_e = AmountEdit(self.fiat_unit)
     btc_e = self.win.amount_e
     fee_e = self.win.fee_e
     self.connect_fields(btc_e, fiat_e, fee_e)
     self.win.send_grid.addWidget(fiat_e, 4, 3, Qt.AlignHCenter)
     btc_e.frozen.connect(lambda: fiat_e.setFrozen(btc_e.isReadOnly()))
开发者ID:kaykurokawa,项目名称:electrum,代码行数:9,代码来源:exchange_rate.py

示例2: on_new_window

# 需要导入模块: from electrum_gui.qt.amountedit import AmountEdit [as 别名]
# 或者: from electrum_gui.qt.amountedit.AmountEdit import setFrozen [as 别名]
    def on_new_window(self, window):
        # Additional send and receive edit boxes
        send_e = AmountEdit(self.config_ccy)
        window.send_grid.addWidget(send_e, 4, 2, Qt.AlignLeft)
        window.amount_e.frozen.connect(lambda: send_e.setFrozen(window.amount_e.isReadOnly()))
        receive_e = AmountEdit(self.config_ccy)
        window.receive_grid.addWidget(receive_e, 2, 2, Qt.AlignLeft)

        self.windows[window] = {"edits": (send_e, receive_e), "last_edited": {}}
        self.connect_fields(window, window.amount_e, send_e, window.fee_e)
        self.connect_fields(window, window.receive_amount_e, receive_e, None)
        window.history_list.refresh_headers()
        window.update_status()
开发者ID:09128319047,项目名称:electrum,代码行数:15,代码来源:exchange_rate.py

示例3: on_new_window

# 需要导入模块: from electrum_gui.qt.amountedit import AmountEdit [as 别名]
# 或者: from electrum_gui.qt.amountedit.AmountEdit import setFrozen [as 别名]
 def on_new_window(self, window):
     # Additional send and receive edit boxes
     send_e = AmountEdit(self.get_currency)
     window.send_grid.addWidget(send_e, 4, 2, Qt.AlignLeft)
     window.amount_e.frozen.connect(lambda: send_e.setFrozen(window.amount_e.isReadOnly()))
     receive_e = AmountEdit(self.get_currency)
     window.receive_grid.addWidget(receive_e, 2, 2, Qt.AlignLeft)
     window.fiat_send_e = send_e
     window.fiat_receive_e = receive_e
     self.connect_fields(window, window.amount_e, send_e, window.fee_e)
     self.connect_fields(window, window.receive_amount_e, receive_e, None)
     window.history_list.refresh_headers()
     window.update_status()
     window.connect(window.app, SIGNAL("new_fx_quotes"), lambda: self.on_fx_quotes(window))
     window.connect(window.app, SIGNAL("new_fx_history"), lambda: self.on_fx_history(window))
     window.connect(window.app, SIGNAL("close_fx_plugin"), lambda: self.restore_window(window))
     window.connect(window.app, SIGNAL("refresh_headers"), window.history_list.refresh_headers)
开发者ID:bitbandi,项目名称:electrum,代码行数:19,代码来源:qt.py

示例4: Plugin

# 需要导入模块: from electrum_gui.qt.amountedit import AmountEdit [as 别名]
# 或者: from electrum_gui.qt.amountedit.AmountEdit import setFrozen [as 别名]

#.........这里部分代码省略.........
                else:
                    disable_check()
                set_currencies(combo)
                self.win.update_status()

        def on_change_hist(checked):
            if checked:
                self.config.set_key('history_rates', 'checked')
                self.history_tab_update()
            else:
                self.config.set_key('history_rates', 'unchecked')
                self.gui.main_window.history_list.setHeaderLabels( [ '', _('Date'), _('Description') , _('Amount'), _('Balance')] )
                self.gui.main_window.history_list.setColumnCount(5)
                for i,width in enumerate(self.gui.main_window.column_widths['history']):
                    self.gui.main_window.history_list.setColumnWidth(i, width)

        def set_hist_check(hist_checkbox):
            cur_exchange = self.config.get('use_exchange', "Blockchain")
            hist_checkbox.setEnabled(cur_exchange in ["CoinDesk", "Winkdex", "BitcoinVenezuela"])

        def set_currencies(combo):
            try:
                combo.blockSignals(True)
                current_currency = self.fiat_unit()
                combo.clear()
            except Exception:
                return
            combo.addItems(self.currencies)
            try:
                index = self.currencies.index(current_currency)
            except Exception:
                index = 0
            combo.blockSignals(False)
            combo.setCurrentIndex(index)

        def set_exchanges(combo_ex):
            try:
                combo_ex.clear()
            except Exception:
                return
            combo_ex.addItems(self.exchanges)
            try:
                index = self.exchanges.index(self.config.get('use_exchange', "Blockchain"))
            except Exception:
                index = 0
            combo_ex.setCurrentIndex(index)

        def ok_clicked():
            if self.config.get('use_exchange', "Blockchain") in ["CoinDesk", "itBit"]:
                self.exchanger.query_rates.set()
            d.accept();

        set_exchanges(combo_ex)
        set_currencies(combo)
        set_hist_check(hist_checkbox)
        combo.currentIndexChanged.connect(on_change)
        combo_ex.currentIndexChanged.connect(on_change_ex)
        hist_checkbox.stateChanged.connect(on_change_hist)
        combo.connect(self.win, SIGNAL('refresh_currencies_combo()'), lambda: set_currencies(combo))
        combo_ex.connect(d, SIGNAL('refresh_exchanges_combo()'), lambda: set_exchanges(combo_ex))
        ok_button.clicked.connect(lambda: ok_clicked())
        layout.addWidget(combo,1,1)
        layout.addWidget(combo_ex,0,1)
        layout.addWidget(hist_checkbox,2,1)
        layout.addWidget(ok_button,3,1)

        if d.exec_():
            return True
        else:
            return False

    def fiat_unit(self):
        return self.config.get("currency", "EUR")

    def add_fiat_edit(self):
        self.fiat_e = AmountEdit(self.fiat_unit)
        self.btc_e = self.win.amount_e
        grid = self.btc_e.parent()
        def fiat_changed():
            try:
                fiat_amount = Decimal(str(self.fiat_e.text()))
            except:
                self.btc_e.setText("")
                return
            exchange_rate = self.exchanger.exchange(Decimal("1.0"), self.fiat_unit())
            if exchange_rate is not None:
                btc_amount = fiat_amount/exchange_rate
                self.btc_e.setAmount(int(btc_amount*Decimal(100000000)))
        self.fiat_e.textEdited.connect(fiat_changed)
        def btc_changed():
            btc_amount = self.btc_e.get_amount()
            if btc_amount is None:
                self.fiat_e.setText("")
                return
            fiat_amount = self.exchanger.exchange(Decimal(btc_amount)/Decimal(100000000), self.fiat_unit())
            if fiat_amount is not None:
                self.fiat_e.setText("%.2f"%fiat_amount)
        self.btc_e.textEdited.connect(btc_changed)
        self.btc_e.frozen.connect(lambda: self.fiat_e.setFrozen(self.btc_e.isReadOnly()))
        self.win.send_grid.addWidget(self.fiat_e, 4, 3, Qt.AlignHCenter)
开发者ID:azhar3339,项目名称:electrum,代码行数:104,代码来源:exchange_rate.py

示例5: Plugin

# 需要导入模块: from electrum_gui.qt.amountedit import AmountEdit [as 别名]
# 或者: from electrum_gui.qt.amountedit.AmountEdit import setFrozen [as 别名]

#.........这里部分代码省略.........
            try:
                index = self.currencies.index(current_currency)
            except Exception:
                index = 0
            combo.blockSignals(False)
            combo.setCurrentIndex(index)

        def set_exchanges(combo_ex):
            try:
                combo_ex.clear()
            except Exception:
                return
            combo_ex.addItems(self.exchanges)
            try:
                index = self.exchanges.index(self.config.get("use_exchange", "Blockchain"))
            except Exception:
                index = 0
            combo_ex.setCurrentIndex(index)

        def ok_clicked():
            if self.config.get("use_exchange", "Blockchain") in ["CoinDesk", "itBit"]:
                self.exchanger.query_rates.set()
            d.accept()

        set_exchanges(combo_ex)
        set_currencies(combo)
        set_hist_check(hist_checkbox)
        combo.currentIndexChanged.connect(on_change)
        combo_ex.currentIndexChanged.connect(on_change_ex)
        hist_checkbox.stateChanged.connect(on_change_hist)
        combo.connect(self.win, SIGNAL("refresh_currencies_combo()"), lambda: set_currencies(combo))
        combo_ex.connect(d, SIGNAL("refresh_exchanges_combo()"), lambda: set_exchanges(combo_ex))
        ok_button.clicked.connect(lambda: ok_clicked())
        layout.addWidget(combo, 1, 1)
        layout.addWidget(combo_ex, 0, 1)
        layout.addWidget(hist_checkbox, 2, 1)
        layout.addWidget(ok_button, 3, 1)

        if d.exec_():
            return True
        else:
            return False

    def fiat_unit(self):
        return self.config.get("currency", "EUR")

    def add_send_edit(self):
        self.send_fiat_e = AmountEdit(self.fiat_unit)
        btc_e = self.win.amount_e
        fee_e = self.win.fee_e
        self.connect_fields(btc_e, self.send_fiat_e, fee_e)
        self.win.send_grid.addWidget(self.send_fiat_e, 4, 3, Qt.AlignHCenter)
        btc_e.frozen.connect(lambda: self.send_fiat_e.setFrozen(btc_e.isReadOnly()))

    def add_receive_edit(self):
        self.receive_fiat_e = AmountEdit(self.fiat_unit)
        btc_e = self.win.receive_amount_e
        self.connect_fields(btc_e, self.receive_fiat_e, None)
        self.win.receive_grid.addWidget(self.receive_fiat_e, 2, 3, Qt.AlignHCenter)

    def connect_fields(self, btc_e, fiat_e, fee_e):
        def fiat_changed():
            fiat_e.setStyleSheet(BLACK_FG)
            try:
                fiat_amount = Decimal(str(fiat_e.text()))
            except:
                btc_e.setText("")
                if fee_e:
                    fee_e.setText("")
                return
            exchange_rate = self.exchanger.exchange(Decimal("1.0"), self.fiat_unit())
            if exchange_rate is not None:
                btc_amount = fiat_amount / exchange_rate
                btc_e.setAmount(int(btc_amount * Decimal(COIN)))
                btc_e.setStyleSheet(BLUE_FG)
                if fee_e:
                    self.win.update_fee()

        fiat_e.textEdited.connect(fiat_changed)

        def btc_changed():
            btc_e.setStyleSheet(BLACK_FG)
            if self.exchanger is None:
                return
            btc_amount = btc_e.get_amount()
            if btc_amount is None:
                fiat_e.setText("")
                return
            fiat_amount = self.exchanger.exchange(Decimal(btc_amount) / Decimal(COIN), self.fiat_unit())
            if fiat_amount is not None:
                pos = fiat_e.cursorPosition()
                fiat_e.setText("%.2f" % fiat_amount)
                fiat_e.setCursorPosition(pos)
                fiat_e.setStyleSheet(BLUE_FG)

        btc_e.textEdited.connect(btc_changed)

    @hook
    def do_clear(self):
        self.send_fiat_e.setText("")
开发者ID:TupambaeNet,项目名称:electrum,代码行数:104,代码来源:exchange_rate.py


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