electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 893e54b7e30c6c2c470024969a81f1f99e982eaf
parent a27d1453c860309626d7b9c0600353ff35e74167
Author: ThomasV <thomasv@gitorious>
Date:   Mon, 13 Feb 2012 19:09:44 +0100

simplify

Diffstat:
Mclient/gui_qt.py | 56++++++++++++++------------------------------------------
1 file changed, 14 insertions(+), 42 deletions(-)

diff --git a/client/gui_qt.py b/client/gui_qt.py @@ -45,6 +45,16 @@ class ElectrumWindow(QMainWindow): QShortcut(QKeySequence("Ctrl+PgUp"), self, lambda: tabs.setCurrentIndex( (tabs.currentIndex() - 1 )%tabs.count() )) QShortcut(QKeySequence("Ctrl+PgDown"), self, lambda: tabs.setCurrentIndex( (tabs.currentIndex() + 1 )%tabs.count() )) + def ok_cancel_buttons(self,d): + hbox = QHBoxLayout() + hbox.addStretch(1) + b = QPushButton("OK") + hbox.addWidget(b) + b.clicked.connect(d.accept) + b = QPushButton("Cancel") + hbox.addWidget(b) + b.clicked.connect(d.reject) + return hbox def connect_slots(self, sender): self.connect(sender, QtCore.SIGNAL('testsignal'), self.update_wallet) @@ -508,16 +518,7 @@ class ElectrumWindow(QMainWindow): grid.addWidget(pw, 1, 1) vbox.addLayout(grid) - hbox = QHBoxLayout() - hbox.addStretch(1) - b = QPushButton("OK") - hbox.addWidget(b) - b.clicked.connect(d.accept) - b = QPushButton("Cancel") - hbox.addWidget(b) - b.clicked.connect(d.reject) - vbox.addLayout(hbox) - + vbox.addLayout(self.ok_cancel_buttons(d)) d.setLayout(vbox) if not d.exec_(): return @@ -550,18 +551,7 @@ class ElectrumWindow(QMainWindow): grid.addWidget(QLabel('Confirm Password'), 3, 0) grid.addWidget(conf_pw, 3, 1) - hbox = QHBoxLayout() - hbox.addStretch(1) - b = QPushButton("OK") - hbox.addWidget(b) - b.clicked.connect(d.accept) - b = QPushButton("Cancel") - hbox.addWidget(b) - b.clicked.connect(d.reject) - vbox = QVBoxLayout() - vbox.addLayout(grid) - vbox.addLayout(hbox) - + vbox.addLayout(self.ok_cancel_buttons(d)) d.setLayout(vbox) if not d.exec_(): return @@ -600,16 +590,7 @@ class ElectrumWindow(QMainWindow): grid.addWidget(fee_line, 2, 1) vbox.addLayout(grid) - hbox = QHBoxLayout() - hbox.addStretch(1) - b = QPushButton("OK") - hbox.addWidget(b) - b.clicked.connect(d.accept) - b = QPushButton("Cancel") - hbox.addWidget(b) - b.clicked.connect(d.reject) - vbox.addLayout(hbox) - + vbox.addLayout(self.ok_cancel_buttons(d)) d.setLayout(vbox) if not d.exec_(): return @@ -653,16 +634,7 @@ class ElectrumWindow(QMainWindow): grid.addWidget(host_line, 2, 1) vbox.addLayout(grid) - hbox = QHBoxLayout() - hbox.addStretch(1) - b = QPushButton("OK") - hbox.addWidget(b) - b.clicked.connect(d.accept) - b = QPushButton("Cancel") - hbox.addWidget(b) - b.clicked.connect(d.reject) - vbox.addLayout(hbox) - + vbox.addLayout(self.ok_cancel_buttons(d)) d.setLayout(vbox) if not d.exec_(): return