|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.EricWidgets.EricLed</title> |
|
4 <meta charset="UTF-8"> |
|
5 <link rel="stylesheet" href="styles.css"> |
|
6 </head> |
|
7 <body> |
|
8 <a NAME="top" ID="top"></a> |
|
9 <h1>eric7.EricWidgets.EricLed</h1> |
|
10 |
|
11 <p> |
|
12 Module implementing a LED widget. |
|
13 </p> |
|
14 <p> |
|
15 It was inspired by KLed. |
|
16 </p> |
|
17 <h3>Global Attributes</h3> |
|
18 |
|
19 <table> |
|
20 <tr><td>None</td></tr> |
|
21 </table> |
|
22 <h3>Classes</h3> |
|
23 |
|
24 <table> |
|
25 |
|
26 <tr> |
|
27 <td><a href="#EricClickableLed">EricClickableLed</a></td> |
|
28 <td>Class implementing a clickable LED widget.</td> |
|
29 </tr> |
|
30 <tr> |
|
31 <td><a href="#EricLed">EricLed</a></td> |
|
32 <td>Class implementing a LED widget.</td> |
|
33 </tr> |
|
34 <tr> |
|
35 <td><a href="#EricLedType">EricLedType</a></td> |
|
36 <td>Class defining the LED types.</td> |
|
37 </tr> |
|
38 </table> |
|
39 <h3>Functions</h3> |
|
40 |
|
41 <table> |
|
42 <tr><td>None</td></tr> |
|
43 </table> |
|
44 <hr /> |
|
45 <hr /> |
|
46 <a NAME="EricClickableLed" ID="EricClickableLed"></a> |
|
47 <h2>EricClickableLed</h2> |
|
48 |
|
49 <p> |
|
50 Class implementing a clickable LED widget. |
|
51 </p> |
|
52 <h3>Signals</h3> |
|
53 <dl> |
|
54 |
|
55 <dt>clicked(QPoint)</dt> |
|
56 <dd> |
|
57 emitted upon a click on the LED with the |
|
58 left button |
|
59 </dd> |
|
60 <dt>middleClicked(QPoint)</dt> |
|
61 <dd> |
|
62 emitted upon a click on the LED with |
|
63 the middle button or CTRL and left button |
|
64 </dd> |
|
65 </dl> |
|
66 <h3>Derived from</h3> |
|
67 EricLed |
|
68 <h3>Class Attributes</h3> |
|
69 |
|
70 <table> |
|
71 <tr><td>None</td></tr> |
|
72 </table> |
|
73 <h3>Class Methods</h3> |
|
74 |
|
75 <table> |
|
76 <tr><td>None</td></tr> |
|
77 </table> |
|
78 <h3>Methods</h3> |
|
79 |
|
80 <table> |
|
81 |
|
82 <tr> |
|
83 <td><a href="#EricClickableLed.__init__">EricClickableLed</a></td> |
|
84 <td>Constructor</td> |
|
85 </tr> |
|
86 <tr> |
|
87 <td><a href="#EricClickableLed.mouseReleaseEvent">mouseReleaseEvent</a></td> |
|
88 <td>Protected method handling mouse release events.</td> |
|
89 </tr> |
|
90 </table> |
|
91 <h3>Static Methods</h3> |
|
92 |
|
93 <table> |
|
94 <tr><td>None</td></tr> |
|
95 </table> |
|
96 |
|
97 <a NAME="EricClickableLed.__init__" ID="EricClickableLed.__init__"></a> |
|
98 <h4>EricClickableLed (Constructor)</h4> |
|
99 <b>EricClickableLed</b>(<i>parent=None, color=None, shape=EricLedType.CIRCULAR, rectRatio=1</i>) |
|
100 |
|
101 <p> |
|
102 Constructor |
|
103 </p> |
|
104 <dl> |
|
105 |
|
106 <dt><i>parent</i> (QWidget)</dt> |
|
107 <dd> |
|
108 reference to parent widget |
|
109 </dd> |
|
110 <dt><i>color</i> (QColor)</dt> |
|
111 <dd> |
|
112 color of the LED |
|
113 </dd> |
|
114 <dt><i>shape</i> (EricLedType)</dt> |
|
115 <dd> |
|
116 shape of the LED |
|
117 </dd> |
|
118 <dt><i>rectRatio</i> (float)</dt> |
|
119 <dd> |
|
120 ratio width to height, if shape is rectangular |
|
121 </dd> |
|
122 </dl> |
|
123 <a NAME="EricClickableLed.mouseReleaseEvent" ID="EricClickableLed.mouseReleaseEvent"></a> |
|
124 <h4>EricClickableLed.mouseReleaseEvent</h4> |
|
125 <b>mouseReleaseEvent</b>(<i>evt</i>) |
|
126 |
|
127 <p> |
|
128 Protected method handling mouse release events. |
|
129 </p> |
|
130 <dl> |
|
131 |
|
132 <dt><i>evt</i></dt> |
|
133 <dd> |
|
134 mouse event (QMouseEvent) |
|
135 </dd> |
|
136 </dl> |
|
137 <div align="right"><a href="#top">Up</a></div> |
|
138 <hr /> |
|
139 <hr /> |
|
140 <a NAME="EricLed" ID="EricLed"></a> |
|
141 <h2>EricLed</h2> |
|
142 |
|
143 <p> |
|
144 Class implementing a LED widget. |
|
145 </p> |
|
146 <h3>Derived from</h3> |
|
147 QWidget |
|
148 <h3>Class Attributes</h3> |
|
149 |
|
150 <table> |
|
151 <tr><td>None</td></tr> |
|
152 </table> |
|
153 <h3>Class Methods</h3> |
|
154 |
|
155 <table> |
|
156 <tr><td>None</td></tr> |
|
157 </table> |
|
158 <h3>Methods</h3> |
|
159 |
|
160 <table> |
|
161 |
|
162 <tr> |
|
163 <td><a href="#EricLed.__init__">EricLed</a></td> |
|
164 <td>Constructor</td> |
|
165 </tr> |
|
166 <tr> |
|
167 <td><a href="#EricLed.__getBestRoundSize">__getBestRoundSize</a></td> |
|
168 <td>Private method to calculate the width of the LED.</td> |
|
169 </tr> |
|
170 <tr> |
|
171 <td><a href="#EricLed.__paintRectangular">__paintRectangular</a></td> |
|
172 <td>Private method to paint a rectangular raised LED.</td> |
|
173 </tr> |
|
174 <tr> |
|
175 <td><a href="#EricLed.__paintRound">__paintRound</a></td> |
|
176 <td>Private method to paint a round raised LED.</td> |
|
177 </tr> |
|
178 <tr> |
|
179 <td><a href="#EricLed.color">color</a></td> |
|
180 <td>Public method to return the LED color.</td> |
|
181 </tr> |
|
182 <tr> |
|
183 <td><a href="#EricLed.darkFactor">darkFactor</a></td> |
|
184 <td>Public method to return the dark factor.</td> |
|
185 </tr> |
|
186 <tr> |
|
187 <td><a href="#EricLed.isFramed">isFramed</a></td> |
|
188 <td>Public method to return the framed state.</td> |
|
189 </tr> |
|
190 <tr> |
|
191 <td><a href="#EricLed.isOn">isOn</a></td> |
|
192 <td>Public method to return the LED state.</td> |
|
193 </tr> |
|
194 <tr> |
|
195 <td><a href="#EricLed.minimumSizeHint">minimumSizeHint</a></td> |
|
196 <td>Public method to give a hint about our minimum size.</td> |
|
197 </tr> |
|
198 <tr> |
|
199 <td><a href="#EricLed.off">off</a></td> |
|
200 <td>Public slot to set the LED to off.</td> |
|
201 </tr> |
|
202 <tr> |
|
203 <td><a href="#EricLed.on">on</a></td> |
|
204 <td>Public slot to set the LED to on.</td> |
|
205 </tr> |
|
206 <tr> |
|
207 <td><a href="#EricLed.paintEvent">paintEvent</a></td> |
|
208 <td>Protected slot handling the paint event.</td> |
|
209 </tr> |
|
210 <tr> |
|
211 <td><a href="#EricLed.ratio">ratio</a></td> |
|
212 <td>Public method to return the LED rectangular ratio [= width / height].</td> |
|
213 </tr> |
|
214 <tr> |
|
215 <td><a href="#EricLed.setColor">setColor</a></td> |
|
216 <td>Public method to set the LED color.</td> |
|
217 </tr> |
|
218 <tr> |
|
219 <td><a href="#EricLed.setDarkFactor">setDarkFactor</a></td> |
|
220 <td>Public method to set the dark factor.</td> |
|
221 </tr> |
|
222 <tr> |
|
223 <td><a href="#EricLed.setFramed">setFramed</a></td> |
|
224 <td>Public slot to set the __framedLed attribute.</td> |
|
225 </tr> |
|
226 <tr> |
|
227 <td><a href="#EricLed.setOn">setOn</a></td> |
|
228 <td>Public method to set the LED to on.</td> |
|
229 </tr> |
|
230 <tr> |
|
231 <td><a href="#EricLed.setRatio">setRatio</a></td> |
|
232 <td>Public method to set the LED rectangular ratio (width / height).</td> |
|
233 </tr> |
|
234 <tr> |
|
235 <td><a href="#EricLed.setShape">setShape</a></td> |
|
236 <td>Public method to set the LED shape.</td> |
|
237 </tr> |
|
238 <tr> |
|
239 <td><a href="#EricLed.shape">shape</a></td> |
|
240 <td>Public method to return the LED shape.</td> |
|
241 </tr> |
|
242 <tr> |
|
243 <td><a href="#EricLed.sizeHint">sizeHint</a></td> |
|
244 <td>Public method to give a hint about our desired size.</td> |
|
245 </tr> |
|
246 <tr> |
|
247 <td><a href="#EricLed.toggle">toggle</a></td> |
|
248 <td>Public slot to toggle the LED state.</td> |
|
249 </tr> |
|
250 </table> |
|
251 <h3>Static Methods</h3> |
|
252 |
|
253 <table> |
|
254 <tr><td>None</td></tr> |
|
255 </table> |
|
256 |
|
257 <a NAME="EricLed.__init__" ID="EricLed.__init__"></a> |
|
258 <h4>EricLed (Constructor)</h4> |
|
259 <b>EricLed</b>(<i>parent=None, color=None, shape=EricLedType.CIRCULAR, rectRatio=1</i>) |
|
260 |
|
261 <p> |
|
262 Constructor |
|
263 </p> |
|
264 <dl> |
|
265 |
|
266 <dt><i>parent</i> (QWidget)</dt> |
|
267 <dd> |
|
268 reference to parent widget |
|
269 </dd> |
|
270 <dt><i>color</i> (QColor)</dt> |
|
271 <dd> |
|
272 color of the LED |
|
273 </dd> |
|
274 <dt><i>shape</i> (EricLedType)</dt> |
|
275 <dd> |
|
276 shape of the LED |
|
277 </dd> |
|
278 <dt><i>rectRatio</i> (float)</dt> |
|
279 <dd> |
|
280 ratio width to height, if shape is rectangular |
|
281 </dd> |
|
282 </dl> |
|
283 <a NAME="EricLed.__getBestRoundSize" ID="EricLed.__getBestRoundSize"></a> |
|
284 <h4>EricLed.__getBestRoundSize</h4> |
|
285 <b>__getBestRoundSize</b>(<i></i>) |
|
286 |
|
287 <p> |
|
288 Private method to calculate the width of the LED. |
|
289 </p> |
|
290 <dl> |
|
291 <dt>Return:</dt> |
|
292 <dd> |
|
293 new width of the LED (integer) |
|
294 </dd> |
|
295 </dl> |
|
296 <a NAME="EricLed.__paintRectangular" ID="EricLed.__paintRectangular"></a> |
|
297 <h4>EricLed.__paintRectangular</h4> |
|
298 <b>__paintRectangular</b>(<i></i>) |
|
299 |
|
300 <p> |
|
301 Private method to paint a rectangular raised LED. |
|
302 </p> |
|
303 <a NAME="EricLed.__paintRound" ID="EricLed.__paintRound"></a> |
|
304 <h4>EricLed.__paintRound</h4> |
|
305 <b>__paintRound</b>(<i></i>) |
|
306 |
|
307 <p> |
|
308 Private method to paint a round raised LED. |
|
309 </p> |
|
310 <a NAME="EricLed.color" ID="EricLed.color"></a> |
|
311 <h4>EricLed.color</h4> |
|
312 <b>color</b>(<i></i>) |
|
313 |
|
314 <p> |
|
315 Public method to return the LED color. |
|
316 </p> |
|
317 <dl> |
|
318 <dt>Return:</dt> |
|
319 <dd> |
|
320 color of the LED (QColor) |
|
321 </dd> |
|
322 </dl> |
|
323 <a NAME="EricLed.darkFactor" ID="EricLed.darkFactor"></a> |
|
324 <h4>EricLed.darkFactor</h4> |
|
325 <b>darkFactor</b>(<i></i>) |
|
326 |
|
327 <p> |
|
328 Public method to return the dark factor. |
|
329 </p> |
|
330 <dl> |
|
331 <dt>Return:</dt> |
|
332 <dd> |
|
333 the current dark factor (integer) |
|
334 </dd> |
|
335 </dl> |
|
336 <a NAME="EricLed.isFramed" ID="EricLed.isFramed"></a> |
|
337 <h4>EricLed.isFramed</h4> |
|
338 <b>isFramed</b>(<i></i>) |
|
339 |
|
340 <p> |
|
341 Public method to return the framed state. |
|
342 </p> |
|
343 <dl> |
|
344 <dt>Return:</dt> |
|
345 <dd> |
|
346 flag indicating the current framed state (boolean) |
|
347 </dd> |
|
348 </dl> |
|
349 <a NAME="EricLed.isOn" ID="EricLed.isOn"></a> |
|
350 <h4>EricLed.isOn</h4> |
|
351 <b>isOn</b>(<i></i>) |
|
352 |
|
353 <p> |
|
354 Public method to return the LED state. |
|
355 </p> |
|
356 <dl> |
|
357 <dt>Return:</dt> |
|
358 <dd> |
|
359 flag indicating the light state (boolean) |
|
360 </dd> |
|
361 </dl> |
|
362 <a NAME="EricLed.minimumSizeHint" ID="EricLed.minimumSizeHint"></a> |
|
363 <h4>EricLed.minimumSizeHint</h4> |
|
364 <b>minimumSizeHint</b>(<i></i>) |
|
365 |
|
366 <p> |
|
367 Public method to give a hint about our minimum size. |
|
368 </p> |
|
369 <dl> |
|
370 <dt>Return:</dt> |
|
371 <dd> |
|
372 size hint (QSize) |
|
373 </dd> |
|
374 </dl> |
|
375 <a NAME="EricLed.off" ID="EricLed.off"></a> |
|
376 <h4>EricLed.off</h4> |
|
377 <b>off</b>(<i></i>) |
|
378 |
|
379 <p> |
|
380 Public slot to set the LED to off. |
|
381 </p> |
|
382 <a NAME="EricLed.on" ID="EricLed.on"></a> |
|
383 <h4>EricLed.on</h4> |
|
384 <b>on</b>(<i></i>) |
|
385 |
|
386 <p> |
|
387 Public slot to set the LED to on. |
|
388 </p> |
|
389 <a NAME="EricLed.paintEvent" ID="EricLed.paintEvent"></a> |
|
390 <h4>EricLed.paintEvent</h4> |
|
391 <b>paintEvent</b>(<i>evt</i>) |
|
392 |
|
393 <p> |
|
394 Protected slot handling the paint event. |
|
395 </p> |
|
396 <dl> |
|
397 |
|
398 <dt><i>evt</i> (QPaintEvent)</dt> |
|
399 <dd> |
|
400 paint event object |
|
401 </dd> |
|
402 </dl> |
|
403 <a NAME="EricLed.ratio" ID="EricLed.ratio"></a> |
|
404 <h4>EricLed.ratio</h4> |
|
405 <b>ratio</b>(<i></i>) |
|
406 |
|
407 <p> |
|
408 Public method to return the LED rectangular ratio [= width / height]. |
|
409 </p> |
|
410 <dl> |
|
411 <dt>Return:</dt> |
|
412 <dd> |
|
413 LED rectangular ratio (float) |
|
414 </dd> |
|
415 </dl> |
|
416 <a NAME="EricLed.setColor" ID="EricLed.setColor"></a> |
|
417 <h4>EricLed.setColor</h4> |
|
418 <b>setColor</b>(<i>color</i>) |
|
419 |
|
420 <p> |
|
421 Public method to set the LED color. |
|
422 </p> |
|
423 <dl> |
|
424 |
|
425 <dt><i>color</i></dt> |
|
426 <dd> |
|
427 color for the LED (QColor) |
|
428 </dd> |
|
429 </dl> |
|
430 <a NAME="EricLed.setDarkFactor" ID="EricLed.setDarkFactor"></a> |
|
431 <h4>EricLed.setDarkFactor</h4> |
|
432 <b>setDarkFactor</b>(<i>darkfactor</i>) |
|
433 |
|
434 <p> |
|
435 Public method to set the dark factor. |
|
436 </p> |
|
437 <dl> |
|
438 |
|
439 <dt><i>darkfactor</i></dt> |
|
440 <dd> |
|
441 value to set for the dark factor (integer) |
|
442 </dd> |
|
443 </dl> |
|
444 <a NAME="EricLed.setFramed" ID="EricLed.setFramed"></a> |
|
445 <h4>EricLed.setFramed</h4> |
|
446 <b>setFramed</b>(<i>framed</i>) |
|
447 |
|
448 <p> |
|
449 Public slot to set the __framedLed attribute. |
|
450 </p> |
|
451 <dl> |
|
452 |
|
453 <dt><i>framed</i></dt> |
|
454 <dd> |
|
455 flag indicating the framed state (boolean) |
|
456 </dd> |
|
457 </dl> |
|
458 <a NAME="EricLed.setOn" ID="EricLed.setOn"></a> |
|
459 <h4>EricLed.setOn</h4> |
|
460 <b>setOn</b>(<i>state</i>) |
|
461 |
|
462 <p> |
|
463 Public method to set the LED to on. |
|
464 </p> |
|
465 <dl> |
|
466 |
|
467 <dt><i>state</i></dt> |
|
468 <dd> |
|
469 new state of the LED (boolean) |
|
470 </dd> |
|
471 </dl> |
|
472 <a NAME="EricLed.setRatio" ID="EricLed.setRatio"></a> |
|
473 <h4>EricLed.setRatio</h4> |
|
474 <b>setRatio</b>(<i>ratio</i>) |
|
475 |
|
476 <p> |
|
477 Public method to set the LED rectangular ratio (width / height). |
|
478 </p> |
|
479 <dl> |
|
480 |
|
481 <dt><i>ratio</i></dt> |
|
482 <dd> |
|
483 new LED rectangular ratio (float) |
|
484 </dd> |
|
485 </dl> |
|
486 <a NAME="EricLed.setShape" ID="EricLed.setShape"></a> |
|
487 <h4>EricLed.setShape</h4> |
|
488 <b>setShape</b>(<i>shape</i>) |
|
489 |
|
490 <p> |
|
491 Public method to set the LED shape. |
|
492 </p> |
|
493 <dl> |
|
494 |
|
495 <dt><i>shape</i> (EricLedType)</dt> |
|
496 <dd> |
|
497 new LED shape |
|
498 </dd> |
|
499 </dl> |
|
500 <a NAME="EricLed.shape" ID="EricLed.shape"></a> |
|
501 <h4>EricLed.shape</h4> |
|
502 <b>shape</b>(<i></i>) |
|
503 |
|
504 <p> |
|
505 Public method to return the LED shape. |
|
506 </p> |
|
507 <dl> |
|
508 <dt>Return:</dt> |
|
509 <dd> |
|
510 LED shape |
|
511 </dd> |
|
512 </dl> |
|
513 <dl> |
|
514 <dt>Return Type:</dt> |
|
515 <dd> |
|
516 EricLedType |
|
517 </dd> |
|
518 </dl> |
|
519 <a NAME="EricLed.sizeHint" ID="EricLed.sizeHint"></a> |
|
520 <h4>EricLed.sizeHint</h4> |
|
521 <b>sizeHint</b>(<i></i>) |
|
522 |
|
523 <p> |
|
524 Public method to give a hint about our desired size. |
|
525 </p> |
|
526 <dl> |
|
527 <dt>Return:</dt> |
|
528 <dd> |
|
529 size hint (QSize) |
|
530 </dd> |
|
531 </dl> |
|
532 <a NAME="EricLed.toggle" ID="EricLed.toggle"></a> |
|
533 <h4>EricLed.toggle</h4> |
|
534 <b>toggle</b>(<i></i>) |
|
535 |
|
536 <p> |
|
537 Public slot to toggle the LED state. |
|
538 </p> |
|
539 <div align="right"><a href="#top">Up</a></div> |
|
540 <hr /> |
|
541 <hr /> |
|
542 <a NAME="EricLedType" ID="EricLedType"></a> |
|
543 <h2>EricLedType</h2> |
|
544 |
|
545 <p> |
|
546 Class defining the LED types. |
|
547 </p> |
|
548 <h3>Derived from</h3> |
|
549 enum.Enum |
|
550 <h3>Class Attributes</h3> |
|
551 |
|
552 <table> |
|
553 <tr><td>CIRCULAR</td></tr><tr><td>RECTANGULAR</td></tr> |
|
554 </table> |
|
555 <h3>Class Methods</h3> |
|
556 |
|
557 <table> |
|
558 <tr><td>None</td></tr> |
|
559 </table> |
|
560 <h3>Methods</h3> |
|
561 |
|
562 <table> |
|
563 <tr><td>None</td></tr> |
|
564 </table> |
|
565 <h3>Static Methods</h3> |
|
566 |
|
567 <table> |
|
568 <tr><td>None</td></tr> |
|
569 </table> |
|
570 |
|
571 <div align="right"><a href="#top">Up</a></div> |
|
572 <hr /> |
|
573 </body></html> |