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