diff --git a/src/digitalpeakmeter.py b/src/digitalpeakmeter.py
index f90bc2c..60bfc07 100644
--- a/src/digitalpeakmeter.py
+++ b/src/digitalpeakmeter.py
@@ -48,7 +48,7 @@ class DigitalPeakMeter(QWidget):
def displayMeter(self, meter_n, level):
if (meter_n < 0 or meter_n > self.m_channels):
- qCritical("DigitalPeakMeter::displayMeter(%i, %f) - Invalid meter number", meter_n, level)
+ qCritical("DigitalPeakMeter::displayMeter(%i, %f) - Invalid meter number" % (meter_n, level))
return
if (level < 0.0):
diff --git a/src/icons/bitmaps/led-big_off.png b/src/icons/bitmaps/led-big_off.png
new file mode 100644
index 0000000..31e6130
Binary files /dev/null and b/src/icons/bitmaps/led-big_off.png differ
diff --git a/src/icons/bitmaps/led-big_on.png b/src/icons/bitmaps/led-big_on.png
new file mode 100644
index 0000000..88b7bf9
Binary files /dev/null and b/src/icons/bitmaps/led-big_on.png differ
diff --git a/src/icons/bitmaps/led_blue.png b/src/icons/bitmaps/led_blue.png
new file mode 100644
index 0000000..d877fed
Binary files /dev/null and b/src/icons/bitmaps/led_blue.png differ
diff --git a/src/icons/bitmaps/led_green.png b/src/icons/bitmaps/led_green.png
new file mode 100644
index 0000000..52da51e
Binary files /dev/null and b/src/icons/bitmaps/led_green.png differ
diff --git a/src/icons/bitmaps/led_off.png b/src/icons/bitmaps/led_off.png
new file mode 100644
index 0000000..1bca42c
Binary files /dev/null and b/src/icons/bitmaps/led_off.png differ
diff --git a/src/icons/bitmaps/led_red.png b/src/icons/bitmaps/led_red.png
new file mode 100644
index 0000000..a952839
Binary files /dev/null and b/src/icons/bitmaps/led_red.png differ
diff --git a/src/icons/bitmaps/led_yellow.png b/src/icons/bitmaps/led_yellow.png
new file mode 100644
index 0000000..280d904
Binary files /dev/null and b/src/icons/bitmaps/led_yellow.png differ
diff --git a/src/icons/icons.qrc b/src/icons/icons.qrc
index f86351a..51da77c 100644
--- a/src/icons/icons.qrc
+++ b/src/icons/icons.qrc
@@ -20,5 +20,12 @@
bitmaps/kbd_h_orange.png
bitmaps/kbd_v_classic.png
bitmaps/kbd_v_orange.png
+ bitmaps/led_off.png
+ bitmaps/led_blue.png
+ bitmaps/led_green.png
+ bitmaps/led_red.png
+ bitmaps/led_yellow.png
+ bitmaps/led-big_on.png
+ bitmaps/led-big_off.png
diff --git a/src/ledbutton.py b/src/ledbutton.py
new file mode 100644
index 0000000..dd50abf
--- /dev/null
+++ b/src/ledbutton.py
@@ -0,0 +1,94 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# Pixmap Button, a custom Qt4 widget
+# Copyright (C) 2012 Filipe Coelho
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# For a full copy of the GNU General Public License see the COPYING file
+
+# Imports (Global)
+from PyQt4.QtCore import qCritical, QRectF
+from PyQt4.QtGui import QPainter, QPixmap, QPushButton
+
+# Imports (Custom Stuff)
+import icons_rc
+
+# Widget Class
+class LEDButton(QPushButton):
+
+ BLUE = 1
+ GREEN = 2
+ RED = 3
+ YELLOW = 4
+ BIG_RED = 5
+
+ def __init__(self, parent):
+ QPushButton.__init__(self, parent)
+
+ self.m_pixmap = QPixmap()
+ self.m_pixmap_rect = QRectF(0, 0, 0, 0)
+
+ self.setCheckable(True)
+ self.setText("")
+
+ self.setColor(self.BLUE)
+
+ from PyQt4.QtCore import QTimer
+ QTimer.singleShot(3000, self.close)
+
+ def setColor(self, color):
+ self.m_color = color
+
+ if (color in (self.BLUE, self.GREEN, self.RED, self.YELLOW)):
+ size = 14
+ elif (color == self.BIG_RED):
+ size = 64
+ else:
+ qCritical("LEDButton::setColor(%i) - Invalid color" % (color))
+ return
+
+ self.setPixmapSize(size)
+
+ def setPixmapSize(self, size):
+ self.m_pixmap_rect = QRectF(0, 0, size, size)
+
+ self.setMinimumWidth(size)
+ self.setMaximumWidth(size)
+ self.setMinimumHeight(size)
+ self.setMaximumHeight(size)
+
+ def paintEvent(self, event):
+ painter = QPainter(self)
+
+ if (self.isChecked()):
+ if (self.m_color == self.BLUE):
+ self.m_pixmap.load(":/bitmaps/led_blue.png")
+ elif (self.m_color == self.GREEN):
+ self.m_pixmap.load(":/bitmaps/led_green.png")
+ elif (self.m_color == self.RED):
+ self.m_pixmap.load(":/bitmaps/led_red.png")
+ elif (self.m_color == self.YELLOW):
+ self.m_pixmap.load(":/bitmaps/led_yellow.png")
+ elif (self.m_color == self.BIG_RED):
+ self.m_pixmap.load(":/bitmaps/led-big_on.png")
+ else:
+ return
+ else:
+ if (self.m_color in (self.BLUE, self.GREEN, self.RED, self.YELLOW)):
+ self.m_pixmap.load(":/bitmaps/led_off.png")
+ elif (self.m_color == self.BIG_RED):
+ self.m_pixmap.load(":/bitmaps/led-big_off.png")
+ else:
+ return
+
+ painter.drawPixmap(self.m_pixmap_rect, self.m_pixmap, self.m_pixmap_rect)
diff --git a/src/pixmapdial.py b/src/pixmapdial.py
index f603fd2..de65bc2 100644
--- a/src/pixmapdial.py
+++ b/src/pixmapdial.py
@@ -25,6 +25,7 @@ import icons_rc
# Widget Class
class PixmapDial(QDial):
+
HORIZONTAL = 0
VERTICAL = 1
diff --git a/src/pixmapkeyboard.py b/src/pixmapkeyboard.py
index 26165c1..0c6a6b1 100644
--- a/src/pixmapkeyboard.py
+++ b/src/pixmapkeyboard.py
@@ -142,7 +142,7 @@ class PixmapKeyboard(QWidget):
elif (color == self.COLOR_ORANGE):
self.m_colorStr = "orange"
else:
- qCritical("PixmapKeyboard::setMode(%i, %i) - Invalid keyboard color", mode, color)
+ qCritical("PixmapKeyboard::setMode(%i, %i) - Invalid keyboard color" % (mode, color))
self.setMode(mode)
return
@@ -159,7 +159,7 @@ class PixmapKeyboard(QWidget):
self.p_width = self.m_pixmap.width()/2
self.p_height = self.m_pixmap.height()
else:
- qCritical("PixmapKeyboard::setMode(%i, %i) - Invalid keyboard mode", mode, color)
+ qCritical("PixmapKeyboard::setMode(%i, %i) - Invalid keyboard mode" % (mode, color))
self.setMode(self.HORIZONTAL)
return