KLed Class Reference
from PyKDE4.kdeui import *
Detailed Description
An LED widget.
Displays a round or rectangular light emitting diode.
It is configurable to arbitrary colors, the two on/off states and three styles (or "looks");
It may display itself in a performant flat view, a round view with light spot or a round view sunken in the screen.
"KDE LED Widget"
Enumerations | |
Look | { Flat, Raised, Sunken } |
Shape | { Rectangular, Circular } |
State | { Off, On } |
Methods | |
__init__ (self, QWidget parent=0) | |
__init__ (self, QColor color, QWidget parent=0) | |
__init__ (self, QColor color, KLed.State state, KLed.Look look, KLed.Shape shape, QWidget parent=0) | |
QColor | color (self) |
int | darkFactor (self) |
int | ledWidth (self) |
KLed.Look | look (self) |
QSize | minimumSizeHint (self) |
off (self) | |
on (self) | |
bool | paintCachedPixmap (self) |
paintEvent (self, QPaintEvent a0) | |
paintFlat (self) | |
paintRaised (self) | |
paintRect (self) | |
paintRectFrame (self, bool raised) | |
paintSunken (self) | |
setColor (self, QColor color) | |
setDarkFactor (self, int darkFactor) | |
setLook (self, KLed.Look look) | |
setShape (self, KLed.Shape shape) | |
setState (self, KLed.State state) | |
KLed.Shape | shape (self) |
QSize | sizeHint (self) |
KLed.State | state (self) |
toggle (self) |
Method Documentation
__init__ | ( | self, | ||
QWidget | parent=0 | |||
) |
Constructs a green, round LED widget which will initially be turned on.
- Parameters:
-
parent The parent widget.
Constructs a round LED widget with the supplied color which will initially be turned on.
- Parameters:
-
color Initial color of the LED. parent The parent widget.
Constructor
__init__ | ( | self, | ||
QColor | color, | |||
KLed.State | state, | |||
KLed.Look | look, | |||
KLed.Shape | shape, | |||
QWidget | parent=0 | |||
) |
Constructor with the color, state and look.
Differs from above only in the parameters, which configure all settings.
- Parameters:
-
color Initial color of the LED. state Sets the State. look Sets the Look. shape Sets the Shape (rectangular or circular). parent The parent widget.
Constructor
QColor color | ( | self ) |
Returns the current color of the widget.
- See also:
- Color
int darkFactor | ( | self ) |
Returns the factor to darken the LED.
- See also:
- setDarkFactor()
int ledWidth | ( | self ) |
Returns the width of the led.
KLed.Look look | ( | self ) |
Returns the current look of the widget.
- See also:
- Look
QSize minimumSizeHint | ( | self ) |
off | ( | self ) |
Sets the state of the widget to Off.
The widget will be painted immediately.
- See also:
- on() toggle() setState()
on | ( | self ) |
Sets the state of the widget to On.
The widget will be painted immediately.
- See also:
- off() toggle() setState()
bool paintCachedPixmap | ( | self ) |
Paint the cached antialiased pixmap corresponding to the state if any
- Returns:
- true if the pixmap was painted, false if it hasn't been created yet
paintEvent | ( | self, | ||
QPaintEvent | a0 | |||
) |
paintFlat | ( | self ) |
Paints a circular, flat LED.
paintRaised | ( | self ) |
Paints a circular, raised LED.
paintRect | ( | self ) |
Paints a rectangular, flat LED.
paintRectFrame | ( | self, | ||
bool | raised | |||
) |
Paints a rectangular LED, either raised or sunken, depending on its argument.
paintSunken | ( | self ) |
Paints a circular, sunken LED.
setColor | ( | self, | ||
QColor | color | |||
) |
Set the color of the widget.
The LED is shown with Color when in the KLed.On state or with the darken Color (@see setDarkFactor) in KLed.Off state.
The widget calls the update() method, so it will be updated when entering the main event loop.
- See also:
- Color
- Parameters:
-
color New color of the LED.
Sets the LED color.
setDarkFactor | ( | self, | ||
int | darkFactor | |||
) |
Sets the factor to darken the LED in KLed.Off state.
The
- Parameters:
-
darkFactor should be greater than 100, otherwise the LED becomes lighter in KLed.Off state.
Defaults to 300.
- See also:
- QColor
- Parameters:
-
darkFactor Sets the factor to darken the LED.
Sets the factor to darken the LED.
setLook | ( | self, | ||
KLed.Look | look | |||
) |
Sets the look of the widget.
The look may be Flat, Raised or Sunken.
The widget calls the update() method, so it will be updated when entering the main event loop.
- See also:
- Look
- Parameters:
-
look New look of the LED.
Sets LED look.
setShape | ( | self, | ||
KLed.Shape | shape | |||
) |
Set the shape of the LED.
- Parameters:
-
shape The LED shape.
Set LED shape.
setState | ( | self, | ||
KLed.State | state | |||
) |
Sets the state of the widget to On or Off.
The widget will be painted immediately.
- See also:
- on() off() toggle()
- Parameters:
-
state The LED state: on or off.
Set LED state.
KLed.Shape shape | ( | self ) |
Returns the current shape of the widget.
- See also:
- Shape
QSize sizeHint | ( | self ) |
KLed.State state | ( | self ) |
Returns the current state of the widget (on/off).
- See also:
- State
toggle | ( | self ) |
Toggles the state of the led from Off to On or vice versa.
The widget repaints itself immediately.
Enumeration Documentation
Look |
Displays a flat, round or sunken LED.
Displaying the LED flat is less time and color consuming, but not so nice to see.
The sunken LED itself is (certainly) smaller than the round LED because of the 3 shading circles and is most time consuming. Makes sense for LED > 15x15 pixels.
Timings: ( AMD K5/133, Diamond Stealth 64 PCI Graphics, widgetsize 29x29 )
The widget will be updated on the next repaining event.
LED look.
- Enumerator:
-
Flat Raised Sunken
Shape |
Shades of the lamp. LED shape
- Enumerator:
-
Rectangular Circular
State |
Status of the light is on/off. LED on/off.
- Enumerator:
-
Off On