View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0017751 | Scribus | Scripter | public | 2026-02-15 01:11 | 2026-02-15 16:42 |
| Reporter | Lynn | Assigned To | |||
| Priority | low | Severity | feature | Reproducibility | N/A |
| Status | new | Resolution | open | ||
| Product Version | 1.7.2 | ||||
| Summary | 0017751: Text wrapping in valueDialog for scripter | ||||
| Description | The scripter messageBox() dialog neatly wraps any text you put into it onto multiple lines so it doesn't run off the screen. The valueDialog() does not, so I have to put a lot of newline characters in my dialog strings. It would be great to have text in the valueDialog automatically wrap like they do in the message box. | ||||
| Additional Information | This comes up for me because I like to write scripts where the user can set variables at runtime (what string do you want to insert, where do you want to place the text in this header, etc.) and sometimes the explanations get a bit long. | ||||
| Tags | No tags attached. | ||||
| Patch | No | ||||
|
|
I have mixed feelings here. First: from what I can tell. the behavior is inherited from Qt. And there seem not to be an easy way to get a different behavior by going through a "manual" QInputDialog's setup: setMaximumWidth() did not seem to have any effect on the width:
QInputDialog* dialog = new QInputDialog(ScCore->primaryMainWindow());
dialog->setWindowTitle(QString::fromUtf8(caption.c_str()));
dialog->setLabelText(QString::fromUtf8(message.c_str()));
dialog->setTextValue(QString::fromUtf8(value.c_str()));
dialog->setMaximumWidth(400);
QString txt;
if (dialog->exec()) {
txt = dialog->textValue();
}
Second: The label needs to get very long before messageBox() will wrap the text. In my eyes that already looks too wide. Third: the scribus.* dialogs are there for simple feedback / settings, for more complex onse tkinter (or in the future Qt for Python) is a much better fit. (this is even more valid, if we can find out why tkinter does not work on mack). All in all, I think that for your use case, you should rather add newlines to the label in your Python code. As a consolation gift, here a nice RegExp for doing it:
re.sub(r'(.{1,20})(?:\s|$)', r'\1\n', 'this is some text with multiple words', re.MULTILINE)
|