commit 2515fc9b6a2669e32820a81b527eccdaac7a21d8
parent b6e7dbe5f728bf520a81205f96d13d81f8820f9c
Author: ThomasV <thomasv@gitorious>
Date: Thu, 6 Aug 2015 12:56:48 +0200
use blue color to denote auto-filled values (fee, exchange rates plugin)
Diffstat:
3 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py
@@ -997,21 +997,22 @@ class ElectrumWindow(QMainWindow):
def entry_changed():
text = ""
if self.not_enough_funds:
- amt_color, fee_color = 'red', 'red'
+ amt_color, fee_color = RED_FG, RED_FG
text = _( "Not enough funds" )
c, u, x = self.wallet.get_frozen_balance()
if c+u+x:
text += ' (' + self.format_amount(c+u+x).strip() + ' ' + self.base_unit() + ' ' +_("are frozen") + ')'
+
elif self.fee_e.isModified():
- amt_color, fee_color = 'black', 'blue'
+ amt_color, fee_color = BLACK_FG, BLACK_FG
+ elif self.amount_e.isModified():
+ amt_color, fee_color = BLACK_FG, BLUE_FG
else:
- amt_color, fee_color = 'black', 'black'
+ amt_color, fee_color = BLUE_FG, BLUE_FG
+
self.statusBar().showMessage(text)
- palette = QPalette()
- palette.setColor(self.amount_e.foregroundRole(), QColor(amt_color))
- self.amount_e.setPalette(palette)
- palette.setColor(self.amount_e.foregroundRole(), QColor(fee_color))
- self.fee_e.setPalette(palette)
+ self.amount_e.setStyleSheet(amt_color)
+ self.fee_e.setStyleSheet(fee_color)
self.amount_e.textChanged.connect(entry_changed)
self.fee_e.textChanged.connect(entry_changed)
diff --git a/gui/qt/util.py b/gui/qt/util.py
@@ -15,9 +15,11 @@ elif platform.system() == 'Darwin':
else:
MONOSPACE_FONT = 'monospace'
-
GREEN_BG = "QWidget {background-color:#80ff80;}"
RED_BG = "QWidget {background-color:#ffcccc;}"
+RED_FG = "QWidget {color:red;}"
+BLUE_FG = "QWidget {color:blue;}"
+BLACK_FG = "QWidget {color:black;}"
class WaitingDialog(QThread):
diff --git a/plugins/exchange_rate.py b/plugins/exchange_rate.py
@@ -512,6 +512,7 @@ class Plugin(BasePlugin):
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:
@@ -522,9 +523,11 @@ class Plugin(BasePlugin):
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()
@@ -536,4 +539,9 @@ class Plugin(BasePlugin):
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('')