URI: 
       taccess to global configuration using set_config and get_config - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit c07c1c58ed1f753f02a55039f3ef65157d680964
   DIR parent 2b2a8d17df1afa8d4b7157280d3484142425cc8a
  HTML Author: ThomasV <thomasv@gitorious>
       Date:   Tue, 17 Jun 2014 12:03:41 +0200
       
       access to global configuration using set_config and get_config
       
       Diffstat:
         M gui/qt/qrcodewidget.py              |      19 ++++++++++---------
         M lib/__init__.py                     |       2 +-
         M lib/simple_config.py                |      11 ++++++++++-
       
       3 files changed, 21 insertions(+), 11 deletions(-)
       ---
   DIR diff --git a/gui/qt/qrcodewidget.py b/gui/qt/qrcodewidget.py
       t@@ -6,6 +6,7 @@ import PyQt4.QtGui as QtGui
        import os
        import qrcode
        
       +import electrum
        from electrum import bmp
        from electrum.i18n import _
        
       t@@ -99,9 +100,9 @@ class QRDialog(QDialog):
                hbox = QHBoxLayout()
                hbox.addStretch(1)
        
       -        if parent:
       -            self.config = parent.config
       -            filename = os.path.join(self.config.path, "qrcode.bmp")
       +        config = electrum.get_config()
       +        if config:
       +            filename = os.path.join(config.path, "qrcode.bmp")
        
                    def print_qr():
                        bmp.save_qrcode(qrw.qr, filename)
       t@@ -112,13 +113,13 @@ class QRDialog(QDialog):
                        self.parent().app.clipboard().setImage(QImage(filename))
                        QMessageBox.information(None, _('Message'), _("QR code saved to clipboard"), _('OK'))
        
       -                b = QPushButton(_("Copy"))
       -                hbox.addWidget(b)
       -                b.clicked.connect(copy_to_clipboard)
       +            b = QPushButton(_("Copy"))
       +            hbox.addWidget(b)
       +            b.clicked.connect(copy_to_clipboard)
        
       -                b = QPushButton(_("Save"))
       -                hbox.addWidget(b)
       -                b.clicked.connect(print_qr)
       +            b = QPushButton(_("Save"))
       +            hbox.addWidget(b)
       +            b.clicked.connect(print_qr)
        
                b = QPushButton(_("Close"))
                hbox.addWidget(b)
   DIR diff --git a/lib/__init__.py b/lib/__init__.py
       t@@ -5,7 +5,7 @@ from wallet import Wallet, Wallet_2of2, Wallet_2of3, Imported_Wallet
        from verifier import TxVerifier
        from network import Network, DEFAULT_SERVERS, DEFAULT_PORTS, pick_random_server
        from interface import Interface
       -from simple_config import SimpleConfig
       +from simple_config import SimpleConfig, get_config, set_config
        import bitcoin
        import account
        import transaction
   DIR diff --git a/lib/simple_config.py b/lib/simple_config.py
       t@@ -6,6 +6,15 @@ import os
        from util import user_dir, print_error, print_msg
        
        
       +config = None
       +def get_config():
       +    global config
       +    return config
       +
       +def set_config(c):
       +    global config
       +    config = c
       +
        
        class SimpleConfig:
            """
       t@@ -32,7 +41,7 @@ a SimpleConfig instance then reads the wallet file.
                self.user_config = {}
                self.read_user_config()
        
       -
       +        set_config(self)