eric4.E4Gui.E4Led

Module implementing a LED widget.

It was inspired by KLed.

Global Attributes

E4LedCircular
E4LedRectangular

Classes

E4Led Class implementing a LED widget.

Functions

None


E4Led

Class implementing a LED widget.

Derived from

QWidget

Class Attributes

None

Class Methods

None

Methods

E4Led Constructor
__getBestRoundSize Private method to calculate the width of the LED.
__paintRectangular Private method to paint a rectangular raised LED.
__paintRound Private method to paint a round raised LED.
color Public method to return the LED color.
darkFactor Public method to return the dark factor.
isFramed Public method to return the framed state.
isOn Public method to return the LED state.
minimumSizeHint Public method to give a hint about our minimum size.
off Public slot to set the LED to off.
on Public slot to set the LED to on.
paintEvent Protected slot handling the paint event.
ratio Public method to return the LED rectangular ratio (width / height).
setColor Public method to set the LED color.
setDarkFactor Public method to set the dark factor.
setFramed Public slot to set the __framedLed attribute.
setOn Public method to set the LED to on.
setRatio Public method to set the LED rectangular ratio (width / height).
setShape Public method to set the LED shape.
shape Public method to return the LED shape.
sizeHint Public method to give a hint about our desired size.
toggle Public slot to toggle the LED state.

Static Methods

None

E4Led (Constructor)

E4Led(parent = None, color = None, shape = E4LedCircular, rectRatio = 1)

Constructor

parent
reference to parent widget (QWidget)
color
color of the LED (QColor)
shape
shape of the LED (E4LedCircular, E4LedRectangular)
rectRation
ratio width to height, if shape is rectangular (float)

E4Led.__getBestRoundSize

__getBestRoundSize()

Private method to calculate the width of the LED.

Returns:
new width of the LED (integer)

E4Led.__paintRectangular

__paintRectangular()

Private method to paint a rectangular raised LED.

E4Led.__paintRound

__paintRound()

Private method to paint a round raised LED.

E4Led.color

color()

Public method to return the LED color.

Returns:
color of the LED (QColor)

E4Led.darkFactor

darkFactor()

Public method to return the dark factor.

Returns:
the current dark factor (integer)

E4Led.isFramed

isFramed()

Public method to return the framed state.

Returns:
flag indicating the current framed state (boolean)

E4Led.isOn

isOn()

Public method to return the LED state.

Returns:
flag indicating the light state (boolean)

E4Led.minimumSizeHint

minimumSizeHint()

Public method to give a hint about our minimum size.

Returns:
size hint (QSize)

E4Led.off

off()

Public slot to set the LED to off.

E4Led.on

on()

Public slot to set the LED to on.

E4Led.paintEvent

paintEvent(evt)

Protected slot handling the paint event.

evt
paint event object (QPaintEvent)
Raises TypeError:
The E4Led has an unsupported shape type.

E4Led.ratio

ratio()

Public method to return the LED rectangular ratio (width / height).

Returns:
LED rectangular ratio (float)

E4Led.setColor

setColor(color)

Public method to set the LED color.

color
color for the LED (QColor)

E4Led.setDarkFactor

setDarkFactor(darkfactor)

Public method to set the dark factor.

darkfactor
value to set for the dark factor (integer)

E4Led.setFramed

setFramed(framed)

Public slot to set the __framedLed attribute.

framed
flag indicating the framed state (boolean)

E4Led.setOn

setOn(state)

Public method to set the LED to on.

state
new state of the LED (boolean)

E4Led.setRatio

setRatio(ratio)

Public method to set the LED rectangular ratio (width / height).

ratio
new LED rectangular ratio (float)

E4Led.setShape

setShape(shape)

Public method to set the LED shape.

shape
new LED shape (E4LedCircular, E4LedRectangular)

E4Led.shape

shape()

Public method to return the LED shape.

Returns:
LED shape (E4LedCircular, E4LedRectangular)

E4Led.sizeHint

sizeHint()

Public method to give a hint about our desired size.

Returns:
size hint (QSize)

E4Led.toggle

toggle()

Public slot to toggle the LED state.

Up