commit 02d8d297dc86d0f24393058d75eae7b6e83509ae
parent b21d08c0af8e381e4acf09505d68e4e9e814e76e
Author: Amir Taaki <genjix@riseup.net>
Date: Sat, 30 Jun 2012 13:47:08 +0200
exchange rate discovery object.
Diffstat:
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/lib/exchange_rate.py b/lib/exchange_rate.py
@@ -0,0 +1,14 @@
+class Exchanger:
+
+ def __init__(self, quote_currencies):
+ self.quote_currencies = quote_currencies
+
+ def exchange(self, btc_amount, quote_currency):
+ assert quote_currency in self.quote_currencies
+
+ return btc_amount * 6
+
+if __name__ == "__main__":
+ exch = Exchanger(("EUR", "USD", "GBP"))
+ print exch.exchange(1, "EUR")
+
diff --git a/lib/gui_lite.py b/lib/gui_lite.py
@@ -2,6 +2,7 @@ from PyQt4.QtCore import *
from PyQt4.QtGui import *
from decimal import Decimal as D
from i18n import _
+import exchange_rate
import random
import re
import sys
@@ -85,6 +86,8 @@ class MiniWindow(QDialog):
self.btc_balance = 0
self.quote_currencies = ("EUR", "USD", "GBP")
+ self.exchanger = exchange_rate.Exchanger(self.quote_currencies)
+
self.balance_label = BalanceLabel(self.change_quote_currency)
self.balance_label.setObjectName("balance_label")
@@ -429,7 +432,6 @@ class MiniDriver(QObject):
def update_balance(self):
conf_balance, unconf_balance = self.wallet.get_balance()
balance = D(conf_balance + unconf_balance)
- balance = D("9879457356")
self.window.set_balances(balance)
if __name__ == "__main__":