# eric7.EricWidgets.EricLed

Module implementing a LED widget.

It was inspired by KLed.

### Global Attributes

None

### Classes

EricClickableLed | Class implementing a clickable LED widget.
EricLed | Class implementing a LED widget.
EricLedType | Class defining the LED types.

### Functions

None

## EricClickableLed

Class implementing a clickable LED widget.

### Signals

clicked(QPoint)
  emitted upon a click on the LED with the left button
middleClicked(QPoint)
  emitted upon a click on the LED with the middle button or CTRL and left button

### Derived from

EricLed

### Class Attributes

None

### Class Methods

None

### Methods

EricClickableLed | Constructor
mouseReleaseEvent | Protected method handling mouse release events.

### Static Methods

None

#### EricClickableLed (Constructor)

EricClickableLed(parent=None, color=None, shape=EricLedType.CIRCULAR, rectRatio=1)

Constructor

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

#### EricClickableLed.mouseReleaseEvent

mouseReleaseEvent(evt)

Protected method handling mouse release events.

evt
  mouse event (QMouseEvent)

Up

## EricLed

Class implementing a LED widget.

### Derived from

QWidget

### Class Attributes

None

### Class Methods

None

### Methods

EricLed | 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

#### EricLed (Constructor)

EricLed(parent=None, color=None, shape=EricLedType.CIRCULAR, rectRatio=1)

Constructor

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

#### EricLed.__getBestRoundSize

__getBestRoundSize()

Private method to calculate the width of the LED.

Return:
  new width of the LED (integer)

#### EricLed.__paintRectangular

__paintRectangular()

Private method to paint a rectangular raised LED.

#### EricLed.__paintRound

__paintRound()

Private method to paint a round raised LED.

#### EricLed.color

color()

Public method to return the LED color.

Return:
  color of the LED (QColor)

#### EricLed.darkFactor

darkFactor()

Public method to return the dark factor.

Return:
  the current dark factor (integer)

#### EricLed.isFramed

isFramed()

Public method to return the framed state.

Return:
  flag indicating the current framed state (boolean)

#### EricLed.isOn

isOn()

Public method to return the LED state.

Return:
  flag indicating the light state (boolean)

#### EricLed.minimumSizeHint

minimumSizeHint()

Public method to give a hint about our minimum size.

Return:
  size hint (QSize)

#### EricLed.off

off()

Public slot to set the LED to off.

#### EricLed.on

on()

Public slot to set the LED to on.

#### EricLed.paintEvent

paintEvent(evt)

Protected slot handling the paint event.

evt (QPaintEvent)
  paint event object

#### EricLed.ratio

ratio()

Public method to return the LED rectangular ratio [= width / height].

Return:
  LED rectangular ratio (float)

#### EricLed.setColor

setColor(color)

Public method to set the LED color.

color
  color for the LED (QColor)

#### EricLed.setDarkFactor

setDarkFactor(darkfactor)

Public method to set the dark factor.

darkfactor
  value to set for the dark factor (integer)

#### EricLed.setFramed

setFramed(framed)

Public slot to set the __framedLed attribute.

framed
  flag indicating the framed state (boolean)

#### EricLed.setOn

setOn(state)

Public method to set the LED to on.

state
  new state of the LED (boolean)

#### EricLed.setRatio

setRatio(ratio)

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

ratio
  new LED rectangular ratio (float)

#### EricLed.setShape

setShape(shape)

Public method to set the LED shape.

shape (EricLedType)
  new LED shape

#### EricLed.shape

shape()

Public method to return the LED shape.

Return:
  LED shape

Return Type:
  EricLedType

#### EricLed.sizeHint

sizeHint()

Public method to give a hint about our desired size.

Return:
  size hint (QSize)

#### EricLed.toggle

toggle()

Public slot to toggle the LED state.

Up

## EricLedType

Class defining the LED types.

### Derived from

enum.Enum

### Class Attributes

CIRCULAR
RECTANGULAR

### Class Methods

None

### Methods

None

### Static Methods

None

Up