Previous topic

qarbon.qt.gui.input

Next topic

qarbon.qt.gui.objectinfowidget

This Page

qarbon.qt.gui.led

A LED (light-emitting diode) widget.

This widget represents a led. The led has a color and a status (On/Off).

Here is an example showing how to display all possible combinations of color, status:

from qarbon.external.qt import QtGui
from qarbon.qt.gui.application import Application
from qarbon.qt.gui.led import Led, LedStatus, LedColor

app = Application()
panel = QtGui.QWidget()
layout = QtGui.QGridLayout()
panel.setLayout(layout)
for i, color in enumerate(LedColor):
    led = Led()
    led.ledColor = color
    led.ledStatus = LedStatus.Off
    layout.addWidget(led, i, 0)
    led = Led()
    led.ledColor = color
    led.ledStatus = LedStatus.On
    layout.addWidget(led, i, 1)
panel.show()

app.exec_()

Inheritance diagram of qarbon.qt.gui.led

Classes

Led A LED (light-emitting diode) like widget
class qarbon.qt.gui.led.LedColor[source]

Bases: qarbon.external.enum._enum.Enum

possible led colors

class qarbon.qt.gui.led.LedStatus[source]

Bases: qarbon.external.enum._enum.Enum

possible led status

class qarbon.qt.gui.led.Led(parent=None)[source]

Bases: qarbon.qt.gui.pixmapwidget.PixmapWidget

A LED (light-emitting diode) like widget

DefaultLedPattern = 'qarbon:/led/led_{color}_{status}.png'

constant defining default led image filename pattern

DefaultLedColor = <LedColor.Green: 1>

constant defining default led color (green)

DefaultLedStatus = <LedStatus.On: 1>

constant defining default led status (On)

DefaultLedInverted = False

constant defining default led status invertion (False)

sizeHint()[source]
minimumSizeHint()[source]

Overwrite the default minimum size hint (0,0) to be (8, 8)

Returns:the minimum size hint 8, 8
Return type:QSize
toLedName(status=None, color=None, inverted=None)[source]

Gives the led name for the given status and color. If status or color are not given, the current led status or color are used.

Parameters:
  • status (bool) – the status
  • color (str) – the color
Returns:

string containing the led name

Return type:

str

isLedColorValid(name)[source]

Determines if the given color name is valid.

Parameters:color (str) – the color
Returns:True is the given color name is valid or False otherwise
Return type:bool
getLedPatternName()[source]

Returns the current led pattern name :return: led pattern name :rtype: str

setLedPatternName(name)[source]

Sets the led pattern name. Should be a string containing a path to valid images. The string can contain the keywords:

  1. {status} - transformed to ‘on’ of ‘off’ according to the status
  2. {color} - transformed to the current led color

Example: :leds/images256/led_{color}_{status}.png will be transformed to :leds/images256/led_red_on.png when the led status is True and the led color is red.

Parameters:name (str) – new pattern
resetLedPatternName()[source]

Resets the led pattern to fwk4:/Leds/led_{color}_{status}.png.

getLedStatus()[source]

Returns the led status :return: led status :rtype: bool

setLedStatus(status)[source]

Sets the led status :param status: the new status :type status: bool

resetLedStatus()[source]

Resets the led status

toggleLedStatus()[source]

toggles the current status of the led

getLedInverted()[source]

Returns if the led is inverted. :return: inverted mode :rtype: bool

setLedInverted(inverted)[source]

Sets the led inverted mode :param status: the new inverted mode :type status: bool

resetLedInverted()[source]

Resets the led inverted mode

getLedColor()[source]

Returns the led color :return: led color :rtype: LedColor

setLedColor(color)[source]

Sets the led color :param status: the new color :type status: LedColor

resetLedColor()[source]

Resets the led color

classmethod getQtDesignerPluginInfo()[source]
ledStatus = <PyQt4.QtCore.pyqtProperty object at 0x36ddc50>

This property holds the led status: False means OFF, True means ON

Access functions:

ledColor = <PyQt4.QtCore.pyqtProperty object at 0x36e3050>

This property holds the led color

Access functions:

ledInverted = <PyQt4.QtCore.pyqtProperty object at 0x36e3090>

This property holds the led inverted: False means do not invert the

Access functions:

ledPattern = <PyQt4.QtCore.pyqtProperty object at 0x36e30d0>

This property holds the led pattern name

Access functions: