2 from PyQt4.QtGui import *
3 from PyQt4.QtCore import *
11 self.emit(SIGNAL('timersignal'))
15 class EnterButton(QPushButton):
16 def __init__(self, text, func):
17 QPushButton.__init__(self, text)
19 self.clicked.connect(func)
21 def keyPressEvent(self, e):
22 if e.key() == Qt.Key_Return:
26 def waiting_dialog(f):
32 w.setWindowTitle('Electrum')
42 w.connect(s, SIGNAL('timersignal'), ff)
47 class HelpButton(QPushButton):
48 def __init__(self, text):
49 QPushButton.__init__(self, '?')
50 self.setFocusPolicy(Qt.NoFocus)
51 self.setFixedWidth(20)
52 self.clicked.connect(lambda: QMessageBox.information(self, 'Help', text, 'OK') )
56 def backup_wallet(path):
58 directory, fileName = os.path.split(path)
60 otherpath = unicode( QFileDialog.getOpenFileName(QWidget(), _('Enter a filename for the copy of your wallet'), directory) )
61 if otherpath and path!=otherpath:
62 shutil.copy2(path, otherpath)
63 QMessageBox.information(None,"Wallet backup created", _("A copy of your wallet file was created in")+" '%s'" % str(otherpath))
64 except (IOError, os.error), reason:
65 QMessageBox.critical(None,"Unable to create backup", _("Electrum was unable to copy your wallet file to the specified location.")+"\n" + str(reason))
67 def ok_cancel_buttons(dialog, ok_label=_("OK") ):
70 b = QPushButton(_("Cancel"))
72 b.clicked.connect(dialog.reject)
73 b = QPushButton(ok_label)
75 b.clicked.connect(dialog.accept)
79 def text_dialog(parent, title, label, ok_label):
80 dialog = QDialog(parent)
81 dialog.setMinimumWidth(500)
82 dialog.setWindowTitle(title)
86 l.addWidget(QLabel(label))
89 l.addLayout(ok_cancel_buttons(dialog, ok_label))
91 return unicode(txt.toPlainText())