commit 2be8c7f7edb21df4978a6a68040af3a8eecbb7e6
parent a194edbefb419356701fd20b5f782d9832d5ad61
Author: ThomasV <thomasv@gitorious>
Date: Thu, 3 Apr 2014 15:36:31 +0200
add optional default value to text dialog
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/gui/qt/util.py b/gui/qt/util.py
@@ -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)
@@ -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_():