tadd optional default value to text dialog - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 2be8c7f7edb21df4978a6a68040af3a8eecbb7e6 DIR parent a194edbefb419356701fd20b5f782d9832d5ad61 HTML Author: ThomasV <thomasv@gitorious> Date: Thu, 3 Apr 2014 15:36:31 +0200 add optional default value to text dialog Diffstat: M gui/qt/util.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- DIR diff --git a/gui/qt/util.py b/gui/qt/util.py t@@ -57,7 +57,7 @@ def ok_cancel_buttons(dialog, ok_label=_("OK") ): b.setDefault(True) return hbox -def text_dialog(parent, title, label, ok_label): +def text_dialog(parent, title, label, ok_label, default=None): dialog = QDialog(parent) dialog.setMinimumWidth(500) dialog.setWindowTitle(title) t@@ -66,6 +66,8 @@ def text_dialog(parent, title, label, ok_label): dialog.setLayout(l) l.addWidget(QLabel(label)) txt = QTextEdit() + if default: + txt.setText(default) l.addWidget(txt) l.addLayout(ok_cancel_buttons(dialog, ok_label)) if dialog.exec_():