Subversion Repositories Scribus

Rev

Rev 23467 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
10646 cbradney 1
<html>
2
<head>
3
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
4
        <title>Using Dialogs from Scribus</title>
5
</head>
18507 gpittman 6
<style>
7
@import "manual.css";
8
</style>
10646 cbradney 9
<body>
559 cbradney 10
<h2>Using Dialogs from Scribus</h2>
11
 
12
<dl>
1041 cbradney 13
 
14
<dt><a name="-fileDialog"><strong>fileDialog</strong></a>(...)</dt>
7440 subik 15
<dd><code>fileDialog("caption", ["filter", "defaultname", haspreview, issave, isdir])<br> -&gt; string with filename</code>
2267 subik 16
<p>Shows a File Open dialog box with the caption "caption". Files are filtered with the filter string "filter". A default filename or file path can also supplied, leave this string empty when you don't want to use it. A value of True for haspreview enables a small preview widget in the FileSelect box. When the issave parameter is set to True the dialog acts like a "Save As" dialog otherwise it acts like a "File Open Dialog". When the isdir parameter is True the dialog shows and returns only directories. The default for all of the opional parameters is False.<p>
1041 cbradney 17
<p>The filter, if specified, takes the form 'comment (*.type *.type2 ...)'. For example 'Images (*.png *.xpm *.jpg)'.</p>
18
<p>Refer to the Qt-Documentation for QFileDialog for details on filters.</p>
22441 gpittman 19
<p>Examples:</p>
20
<p><b>fileDialog('Open input', 'CSV files (*.csv)')</p>
21
<p>fileDialog('Save report', defaultname='report.txt', issave=True)</b></p></dd>
7440 subik 22
 
14947 jghali 23
<dt><a name="-fileQuit"><strong>fileQuit</strong></a>(...)</dt>
24
<dd><code>fileQuit()</code>
25
<p>Quit Scribus.</p></dd>
26
 
1041 cbradney 27
<dt><a name="-getGuiLanguage"><strong>getGuiLanguage</strong></a>(...)</dt>
7440 subik 28
<dd><code>getGuiLanguage() -&gt; string</code>
1041 cbradney 29
<p>Returns a string with the -lang value.</p></dd>
7440 subik 30
 
1041 cbradney 31
<dt><a name="-messagebarText"><strong>messagebarText</strong></a>(...)</dt>
7440 subik 32
<dd><code>messagebarText("string")</code>
24091 jghali 33
<p>Deprecated. Use statusMessage() instead.</p></dd>
7440 subik 34
 
1041 cbradney 35
<dt><a name="-messageBox"><strong>messageBox</strong></a>(...)</dt>
7440 subik 36
<dd><code>messageBox("caption", "message",
23467 jghali 37
icon=ICON_NONE, button1=BUTTON_OK|BUTTON_DEFAULT,
7440 subik 38
button2=BUTTON_NONE, button3=BUTTON_NONE) -&gt; integer</code>
39
<p>Displays a message box with the title "caption", the message "message", and an icon "icon" and up to 3 buttons. By default no icon is used and a single button, OK, is displayed. Only the caption and message arguments are required, though setting an icon and appropriate button(s) is strongly recommended. The message text may contain simple HTML-like markup.</p>
23467 jghali 40
<p>Returns the BUTTON_* constant value corresponding to the clicked button. For example, if OK button is clicked, BUTTON_OK will be returned regardless of whether it is assigned to button1, button2, or button3. Check <a href="scripterapi-constants.html">Pre-defined Constants</a> for further information.</p>
7440 subik 41
<p>For the icon and the button parameters there are predefined constants available with the same names as in the Qt Documentation. These are the BUTTON_* and ICON_* constants defined in the module. There are also two extra constants that can be binary-ORed with button constants:</p>
1041 cbradney 42
<ul>
23467 jghali 43
<li>BUTTON_DEFAULT Pressing enter presses this button.</li>
44
<li>BUTTON_ESCAPE Pressing escape presses this button.</li>
1041 cbradney 45
</ul>
46
<p>Usage examples:</p>
22441 gpittman 47
<p><b>result = messageBox</a>('Script failed', 'This script only works when you have a text frame selected.', ICON_ERROR)</p>
23467 jghali 48
<p>result = messageBox('Monkeys!', 'Something went ook! &lt;i&gt;Was it a monkey?&lt;/i&gt;', ICON_WARNING, BUTTON_YES|BUTTON_DEFAULT, BUTTON_NO, BUTTON_IGNORE|BUTTON_ESCAPE)</b></p>
7440 subik 49
<p>Defined button and icon constants: BUTTON_NONE, BUTTON_ABORT, BUTTON_CANCEL, BUTTON_IGNORE, BUTTON_NO, BUTTON_NOALL, BUTTON_OK, BUTTON_RETRY, BUTTON_YES, BUTTON_YESALL, ICON_NONE, ICON_INFORMATION, ICON_WARNING, ICON_CRITICAL.</p></dd>
50
 
