From c712e587ca6c248e52159c62de79e1fcfbd7a995 Mon Sep 17 00:00:00 2001 From: falkTX Date: Tue, 12 Mar 2013 19:23:25 +0000 Subject: [PATCH] Rework makefiles, incomplete --- resources/ui/carla.ui | 1 - source/carla.py | 2 +- source/carla_shared.py | 3 +- source/discovery/Makefile | 2 - source/libs/Makefile | 35 +++-- source/libs/distrho/dgl/Makefile | 91 +++++++++-- source/libs/lilv/Makefile | 57 +++---- source/libs/rtmempool/Makefile | 64 ++++---- source/widgets/canvaspreviewframe.py | 9 +- source/widgets/digitalpeakmeter.py | 160 ++++++++++---------- source/widgets/pixmapdial.py | 33 ++-- source/widgets/pixmapkeyboard.py | 217 +++++++++++++-------------- 12 files changed, 378 insertions(+), 296 deletions(-) diff --git a/resources/ui/carla.ui b/resources/ui/carla.ui index 89c1cb77e..2df78dcec 100644 --- a/resources/ui/carla.ui +++ b/resources/ui/carla.ui @@ -318,7 +318,6 @@ - toolBar diff --git a/source/carla.py b/source/carla.py index 7125147e7..1dcb17879 100755 --- a/source/carla.py +++ b/source/carla.py @@ -598,7 +598,7 @@ class CarlaMainW(QMainWindow): # Set-up Canvas Preview self.ui.miniCanvasPreview.setRealParent(self) - self.ui.miniCanvasPreview.setViewTheme(patchcanvas.canvas.theme.rubberband_brush, patchcanvas.canvas.theme.rubberband_pen.color()) + self.ui.miniCanvasPreview.setViewTheme(patchcanvas.canvas.theme.canvas_bg, patchcanvas.canvas.theme.rubberband_brush, patchcanvas.canvas.theme.rubberband_pen.color()) self.ui.miniCanvasPreview.init(self.scene, DEFAULT_CANVAS_WIDTH, DEFAULT_CANVAS_HEIGHT) QTimer.singleShot(100, self, SLOT("slot_miniCanvasInit()")) diff --git a/source/carla_shared.py b/source/carla_shared.py index 92e6c14e3..b83cb20a9 100644 --- a/source/carla_shared.py +++ b/source/carla_shared.py @@ -25,12 +25,11 @@ import platform import sys from codecs import open as codecopen from copy import deepcopy -#from decimal import Decimal from subprocess import Popen, PIPE from PyQt4.QtCore import pyqtSlot, qWarning, Qt, QByteArray, QSettings, QThread, QTimer, SIGNAL, SLOT from PyQt4.QtGui import QColor, QCursor, QDialog, QIcon, QFileDialog, QFontMetrics, QFrame, QMenu from PyQt4.QtGui import QMessageBox, QPainter, QPainterPath, QTableWidgetItem, QVBoxLayout, QWidget -#from PyQt4.QtGui import QGraphicsScene, QInputDialog, QLinearGradient, +#from PyQt4.QtGui import QInputDialog, QLinearGradient, #from PyQt4.QtXml import QDomDocument # ------------------------------------------------------------------------------------------------------------ diff --git a/source/discovery/Makefile b/source/discovery/Makefile index 7c24231c3..7f0496a7c 100644 --- a/source/discovery/Makefile +++ b/source/discovery/Makefile @@ -78,7 +78,5 @@ carla-discovery-win64.exe: $(OBJS) ../libs/lilv_win64.a clean: rm -f carla-discovery-* -# -------------------------------------------------------------- - debug: $(MAKE) DEBUG=true diff --git a/source/libs/Makefile b/source/libs/Makefile index bb1e94e92..961316a58 100644 --- a/source/libs/Makefile +++ b/source/libs/Makefile @@ -11,26 +11,15 @@ all: dgl.a: $(MAKE) -C distrho/dgl -# -------------------------------------------------------------- - -jackbridge-win32.dll: - $(MAKE) -C jackbridge win32 - -jackbridge-win64.dll: - $(MAKE) -C jackbridge win64 - -jackbridge-win32.dll.so: - $(MAKE) -C jackbridge wine32 - -jackbridge-win64.dll.so: - $(MAKE) -C jackbridge wine64 +dgl.%.a: + $(MAKE) -C distrho/dgl $* # -------------------------------------------------------------- lilv.a: $(MAKE) -C lilv -lilv_%.a: +lilv.%.a: $(MAKE) -C lilv $* # -------------------------------------------------------------- @@ -38,13 +27,27 @@ lilv_%.a: rtmempool.a: $(MAKE) -C rtmempool -rtmempool_%.a: +rtmempool.%.a: $(MAKE) -C rtmempool $* # -------------------------------------------------------------- +jackbridge-win32.dll: + $(MAKE) -C jackbridge win32 + +jackbridge-win64.dll: + $(MAKE) -C jackbridge win64 + +jackbridge-win32.dll.so: + $(MAKE) -C jackbridge wine32 + +jackbridge-win64.dll.so: + $(MAKE) -C jackbridge wine64 + +# -------------------------------------------------------------- + clean: - rm -f *.a *.def *.dll *.so + rm -f *~ *.a *.def *.dll *.dylib *.so $(MAKE) clean -C distrho/dgl $(MAKE) clean -C lilv $(MAKE) clean -C rtmempool diff --git a/source/libs/distrho/dgl/Makefile b/source/libs/distrho/dgl/Makefile index 0213628dd..02cc34bae 100644 --- a/source/libs/distrho/dgl/Makefile +++ b/source/libs/distrho/dgl/Makefile @@ -10,7 +10,7 @@ include ../../../Makefile.mk BUILD_CXX_FLAGS += -fvisibility=hidden -fPIC -I. -OBJS = \ +OBJS = \ src/App.cpp.o \ src/Image.cpp.o \ src/ImageAboutWindow.cpp.o \ @@ -21,23 +21,76 @@ OBJS = \ src/Widget.cpp.o \ src/Window.cpp.o +OBJS_posix32 = \ + src/App.cpp.posix32.o \ + src/Image.cpp.posix32.o \ + src/ImageAboutWindow.cpp.posix32.o \ + src/ImageButton.cpp.posix32.o \ + src/ImageKnob.cpp.posix32.o \ + src/ImageSlider.cpp.posix32.o \ + src/Geometry.cpp.posix32.o \ + src/Widget.cpp.posix32.o \ + src/Window.cpp.posix32.o + +OBJS_posix64 = \ + src/App.cpp.posix64.o \ + src/Image.cpp.posix64.o \ + src/ImageAboutWindow.cpp.posix64.o \ + src/ImageButton.cpp.posix64.o \ + src/ImageKnob.cpp.posix64.o \ + src/ImageSlider.cpp.posix64.o \ + src/Geometry.cpp.posix64.o \ + src/Widget.cpp.posix64.o \ + src/Window.cpp.posix64.o + +OBJS_win32 = \ + src/App.cpp.win32.o \ + src/Image.cpp.win32.o \ + src/ImageAboutWindow.cpp.win32.o \ + src/ImageButton.cpp.win32.o \ + src/ImageKnob.cpp.win32.o \ + src/ImageSlider.cpp.win32.o \ + src/Geometry.cpp.win32.o \ + src/Widget.cpp.win32.o \ + src/Window.cpp.win32.o + +OBJS_win64 = \ + src/App.cpp.win64.o \ + src/Image.cpp.win64.o \ + src/ImageAboutWindow.cpp.win64.o \ + src/ImageButton.cpp.win64.o \ + src/ImageKnob.cpp.win64.o \ + src/ImageSlider.cpp.win64.o \ + src/Geometry.cpp.win64.o \ + src/Widget.cpp.win64.o \ + src/Window.cpp.win64.o + OBJSM = src/pugl/pugl_osx.m.o -STATIC = ../../dgl.a +# -------------------------------------------------------------- + +all: ../../dgl.a + +posix32: ../../dgl.posix32.a +posix64: ../../dgl.posix64.a +win32: ../../dgl.win32.a +win64: ../../dgl.win64.a # -------------------------------------------------------------- -all: $(STATIC) +../../dgl.a: $(OBJS) + $(AR) rs $@ $^ -clean: - rm -f $(OBJS) $(OBJSM) $(SHARED) $(STATIC) +../../dgl.posix32.a: $(OBJS_posix32) + $(AR) rs $@ $^ -debug: - $(MAKE) DEBUG=true +../../dgl.posix64.a: $(OBJS_posix64) + $(AR) rs $@ $^ -# -------------------------------------------------------------- +../../dgl.win32.a: $(OBJS_win32) + $(AR) rs $@ $^ -$(STATIC): $(OBJS) +../../dgl.win64.a: $(OBJS_win64) $(AR) rs $@ $^ ../../dgl.dll: $(OBJS) @@ -54,5 +107,25 @@ $(STATIC): $(OBJS) %.cpp.o: %.cpp $(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ +%.cpp.posix32.o: %.cpp + $(CXX) $< $(BUILD_CXX_FLAGS) $(32BIT_FLAGS) -c -o $@ + +%.cpp.posix64.o: %.cpp + $(CXX) $< $(BUILD_CXX_FLAGS) $(64BIT_FLAGS) -c -o $@ + +%.cpp.win32.o: %.cpp + $(CXX) $< $(BUILD_CXX_FLAGS) $(32BIT_FLAGS) -c -o $@ + +%.cpp.win64.o: %.cpp + $(CXX) $< $(BUILD_CXX_FLAGS) $(64BIT_FLAGS) -c -o $@ + %.m.o: %.m $(CC) $< $(BUILD_C_FLAGS) -objc -c -o $@ + +# -------------------------------------------------------------- + +clean: + rm -f *.o src/*.o src/pugl/*.o ../../dgl.* + +debug: + $(MAKE) DEBUG=true diff --git a/source/libs/lilv/Makefile b/source/libs/lilv/Makefile index cbba76f67..c27796aba 100644 --- a/source/libs/lilv/Makefile +++ b/source/libs/lilv/Makefile @@ -1,6 +1,6 @@ #!/usr/bin/make -f # Makefile for lilv # -# ----------------------- # +# ----------------- # # Created by falkTX # @@ -16,81 +16,84 @@ LILV_VERSION = 0.14.4 BUILD_C_FLAGS += -fvisibility=hidden -fPIC -w BUILD_C_FLAGS += -Iconfig -I../../includes -OBJS = serd.o sord.o sratom.o lilv.o -OBJS_posix32 = serd_posix32.o sord_posix32.o sratom_posix32.o lilv_posix32.o -OBJS_posix64 = serd_posix64.o sord_posix64.o sratom_posix64.o lilv_posix64.o -OBJS_win32 = serd_win32.o sord_win32.o sratom_win32.o lilv_win32.o -OBJS_win64 = serd_win64.o sord_win64.o sratom_win64.o lilv_win64.o +OBJS = serd.c.o sord.c.o sratom.c.o lilv.c.o +OBJS_posix32 = serd.c.posix32.o sord.c.posix32.o sratom.c.posix32.o lilv.c.posix32.o +OBJS_posix64 = serd.c.posix64.o sord.c.posix64.o sratom.c.posix64.o lilv.c.posix64.o +OBJS_win32 = serd.c.win32.o sord.c.win32.o sratom.c.win32.o lilv.c.win32.o +OBJS_win64 = serd.c.win64.o sord.c.win64.o sratom.c.win64.o lilv.c.win64.o # -------------------------------------------------------------- all: ../lilv.a -posix32: ../lilv_posix32.a -posix64: ../lilv_posix64.a -win32: ../lilv_win32.a -win64: ../lilv_win64.a +posix32: ../lilv.posix32.a +posix64: ../lilv.posix64.a +win32: ../lilv.win32.a +win64: ../lilv.win64.a # -------------------------------------------------------------- ../lilv.a: $(OBJS) $(AR) rs $@ $^ -../lilv_posix32.a: $(OBJS_posix32) +../lilv.posix32.a: $(OBJS_posix32) $(AR) rs $@ $^ -../lilv_posix64.a: $(OBJS_posix64) +../lilv.posix64.a: $(OBJS_posix64) $(AR) rs $@ $^ -../lilv_win32.a: $(OBJS_win32) +../lilv.win32.a: $(OBJS_win32) $(AR) rs $@ $^ -../lilv_win64.a: $(OBJS_win64) +../lilv.win64.a: $(OBJS_win64) $(AR) rs $@ $^ # -------------------------------------------------------------- -serd.o: serd.c +serd.c.o: serd.c $(CC) $< $(BUILD_C_FLAGS) -Iserd-$(SERD_VERSION) -c -o $@ -sord.o: sord.c +sord.c.o: sord.c $(CC) $< $(BUILD_C_FLAGS) -Isord-$(SORD_VERSION) -Isord-$(SORD_VERSION)/src -c -o $@ -sratom.o: sratom.c +sratom.c.o: sratom.c $(CC) $< $(BUILD_C_FLAGS) -Isratom-$(SRATOM_VERSION) -c -o $@ -lilv.o: lilv.c +lilv.c.o: lilv.c $(CC) $< $(BUILD_C_FLAGS) -Ililv-$(LILV_VERSION) -Ililv-$(LILV_VERSION)/src -c -o $@ # -------------------------------------------------------------- -serd_%32.o: serd.c +serd.c.%32.o: serd.c $(CC) $< $(BUILD_C_FLAGS) -Iserd-$(SERD_VERSION) $(32BIT_FLAGS) -c -o $@ -sord_%32.o: sord.c +sord.c.%32.o: sord.c $(CC) $< $(BUILD_C_FLAGS) -Isord-$(SORD_VERSION) -Isord-$(SORD_VERSION)/src $(32BIT_FLAGS) -c -o $@ -sratom_%32.o: sratom.c +sratom.c.%32.o: sratom.c $(CC) $< $(BUILD_C_FLAGS) -Isratom-$(SRATOM_VERSION) $(32BIT_FLAGS) -c -o $@ -lilv_%32.o: lilv.c +lilv.c.%32.o: lilv.c $(CC) $< $(BUILD_C_FLAGS) -Ililv-$(LILV_VERSION) -Ililv-$(LILV_VERSION)/src $(32BIT_FLAGS) -c -o $@ # -------------------------------------------------------------- -serd_%64.o: serd.c +serd.c.%64.o: serd.c $(CC) $< $(BUILD_C_FLAGS) -Iserd-$(SERD_VERSION) $(64BIT_FLAGS) -c -o $@ -sord_%64.o: sord.c +sord.c.%64.o: sord.c $(CC) $< $(BUILD_C_FLAGS) -Isord-$(SORD_VERSION) -Isord-$(SORD_VERSION)/src $(64BIT_FLAGS) -c -o $@ -sratom_%64.o: sratom.c +sratom.c.%64.o: sratom.c $(CC) $< $(BUILD_C_FLAGS) -Isratom-$(SRATOM_VERSION) $(64BIT_FLAGS) -c -o $@ -lilv_%64.o: lilv.c +lilv.c.%64.o: lilv.c $(CC) $< $(BUILD_C_FLAGS) -Ililv-$(LILV_VERSION) -Ililv-$(LILV_VERSION)/src $(64BIT_FLAGS) -c -o $@ # -------------------------------------------------------------- clean: - rm -f *.o + rm -f *.o ../lilv.* + +debug: + $(MAKE) DEBUG=true diff --git a/source/libs/rtmempool/Makefile b/source/libs/rtmempool/Makefile index d1f807b7a..c05a626be 100644 --- a/source/libs/rtmempool/Makefile +++ b/source/libs/rtmempool/Makefile @@ -1,6 +1,6 @@ #!/usr/bin/make -f # Makefile for rtmempool # -# ----------------------------------- # +# ---------------------- # # Created by falkTX # @@ -8,71 +8,77 @@ include ../../Makefile.mk # -------------------------------------------------------------- -BUILD_C_FLAGS += -fvisibility=hidden -fPIC +BUILD_C_FLAGS += -fvisibility=hidden -fPIC -pthread BUILD_C_FLAGS += -I. -I../../includes ifeq ($(CARLA_PLUGIN_SUPPORT),true) BUILD_C_FLAGS += -DWANT_LV2 endif -OBJS = rtmempool.o -OBJS_posix32 = rtmempool_posix32.o -OBJS_posix64 = rtmempool_posix64.o -OBJS_win32 = rtmempool_win32.o -OBJS_win64 = rtmempool_win64.o +LINK_FLAGS += -lpthread + +OBJS = rtmempool.c.o +OBJS_posix32 = rtmempool.c.posix32.o +OBJS_posix64 = rtmempool.c.posix64.o +OBJS_win32 = rtmempool.c.win32.o +OBJS_win64 = rtmempool.c.win64.o # -------------------------------------------------------------- all: ../rtmempool.a -posix32: ../rtmempool_posix32.a -posix64: ../rtmempool_posix64.a -win32: ../rtmempool_win32.a -win64: ../rtmempool_win64.a +posix32: ../rtmempool.posix32.a +posix64: ../rtmempool.posix64.a +win32: ../rtmempool.win32.a +win64: ../rtmempool.win64.a # -------------------------------------------------------------- ../rtmempool.a: $(OBJS) $(AR) rs $@ $^ -../rtmempool_posix32.a: $(OBJS_posix32) +../rtmempool.posix32.a: $(OBJS_posix32) $(AR) rs $@ $^ -../rtmempool_posix64.a: $(OBJS_posix64) +../rtmempool.posix64.a: $(OBJS_posix64) $(AR) rs $@ $^ -../rtmempool_win32.a: $(OBJS_win32) +../rtmempool.win32.a: $(OBJS_win32) $(AR) rs $@ $^ -../rtmempool_win64.a: $(OBJS_win64) +../rtmempool.win64.a: $(OBJS_win64) $(AR) rs $@ $^ -# -------------------------------------------------------------- +../rtmempool.dll: $(OBJS) + $(CXX) $^ -shared $(LINK_FLAGS) -o $@ -rtmempool.o: rtmempool.c - $(CC) $< $(BUILD_C_FLAGS) -c -o $@ +../rtmempool.dylib: $(OBJS) + $(CXX) $^ -shared $(LINK_FLAGS) -o $@ + +../rtmempool.so: $(OBJS) + $(CXX) $^ -shared $(LINK_FLAGS) -o $@ # -------------------------------------------------------------- -rtmempool_posix32.o: rtmempool.c - $(CC) $< $(BUILD_C_FLAGS) $(32BIT_FLAGS) -c -o $@ +rtmempool.c.o: rtmempool.c + $(CC) $< $(BUILD_C_FLAGS) -c -o $@ -# -------------------------------------------------------------- +rtmempool.c.posix32.o: rtmempool.c + $(CC) $< $(BUILD_C_FLAGS) $(32BIT_FLAGS) -c -o $@ -rtmempool_posix64.o: rtmempool.c +rtmempool.c.posix64.o: rtmempool.c $(CC) $< $(BUILD_C_FLAGS) $(64BIT_FLAGS) -c -o $@ -# -------------------------------------------------------------- - -rtmempool_win32.o: rtmempool.c +rtmempool.c.win32.o: rtmempool.c $(CC) $< $(BUILD_C_FLAGS) -DPTW32_STATIC_LIB $(32BIT_FLAGS) -c -o $@ -# -------------------------------------------------------------- - -rtmempool_win64.o: rtmempool.c +rtmempool.c.win64.o: rtmempool.c $(CC) $< $(BUILD_C_FLAGS) -DPTW32_STATIC_LIB $(64BIT_FLAGS) -c -o $@ # -------------------------------------------------------------- clean: - rm -f *.o + rm -f *.o ../rtmempool.* + +debug: + $(MAKE) DEBUG=true diff --git a/source/widgets/canvaspreviewframe.py b/source/widgets/canvaspreviewframe.py index fa8977b4f..398e676fc 100644 --- a/source/widgets/canvaspreviewframe.py +++ b/source/widgets/canvaspreviewframe.py @@ -39,6 +39,7 @@ class CanvasPreviewFrame(QFrame): self.fMouseDown = False + self.fViewBg = QColor(0, 0, 0) self.fViewBrush = QBrush(QColor(75, 75, 255, 30)) self.fViewPen = QPen(Qt.blue, 1) @@ -97,9 +98,10 @@ class CanvasPreviewFrame(QFrame): self.fViewRect[iHeight] = height * self.fFakeHeight self.update() - def setViewTheme(self, brushColor, penColor): + def setViewTheme(self, bgColor, brushColor, penColor): brushColor.setAlpha(40) penColor.setAlpha(100) + self.fViewBg = bgColor self.fViewBrush = QBrush(brushColor) self.fViewPen = QPen(penColor, 1) @@ -152,8 +154,9 @@ class CanvasPreviewFrame(QFrame): def paintEvent(self, event): painter = QPainter(self) - painter.setBrush(QBrush(Qt.darkBlue, Qt.DiagCrossPattern)) - painter.drawRect(0, 0, self.width(), self.height()) + painter.setBrush(self.fViewBg) + painter.setPen(self.fViewBg) + painter.drawRoundRect(2, 2, self.width()-6, self.height()-6, 3, 3) self.fScene.render(painter, self.fRenderSource, self.fRenderTarget, Qt.KeepAspectRatio) diff --git a/source/widgets/digitalpeakmeter.py b/source/widgets/digitalpeakmeter.py index c02638811..2c9f12031 100644 --- a/source/widgets/digitalpeakmeter.py +++ b/source/widgets/digitalpeakmeter.py @@ -37,23 +37,23 @@ class DigitalPeakMeter(QWidget): def __init__(self, parent): QWidget.__init__(self, parent) - self.m_channels = 0 - self.m_orientation = self.VERTICAL - self.m_smoothMultiplier = 1 + self.fChannels = 0 + self.fOrientation = self.VERTICAL + self.fSmoothMultiplier = 1 - self.m_colorBackground = QColor("#111111") - self.m_gradientMeter = QLinearGradient(0, 0, 1, 1) + self.fColorBackground = QColor("#111111") + self.fGradientMeter = QLinearGradient(0, 0, 1, 1) self.setChannels(0) self.setColor(self.GREEN) - self.m_paintTimer = QTimer(self) - self.m_paintTimer.setInterval(60) - self.m_paintTimer.timeout.connect(self.update) - self.m_paintTimer.start() + self.fPaintTimer = QTimer(self) + self.fPaintTimer.setInterval(60) + self.fPaintTimer.timeout.connect(self.update) + self.fPaintTimer.start() def displayMeter(self, meter, level): - if meter <= 0 or meter > self.m_channels: + if meter <= 0 or meter > self.fChannels: return qCritical("DigitalPeakMeter::displayMeter(%i, %f) - invalid meter number" % (meter, level)) if level < 0.0: @@ -61,50 +61,50 @@ class DigitalPeakMeter(QWidget): elif level > 1.0: level = 1.0 - self.m_channelsData[meter-1] = level + self.fChannelsData[meter-1] = level def setChannels(self, channels): if channels < 0: return qCritical("DigitalPeakMeter::setChannels(%i) - 'channels' must be a positive integer" % channels) - self.m_channels = channels - self.m_channelsData = [] - self.m_lastValueData = [] + self.fChannels = channels + self.fChannelsData = [] + self.fLastValueData = [] for x in range(channels): - self.m_channelsData.append(0.0) - self.m_lastValueData.append(0.0) + self.fChannelsData.append(0.0) + self.fLastValueData.append(0.0) def setColor(self, color): if color == self.GREEN: - self.m_colorBase = QColor(93, 231, 61) - self.m_colorBaseT = QColor(15, 110, 15, 100) + self.fColorBase = QColor(93, 231, 61) + self.fColorBaseT = QColor(15, 110, 15, 100) elif color == self.BLUE: - self.m_colorBase = QColor(82, 238, 248) - self.m_colorBaseT = QColor(15, 15, 110, 100) + self.fColorBase = QColor(82, 238, 248) + self.fColorBaseT = QColor(15, 15, 110, 100) else: return qCritical("DigitalPeakMeter::setColor(%i) - invalid color" % color) - self.setOrientation(self.m_orientation) + self.setOrientation(self.fOrientation) def setOrientation(self, orientation): - self.m_orientation = orientation - - if self.m_orientation == self.HORIZONTAL: - self.m_gradientMeter.setColorAt(0.0, self.m_colorBase) - self.m_gradientMeter.setColorAt(0.2, self.m_colorBase) - self.m_gradientMeter.setColorAt(0.4, self.m_colorBase) - self.m_gradientMeter.setColorAt(0.6, self.m_colorBase) - self.m_gradientMeter.setColorAt(0.8, Qt.yellow) - self.m_gradientMeter.setColorAt(1.0, Qt.red) - - elif self.m_orientation == self.VERTICAL: - self.m_gradientMeter.setColorAt(0.0, Qt.red) - self.m_gradientMeter.setColorAt(0.2, Qt.yellow) - self.m_gradientMeter.setColorAt(0.4, self.m_colorBase) - self.m_gradientMeter.setColorAt(0.6, self.m_colorBase) - self.m_gradientMeter.setColorAt(0.8, self.m_colorBase) - self.m_gradientMeter.setColorAt(1.0, self.m_colorBase) + self.fOrientation = orientation + + if self.fOrientation == self.HORIZONTAL: + self.fGradientMeter.setColorAt(0.0, self.fColorBase) + self.fGradientMeter.setColorAt(0.2, self.fColorBase) + self.fGradientMeter.setColorAt(0.4, self.fColorBase) + self.fGradientMeter.setColorAt(0.6, self.fColorBase) + self.fGradientMeter.setColorAt(0.8, Qt.yellow) + self.fGradientMeter.setColorAt(1.0, Qt.red) + + elif self.fOrientation == self.VERTICAL: + self.fGradientMeter.setColorAt(0.0, Qt.red) + self.fGradientMeter.setColorAt(0.2, Qt.yellow) + self.fGradientMeter.setColorAt(0.4, self.fColorBase) + self.fGradientMeter.setColorAt(0.6, self.fColorBase) + self.fGradientMeter.setColorAt(0.8, self.fColorBase) + self.fGradientMeter.setColorAt(1.0, self.fColorBase) else: return qCritical("DigitalPeakMeter::setOrientation(%i) - invalid orientation" % orientation) @@ -112,9 +112,9 @@ class DigitalPeakMeter(QWidget): self.updateSizes() def setRefreshRate(self, rate): - self.m_paintTimer.stop() - self.m_paintTimer.setInterval(rate) - self.m_paintTimer.start() + self.fPaintTimer.stop() + self.fPaintTimer.setInterval(rate) + self.fPaintTimer.start() def setSmoothRelease(self, value): if value < 0: @@ -122,77 +122,77 @@ class DigitalPeakMeter(QWidget): elif value > 5: value = 5 - self.m_smoothMultiplier = value + self.fSmoothMultiplier = value def minimumSizeHint(self): return QSize(10, 10) def sizeHint(self): - return QSize(self.m_width, self.m_height) + return QSize(self.fWidth, self.fHeight) def updateSizes(self): - self.m_width = self.width() - self.m_height = self.height() - self.m_sizeMeter = 0 + self.fWidth = self.width() + self.fHeight = self.height() + self.fSizeMeter = 0 - if self.m_orientation == self.HORIZONTAL: - self.m_gradientMeter.setFinalStop(self.m_width, 0) + if self.fOrientation == self.HORIZONTAL: + self.fGradientMeter.setFinalStop(self.fWidth, 0) - if self.m_channels > 0: - self.m_sizeMeter = self.m_height / self.m_channels + if self.fChannels > 0: + self.fSizeMeter = self.fHeight / self.fChannels - elif self.m_orientation == self.VERTICAL: - self.m_gradientMeter.setFinalStop(0, self.m_height) + elif self.fOrientation == self.VERTICAL: + self.fGradientMeter.setFinalStop(0, self.fHeight) - if self.m_channels > 0: - self.m_sizeMeter = self.m_width / self.m_channels + if self.fChannels > 0: + self.fSizeMeter = self.fWidth / self.fChannels def paintEvent(self, event): painter = QPainter(self) painter.setPen(Qt.black) painter.setBrush(Qt.black) - painter.drawRect(0, 0, self.m_width, self.m_height) + painter.drawRect(0, 0, self.fWidth, self.fHeight) meterX = 0 - painter.setPen(self.m_colorBackground) - painter.setBrush(self.m_gradientMeter) + painter.setPen(self.fColorBackground) + painter.setBrush(self.fGradientMeter) - for i in range(self.m_channels): - level = self.m_channelsData[i] + for i in range(self.fChannels): + level = self.fChannelsData[i] - if level == self.m_lastValueData[i]: + if level == self.fLastValueData[i]: continue - if self.m_orientation == self.HORIZONTAL: - value = level * self.m_width - elif self.m_orientation == self.VERTICAL: - value = float(self.m_height) - (level * self.m_height) + if self.fOrientation == self.HORIZONTAL: + value = level * self.fWidth + elif self.fOrientation == self.VERTICAL: + value = float(self.fHeight) - (level * self.fHeight) else: value = 0.0 if value < 0.0: value = 0.0 - elif self.m_smoothMultiplier > 0: - value = (self.m_lastValueData[i] * self.m_smoothMultiplier + value) / (self.m_smoothMultiplier + 1) + elif self.fSmoothMultiplier > 0: + value = (self.fLastValueData[i] * self.fSmoothMultiplier + value) / (self.fSmoothMultiplier + 1) - if self.m_orientation == self.HORIZONTAL: - painter.drawRect(0, meterX, value, self.m_sizeMeter) - elif self.m_orientation == self.VERTICAL: - painter.drawRect(meterX, value, self.m_sizeMeter, self.m_height) + if self.fOrientation == self.HORIZONTAL: + painter.drawRect(0, meterX, value, self.fSizeMeter) + elif self.fOrientation == self.VERTICAL: + painter.drawRect(meterX, value, self.fSizeMeter, self.fHeight) - meterX += self.m_sizeMeter - self.m_lastValueData[i] = value + meterX += self.fSizeMeter + self.fLastValueData[i] = value painter.setBrush(QColor(0, 0, 0, 0)) - if self.m_orientation == self.HORIZONTAL: + if self.fOrientation == self.HORIZONTAL: # Variables - lsmall = self.m_width - lfull = self.m_height - 1 + lsmall = self.fWidth + lfull = self.fHeight - 1 # Base - painter.setPen(self.m_colorBaseT) + painter.setPen(self.fColorBaseT) painter.drawLine(lsmall * 0.25, 2, lsmall * 0.25, lfull-2) painter.drawLine(lsmall * 0.50, 2, lsmall * 0.50, lfull-2) @@ -209,13 +209,13 @@ class DigitalPeakMeter(QWidget): painter.setPen(QColor(110, 15, 15, 100)) painter.drawLine(lsmall * 0.96, 2, lsmall * 0.96, lfull-2) - elif self.m_orientation == self.VERTICAL: + elif self.fOrientation == self.VERTICAL: # Variables - lsmall = self.m_height - lfull = self.m_width - 1 + lsmall = self.fHeight + lfull = self.fWidth - 1 # Base - painter.setPen(self.m_colorBaseT) + painter.setPen(self.fColorBaseT) painter.drawLine(2, lsmall - (lsmall * 0.25), lfull-2, lsmall - (lsmall * 0.25)) painter.drawLine(2, lsmall - (lsmall * 0.50), lfull-2, lsmall - (lsmall * 0.50)) diff --git a/source/widgets/pixmapdial.py b/source/widgets/pixmapdial.py index 4aae3e9a3..21a176470 100644 --- a/source/widgets/pixmapdial.py +++ b/source/widgets/pixmapdial.py @@ -45,7 +45,7 @@ class PixmapDial(QDial): def __init__(self, parent): QDial.__init__(self, parent) - self.fPixmap = QPixmap(":/bitmaps/dial_01d.png") + self.fPixmap = QPixmap(":/bitmaps/dial_01d.png") self.fPixmapNum = "01" self.fCustomPaint = self.CUSTOM_PAINT_NULL @@ -57,8 +57,8 @@ class PixmapDial(QDial): else: self.fOrientation = self.VERTICAL - self.fLabel = "" - self.fLabelPos = QPointF(0.0, 0.0) + self.fLabel = "" + self.fLabelPos = QPointF(0.0, 0.0) self.fLabelFont = QFont() self.fLabelFont.setPointSize(6) self.fLabelWidth = 0 @@ -132,21 +132,21 @@ class PixmapDial(QDial): return QSize(self.fSize, self.fSize) def updateSizes(self): - self.p_width = self.fPixmap.width() - self.p_height = self.fPixmap.height() + self.fWidth = self.fPixmap.width() + self.fHeight = self.fPixmap.height() - if self.p_width < 1: - self.p_width = 1 + if self.fWidth < 1: + self.fWidth = 1 - if self.p_height < 1: - self.p_height = 1 + if self.fHeight < 1: + self.fHeight = 1 if self.fOrientation == self.HORIZONTAL: - self.fSize = self.p_height - self.p_count = self.p_width / self.p_height + self.fSize = self.fHeight + self.fCount = self.fWidth / self.fHeight else: - self.fSize = self.p_width - self.p_count = self.p_height / self.p_width + self.fSize = self.fWidth + self.fCount = self.fHeight / self.fWidth self.setMinimumSize(self.fSize, self.fSize + self.fLabelHeight + 5) self.setMaximumSize(self.fSize, self.fSize + self.fLabelHeight + 5) @@ -166,6 +166,7 @@ class PixmapDial(QDial): def paintEvent(self, event): painter = QPainter(self) painter.setRenderHint(QPainter.Antialiasing, True) + event.accept() if self.fLabel: if self.fCustomPaint == self.CUSTOM_PAINT_NULL: @@ -187,7 +188,7 @@ class PixmapDial(QDial): value = current / divider target = QRectF(0.0, 0.0, self.fSize, self.fSize) - per = int((self.p_count - 1) * value) + per = int((self.fCount - 1) * value) if self.fOrientation == self.HORIZONTAL: xpos = self.fSize * per @@ -278,12 +279,10 @@ class PixmapDial(QDial): self.fHoverStep += 1 if self.fHovered else -1 QTimer.singleShot(20, self, SLOT("update()")) - else: + else: # isEnabled() target = QRectF(0.0, 0.0, self.fSize, self.fSize) painter.drawPixmap(target, self.fPixmap, target) - event.accept() - def resizeEvent(self, event): self.updateSizes() QDial.resizeEvent(self, event) diff --git a/source/widgets/pixmapkeyboard.py b/source/widgets/pixmapkeyboard.py index 2adc6a295..a4149c76e 100644 --- a/source/widgets/pixmapkeyboard.py +++ b/source/widgets/pixmapkeyboard.py @@ -98,147 +98,147 @@ class PixmapKeyboard(QWidget): def __init__(self, parent): QWidget.__init__(self, parent) - self.m_octaves = 6 - self.m_lastMouseNote = -1 + self.fOctaves = 6 + self.fLastMouseNote = -1 - self.m_needsUpdate = False - self.m_enabledKeys = [] + self.fNeedsUpdate = False + self.fEnabledKeys = [] - self.m_font = QFont("Monospace", 8, QFont.Normal) - self.m_pixmap = QPixmap("") + self.fFont = QFont("Monospace", 8, QFont.Normal) + self.fPixmap = QPixmap("") self.setCursor(Qt.PointingHandCursor) self.setMode(self.HORIZONTAL) def allNotesOff(self): - self.m_enabledKeys = [] + self.fEnabledKeys = [] - self.m_needsUpdate = True + self.fNeedsUpdate = True QTimer.singleShot(0, self, SLOT("slot_updateOnce()")) self.emit(SIGNAL("notesOff()")) def sendNoteOn(self, note, sendSignal=True): - if 0 <= note <= 127 and note not in self.m_enabledKeys: - self.m_enabledKeys.append(note) + if 0 <= note <= 127 and note not in self.fEnabledKeys: + self.fEnabledKeys.append(note) if sendSignal: self.emit(SIGNAL("noteOn(int)"), note) - self.m_needsUpdate = True + self.fNeedsUpdate = True QTimer.singleShot(0, self, SLOT("slot_updateOnce()")) - if len(self.m_enabledKeys) == 1: + if len(self.fEnabledKeys) == 1: self.emit(SIGNAL("notesOn()")) def sendNoteOff(self, note, sendSignal=True): - if 0 <= note <= 127 and note in self.m_enabledKeys: - self.m_enabledKeys.remove(note) + if 0 <= note <= 127 and note in self.fEnabledKeys: + self.fEnabledKeys.remove(note) if sendSignal: self.emit(SIGNAL("noteOff(int)"), note) - self.m_needsUpdate = True + self.fNeedsUpdate = True QTimer.singleShot(0, self, SLOT("slot_updateOnce()")) - if len(self.m_enabledKeys) == 0: + if len(self.fEnabledKeys) == 0: self.emit(SIGNAL("notesOff()")) def setMode(self, mode, color=COLOR_ORANGE): if color == self.COLOR_CLASSIC: - self.m_colorStr = "classic" + self.fColorStr = "classic" elif color == self.COLOR_ORANGE: - self.m_colorStr = "orange" + self.fColorStr = "orange" else: qCritical("PixmapKeyboard::setMode(%i, %i) - invalid color" % (mode, color)) return self.setMode(mode) if mode == self.HORIZONTAL: - self.m_midiMap = midi_key2rect_map_horizontal - self.m_pixmap.load(":/bitmaps/kbd_h_%s.png" % self.m_colorStr) - self.m_pixmapMode = self.HORIZONTAL - self.p_width = self.m_pixmap.width() - self.p_height = self.m_pixmap.height() / 2 + self.fMidiMap = midi_key2rect_map_horizontal + self.fPixmap.load(":/bitmaps/kbd_h_%s.png" % self.fColorStr) + self.fPixmapMode = self.HORIZONTAL + self.fWidth = self.fPixmap.width() + self.fHeight = self.fPixmap.height() / 2 elif mode == self.VERTICAL: - self.m_midiMap = midi_key2rect_map_vertical - self.m_pixmap.load(":/bitmaps/kbd_v_%s.png" % self.m_colorStr) - self.m_pixmapMode = self.VERTICAL - self.p_width = self.m_pixmap.width() / 2 - self.p_height = self.m_pixmap.height() + self.fMidiMap = midi_key2rect_map_vertical + self.fPixmap.load(":/bitmaps/kbd_v_%s.png" % self.fColorStr) + self.fPixmapMode = self.VERTICAL + self.fWidth = self.fPixmap.width() / 2 + self.fHeight = self.fPixmap.height() else: qCritical("PixmapKeyboard::setMode(%i, %i) - invalid mode" % (mode, color)) return self.setMode(self.HORIZONTAL) - self.setOctaves(self.m_octaves) + self.setOctaves(self.fOctaves) def setOctaves(self, octaves): if octaves < 1: octaves = 1 elif octaves > 8: octaves = 8 - self.m_octaves = octaves + self.fOctaves = octaves - if self.m_pixmapMode == self.HORIZONTAL: - self.setMinimumSize(self.p_width * self.m_octaves, self.p_height) - self.setMaximumSize(self.p_width * self.m_octaves, self.p_height) - elif self.m_pixmapMode == self.VERTICAL: - self.setMinimumSize(self.p_width, self.p_height * self.m_octaves) - self.setMaximumSize(self.p_width, self.p_height * self.m_octaves) + if self.fPixmapMode == self.HORIZONTAL: + self.setMinimumSize(self.fWidth * self.fOctaves, self.fHeight) + self.setMaximumSize(self.fWidth * self.fOctaves, self.fHeight) + elif self.fPixmapMode == self.VERTICAL: + self.setMinimumSize(self.fWidth, self.fHeight * self.fOctaves) + self.setMaximumSize(self.fWidth, self.fHeight * self.fOctaves) self.update() def handleMousePos(self, pos): - if self.m_pixmapMode == self.HORIZONTAL: - if pos.x() < 0 or pos.x() > self.m_octaves * 144: + if self.fPixmapMode == self.HORIZONTAL: + if pos.x() < 0 or pos.x() > self.fOctaves * 144: return posX = pos.x() - 1 - octave = int(posX / self.p_width) - n_pos = QPointF(posX % self.p_width, pos.y()) - elif self.m_pixmapMode == self.VERTICAL: - if pos.y() < 0 or pos.y() > self.m_octaves * 144: + octave = int(posX / self.fWidth) + n_pos = QPointF(posX % self.fWidth, pos.y()) + elif self.fPixmapMode == self.VERTICAL: + if pos.y() < 0 or pos.y() > self.fOctaves * 144: return posY = pos.y() - 1 - octave = int(self.m_octaves - posY / self.p_height) - n_pos = QPointF(pos.x(), posY % self.p_height) + octave = int(self.fOctaves - posY / self.fHeight) + n_pos = QPointF(pos.x(), posY % self.fHeight) else: return octave += 3 - if self.m_midiMap['1'].contains(n_pos): # C# + if self.fMidiMap['1'].contains(n_pos): # C# note = 1 - elif self.m_midiMap['3'].contains(n_pos): # D# + elif self.fMidiMap['3'].contains(n_pos): # D# note = 3 - elif self.m_midiMap['6'].contains(n_pos): # F# + elif self.fMidiMap['6'].contains(n_pos): # F# note = 6 - elif self.m_midiMap['8'].contains(n_pos): # G# + elif self.fMidiMap['8'].contains(n_pos): # G# note = 8 - elif self.m_midiMap['10'].contains(n_pos):# A# + elif self.fMidiMap['10'].contains(n_pos):# A# note = 10 - elif self.m_midiMap['0'].contains(n_pos): # C + elif self.fMidiMap['0'].contains(n_pos): # C note = 0 - elif self.m_midiMap['2'].contains(n_pos): # D + elif self.fMidiMap['2'].contains(n_pos): # D note = 2 - elif self.m_midiMap['4'].contains(n_pos): # E + elif self.fMidiMap['4'].contains(n_pos): # E note = 4 - elif self.m_midiMap['5'].contains(n_pos): # F + elif self.fMidiMap['5'].contains(n_pos): # F note = 5 - elif self.m_midiMap['7'].contains(n_pos): # G + elif self.fMidiMap['7'].contains(n_pos): # G note = 7 - elif self.m_midiMap['9'].contains(n_pos): # A + elif self.fMidiMap['9'].contains(n_pos): # A note = 9 - elif self.m_midiMap['11'].contains(n_pos):# B + elif self.fMidiMap['11'].contains(n_pos):# B note = 11 else: note = -1 if note != -1: note += octave * 12 - if self.m_lastMouseNote != note: - self.sendNoteOff(self.m_lastMouseNote) + if self.fLastMouseNote != note: + self.sendNoteOff(self.fLastMouseNote) self.sendNoteOn(note) else: - self.sendNoteOff(self.m_lastMouseNote) + self.sendNoteOff(self.fLastMouseNote) - self.m_lastMouseNote = note + self.fLastMouseNote = note def keyPressEvent(self, event): if not event.isAutoRepeat(): @@ -255,7 +255,7 @@ class PixmapKeyboard(QWidget): QWidget.keyReleaseEvent(self, event) def mousePressEvent(self, event): - self.m_lastMouseNote = -1 + self.fLastMouseNote = -1 self.handleMousePos(event.pos()) self.setFocus() QWidget.mousePressEvent(self, event) @@ -265,35 +265,36 @@ class PixmapKeyboard(QWidget): QWidget.mousePressEvent(self, event) def mouseReleaseEvent(self, event): - if self.m_lastMouseNote != -1: - self.sendNoteOff(self.m_lastMouseNote) - self.m_lastMouseNote = -1 + if self.fLastMouseNote != -1: + self.sendNoteOff(self.fLastMouseNote) + self.fLastMouseNote = -1 QWidget.mouseReleaseEvent(self, event) def paintEvent(self, event): painter = QPainter(self) + event.accept() # ------------------------------------------------------------- # Paint clean keys (as background) - for octave in range(self.m_octaves): - if self.m_pixmapMode == self.HORIZONTAL: - target = QRectF(self.p_width * octave, 0, self.p_width, self.p_height) - elif self.m_pixmapMode == self.VERTICAL: - target = QRectF(0, self.p_height * octave, self.p_width, self.p_height) + for octave in range(self.fOctaves): + if self.fPixmapMode == self.HORIZONTAL: + target = QRectF(self.fWidth * octave, 0, self.fWidth, self.fHeight) + elif self.fPixmapMode == self.VERTICAL: + target = QRectF(0, self.fHeight * octave, self.fWidth, self.fHeight) else: return - source = QRectF(0, 0, self.p_width, self.p_height) - painter.drawPixmap(target, self.m_pixmap, source) + source = QRectF(0, 0, self.fWidth, self.fHeight) + painter.drawPixmap(target, self.fPixmap, source) # ------------------------------------------------------------- # Paint (white) pressed keys paintedWhite = False - for i in range(len(self.m_enabledKeys)): - note = self.m_enabledKeys[i] + for i in range(len(self.fEnabledKeys)): + note = self.fEnabledKeys[i] pos = self._getRectFromMidiNote(note) if self._isNoteBlack(note): @@ -322,44 +323,44 @@ class PixmapKeyboard(QWidget): # cannot paint this note either continue - if self.m_pixmapMode == self.VERTICAL: - octave = self.m_octaves - octave - 1 + if self.fPixmapMode == self.VERTICAL: + octave = self.fOctaves - octave - 1 - if self.m_pixmapMode == self.HORIZONTAL: - target = QRectF(pos.x() + (self.p_width * octave), 0, pos.width(), pos.height()) - source = QRectF(pos.x(), self.p_height, pos.width(), pos.height()) - elif self.m_pixmapMode == self.VERTICAL: - target = QRectF(pos.x(), pos.y() + (self.p_height * octave), pos.width(), pos.height()) - source = QRectF(self.p_width, pos.y(), pos.width(), pos.height()) + if self.fPixmapMode == self.HORIZONTAL: + target = QRectF(pos.x() + (self.fWidth * octave), 0, pos.width(), pos.height()) + source = QRectF(pos.x(), self.fHeight, pos.width(), pos.height()) + elif self.fPixmapMode == self.VERTICAL: + target = QRectF(pos.x(), pos.y() + (self.fHeight * octave), pos.width(), pos.height()) + source = QRectF(self.fWidth, pos.y(), pos.width(), pos.height()) else: return paintedWhite = True - painter.drawPixmap(target, self.m_pixmap, source) + painter.drawPixmap(target, self.fPixmap, source) # ------------------------------------------------------------- # Clear white keys border if paintedWhite: - for octave in range(self.m_octaves): + for octave in range(self.fOctaves): for note in (1, 3, 6, 8, 10): pos = self._getRectFromMidiNote(note) - if self.m_pixmapMode == self.HORIZONTAL: - target = QRectF(pos.x() + (self.p_width * octave), 0, pos.width(), pos.height()) + if self.fPixmapMode == self.HORIZONTAL: + target = QRectF(pos.x() + (self.fWidth * octave), 0, pos.width(), pos.height()) source = QRectF(pos.x(), 0, pos.width(), pos.height()) - elif self.m_pixmapMode == self.VERTICAL: - target = QRectF(pos.x(), pos.y() + (self.p_height * octave), pos.width(), pos.height()) + elif self.fPixmapMode == self.VERTICAL: + target = QRectF(pos.x(), pos.y() + (self.fHeight * octave), pos.width(), pos.height()) source = QRectF(0, pos.y(), pos.width(), pos.height()) else: return - painter.drawPixmap(target, self.m_pixmap, source) + painter.drawPixmap(target, self.fPixmap, source) # ------------------------------------------------------------- # Paint (black) pressed keys - for i in range(len(self.m_enabledKeys)): - note = self.m_enabledKeys[i] + for i in range(len(self.fEnabledKeys)): + note = self.fEnabledKeys[i] pos = self._getRectFromMidiNote(note) if not self._isNoteBlack(note): @@ -388,41 +389,39 @@ class PixmapKeyboard(QWidget): # cannot paint this note either continue - if self.m_pixmapMode == self.VERTICAL: - octave = self.m_octaves - octave - 1 + if self.fPixmapMode == self.VERTICAL: + octave = self.fOctaves - octave - 1 - if self.m_pixmapMode == self.HORIZONTAL: - target = QRectF(pos.x() + (self.p_width * octave), 0, pos.width(), pos.height()) - source = QRectF(pos.x(), self.p_height, pos.width(), pos.height()) - elif self.m_pixmapMode == self.VERTICAL: - target = QRectF(pos.x(), pos.y() + (self.p_height * octave), pos.width(), pos.height()) - source = QRectF(self.p_width, pos.y(), pos.width(), pos.height()) + if self.fPixmapMode == self.HORIZONTAL: + target = QRectF(pos.x() + (self.fWidth * octave), 0, pos.width(), pos.height()) + source = QRectF(pos.x(), self.fHeight, pos.width(), pos.height()) + elif self.fPixmapMode == self.VERTICAL: + target = QRectF(pos.x(), pos.y() + (self.fHeight * octave), pos.width(), pos.height()) + source = QRectF(self.fWidth, pos.y(), pos.width(), pos.height()) else: return - painter.drawPixmap(target, self.m_pixmap, source) + painter.drawPixmap(target, self.fPixmap, source) # Paint C-number note info - painter.setFont(self.m_font) + painter.setFont(self.fFont) painter.setPen(Qt.black) - for i in range(self.m_octaves): - if self.m_pixmapMode == self.HORIZONTAL: + for i in range(self.fOctaves): + if self.fPixmapMode == self.HORIZONTAL: painter.drawText(i * 144, 48, 18, 18, Qt.AlignCenter, "C%i" % int(i + 2)) - elif self.m_pixmapMode == self.VERTICAL: - painter.drawText(45, (self.m_octaves * 144) - (i * 144) - 16, 18, 18, Qt.AlignCenter, "C%i" % int(i + 2)) - - event.accept() + elif self.fPixmapMode == self.VERTICAL: + painter.drawText(45, (self.fOctaves * 144) - (i * 144) - 16, 18, 18, Qt.AlignCenter, "C%i" % int(i + 2)) @pyqtSlot() def slot_updateOnce(self): - if self.m_needsUpdate: + if self.fNeedsUpdate: self.update() - self.m_needsUpdate = False + self.fNeedsUpdate = False def _isNoteBlack(self, note): baseNote = note % 12 return bool(baseNote in (1, 3, 6, 8, 10)) def _getRectFromMidiNote(self, note): - return self.m_midiMap.get(str(note % 12)) + return self.fMidiMap.get(str(note % 12))