|
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.E5Gui.E5Led</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>eric5.E5Gui.E5Led</h1> |
|
24 <p> |
|
25 Module implementing a LED widget. |
|
26 </p><p> |
|
27 It was inspired by KLed. |
|
28 </p> |
|
29 <h3>Global Attributes</h3> |
|
30 <table> |
|
31 <tr><td>E5LedCircular</td></tr><tr><td>E5LedRectangular</td></tr> |
|
32 </table> |
|
33 <h3>Classes</h3> |
|
34 <table> |
|
35 <tr> |
|
36 <td><a href="#E5Led">E5Led</a></td> |
|
37 <td>Class implementing a LED widget.</td> |
|
38 </tr> |
|
39 </table> |
|
40 <h3>Functions</h3> |
|
41 <table> |
|
42 <tr><td>None</td></tr> |
|
43 </table> |
|
44 <hr /><hr /> |
|
45 <a NAME="E5Led" ID="E5Led"></a> |
|
46 <h2>E5Led</h2> |
|
47 <p> |
|
48 Class implementing a LED widget. |
|
49 </p> |
|
50 <h3>Derived from</h3> |
|
51 QWidget |
|
52 <h3>Class Attributes</h3> |
|
53 <table> |
|
54 <tr><td>None</td></tr> |
|
55 </table> |
|
56 <h3>Methods</h3> |
|
57 <table> |
|
58 <tr> |
|
59 <td><a href="#E5Led.__init__">E5Led</a></td> |
|
60 <td>Constructor</td> |
|
61 </tr><tr> |
|
62 <td><a href="#E5Led.__getBestRoundSize">__getBestRoundSize</a></td> |
|
63 <td>Private method to calculate the width of the LED.</td> |
|
64 </tr><tr> |
|
65 <td><a href="#E5Led.__paintRectangular">__paintRectangular</a></td> |
|
66 <td>Private method to paint a rectangular raised LED.</td> |
|
67 </tr><tr> |
|
68 <td><a href="#E5Led.__paintRound">__paintRound</a></td> |
|
69 <td>Private method to paint a round raised LED.</td> |
|
70 </tr><tr> |
|
71 <td><a href="#E5Led.color">color</a></td> |
|
72 <td>Public method to return the LED color.</td> |
|
73 </tr><tr> |
|
74 <td><a href="#E5Led.darkFactor">darkFactor</a></td> |
|
75 <td>Public method to return the dark factor.</td> |
|
76 </tr><tr> |
|
77 <td><a href="#E5Led.isFramed">isFramed</a></td> |
|
78 <td>Public method to return the framed state.</td> |
|
79 </tr><tr> |
|
80 <td><a href="#E5Led.isOn">isOn</a></td> |
|
81 <td>Public method to return the LED state.</td> |
|
82 </tr><tr> |
|
83 <td><a href="#E5Led.minimumSizeHint">minimumSizeHint</a></td> |
|
84 <td>Public method to give a hint about our minimum size.</td> |
|
85 </tr><tr> |
|
86 <td><a href="#E5Led.off">off</a></td> |
|
87 <td>Public slot to set the LED to off.</td> |
|
88 </tr><tr> |
|
89 <td><a href="#E5Led.on">on</a></td> |
|
90 <td>Public slot to set the LED to on.</td> |
|
91 </tr><tr> |
|
92 <td><a href="#E5Led.paintEvent">paintEvent</a></td> |
|
93 <td>Protected slot handling the paint event.</td> |
|
94 </tr><tr> |
|
95 <td><a href="#E5Led.ratio">ratio</a></td> |
|
96 <td>Public method to return the LED rectangular ratio (width / height).</td> |
|
97 </tr><tr> |
|
98 <td><a href="#E5Led.setColor">setColor</a></td> |
|
99 <td>Public method to set the LED color.</td> |
|
100 </tr><tr> |
|
101 <td><a href="#E5Led.setDarkFactor">setDarkFactor</a></td> |
|
102 <td>Public method to set the dark factor.</td> |
|
103 </tr><tr> |
|
104 <td><a href="#E5Led.setFramed">setFramed</a></td> |
|
105 <td>Public slot to set the __framedLed attribute.</td> |
|
106 </tr><tr> |
|
107 <td><a href="#E5Led.setOn">setOn</a></td> |
|
108 <td>Public method to set the LED to on.</td> |
|
109 </tr><tr> |
|
110 <td><a href="#E5Led.setRatio">setRatio</a></td> |
|
111 <td>Public method to set the LED rectangular ratio (width / height).</td> |
|
112 </tr><tr> |
|
113 <td><a href="#E5Led.setShape">setShape</a></td> |
|
114 <td>Public method to set the LED shape.</td> |
|
115 </tr><tr> |
|
116 <td><a href="#E5Led.shape">shape</a></td> |
|
117 <td>Public method to return the LED shape.</td> |
|
118 </tr><tr> |
|
119 <td><a href="#E5Led.sizeHint">sizeHint</a></td> |
|
120 <td>Public method to give a hint about our desired size.</td> |
|
121 </tr><tr> |
|
122 <td><a href="#E5Led.toggle">toggle</a></td> |
|
123 <td>Public slot to toggle the LED state.</td> |
|
124 </tr> |
|
125 </table> |
|
126 <a NAME="E5Led.__init__" ID="E5Led.__init__"></a> |
|
127 <h4>E5Led (Constructor)</h4> |
|
128 <b>E5Led</b>(<i>parent = None, color = None, shape = E5LedCircular, rectRatio = 1</i>) |
|
129 <p> |
|
130 Constructor |
|
131 </p><dl> |
|
132 <dt><i>parent</i></dt> |
|
133 <dd> |
|
134 reference to parent widget (QWidget) |
|
135 </dd><dt><i>color</i></dt> |
|
136 <dd> |
|
137 color of the LED (QColor) |
|
138 </dd><dt><i>shape</i></dt> |
|
139 <dd> |
|
140 shape of the LED (E5LedCircular, E5LedRectangular) |
|
141 </dd><dt><i>rectRation</i></dt> |
|
142 <dd> |
|
143 ratio width to height, if shape is rectangular (float) |
|
144 </dd> |
|
145 </dl><a NAME="E5Led.__getBestRoundSize" ID="E5Led.__getBestRoundSize"></a> |
|
146 <h4>E5Led.__getBestRoundSize</h4> |
|
147 <b>__getBestRoundSize</b>(<i></i>) |
|
148 <p> |
|
149 Private method to calculate the width of the LED. |
|
150 </p><dl> |
|
151 <dt>Returns:</dt> |
|
152 <dd> |
|
153 new width of the LED (integer) |
|
154 </dd> |
|
155 </dl><a NAME="E5Led.__paintRectangular" ID="E5Led.__paintRectangular"></a> |
|
156 <h4>E5Led.__paintRectangular</h4> |
|
157 <b>__paintRectangular</b>(<i></i>) |
|
158 <p> |
|
159 Private method to paint a rectangular raised LED. |
|
160 </p><a NAME="E5Led.__paintRound" ID="E5Led.__paintRound"></a> |
|
161 <h4>E5Led.__paintRound</h4> |
|
162 <b>__paintRound</b>(<i></i>) |
|
163 <p> |
|
164 Private method to paint a round raised LED. |
|
165 </p><a NAME="E5Led.color" ID="E5Led.color"></a> |
|
166 <h4>E5Led.color</h4> |
|
167 <b>color</b>(<i></i>) |
|
168 <p> |
|
169 Public method to return the LED color. |
|
170 </p><dl> |
|
171 <dt>Returns:</dt> |
|
172 <dd> |
|
173 color of the LED (QColor) |
|
174 </dd> |
|
175 </dl><a NAME="E5Led.darkFactor" ID="E5Led.darkFactor"></a> |
|
176 <h4>E5Led.darkFactor</h4> |
|
177 <b>darkFactor</b>(<i></i>) |
|
178 <p> |
|
179 Public method to return the dark factor. |
|
180 </p><dl> |
|
181 <dt>Returns:</dt> |
|
182 <dd> |
|
183 the current dark factor (integer) |
|
184 </dd> |
|
185 </dl><a NAME="E5Led.isFramed" ID="E5Led.isFramed"></a> |
|
186 <h4>E5Led.isFramed</h4> |
|
187 <b>isFramed</b>(<i></i>) |
|
188 <p> |
|
189 Public method to return the framed state. |
|
190 </p><dl> |
|
191 <dt>Returns:</dt> |
|
192 <dd> |
|
193 flag indicating the current framed state (boolean) |
|
194 </dd> |
|
195 </dl><a NAME="E5Led.isOn" ID="E5Led.isOn"></a> |
|
196 <h4>E5Led.isOn</h4> |
|
197 <b>isOn</b>(<i></i>) |
|
198 <p> |
|
199 Public method to return the LED state. |
|
200 </p><dl> |
|
201 <dt>Returns:</dt> |
|
202 <dd> |
|
203 flag indicating the light state (boolean) |
|
204 </dd> |
|
205 </dl><a NAME="E5Led.minimumSizeHint" ID="E5Led.minimumSizeHint"></a> |
|
206 <h4>E5Led.minimumSizeHint</h4> |
|
207 <b>minimumSizeHint</b>(<i></i>) |
|
208 <p> |
|
209 Public method to give a hint about our minimum size. |
|
210 </p><dl> |
|
211 <dt>Returns:</dt> |
|
212 <dd> |
|
213 size hint (QSize) |
|
214 </dd> |
|
215 </dl><a NAME="E5Led.off" ID="E5Led.off"></a> |
|
216 <h4>E5Led.off</h4> |
|
217 <b>off</b>(<i></i>) |
|
218 <p> |
|
219 Public slot to set the LED to off. |
|
220 </p><a NAME="E5Led.on" ID="E5Led.on"></a> |
|
221 <h4>E5Led.on</h4> |
|
222 <b>on</b>(<i></i>) |
|
223 <p> |
|
224 Public slot to set the LED to on. |
|
225 </p><a NAME="E5Led.paintEvent" ID="E5Led.paintEvent"></a> |
|
226 <h4>E5Led.paintEvent</h4> |
|
227 <b>paintEvent</b>(<i>evt</i>) |
|
228 <p> |
|
229 Protected slot handling the paint event. |
|
230 </p><dl> |
|
231 <dt><i>evt</i></dt> |
|
232 <dd> |
|
233 paint event object (QPaintEvent) |
|
234 </dd> |
|
235 </dl><dl> |
|
236 <dt>Raises <b>TypeError</b>:</dt> |
|
237 <dd> |
|
238 The E5Led has an unsupported shape type. |
|
239 </dd> |
|
240 </dl><a NAME="E5Led.ratio" ID="E5Led.ratio"></a> |
|
241 <h4>E5Led.ratio</h4> |
|
242 <b>ratio</b>(<i></i>) |
|
243 <p> |
|
244 Public method to return the LED rectangular ratio (width / height). |
|
245 </p><dl> |
|
246 <dt>Returns:</dt> |
|
247 <dd> |
|
248 LED rectangular ratio (float) |
|
249 </dd> |
|
250 </dl><a NAME="E5Led.setColor" ID="E5Led.setColor"></a> |
|
251 <h4>E5Led.setColor</h4> |
|
252 <b>setColor</b>(<i>color</i>) |
|
253 <p> |
|
254 Public method to set the LED color. |
|
255 </p><dl> |
|
256 <dt><i>color</i></dt> |
|
257 <dd> |
|
258 color for the LED (QColor) |
|
259 </dd> |
|
260 </dl><a NAME="E5Led.setDarkFactor" ID="E5Led.setDarkFactor"></a> |
|
261 <h4>E5Led.setDarkFactor</h4> |
|
262 <b>setDarkFactor</b>(<i>darkfactor</i>) |
|
263 <p> |
|
264 Public method to set the dark factor. |
|
265 </p><dl> |
|
266 <dt><i>darkfactor</i></dt> |
|
267 <dd> |
|
268 value to set for the dark factor (integer) |
|
269 </dd> |
|
270 </dl><a NAME="E5Led.setFramed" ID="E5Led.setFramed"></a> |
|
271 <h4>E5Led.setFramed</h4> |
|
272 <b>setFramed</b>(<i>framed</i>) |
|
273 <p> |
|
274 Public slot to set the __framedLed attribute. |
|
275 </p><dl> |
|
276 <dt><i>framed</i></dt> |
|
277 <dd> |
|
278 flag indicating the framed state (boolean) |
|
279 </dd> |
|
280 </dl><a NAME="E5Led.setOn" ID="E5Led.setOn"></a> |
|
281 <h4>E5Led.setOn</h4> |
|
282 <b>setOn</b>(<i>state</i>) |
|
283 <p> |
|
284 Public method to set the LED to on. |
|
285 </p><dl> |
|
286 <dt><i>state</i></dt> |
|
287 <dd> |
|
288 new state of the LED (boolean) |
|
289 </dd> |
|
290 </dl><a NAME="E5Led.setRatio" ID="E5Led.setRatio"></a> |
|
291 <h4>E5Led.setRatio</h4> |
|
292 <b>setRatio</b>(<i>ratio</i>) |
|
293 <p> |
|
294 Public method to set the LED rectangular ratio (width / height). |
|
295 </p><dl> |
|
296 <dt><i>ratio</i></dt> |
|
297 <dd> |
|
298 new LED rectangular ratio (float) |
|
299 </dd> |
|
300 </dl><a NAME="E5Led.setShape" ID="E5Led.setShape"></a> |
|
301 <h4>E5Led.setShape</h4> |
|
302 <b>setShape</b>(<i>shape</i>) |
|
303 <p> |
|
304 Public method to set the LED shape. |
|
305 </p><dl> |
|
306 <dt><i>shape</i></dt> |
|
307 <dd> |
|
308 new LED shape (E5LedCircular, E5LedRectangular) |
|
309 </dd> |
|
310 </dl><a NAME="E5Led.shape" ID="E5Led.shape"></a> |
|
311 <h4>E5Led.shape</h4> |
|
312 <b>shape</b>(<i></i>) |
|
313 <p> |
|
314 Public method to return the LED shape. |
|
315 </p><dl> |
|
316 <dt>Returns:</dt> |
|
317 <dd> |
|
318 LED shape (E5LedCircular, E5LedRectangular) |
|
319 </dd> |
|
320 </dl><a NAME="E5Led.sizeHint" ID="E5Led.sizeHint"></a> |
|
321 <h4>E5Led.sizeHint</h4> |
|
322 <b>sizeHint</b>(<i></i>) |
|
323 <p> |
|
324 Public method to give a hint about our desired size. |
|
325 </p><dl> |
|
326 <dt>Returns:</dt> |
|
327 <dd> |
|
328 size hint (QSize) |
|
329 </dd> |
|
330 </dl><a NAME="E5Led.toggle" ID="E5Led.toggle"></a> |
|
331 <h4>E5Led.toggle</h4> |
|
332 <b>toggle</b>(<i></i>) |
|
333 <p> |
|
334 Public slot to toggle the LED state. |
|
335 </p> |
|
336 <div align="right"><a href="#top">Up</a></div> |
|
337 <hr /> |
|
338 </body></html> |