| @@ -82,6 +82,7 @@ | |||
| <file>bitmaps/button_gui_hover2.png</file> | |||
| <file>bitmaps/button_off.png</file> | |||
| <file>bitmaps/button_on.png</file> | |||
| <file>bitmaps/dial_01.png</file> | |||
| <file>bitmaps/dial_01d.png</file> | |||
| <file>bitmaps/dial_02.png</file> | |||
| @@ -92,15 +93,21 @@ | |||
| <file>bitmaps/dial_04d.png</file> | |||
| <file>bitmaps/dial_05.png</file> | |||
| <file>bitmaps/dial_05d.png</file> | |||
| <file>bitmaps/kbd_h_classic.png</file> | |||
| <file>bitmaps/kbd_h_orange.png</file> | |||
| <file>bitmaps/kbd_v_classic.png</file> | |||
| <file>bitmaps/kbd_v_orange.png</file> | |||
| <file>bitmaps/led_off.png</file> | |||
| <file>bitmaps/led_blue.png</file> | |||
| <file>bitmaps/led_green.png</file> | |||
| <file>bitmaps/led_red.png</file> | |||
| <file>bitmaps/led_yellow.png</file> | |||
| <file>bitmaps/led_calf_off.png</file> | |||
| <file>bitmaps/led_calf_on.png</file> | |||
| <file>bitmaps/logo_calf.png</file> | |||
| <file>bitmaps/canvas/frame_node_header.png</file> | |||
| @@ -6,7 +6,7 @@ | |||
| <rect> | |||
| <x>0</x> | |||
| <y>0</y> | |||
| <width>665</width> | |||
| <width>644</width> | |||
| <height>80</height> | |||
| </rect> | |||
| </property> | |||
| @@ -103,8 +103,29 @@ | |||
| </item> | |||
| <item> | |||
| <widget class="LEDButton" name="led_midi"> | |||
| <property name="minimumSize"> | |||
| <size> | |||
| <width>25</width> | |||
| <height>25</height> | |||
| </size> | |||
| </property> | |||
| <property name="maximumSize"> | |||
| <size> | |||
| <width>25</width> | |||
| <height>25</height> | |||
| </size> | |||
| </property> | |||
| <property name="text"> | |||
| <string>M</string> | |||
| <string/> | |||
| </property> | |||
| <property name="iconSize"> | |||
| <size> | |||
| <width>25</width> | |||
| <height>25</height> | |||
| </size> | |||
| </property> | |||
| <property name="checkable"> | |||
| <bool>true</bool> | |||
| </property> | |||
| </widget> | |||
| </item> | |||
| @@ -139,7 +160,14 @@ | |||
| </widget> | |||
| </item> | |||
| <item> | |||
| <widget class="DigitalPeakMeter" name="peak_out" native="true"/> | |||
| <widget class="DigitalPeakMeter" name="peak_out" native="true"> | |||
| <property name="minimumSize"> | |||
| <size> | |||
| <width>150</width> | |||
| <height>0</height> | |||
| </size> | |||
| </property> | |||
| </widget> | |||
| </item> | |||
| </layout> | |||
| </item> | |||
| @@ -159,7 +187,14 @@ | |||
| </widget> | |||
| </item> | |||
| <item> | |||
| <widget class="DigitalPeakMeter" name="peak_in" native="true"/> | |||
| <widget class="DigitalPeakMeter" name="peak_in" native="true"> | |||
| <property name="minimumSize"> | |||
| <size> | |||
| <width>150</width> | |||
| <height>0</height> | |||
| </size> | |||
| </property> | |||
| </widget> | |||
| </item> | |||
| </layout> | |||
| </item> | |||
| @@ -19,7 +19,7 @@ | |||
| # ------------------------------------------------------------------------------------------------------------ | |||
| # Imports (Global) | |||
| from PyQt4.QtGui import QFrame | |||
| from PyQt4.QtGui import QFont, QFrame | |||
| # ------------------------------------------------------------------------------------------------------------ | |||
| # Imports (Custom) | |||
| @@ -559,6 +559,13 @@ class PluginSlot_Calf(PluginSlot): | |||
| self.fIsActive = False | |||
| self.fButtonFont = QFont() | |||
| self.fButtonFont.setBold(False) | |||
| self.fButtonFont.setPointSize(9) | |||
| self.fButtonColorOn = QColor( 18, 41, 87) | |||
| self.fButtonColorOff = QColor(150, 150, 150) | |||
| # ------------------------------------------------------------- | |||
| # Set-up GUI | |||
| @@ -575,10 +582,18 @@ class PluginSlot_Calf(PluginSlot): | |||
| self.ui.b_edit.setPixmaps(":/bitmaps/button_calf2.png", ":/bitmaps/button_calf2_down.png", ":/bitmaps/button_calf2_hover.png") | |||
| self.ui.b_remove.setPixmaps(":/bitmaps/button_calf1.png", ":/bitmaps/button_calf1_down.png", ":/bitmaps/button_calf1_hover.png") | |||
| self.ui.b_gui.setEnabled((self.fPluginInfo['hints'] & PLUGIN_HAS_CUSTOM_UI) != 0) | |||
| self.ui.b_edit.setTopText(self.tr("Edit"), self.fButtonColorOn, self.fButtonFont) | |||
| self.ui.b_remove.setTopText(self.tr("Remove"), self.fButtonColorOn, self.fButtonFont) | |||
| self.ui.led_midi.setColor(self.ui.led_midi.RED) | |||
| self.ui.led_midi.setEnabled(False) | |||
| if self.fPluginInfo['hints'] & PLUGIN_HAS_CUSTOM_UI: | |||
| self.ui.b_gui.setEnabled(True) | |||
| self.ui.b_gui.setTopText(self.tr("GUI"), self.fButtonColorOn, self.fButtonFont) | |||
| else: | |||
| self.ui.b_gui.setEnabled(False) | |||
| self.ui.b_gui.setTopText(self.tr("GUI"), self.fButtonColorOff, self.fButtonFont) | |||
| self.ui.led_midi.setColor(self.ui.led_midi.CALF) | |||
| #self.ui.led_midi.setEnabled(False) | |||
| self.ui.peak_in.setColor(self.ui.peak_in.GREEN) | |||
| self.ui.peak_in.setChannels(self.fPeaksInputCount) | |||
| @@ -606,12 +621,18 @@ class PluginSlot_Calf(PluginSlot): | |||
| #------------------------------------------------------------------ | |||
| def getFixedHeight(self): | |||
| return 80 | |||
| return 75 | |||
| #------------------------------------------------------------------ | |||
| def recheckPluginHints(self, hints): | |||
| self.ui.b_gui.setEnabled(hints & PLUGIN_HAS_CUSTOM_UI) | |||
| if hints & PLUGIN_HAS_CUSTOM_UI: | |||
| self.ui.b_gui.setEnabled(True) | |||
| self.ui.b_gui.setTopText(self.tr("GUI"), self.fButtonColorOn, self.fButtonFont) | |||
| else: | |||
| self.ui.b_gui.setEnabled(False) | |||
| self.ui.b_gui.setTopText(self.tr("GUI"), self.fButtonColorOff, self.fButtonFont) | |||
| PluginSlot.recheckPluginHints(self, hints) | |||
| def setName(self, name): | |||
| @@ -26,11 +26,14 @@ from PyQt4.QtGui import QPainter, QPixmap, QPushButton | |||
| # Widget Class | |||
| class LEDButton(QPushButton): | |||
| # normal | |||
| OFF = 0 | |||
| BLUE = 1 | |||
| GREEN = 2 | |||
| RED = 3 | |||
| YELLOW = 4 | |||
| # extra | |||
| CALF = 5 | |||
| def __init__(self, parent): | |||
| QPushButton.__init__(self, parent) | |||
| @@ -41,15 +44,20 @@ class LEDButton(QPushButton): | |||
| self.setCheckable(True) | |||
| self.setText("") | |||
| self.setColor(self.BLUE) | |||
| self.fLastColor = self.OFF | |||
| self.fPixmap.load(":/bitmaps/led_off.png") | |||
| self.setColor(self.BLUE) | |||
| def setColor(self, color): | |||
| self.fColor = color | |||
| size = 14 | |||
| self._loadPixmapNow() | |||
| # Fix calf off | |||
| if color == self.CALF: | |||
| self.fPixmap.load(":/bitmaps/led_calf_off.png") | |||
| size = self.fPixmap.width() | |||
| self.fPixmapRect = QRectF(0, 0, size, size) | |||
| self.setMinimumSize(size, size) | |||
| @@ -59,6 +67,12 @@ class LEDButton(QPushButton): | |||
| painter = QPainter(self) | |||
| event.accept() | |||
| self._loadPixmapNow() | |||
| painter.drawPixmap(self.fPixmapRect, self.fPixmap, self.fPixmapRect) | |||
| def _loadPixmapNow(self): | |||
| if self.isChecked(): | |||
| if self.fLastColor != self.fColor: | |||
| if self.fColor == self.OFF: | |||
| @@ -71,13 +85,13 @@ class LEDButton(QPushButton): | |||
| self.fPixmap.load(":/bitmaps/led_red.png") | |||
| elif self.fColor == self.YELLOW: | |||
| self.fPixmap.load(":/bitmaps/led_yellow.png") | |||
| elif self.fColor == self.CALF: | |||
| self.fPixmap.load(":/bitmaps/calf_on.png") | |||
| else: | |||
| return | |||
| self.fLastColor = self.fColor | |||
| elif self.fLastColor != self.OFF: | |||
| self.fPixmap.load(":/bitmaps/led_off.png") | |||
| self.fPixmap.load(":/bitmaps/led_calf_off.png" if self.fColor == self.CALF else ":/bitmaps/led_off.png") | |||
| self.fLastColor = self.OFF | |||
| painter.drawPixmap(self.fPixmapRect, self.fPixmap, self.fPixmapRect) | |||
| @@ -19,8 +19,8 @@ | |||
| # ------------------------------------------------------------------------------------------------------------ | |||
| # Imports (Global) | |||
| from PyQt4.QtCore import QRectF | |||
| from PyQt4.QtGui import QPainter, QPixmap, QPushButton | |||
| from PyQt4.QtCore import QPointF, QRectF | |||
| from PyQt4.QtGui import QColor, QFont, QPainter, QPixmap, QPushButton | |||
| # ------------------------------------------------------------------------------------------------------------ | |||
| # Widget Class | |||
| @@ -36,6 +36,10 @@ class PixmapButton(QPushButton): | |||
| self.fIsHovered = False | |||
| self.fTopText = "" | |||
| self.fTopTextColor = QColor() | |||
| self.fTopTextFont = QFont() | |||
| self.setText("") | |||
| def setPixmaps(self, normal, down, hover): | |||
| @@ -51,6 +55,11 @@ class PixmapButton(QPushButton): | |||
| self.setMinimumSize(width, height) | |||
| self.setMaximumSize(width, height) | |||
| def setTopText(self, text, color, font): | |||
| self.fTopText = text | |||
| self.fTopTextColor = color | |||
| self.fTopTextFont = font | |||
| def enterEvent(self, event): | |||
| self.fIsHovered = True | |||
| QPushButton.enterEvent(self, event) | |||
| @@ -77,3 +86,13 @@ class PixmapButton(QPushButton): | |||
| else: | |||
| painter.drawPixmap(self.fPixmapRect, self.fPixmapNormal, self.fPixmapRect) | |||
| if not self.fTopText: | |||
| return | |||
| painter.save() | |||
| painter.setPen(self.fTopTextColor) | |||
| painter.setBrush(self.fTopTextColor) | |||
| painter.setFont(self.fTopTextFont) | |||
| painter.drawText(QPointF(10, 16), self.fTopText) | |||
| painter.restore() | |||