Updates for exchange_rate plugin
Have AmountEdit return an int if is_int, otherwise a Decimal Set the tray tooltip unconditionally. More verbose logging for exchage_rate plugin. Get rate_float from Coindesk as rate can have commas. Plugin tracks windows itself, and doesn't create its own members in the window objects. Clean up the edit handling.
This commit is contained in:
@@ -63,10 +63,9 @@ class AmountEdit(MyLineEdit):
|
||||
|
||||
def get_amount(self):
|
||||
try:
|
||||
x = int(str(self.text()))
|
||||
return (int if self.is_int else Decimal)(str(self.text()))
|
||||
except:
|
||||
return None
|
||||
return x
|
||||
|
||||
|
||||
class BTCAmountEdit(AmountEdit):
|
||||
|
||||
@@ -15,7 +15,6 @@ from electrum import util
|
||||
import seed_dialog
|
||||
from network_dialog import NetworkDialog
|
||||
from util import *
|
||||
from amountedit import AmountEdit
|
||||
|
||||
from electrum.plugins import always_hook, run_hook
|
||||
from electrum.mnemonic import prepare_seed
|
||||
|
||||
@@ -45,7 +45,7 @@ from electrum import SimpleConfig, Wallet, WalletStorage
|
||||
from electrum import Imported_Wallet
|
||||
from electrum import paymentrequest
|
||||
|
||||
from amountedit import AmountEdit, BTCAmountEdit, MyLineEdit, BTCkBEdit
|
||||
from amountedit import BTCAmountEdit, MyLineEdit, BTCkBEdit
|
||||
from network_dialog import NetworkDialog
|
||||
from qrcodewidget import QRCodeWidget, QRDialog
|
||||
from qrtextedit import ScanQRTextEdit, ShowQRTextEdit
|
||||
@@ -523,14 +523,12 @@ class ElectrumWindow(QMainWindow):
|
||||
quote = r.get(0)
|
||||
if quote:
|
||||
text += "%s"%quote
|
||||
|
||||
if self.tray:
|
||||
self.tray.setToolTip("%s (%s)" % (text, self.wallet.basename()))
|
||||
icon = QIcon(":icons/status_connected.png")
|
||||
else:
|
||||
text = _("Not connected")
|
||||
icon = QIcon(":icons/status_disconnected.png")
|
||||
|
||||
self.tray.setToolTip("%s (%s)" % (text, self.wallet.basename()))
|
||||
self.balance_label.setText(text)
|
||||
self.status_button.setIcon( icon )
|
||||
|
||||
|
||||
Reference in New Issue
Block a user