1041 cbradney 51
<dt><a name="-newDocDialog"><strong>newDocDialog</strong></a>(...)</dt>
7440 subik 52
<dd><code>newDocDialog() -&gt; bool</code>
1041 cbradney 53
<p>Displays the "New Document" dialog box. Creates a new document if the user accepts the settings. Does not create a document if the user presses cancel. Returns true if a new document was created.</p></dd>
7440 subik 54
 
55
<dt><a name="-newStyleDialog"><strong>newStyleDialog</strong>(...)</a></dt>
56
<dd><code>newStyleDialog() -&gt; string</code>
57
<p>Shows 'Create new paragraph style' dialog. Function returns real style name or None when user cancels the dialog.</p></dd>
58
 
1041 cbradney 59
<dt><a name="-statusMessage"><strong>statusMessage</strong></a>(...)</dt>
24091 jghali 60
<dd><code>statusMessage("string")</code>
1041 cbradney 61
<p>Writes the "string" into the Scribus message bar (status line). The text must be UTF8 encoded or 'unicode' string(recommended).</p></dd>
7440 subik 62
 
1041 cbradney 63
<dt><a name="-progressReset"><strong>progressReset</strong></a>(...)</dt>
7440 subik 64
<dd><code>progressReset()</code>
65
<p>Cleans up the Scribus progress bar previous settings. It is called before the new progress bar use. See progressSet.</p></dd>
559 cbradney 66
 
1041 cbradney 67
<dt><a name="-progressSet"><strong>progressSet</strong></a>(...)</dt>
7440 subik 68
<dd><code>progressSet(nr)</code>
1041 cbradney 69
<p>Set the progress bar position to "nr", a value relative to the previously set progressTotal. The progress bar uses the concept of steps; you give it the total number of steps and the number of steps completed so far and it will display the percentage of steps that have been completed. You can specify the total number of steps with <a href="#-progressTotal">progressTotal</a>(). The current number of steps is set with <a href="#-progressSet">progressSet</a>(). The progress bar can be rewound to the beginning with <a href="#-progressReset">progressReset</a>(). [based on info taken from Trolltech's Qt docs]</p></dd>
70
 
71
<dt><a name="-progressTotal"><strong>progressTotal</strong></a>(...)</dt>
7440 subik 72
<dd><code>progressTotal(max)</code>
1041 cbradney 73
<p>Sets the progress bar's maximum steps value to the specified number. See progressSet.</p></dd>
74
 
75
<dt><a name="-valueDialog"><strong>valueDialog</strong></a>(...)</dt>
7440 subik 76
<dd><code>valueDialog(caption, message [,defaultvalue]) -&gt; string</code>
1041 cbradney 77
<p>Shows the common 'Ask for string' dialog and returns its value as a string Parameters: window title, text in the window and optional 'default' value.</p>
78
<p>Example: <a href="#-valueDialog">valueDialog</a>('title', 'text in the window', 'optional')</p></dd>
79
 
597 cbradney 80
</dl>
1041 cbradney 81
 
10646 cbradney 82
</body>
83
</html>