URI: 
       tSeparate out new QT util ChoicesLayout - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 237747620752b4697988622e68307ab82ba46bd6
   DIR parent 3e8598c245c55aaa408199bc56800224639bd892
  HTML Author: Neil Booth <kyuupichan@gmail.com>
       Date:   Sat,  9 Jan 2016 15:38:27 +0900
       
       Separate out new QT util ChoicesLayout
       
       For future use elsewhere
       
       Diffstat:
         M gui/qt/installwizard.py             |      31 ++++++-------------------------
         M gui/qt/util.py                      |      31 +++++++++++++++++++++++++++++++
       
       2 files changed, 37 insertions(+), 25 deletions(-)
       ---
   DIR diff --git a/gui/qt/installwizard.py b/gui/qt/installwizard.py
       t@@ -342,35 +342,16 @@ class InstallWizard(WindowModalDialog, WizardBase):
                    network.auto_connect = True
        
            def query_choice(self, msg, choices):
       -        vbox = QVBoxLayout()
       -        self.set_layout(vbox)
       -        if len(msg) > 50:
       -            label = QLabel(msg)
       -            label.setWordWrap(True)
       -            vbox.addWidget(label)
       -            msg = ""
       -        gb2 = QGroupBox(msg)
       -        vbox.addWidget(gb2)
       -
       -        vbox2 = QVBoxLayout()
       -        gb2.setLayout(vbox2)
       -
       -        group2 = QButtonGroup()
       -        for i,c in enumerate(choices):
       -            button = QRadioButton(gb2)
       -            button.setText(c)
       -            vbox2.addWidget(button)
       -            group2.addButton(button)
       -            group2.setId(button, i)
       -            if i==0:
       -                button.setChecked(True)
       -        vbox.addStretch(1)
       +        clayout = ChoicesLayout(msg, choices)
                next_button = OkButton(self, _('Next'))
                next_button.setEnabled(bool(choices))
       -        vbox.addLayout(Buttons(CancelButton(self), next_button))
       +        layout = clayout.layout()
       +        layout.addStretch(1)
       +        layout.addLayout(Buttons(CancelButton(self), next_button))
       +        self.set_layout(layout)
                if not self.exec_():
                    raise UserCancelled
       -        return group2.checkedId()
       +        return clayout.selected_index()
        
            def query_multisig(self, action):
                vbox = QVBoxLayout()
   DIR diff --git a/gui/qt/util.py b/gui/qt/util.py
       t@@ -261,6 +261,37 @@ def text_dialog(parent, title, label, ok_label, default=None):
            if dialog.exec_():
                return unicode(txt.toPlainText())
        
       +class ChoicesLayout(object):
       +    def __init__(self, msg, choices):
       +        vbox = QVBoxLayout()
       +        if len(msg) > 50:
       +            label = QLabel(msg)
       +            label.setWordWrap(True)
       +            vbox.addWidget(label)
       +            msg = ""
       +        gb2 = QGroupBox(msg)
       +        vbox.addWidget(gb2)
       +
       +        vbox2 = QVBoxLayout()
       +        gb2.setLayout(vbox2)
       +
       +        self.group = group = QButtonGroup()
       +        for i,c in enumerate(choices):
       +            button = QRadioButton(gb2)
       +            button.setText(c)
       +            vbox2.addWidget(button)
       +            group.addButton(button)
       +            group.setId(button, i)
       +            if i==0:
       +                button.setChecked(True)
       +        self.vbox = vbox
       +
       +    def layout(self):
       +        return self.vbox
       +
       +    def selected_index(self):
       +        return self.group.checkedId()
       +
        def address_field(addresses):
            hbox = QHBoxLayout()
            address_e = QLineEdit()