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