|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' |
|
3 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'> |
|
4 <html><head> |
|
5 <title>eric4.Utilities.Startup</title> |
|
6 <style> |
|
7 body { |
|
8 background:white; |
|
9 margin: 0em 1em 10em 1em; |
|
10 color: black; |
|
11 } |
|
12 |
|
13 h1 { color: white; background: #4FA4FF; } |
|
14 h2 { color: white; background: #4FA4FF; } |
|
15 h3 { color: white; background: #00557F; } |
|
16 h4 { color: white; background: #00557F; } |
|
17 |
|
18 a { color: #AA5500; } |
|
19 |
|
20 </style> |
|
21 </head> |
|
22 <body><a NAME="top" ID="top"></a> |
|
23 <h1>eric4.Utilities.Startup</h1> |
|
24 <p> |
|
25 Module implementing some startup helper funcions |
|
26 </p> |
|
27 <h3>Global Attributes</h3> |
|
28 <table> |
|
29 <tr><td>loaded_translators</td></tr> |
|
30 </table> |
|
31 <h3>Classes</h3> |
|
32 <table> |
|
33 <tr><td>None</td></tr> |
|
34 </table> |
|
35 <h3>Functions</h3> |
|
36 <table> |
|
37 <tr> |
|
38 <td><a href="#handleArgs">handleArgs</a></td> |
|
39 <td>Module function to handle the always present commandline options.</td> |
|
40 </tr><tr> |
|
41 <td><a href="#initializeResourceSearchPath">initializeResourceSearchPath</a></td> |
|
42 <td>Module function to initialize the default mime source factory.</td> |
|
43 </tr><tr> |
|
44 <td><a href="#loadTranslatorForLocale">loadTranslatorForLocale</a></td> |
|
45 <td>Module function to find and load a specific translation.</td> |
|
46 </tr><tr> |
|
47 <td><a href="#loadTranslators">loadTranslators</a></td> |
|
48 <td>Module function to load all required translations.</td> |
|
49 </tr><tr> |
|
50 <td><a href="#makeAppInfo">makeAppInfo</a></td> |
|
51 <td>Module function to generate a dictionary describing the application.</td> |
|
52 </tr><tr> |
|
53 <td><a href="#simpleAppStartup">simpleAppStartup</a></td> |
|
54 <td>Module function to start up an application that doesn't need a specialized start up.</td> |
|
55 </tr><tr> |
|
56 <td><a href="#usage">usage</a></td> |
|
57 <td>Module function to show the usage information.</td> |
|
58 </tr><tr> |
|
59 <td><a href="#version">version</a></td> |
|
60 <td>Module function to show the version information.</td> |
|
61 </tr> |
|
62 </table> |
|
63 <hr /><hr /> |
|
64 <a NAME="handleArgs" ID="handleArgs"></a> |
|
65 <h2>handleArgs</h2> |
|
66 <b>handleArgs</b>(<i>argv, appinfo</i>) |
|
67 <p> |
|
68 Module function to handle the always present commandline options. |
|
69 </p><dl> |
|
70 <dt><i>argv</i></dt> |
|
71 <dd> |
|
72 list of commandline parameters (list of strings) |
|
73 </dd><dt><i>appinfo</i></dt> |
|
74 <dd> |
|
75 dictionary describing the application |
|
76 </dd> |
|
77 </dl><dl> |
|
78 <dt>Returns:</dt> |
|
79 <dd> |
|
80 index of the '--' option (integer). This is used to tell |
|
81 the application, that all additional option don't belong to |
|
82 the application. |
|
83 </dd> |
|
84 </dl> |
|
85 <div align="right"><a href="#top">Up</a></div> |
|
86 <hr /><hr /> |
|
87 <a NAME="initializeResourceSearchPath" ID="initializeResourceSearchPath"></a> |
|
88 <h2>initializeResourceSearchPath</h2> |
|
89 <b>initializeResourceSearchPath</b>(<i></i>) |
|
90 <p> |
|
91 Module function to initialize the default mime source factory. |
|
92 </p> |
|
93 <div align="right"><a href="#top">Up</a></div> |
|
94 <hr /><hr /> |
|
95 <a NAME="loadTranslatorForLocale" ID="loadTranslatorForLocale"></a> |
|
96 <h2>loadTranslatorForLocale</h2> |
|
97 <b>loadTranslatorForLocale</b>(<i>dirs, tn</i>) |
|
98 <p> |
|
99 Module function to find and load a specific translation. |
|
100 </p><dl> |
|
101 <dt><i>dirs</i></dt> |
|
102 <dd> |
|
103 Searchpath for the translations. (list of strings) |
|
104 </dd><dt><i>tn</i></dt> |
|
105 <dd> |
|
106 The translation to be loaded. (string) |
|
107 </dd> |
|
108 </dl><dl> |
|
109 <dt>Returns:</dt> |
|
110 <dd> |
|
111 Tuple of a status flag and the loaded translator. (int, QTranslator) |
|
112 </dd> |
|
113 </dl> |
|
114 <div align="right"><a href="#top">Up</a></div> |
|
115 <hr /><hr /> |
|
116 <a NAME="loadTranslators" ID="loadTranslators"></a> |
|
117 <h2>loadTranslators</h2> |
|
118 <b>loadTranslators</b>(<i>qtTransDir, app, translationFiles = ()</i>) |
|
119 <p> |
|
120 Module function to load all required translations. |
|
121 </p><dl> |
|
122 <dt><i>qtTransDir</i></dt> |
|
123 <dd> |
|
124 directory of the Qt translations files (string) |
|
125 </dd><dt><i>app</i></dt> |
|
126 <dd> |
|
127 reference to the application object (QApplication) |
|
128 </dd><dt><i>translationFiles</i></dt> |
|
129 <dd> |
|
130 tuple of additional translations to |
|
131 be loaded (tuple of strings) |
|
132 </dd> |
|
133 </dl><dl> |
|
134 <dt>Returns:</dt> |
|
135 <dd> |
|
136 the requested locale (string) |
|
137 </dd> |
|
138 </dl> |
|
139 <div align="right"><a href="#top">Up</a></div> |
|
140 <hr /><hr /> |
|
141 <a NAME="makeAppInfo" ID="makeAppInfo"></a> |
|
142 <h2>makeAppInfo</h2> |
|
143 <b>makeAppInfo</b>(<i>argv, name, arg, description, options = []</i>) |
|
144 <p> |
|
145 Module function to generate a dictionary describing the application. |
|
146 </p><dl> |
|
147 <dt><i>argv</i></dt> |
|
148 <dd> |
|
149 list of commandline parameters (list of strings) |
|
150 </dd><dt><i>name</i></dt> |
|
151 <dd> |
|
152 name of the application (string) |
|
153 </dd><dt><i>arg</i></dt> |
|
154 <dd> |
|
155 commandline arguments (string) |
|
156 </dd><dt><i>description</i></dt> |
|
157 <dd> |
|
158 text describing the application (string) |
|
159 </dd><dt><i>options</i></dt> |
|
160 <dd> |
|
161 list of additional commandline options |
|
162 (list of tuples of two strings (commandline option, option description)). |
|
163 The options --version, --help and -h are always present and must not |
|
164 be repeated in this list. |
|
165 </dd> |
|
166 </dl><dl> |
|
167 <dt>Returns:</dt> |
|
168 <dd> |
|
169 dictionary describing the application |
|
170 </dd> |
|
171 </dl> |
|
172 <div align="right"><a href="#top">Up</a></div> |
|
173 <hr /><hr /> |
|
174 <a NAME="simpleAppStartup" ID="simpleAppStartup"></a> |
|
175 <h2>simpleAppStartup</h2> |
|
176 <b>simpleAppStartup</b>(<i>argv, appinfo, mwFactory, quitOnLastWindowClosed = True</i>) |
|
177 <p> |
|
178 Module function to start up an application that doesn't need a specialized start up. |
|
179 </p><p> |
|
180 This function is used by all of eric4's helper programs. |
|
181 </p><dl> |
|
182 <dt><i>argv</i></dt> |
|
183 <dd> |
|
184 list of commandline parameters (list of strings) |
|
185 </dd><dt><i>appinfo</i></dt> |
|
186 <dd> |
|
187 dictionary describing the application |
|
188 </dd><dt><i>mwFactory</i></dt> |
|
189 <dd> |
|
190 factory function generating the main widget. This |
|
191 function must accept the following parameter. |
|
192 <dl> |
|
193 <dt>argv</dt> |
|
194 <dd>list of commandline parameters (list of strings)</dd> |
|
195 </dl> |
|
196 </dd><dt><i>quitOnLastWindowClosed=</i></dt> |
|
197 <dd> |
|
198 flag indicating to quit the application, |
|
199 if the last window was closed (boolean) |
|
200 </dd> |
|
201 </dl> |
|
202 <div align="right"><a href="#top">Up</a></div> |
|
203 <hr /><hr /> |
|
204 <a NAME="usage" ID="usage"></a> |
|
205 <h2>usage</h2> |
|
206 <b>usage</b>(<i>appinfo, optlen = 12</i>) |
|
207 <p> |
|
208 Module function to show the usage information. |
|
209 </p><dl> |
|
210 <dt><i>appinfo</i></dt> |
|
211 <dd> |
|
212 dictionary describing the application |
|
213 </dd><dt><i>optlen</i></dt> |
|
214 <dd> |
|
215 length of the field for the commandline option (integer) |
|
216 </dd> |
|
217 </dl> |
|
218 <div align="right"><a href="#top">Up</a></div> |
|
219 <hr /><hr /> |
|
220 <a NAME="version" ID="version"></a> |
|
221 <h2>version</h2> |
|
222 <b>version</b>(<i>appinfo</i>) |
|
223 <p> |
|
224 Module function to show the version information. |
|
225 </p><dl> |
|
226 <dt><i>appinfo</i></dt> |
|
227 <dd> |
|
228 dictionary describing the application |
|
229 </dd> |
|
230 </dl> |
|
231 <div align="right"><a href="#top">Up</a></div> |
|
232 <hr /> |
|
233 </body></html> |