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_()
Classes
| Led | A LED (light-emitting diode) like widget |
Bases: qarbon.external.enum._enum.Enum
possible led colors
Bases: qarbon.external.enum._enum.Enum
possible led status
Bases: qarbon.qt.gui.pixmapwidget.PixmapWidget
A LED (light-emitting diode) like widget
constant defining default led image filename pattern
constant defining default led color (green)
constant defining default led status (On)
constant defining default led status invertion (False)
Overwrite the default minimum size hint (0,0) to be (8, 8)
| Returns: | the minimum size hint 8, 8 |
|---|---|
| Return type: | QSize |
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: | |
|---|---|
| Returns: | string containing the led name |
| Return type: | str |
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 |
Returns the current led pattern name :return: led pattern name :rtype: str
Sets the led pattern name. Should be a string containing a path to valid images. The string can contain the keywords:
- {status} - transformed to ‘on’ of ‘off’ according to the status
- {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 |
|---|
Sets the led inverted mode :param status: the new inverted mode :type status: bool
This property holds the led status: False means OFF, True means ON
Access functions:
This property holds the led color
Access functions:
This property holds the led inverted: False means do not invert the
Access functions:
This property holds the led pattern name
Access functions: