commit 897a5d34ed6c2528df6c6d057276c08f3ff62fc3
parent da91a395b16657418a6bff70e35eb0dfb2975057
Author: ThomasV <thomasv@electrum.org>
Date: Thu, 3 Sep 2015 16:52:40 +0200
share contacts and invoices objects between windows
Diffstat:
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/gui/qt/__init__.py b/gui/qt/__init__.py
@@ -32,6 +32,8 @@ import PyQt4.QtCore as QtCore
from electrum.i18n import _, set_language
from electrum.plugins import run_hook
from electrum import SimpleConfig, Wallet, WalletStorage
+from electrum.paymentrequest import InvoiceStore
+from electrum.contacts import Contacts
try:
import icons_rc
@@ -68,7 +70,9 @@ class ElectrumGui:
self.app = QApplication(sys.argv)
self.app.installEventFilter(self.efilter)
self.timer = Timer()
-
+ # shared objects
+ self.invoices = InvoiceStore(self.config)
+ self.contacts = Contacts(self.config)
# init tray
self.dark_icon = self.config.get("dark_icon", False)
self.tray = QSystemTrayIcon(self.tray_icon(), None)
diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py
@@ -44,7 +44,6 @@ from electrum import util, bitcoin, commands, Wallet
from electrum import SimpleConfig, Wallet, WalletStorage
from electrum import Imported_Wallet
from electrum import paymentrequest
-from electrum.contacts import Contacts
from amountedit import AmountEdit, BTCAmountEdit, MyLineEdit, BTCkBEdit
from network_dialog import NetworkDialog
@@ -82,7 +81,7 @@ class StatusBarButton(QPushButton):
from electrum.paymentrequest import PR_UNPAID, PR_PAID, PR_UNKNOWN, PR_EXPIRED
-from electrum.paymentrequest import PaymentRequest, InvoiceStore, get_payment_request
+from electrum.paymentrequest import PaymentRequest, get_payment_request
pr_icons = {
PR_UNPAID:":icons/unpaid.png",
@@ -114,14 +113,12 @@ class ElectrumWindow(QMainWindow):
self.config = config
self.network = network
self.wallet = None
-
self.gui_object = gui_object
+ self.invoices = gui_object.invoices
+ self.contacts = gui_object.contacts
self.tray = gui_object.tray
self.app = gui_object.app
- self.invoices = InvoiceStore(self.config)
- self.contacts = Contacts(self.config)
-
self.create_status_bar()
self.need_update = threading.Event()