From 107f26f536ec7d14d3c17688b6960355a553c91f Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 10 Feb 2014 10:46:54 +0000 Subject: [PATCH] Add show meters/keyboard menu actions --- resources/ui/carla_host.ui | 20 ++++++++++++++++++- source/carla | 2 -- source/carla_patchbay.py | 33 ++++++++++++++++++++++++++++++++ source/widgets/pixmapkeyboard.py | 2 -- 4 files changed, 52 insertions(+), 5 deletions(-) diff --git a/resources/ui/carla_host.ui b/resources/ui/carla_host.ui index 7894ec15f..913ff3811 100644 --- a/resources/ui/carla_host.ui +++ b/resources/ui/carla_host.ui @@ -180,7 +180,7 @@ 0 0 688 - 17 + 19 @@ -260,6 +260,8 @@ &Settings + + @@ -633,6 +635,22 @@ About &Qt + + + true + + + Show Canvas &Meters + + + + + true + + + Show Canvas &Keyboard + + diff --git a/source/carla b/source/carla index 383441727..6e427c0e6 100755 --- a/source/carla +++ b/source/carla @@ -147,9 +147,7 @@ class CarlaMultiW(QTabWidget): self.fPatchbay.projectLoaded() def saveSettings(self, settings): - #self.fRack.saveSettings(settings) self.fPatchbay.saveSettings(settings) - #self.fParent.saveSettings(settings) def showEditDialog(self, pluginId): self.fRack.showEditDialog(pluginId) diff --git a/source/carla_patchbay.py b/source/carla_patchbay.py index e3f5c9e07..ed8f69123 100644 --- a/source/carla_patchbay.py +++ b/source/carla_patchbay.py @@ -118,6 +118,9 @@ class CarlaPatchbayW(QFrame): # ------------------------------------------------------------- # Connect actions to functions + parent.ui.act_settings_show_meters.toggled.connect(self.slot_showCanvasMeters) + parent.ui.act_settings_show_keyboard.toggled.connect(self.slot_showCanvasKeyboard) + self.fView.horizontalScrollBar().valueChanged.connect(self.slot_horizontalScrollBarChanged) self.fView.verticalScrollBar().valueChanged.connect(self.slot_verticalScrollBarChanged) @@ -130,6 +133,23 @@ class CarlaPatchbayW(QFrame): self.fKeys.keyboard.noteOn.connect(self.slot_noteOn) self.fKeys.keyboard.noteOff.connect(self.slot_noteOff) + # ------------------------------------------------------------- + # Load Settings + + settings = QSettings() + + showMeters = settings.value("ShowMeters", False, type=bool) + self.fParent.ui.act_settings_show_meters.setChecked(showMeters) + self.fPeaksIn.setVisible(showMeters) + self.fPeaksOut.setVisible(showMeters) + + showKeyboard = settings.value("ShowKeyboard", True, type=bool) + self.fParent.ui.act_settings_show_keyboard.setChecked(showKeyboard) + self.fKeys.setVisible(showKeyboard) + + # ------------------------------------------------------------- + # Connect actions to functions (part 2) + if not doSetup: return parent.ui.act_plugins_enable.triggered.connect(self.slot_pluginsEnable) @@ -297,6 +317,8 @@ class CarlaPatchbayW(QFrame): QTimer.singleShot(1000, self.slot_canvasRefresh) def saveSettings(self, settings): + settings.setValue("ShowMeters", self.fPeaksIn.isVisible()) + settings.setValue("ShowKeyboard", self.fKeys.isVisible()) settings.setValue("HorizontalScrollBarValue", self.fView.horizontalScrollBar().value()) settings.setValue("VerticalScrollBarValue", self.fView.verticalScrollBar().value()) @@ -359,6 +381,17 @@ class CarlaPatchbayW(QFrame): # ----------------------------------------------------------------- + @pyqtSlot(bool) + def slot_showCanvasMeters(self, yesNo): + self.fPeaksIn.setVisible(yesNo) + self.fPeaksOut.setVisible(yesNo) + + @pyqtSlot(bool) + def slot_showCanvasKeyboard(self, yesNo): + self.fKeys.setVisible(yesNo) + + # ----------------------------------------------------------------- + @pyqtSlot() def slot_miniCanvasCheckAll(self): self.slot_miniCanvasCheckSize() diff --git a/source/widgets/pixmapkeyboard.py b/source/widgets/pixmapkeyboard.py index 3a0c00754..c5e21f943 100644 --- a/source/widgets/pixmapkeyboard.py +++ b/source/widgets/pixmapkeyboard.py @@ -222,8 +222,6 @@ class PixmapKeyboard(QWidget): else: note = -1 - print(keyPos, note, octave) - if note != -1: note += octave * 12