diff --git a/Makefile b/Makefile index 68d517338..4cd38e1b3 100644 --- a/Makefile +++ b/Makefile @@ -82,7 +82,6 @@ source/%_rc.py: resources/%.qrc resources/*/*.png resources/*/*.svg # UI code UIs = \ - source/ui_carla.py \ source/ui_carla_control.py \ source/ui_carla_about.py \ source/ui_carla_database.py \ diff --git a/resources/ui/carla.ui b/resources/ui/carla.ui deleted file mode 100644 index 91e59ea3b..000000000 --- a/resources/ui/carla.ui +++ /dev/null @@ -1,792 +0,0 @@ - - - CarlaMainW - - - - 0 - 0 - 782 - 482 - - - - true - - - Carla - - - - - - - false - - - Qt::Horizontal - - - - true - - - 0 - - - - Plugins - - - - 0 - - - 0 - - - 2 - - - 0 - - - 2 - - - - - - 0 - - - 0 - - - - - - - - Qt::Vertical - - - - 20 - 333 - - - - - - - - - Patchbay - - - - 0 - - - 2 - - - - - Qt::ScrollBarAlwaysOn - - - Qt::ScrollBarAlwaysOn - - - - - - - - Log - - - - 0 - - - 2 - - - - - Qt::ScrollBarAlwaysOn - - - Qt::ScrollBarAlwaysOn - - - false - - - QPlainTextEdit::NoWrap - - - - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - - - 1 - - - - - - 0 - 0 - - - - - 210 - 0 - - - - false - - - QTabWidget::East - - - 0 - - - - false - - - Disk - - - - 0 - - - 0 - - - 0 - - - 0 - - - 1 - - - - - - - - Home - - - - - - - - - - - - :/16x16/list-add.png:/16x16/list-add.png - - - - - - - false - - - - - - - :/16x16/list-remove.png:/16x16/list-remove.png - - - - - - - - - QAbstractItemView::NoEditTriggers - - - true - - - QAbstractItemView::DragDrop - - - - - - - - - - - - 210 - 162 - - - - - 210 - 162 - - - - false - - - QFrame::StyledPanel - - - QFrame::Sunken - - - - - - - - - - - - - 0 - 0 - 782 - 19 - - - - - &File - - - - - - - - - - - &Plugin - - - - Macros (all plugins) - - - - - - - - - - - - - - - - - - - - &Help - - - - - - - &Engine - - - - - - - &Settings - - - - - - - - &Canvas - - - - Zoom - - - - - - - - - - - - - - - - - &Transport - - - - - - - - - - - - - - - - - toolBar - - - false - - - Qt::NoToolBarArea - - - Qt::ToolButtonTextBesideIcon - - - TopToolBarArea - - - false - - - - - - - - - - - - - - - - :/16x16/document-save.png:/16x16/document-save.png - - - &Save - - - Ctrl+S - - - - - - :/16x16/document-save-as.png:/16x16/document-save-as.png - - - Save &As... - - - Ctrl+Shift+S - - - - - - :/16x16/document-new.png:/16x16/document-new.png - - - &New - - - Ctrl+N - - - - - - :/16x16/document-open.png:/16x16/document-open.png - - - &Open... - - - Ctrl+O - - - - - - :/16x16/application-exit.png:/16x16/application-exit.png - - - &Quit - - - Ctrl+Q - - - - - - :/16x16/edit-delete.png:/16x16/edit-delete.png - - - &Remove All - - - - - &About - - - - - About &Qt - - - - - - :/16x16/list-add.png:/16x16/list-add.png - - - &Add New... - - - Ctrl+A - - - - - true - - - Show &Toolbar - - - - - - :/16x16/configure.png:/16x16/configure.png - - - Configure Carla - - - - - - :/16x16/media-playback-start.png:/16x16/media-playback-start.png - - - &Start - - - F5 - - - - - - :/16x16/media-playback-stop.png:/16x16/media-playback-stop.png - - - St&op - - - F6 - - - - - - :/16x16/view-sort-ascending.png:/16x16/view-sort-ascending.png - - - &Arrange - - - Ctrl+G - - - - - - :/16x16/view-refresh.png:/16x16/view-refresh.png - - - &Refresh - - - Ctrl+R - - - - - - :/16x16/document-print.png:/16x16/document-print.png - - - &Print... - - - - - Save &Image... - - - - - - :/16x16/zoom-fit-best.png:/16x16/zoom-fit-best.png - - - Auto-Fit - - - Home - - - - - - :/16x16/zoom-in.png:/16x16/zoom-in.png - - - Zoom In - - - Ctrl++ - - - - - - :/16x16/zoom-out.png:/16x16/zoom-out.png - - - Zoom Out - - - Ctrl+- - - - - - - :/16x16/zoom-original.png:/16x16/zoom-original.png - - - Zoom 100% - - - Ctrl+1 - - - - - true - - - - :/16x16/media-playback-start.png:/16x16/media-playback-start.png - - - &Play - - - Ctrl+Shift+P - - - - - - :/16x16/media-playback-stop.png:/16x16/media-playback-stop.png - - - &Stop - - - Ctrl+Shift+X - - - - - - :/16x16/media-seek-backward.png:/16x16/media-seek-backward.png - - - &Backwards - - - Ctrl+Shift+B - - - - - - :/16x16/media-seek-forward.png:/16x16/media-seek-forward.png - - - &Forwards - - - Ctrl+Shift+F - - - - - Enable - - - - - Disable - - - - - 0% Wet (Bypass) - - - - - 100% Wet - - - - - 0% Volume (Mute) - - - - - 100% Volume - - - - - Center Balance - - - - - - :/16x16/dialog-warning.png:/16x16/dialog-warning.png - - - Panic - - - Panic - - - - - - :/16x16/list-add.png:/16x16/list-add.png - - - Add New Plugin... - - - Add New Plugin - - - - - Export LV2 Plugin State... - - - - - - CanvasPreviewFrame - QFrame -
canvaspreviewframe.h
- 1 -
-
- - - - - - act_file_quit - triggered() - CarlaMainW - close() - - - -1 - -1 - - - 189 - 34 - - - - - act_settings_show_toolbar - triggered(bool) - toolBar - setVisible(bool) - - - -1 - -1 - - - 354 - 35 - - - - -
diff --git a/source/carla.py b/source/carla.py deleted file mode 100755 index dee108dfd..000000000 --- a/source/carla.py +++ /dev/null @@ -1,273 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Carla plugin host -# Copyright (C) 2011-2013 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 GPL.txt file - -# ------------------------------------------------------------------------------------------------------------ -# Imports (Global) - -from time import sleep -from PyQt5.QtCore import Qt, QModelIndex, QPointF, QSize -from PyQt5.QtGui import QImage, QPalette, QResizeEvent, QSyntaxHighlighter -from PyQt5.QtPrintSupport import QPrinter, QPrintDialog -from PyQt5.QtWidgets import QApplication, QDialogButtonBox, QFileSystemModel, QLabel, QMainWindow - -# ------------------------------------------------------------------------------------------------------------ -# Imports (Custom Stuff) - -import ui_carla - -from carla_shared import * - -# ------------------------------------------------------------------------------------------------------------ -# Global Variables - -libPrefix = None -projectFilename = None - -# ------------------------------------------------------------------------------------------------------------ -# Log Syntax Highlighter - -class LogSyntaxHighlighter(QSyntaxHighlighter): - def __init__(self, parent): - QSyntaxHighlighter.__init__(self, parent) - - palette = parent.palette() - - self.fColorDebug = palette.color(QPalette.Disabled, QPalette.WindowText) - self.fColorError = Qt.red - - # ------------------------------------------------------------- - - def highlightBlock(self, text): - if text.startswith("DEBUG:"): - self.setFormat(0, len(text), self.fColorDebug) - elif text.startswith("ERROR:"): - self.setFormat(0, len(text), self.fColorError) - -# ------------------------------------------------------------------------------------------------------------ -# Main Window - -class CarlaMainW(QMainWindow): - def __init__(self, parent=None): - QMainWindow.__init__(self, parent) - self.ui = ui_carla.Ui_CarlaMainW() - self.ui.setupUi(self) - - # ------------------------------------------------------------- - # Internal stuff - - self.fFirstEngineInit = True - - # ------------------------------------------------------------- - # Set-up GUI stuff - - if not WINDOWS: - self.fSyntaxLog = LogSyntaxHighlighter(self.ui.pte_log) - self.fSyntaxLog.setDocument(self.ui.pte_log.document()) - - if LADISH_APP_NAME: - self.ui.miniCanvasPreview.setVisible(False) - self.ui.tabMain.removeTab(1) - else: - self.ui.tabMain.removeTab(2) - - self.ui.act_engine_start.setEnabled(False) - self.ui.act_engine_stop.setEnabled(False) - self.ui.act_plugin_remove_all.setEnabled(False) - - # FIXME: Qt4 needs this so it properly creates & resizes the canvas - self.ui.tabMain.setCurrentIndex(1) - self.ui.tabMain.setCurrentIndex(0) - - # ------------------------------------------------------------- - # Set-up Canvas Preview - - self.ui.miniCanvasPreview.setRealParent(self) - 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, self.fSavedSettings["UseCustomMiniCanvasPaint"]) - QTimer.singleShot(100, self, SLOT("slot_miniCanvasInit()")) - - @pyqtSlot() - def slot_fileExportLv2Preset(self): - fileFilter = self.tr("LV2 Preset (*.lv2)") - filenameTry = QFileDialog.getSaveFileName(self, self.tr("Save Carla Project File"), self.fSavedSettings["Main/DefaultProjectFolder"], filter=fileFilter) - - if not filenameTry: - return - - if not filenameTry.endswith(".lv2"): - filenameTry += ".lv2" - - if os.path.exists(filenameTry) and not os.path.isdir(filenameTry): - # TODO - error - return - - # Save current project to a tmp file, and read it - tmpFile = os.path.join(TMP, "carla-plugin-export.carxp") - - if not Carla.host.save_project(tmpFile): - # TODO - error - return - - tmpFileFd = open(tmpFile, "r") - presetContents = tmpFileFd.read() - tmpFileFd.close() - os.remove(tmpFile) - - # Create LV2 Preset - os.mkdir(filenameTry) - - manifestPath = os.path.join(filenameTry, "manifest.ttl") - - manifestFd = open(manifestPath, "w") - manifestFd.write("""# LV2 Preset for the Carla LV2 Plugin -@prefix lv2: . -@prefix pset: . -@prefix rdfs: . -@prefix state: . - - - a pset:Preset ; - lv2:appliesTo ; - rdfs:label "%s" ; - state:state [ - -\"\"\" -%s -\"\"\" - ] . -""" % (manifestPath, os.path.basename(filenameTry), presetContents)) - manifestFd.close() - - @pyqtSlot(float, float) - def slot_miniCanvasMoved(self, xp, yp): - self.ui.graphicsView.horizontalScrollBar().setValue(xp * DEFAULT_CANVAS_WIDTH) - self.ui.graphicsView.verticalScrollBar().setValue(yp * DEFAULT_CANVAS_HEIGHT) - - @pyqtSlot(int) - def slot_horizontalScrollBarChanged(self, value): - maximum = self.ui.graphicsView.horizontalScrollBar().maximum() - if maximum == 0: - xp = 0 - else: - xp = float(value) / maximum - self.ui.miniCanvasPreview.setViewPosX(xp) - - @pyqtSlot(int) - def slot_verticalScrollBarChanged(self, value): - maximum = self.ui.graphicsView.verticalScrollBar().maximum() - if maximum == 0: - yp = 0 - else: - yp = float(value) / maximum - self.ui.miniCanvasPreview.setViewPosY(yp) - - @pyqtSlot(int, int, QPointF) - def slot_canvasItemMoved(self, group_id, split_mode, pos): - self.ui.miniCanvasPreview.update() - - @pyqtSlot(float) - def slot_canvasScaleChanged(self, scale): - self.ui.miniCanvasPreview.setViewScale(scale) - - @pyqtSlot() - def slot_miniCanvasInit(self): - settings = QSettings() - self.ui.graphicsView.horizontalScrollBar().setValue(settings.value("HorizontalScrollBarValue", DEFAULT_CANVAS_WIDTH / 3, type=int)) - self.ui.graphicsView.verticalScrollBar().setValue(settings.value("VerticalScrollBarValue", DEFAULT_CANVAS_HEIGHT * 3 / 8, type=int)) - - @pyqtSlot() - def slot_miniCanvasCheckAll(self): - self.slot_miniCanvasCheckSize() - self.slot_horizontalScrollBarChanged(self.ui.graphicsView.horizontalScrollBar().value()) - self.slot_verticalScrollBarChanged(self.ui.graphicsView.verticalScrollBar().value()) - - @pyqtSlot() - def slot_miniCanvasCheckSize(self): - self.ui.miniCanvasPreview.setViewSize(float(self.ui.graphicsView.width()) / DEFAULT_CANVAS_WIDTH, float(self.ui.graphicsView.height()) / DEFAULT_CANVAS_HEIGHT) - - @pyqtSlot(str) - def slot_handleNSM_AnnounceCallback(self, smName): - self.fSessionManagerName = smName - self.ui.act_file_new.setEnabled(False) - self.ui.act_file_open.setEnabled(False) - self.ui.act_file_save_as.setEnabled(False) - self.ui.act_engine_start.setEnabled(True) - self.ui.act_engine_stop.setEnabled(False) - - @pyqtSlot(str) - def slot_handleNSM_OpenCallback(self, data): - projectPath, clientId = data.rsplit(":", 1) - self.fClientName = clientId - - # restart engine - if self.fEngineStarted: - self.stopEngine() - - self.slot_engineStart() - - if self.fEngineStarted: - self.loadProject(projectPath) - - Carla.host.nsm_reply_open() - - @pyqtSlot() - def slot_handleNSM_SaveCallback(self): - self.saveProject(self.fProjectFilename) - Carla.host.nsm_reply_save() - - @pyqtSlot(str) - def slot_handleErrorCallback(self, error): - QMessageBox.critical(self, self.tr("Error"), error) - - @pyqtSlot() - def slot_handleQuitCallback(self): - CustomMessageBox(self, QMessageBox.Warning, self.tr("Warning"), - self.tr("Engine has been stopped or crashed.\nPlease restart Carla"), - self.tr("You may want to save your session now..."), QMessageBox.Ok, QMessageBox.Ok) - - def dragEnterEvent(self, event): - if event.source() == self.ui.fileTreeView: - event.accept() - elif self.ui.tabMain.contentsRect().contains(event.pos()): - event.accept() - else: - QMainWindow.dragEnterEvent(self, event) - - def dropEvent(self, event): - event.accept() - - urls = event.mimeData().urls() - - for url in urls: - filename = url.toLocalFile() - - if not Carla.host.load_filename(filename): - CustomMessageBox(self, QMessageBox.Critical, self.tr("Error"), - self.tr("Failed to load file"), - cString(Carla.host.get_last_error()), QMessageBox.Ok, QMessageBox.Ok) - - def resizeEvent(self, event): - if self.ui.tabMain.currentIndex() == 0: - # Force update of 2nd tab - width = self.ui.tab_plugins.width()-4 - height = self.ui.tab_plugins.height()-4 - self.ui.miniCanvasPreview.setViewSize(float(width) / DEFAULT_CANVAS_WIDTH, float(height) / DEFAULT_CANVAS_HEIGHT) - else: - QTimer.singleShot(0, self, SLOT("slot_miniCanvasCheckSize()")) - - QMainWindow.resizeEvent(self, event) diff --git a/source/carla_database.py b/source/carla_database.py index 11bcbb081..5f12a222f 100755 --- a/source/carla_database.py +++ b/source/carla_database.py @@ -147,7 +147,7 @@ gDiscoveryProcess = None def runCarlaDiscovery(itype, stype, filename, tool, isWine=False): if not os.path.exists(tool): - qCritical("runCarlaDiscovery() - tool '%s' does not exist" % tool) + qWarning("runCarlaDiscovery() - tool '%s' does not exist" % tool) return command = [] @@ -1662,7 +1662,7 @@ class PluginDatabaseW(QDialog): # Main if __name__ == '__main__': - from carla_style import * + from carla_style import CarlaApplication app = CarlaApplication() diff --git a/source/widgets/digitalpeakmeter.py b/source/widgets/digitalpeakmeter.py index e3549883e..369e464e0 100644 --- a/source/widgets/digitalpeakmeter.py +++ b/source/widgets/digitalpeakmeter.py @@ -19,9 +19,13 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import qCritical, Qt, QTimer, QSize -from PyQt5.QtGui import QColor, QLinearGradient, QPainter -from PyQt5.QtWidgets import QWidget +try: + from PyQt5.QtCore import qCritical, Qt, QTimer, QSize + from PyQt5.QtGui import QColor, QLinearGradient, QPainter + from PyQt5.QtWidgets import QWidget +except: + from PyQt4.QtCore import qCritical, Qt, QTimer, QSize + from PyQt4.QtGui import QColor, QLinearGradient, QPainter, QWidget # ------------------------------------------------------------------------------------------------------------ # Widget Class diff --git a/source/widgets/ledbutton.py b/source/widgets/ledbutton.py index 48acd411c..c1732dfa2 100644 --- a/source/widgets/ledbutton.py +++ b/source/widgets/ledbutton.py @@ -19,9 +19,13 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import qCritical, QRectF -from PyQt5.QtGui import QPainter, QPixmap -from PyQt5.QtWidgets import QPushButton +try: + from PyQt5.QtCore import qCritical, QRectF + from PyQt5.QtGui import QPainter, QPixmap + from PyQt5.QtWidgets import QPushButton +except: + from PyQt4.QtCore import qCritical, QRectF + from PyQt4.QtGui import QPainter, QPixmap, QPushButton # ------------------------------------------------------------------------------------------------------------ # Widget Class diff --git a/source/widgets/pixmapbutton.py b/source/widgets/pixmapbutton.py index 302d77c34..38d4243ba 100644 --- a/source/widgets/pixmapbutton.py +++ b/source/widgets/pixmapbutton.py @@ -19,9 +19,13 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import QRectF -from PyQt5.QtGui import QPainter, QPixmap -from PyQt5.QtWidgets import QPushButton +try: + from PyQt5.QtCore import QRectF + from PyQt5.QtGui import QPainter, QPixmap + from PyQt5.QtWidgets import QPushButton +except: + from PyQt4.QtCore import QRectF + from PyQt4.QtGui import QPainter, QPixmap, QPushButton # ------------------------------------------------------------------------------------------------------------ # Widget Class diff --git a/source/widgets/pixmapdial.py b/source/widgets/pixmapdial.py index c67290e51..bb3c8efaf 100644 --- a/source/widgets/pixmapdial.py +++ b/source/widgets/pixmapdial.py @@ -20,10 +20,16 @@ # Imports (Global) from math import floor -from PyQt5.QtCore import Qt, QPointF, QRectF, QTimer, QSize -from PyQt5.QtGui import QColor, QConicalGradient, QFont, QFontMetrics -from PyQt5.QtGui import QLinearGradient, QPainter, QPainterPath, QPen, QPixmap -from PyQt5.QtWidgets import QDial + +try: + from PyQt5.QtCore import Qt, QPointF, QRectF, QTimer, QSize + from PyQt5.QtGui import QColor, QConicalGradient, QFont, QFontMetrics + from PyQt5.QtGui import QLinearGradient, QPainter, QPainterPath, QPen, QPixmap + from PyQt5.QtWidgets import QDial +except: + from PyQt4.QtCore import Qt, QPointF, QRectF, QTimer, QSize + from PyQt4.QtGui import QColor, QConicalGradient, QFont, QFontMetrics + from PyQt4.QtGui import QDial, QLinearGradient, QPainter, QPainterPath, QPen, QPixmap # ------------------------------------------------------------------------------------------------------------ # Widget Class diff --git a/source/widgets/pixmapkeyboard.py b/source/widgets/pixmapkeyboard.py index c275eca7f..d93a6ae66 100644 --- a/source/widgets/pixmapkeyboard.py +++ b/source/widgets/pixmapkeyboard.py @@ -19,9 +19,13 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import pyqtSignal, qCritical, Qt, QPointF, QRectF, QSize -from PyQt5.QtGui import QFont, QPainter, QPixmap -from PyQt5.QtWidgets import QWidget +try: + from PyQt5.QtCore import pyqtSignal, qCritical, Qt, QPointF, QRectF, QSize + from PyQt5.QtGui import QFont, QPainter, QPixmap + from PyQt5.QtWidgets import QWidget +except: + from PyQt4.QtCore import pyqtSignal, qCritical, Qt, QPointF, QRectF, QSize + from PyQt4.QtGui import QFont, QPainter, QPixmap, QWidget # ------------------------------------------------------------------------------------------------------------