From 2be8c7f7edb21df4978a6a68040af3a8eecbb7e6 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Thu, 3 Apr 2014 15:36:31 +0200 Subject: [PATCH] add optional default value to text dialog --- gui/qt/util.py | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/gui/qt/util.py b/gui/qt/util.py index c83ed6b..8e1ea2f 100644 --- 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_(): -- 1.7.1