@@ -42,6 +42,12 @@ jobs: | |||||
env: | env: | ||||
- TARGET="linux-juce-strict" | - TARGET="linux-juce-strict" | ||||
# linux with default, tests python code | |||||
- os: linux | |||||
compiler: gcc | |||||
env: | |||||
- TARGET="pylint" | |||||
before_install: | before_install: | ||||
- sh ${TRAVIS_BUILD_DIR}/.travis/before_install.sh | - sh ${TRAVIS_BUILD_DIR}/.travis/before_install.sh | ||||
@@ -89,17 +89,6 @@ elif [ "${TARGET}" = "macos" ]; then | |||||
pkg-config \ | pkg-config \ | ||||
apple-x86-setup | apple-x86-setup | ||||
# mkdir /tmp/osx-macports-pkgs | |||||
# cd /tmp/osx-macports-pkgs | |||||
# wget https://launchpad.net/~kxstudio-team/+archive/ubuntu/builds/+files/apple-macports-flac_1.2.1-1_all.deb | |||||
# wget https://launchpad.net/~kxstudio-team/+archive/ubuntu/builds/+files/apple-macports-libiconv_1.14-0_all.deb | |||||
# wget https://launchpad.net/~kxstudio-team/+archive/ubuntu/builds/+files/apple-macports-liblo_0.26-1_all.deb | |||||
# wget https://launchpad.net/~kxstudio-team/+archive/ubuntu/builds/+files/apple-macports-libogg_1.3.0-1_all.deb | |||||
# wget https://launchpad.net/~kxstudio-team/+archive/ubuntu/builds/+files/apple-macports-libsndfile_1.0.25-0_all.deb | |||||
# wget https://launchpad.net/~kxstudio-team/+archive/ubuntu/builds/+files/apple-macports-libvorbis_1.3.3-0_all.deb | |||||
# cd ~ | |||||
# rm -r /tmp/osx-macports-pkgs | |||||
elif [ "${TARGET}" = "win32" ]; then | elif [ "${TARGET}" = "win32" ]; then | ||||
sudo apt-get install -y \ | sudo apt-get install -y \ | ||||
mingw32-x-gcc \ | mingw32-x-gcc \ | ||||
@@ -112,15 +101,12 @@ elif [ "${TARGET}" = "win64" ]; then | |||||
mingw64-x-gcc \ | mingw64-x-gcc \ | ||||
mingw64-x-pkgconfig | mingw64-x-pkgconfig | ||||
fi | |||||
elif [ "${TARGET}" = "pylint" ]; then | |||||
sudo apt-get install -y \ | |||||
pylint3 \ | |||||
python3-liblo \ | |||||
python3-pyqt5 python3-pyqt5.qtsvg python3-pyqt5.qtopengl python3-rdflib \ | |||||
pyqt5-dev-tools \ | |||||
qtbase5-dev | |||||
# mingw32-x-fluidsynth | |||||
# mingw32-x-fftw | |||||
# mingw32-x-liblo | |||||
# mingw32-x-mxml | |||||
# mingw32-x-zlib | |||||
# mingw64-x-fluidsynth | |||||
# mingw64-x-fftw | |||||
# mingw64-x-liblo | |||||
# mingw64-x-mxml | |||||
# mingw64-x-zlib | |||||
fi |
@@ -0,0 +1,32 @@ | |||||
#!/bin/bash | |||||
set -e | |||||
pylint3 \ | |||||
--extension-pkg-whitelist=PyQt5 \ | |||||
--disable=\ | |||||
bad-whitespace,\ | |||||
bare-except,\ | |||||
blacklisted-name,\ | |||||
duplicate-code,\ | |||||
fixme,\ | |||||
invalid-name,\ | |||||
line-too-long,\ | |||||
missing-docstring,\ | |||||
too-few-public-methods,\ | |||||
too-many-arguments,\ | |||||
too-many-branches,\ | |||||
too-many-instance-attributes,\ | |||||
too-many-lines,\ | |||||
too-many-locals,\ | |||||
too-many-public-methods,\ | |||||
too-many-return-statements,\ | |||||
too-many-statements,\ | |||||
unused-argument,\ | |||||
wrong-import-position \ | |||||
source/frontend/carla_{app,backend,backend_qt,settings,shared,utils,widgets}.py | |||||
pylint3 \ | |||||
--extension-pkg-whitelist=PyQt5 \ | |||||
-E \ | |||||
source/frontend/carla_{database,host,skin}.py |
@@ -2,7 +2,7 @@ | |||||
# -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||||
# Carla application | # Carla application | ||||
# Copyright (C) 2013-2019 Filipe Coelho <falktx@falktx.com> | |||||
# Copyright (C) 2013-2020 Filipe Coelho <falktx@falktx.com> | |||||
# | # | ||||
# This program is free software; you can redistribute it and/or | # This program is free software; you can redistribute it and/or | ||||
# modify it under the terms of the GNU General Public License as | # modify it under the terms of the GNU General Public License as | ||||
@@ -19,14 +19,36 @@ | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Imports (Global) | # Imports (Global) | ||||
import os | |||||
import sys | |||||
# ------------------------------------------------------------------------------------------------------------ | |||||
# Imports (ctypes) | |||||
from ctypes import CDLL, RTLD_GLOBAL | |||||
# ------------------------------------------------------------------------------------------------------------ | |||||
# Imports (PyQt5) | |||||
from PyQt5.QtCore import QT_VERSION, Qt, QCoreApplication | from PyQt5.QtCore import QT_VERSION, Qt, QCoreApplication | ||||
from PyQt5.QtGui import QColor, QPalette | |||||
from PyQt5.QtGui import QColor, QIcon, QPalette | |||||
from PyQt5.QtWidgets import QApplication | from PyQt5.QtWidgets import QApplication | ||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Imports (Custom) | # Imports (Custom) | ||||
from carla_shared import * | |||||
from carla_backend import kIs64bit, LINUX, MACOS, WINDOWS | |||||
from carla_shared import ( | |||||
CARLA_KEY_MAIN_USE_PRO_THEME, | |||||
CARLA_KEY_MAIN_PRO_THEME_COLOR, | |||||
CARLA_DEFAULT_MAIN_USE_PRO_THEME, | |||||
CARLA_DEFAULT_MAIN_PRO_THEME_COLOR, | |||||
CWD, VERSION, | |||||
getPaths, | |||||
QSafeSettings, | |||||
gCarla | |||||
) | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
@@ -34,7 +56,7 @@ class CarlaApplication(object): | |||||
def __init__(self, appName = "Carla2", libPrefix = None): | def __init__(self, appName = "Carla2", libPrefix = None): | ||||
object.__init__(self) | object.__init__(self) | ||||
pathBinaries, pathResources = getPaths(libPrefix) | |||||
pathBinaries, _ = getPaths(libPrefix) | |||||
# Needed for MacOS and Windows | # Needed for MacOS and Windows | ||||
if os.path.exists(CWD) and (MACOS or WINDOWS): | if os.path.exists(CWD) and (MACOS or WINDOWS): | ||||
@@ -87,126 +109,10 @@ class CarlaApplication(object): | |||||
proThemeColor = settings.value(CARLA_KEY_MAIN_PRO_THEME_COLOR, CARLA_DEFAULT_MAIN_PRO_THEME_COLOR, str).lower() | proThemeColor = settings.value(CARLA_KEY_MAIN_PRO_THEME_COLOR, CARLA_DEFAULT_MAIN_PRO_THEME_COLOR, str).lower() | ||||
if MACOS or proThemeColor == "black": | if MACOS or proThemeColor == "black": | ||||
self.fPalBlack = QPalette() | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Window, QColor(14, 14, 14)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.Window, QColor(17, 17, 17)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Window, QColor(17, 17, 17)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.WindowText, QColor(83, 83, 83)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.WindowText, QColor(240, 240, 240)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.WindowText, QColor(240, 240, 240)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Base, QColor(6, 6, 6)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.Base, QColor(7, 7, 7)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Base, QColor(7, 7, 7)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.AlternateBase, QColor(12, 12, 12)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.AlternateBase, QColor(14, 14, 14)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.AlternateBase, QColor(14, 14, 14)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.ToolTipBase, QColor(4, 4, 4)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.ToolTipBase, QColor(4, 4, 4)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.ToolTipBase, QColor(4, 4, 4)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.ToolTipText, QColor(230, 230, 230)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.ToolTipText, QColor(230, 230, 230)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.ToolTipText, QColor(230, 230, 230)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Text, QColor(74, 74, 74)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.Text, QColor(230, 230, 230)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Text, QColor(230, 230, 230)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Button, QColor(24, 24, 24)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.Button, QColor(28, 28, 28)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Button, QColor(28, 28, 28)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(90, 90, 90)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.ButtonText, QColor(240, 240, 240)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.ButtonText, QColor(240, 240, 240)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.BrightText, QColor(255, 255, 255)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.BrightText, QColor(255, 255, 255)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.BrightText, QColor(255, 255, 255)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Light, QColor(191, 191, 191)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.Light, QColor(191, 191, 191)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Light, QColor(191, 191, 191)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Midlight, QColor(155, 155, 155)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.Midlight, QColor(155, 155, 155)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Midlight, QColor(155, 155, 155)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Dark, QColor(129, 129, 129)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.Dark, QColor(129, 129, 129)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Dark, QColor(129, 129, 129)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Mid, QColor(94, 94, 94)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.Mid, QColor(94, 94, 94)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Mid, QColor(94, 94, 94)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Shadow, QColor(155, 155, 155)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.Shadow, QColor(155, 155, 155)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Shadow, QColor(155, 155, 155)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Highlight, QColor(14, 14, 14)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.Highlight, QColor(60, 60, 60)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Highlight, QColor(34, 34, 34)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.HighlightedText, QColor(83, 83, 83)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.HighlightedText, QColor(255, 255, 255)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.HighlightedText, QColor(240, 240, 240)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Link, QColor(34, 34, 74)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.Link, QColor(100, 100, 230)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Link, QColor(100, 100, 230)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.LinkVisited, QColor(74, 34, 74)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.LinkVisited, QColor(230, 100, 230)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.LinkVisited, QColor(230, 100, 230)) | |||||
self.fApp.setPalette(self.fPalBlack) | |||||
self.createPaletteBlack() | |||||
elif proThemeColor == "blue": | elif proThemeColor == "blue": | ||||
self.fPalBlue = QPalette() | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Window, QColor(32, 35, 39)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.Window, QColor(37, 40, 45)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Window, QColor(37, 40, 45)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.WindowText, QColor(89, 95, 104)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.WindowText, QColor(223, 237, 255)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.WindowText, QColor(223, 237, 255)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Base, QColor(48, 53, 60)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.Base, QColor(55, 61, 69)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Base, QColor(55, 61, 69)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.AlternateBase, QColor(60, 64, 67)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.AlternateBase, QColor(69, 73, 77)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.AlternateBase, QColor(69, 73, 77)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.ToolTipBase, QColor(182, 193, 208)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.ToolTipBase, QColor(182, 193, 208)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.ToolTipBase, QColor(182, 193, 208)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.ToolTipText, QColor(42, 44, 48)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.ToolTipText, QColor(42, 44, 48)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.ToolTipText, QColor(42, 44, 48)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Text, QColor(96, 103, 113)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.Text, QColor(210, 222, 240)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Text, QColor(210, 222, 240)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Button, QColor(51, 55, 62)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.Button, QColor(59, 63, 71)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Button, QColor(59, 63, 71)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(98, 104, 114)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.ButtonText, QColor(210, 222, 240)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.ButtonText, QColor(210, 222, 240)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.BrightText, QColor(255, 255, 255)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.BrightText, QColor(255, 255, 255)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.BrightText, QColor(255, 255, 255)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Light, QColor(59, 64, 72)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.Light, QColor(63, 68, 76)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Light, QColor(63, 68, 76)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Midlight, QColor(48, 52, 59)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.Midlight, QColor(51, 56, 63)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Midlight, QColor(51, 56, 63)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Dark, QColor(18, 19, 22)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.Dark, QColor(20, 22, 25)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Dark, QColor(20, 22, 25)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Mid, QColor(28, 30, 34)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.Mid, QColor(32, 35, 39)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Mid, QColor(32, 35, 39)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Shadow, QColor(13, 14, 16)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.Shadow, QColor(15, 16, 18)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Shadow, QColor(15, 16, 18)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Highlight, QColor(32, 35, 39)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.Highlight, QColor(14, 14, 17)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Highlight, QColor(27, 28, 33)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.HighlightedText, QColor(89, 95, 104)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.HighlightedText, QColor(217, 234, 253)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.HighlightedText, QColor(223, 237, 255)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Link, QColor(79, 100, 118)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.Link, QColor(156, 212, 255)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Link, QColor(156, 212, 255)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.LinkVisited, QColor(51, 74, 118)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.LinkVisited, QColor(64, 128, 255)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.LinkVisited, QColor(64, 128, 255)) | |||||
self.fApp.setPalette(self.fPalBlue) | |||||
self.createPaletteBlue() | |||||
def createApp(self, appName): | def createApp(self, appName): | ||||
if LINUX: | if LINUX: | ||||
@@ -246,6 +152,128 @@ class CarlaApplication(object): | |||||
self.fApp.setDesktopFileName("carla") | self.fApp.setDesktopFileName("carla") | ||||
self.fApp.setWindowIcon(QIcon(":/scalable/carla.svg")) | self.fApp.setWindowIcon(QIcon(":/scalable/carla.svg")) | ||||
def createPaletteBlack(self): | |||||
self.fPalBlack = QPalette() | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Window, QColor(14, 14, 14)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.Window, QColor(17, 17, 17)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Window, QColor(17, 17, 17)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.WindowText, QColor(83, 83, 83)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.WindowText, QColor(240, 240, 240)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.WindowText, QColor(240, 240, 240)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Base, QColor(6, 6, 6)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.Base, QColor(7, 7, 7)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Base, QColor(7, 7, 7)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.AlternateBase, QColor(12, 12, 12)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.AlternateBase, QColor(14, 14, 14)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.AlternateBase, QColor(14, 14, 14)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.ToolTipBase, QColor(4, 4, 4)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.ToolTipBase, QColor(4, 4, 4)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.ToolTipBase, QColor(4, 4, 4)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.ToolTipText, QColor(230, 230, 230)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.ToolTipText, QColor(230, 230, 230)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.ToolTipText, QColor(230, 230, 230)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Text, QColor(74, 74, 74)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.Text, QColor(230, 230, 230)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Text, QColor(230, 230, 230)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Button, QColor(24, 24, 24)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.Button, QColor(28, 28, 28)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Button, QColor(28, 28, 28)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(90, 90, 90)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.ButtonText, QColor(240, 240, 240)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.ButtonText, QColor(240, 240, 240)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.BrightText, QColor(255, 255, 255)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.BrightText, QColor(255, 255, 255)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.BrightText, QColor(255, 255, 255)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Light, QColor(191, 191, 191)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.Light, QColor(191, 191, 191)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Light, QColor(191, 191, 191)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Midlight, QColor(155, 155, 155)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.Midlight, QColor(155, 155, 155)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Midlight, QColor(155, 155, 155)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Dark, QColor(129, 129, 129)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.Dark, QColor(129, 129, 129)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Dark, QColor(129, 129, 129)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Mid, QColor(94, 94, 94)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.Mid, QColor(94, 94, 94)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Mid, QColor(94, 94, 94)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Shadow, QColor(155, 155, 155)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.Shadow, QColor(155, 155, 155)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Shadow, QColor(155, 155, 155)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Highlight, QColor(14, 14, 14)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.Highlight, QColor(60, 60, 60)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Highlight, QColor(34, 34, 34)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.HighlightedText, QColor(83, 83, 83)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.HighlightedText, QColor(255, 255, 255)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.HighlightedText, QColor(240, 240, 240)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.Link, QColor(34, 34, 74)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.Link, QColor(100, 100, 230)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.Link, QColor(100, 100, 230)) | |||||
self.fPalBlack.setColor(QPalette.Disabled, QPalette.LinkVisited, QColor(74, 34, 74)) | |||||
self.fPalBlack.setColor(QPalette.Active, QPalette.LinkVisited, QColor(230, 100, 230)) | |||||
self.fPalBlack.setColor(QPalette.Inactive, QPalette.LinkVisited, QColor(230, 100, 230)) | |||||
self.fApp.setPalette(self.fPalBlack) | |||||
def createPaletteBlue(self): | |||||
self.fPalBlue = QPalette() | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Window, QColor(32, 35, 39)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.Window, QColor(37, 40, 45)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Window, QColor(37, 40, 45)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.WindowText, QColor(89, 95, 104)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.WindowText, QColor(223, 237, 255)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.WindowText, QColor(223, 237, 255)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Base, QColor(48, 53, 60)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.Base, QColor(55, 61, 69)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Base, QColor(55, 61, 69)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.AlternateBase, QColor(60, 64, 67)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.AlternateBase, QColor(69, 73, 77)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.AlternateBase, QColor(69, 73, 77)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.ToolTipBase, QColor(182, 193, 208)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.ToolTipBase, QColor(182, 193, 208)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.ToolTipBase, QColor(182, 193, 208)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.ToolTipText, QColor(42, 44, 48)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.ToolTipText, QColor(42, 44, 48)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.ToolTipText, QColor(42, 44, 48)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Text, QColor(96, 103, 113)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.Text, QColor(210, 222, 240)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Text, QColor(210, 222, 240)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Button, QColor(51, 55, 62)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.Button, QColor(59, 63, 71)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Button, QColor(59, 63, 71)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(98, 104, 114)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.ButtonText, QColor(210, 222, 240)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.ButtonText, QColor(210, 222, 240)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.BrightText, QColor(255, 255, 255)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.BrightText, QColor(255, 255, 255)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.BrightText, QColor(255, 255, 255)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Light, QColor(59, 64, 72)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.Light, QColor(63, 68, 76)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Light, QColor(63, 68, 76)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Midlight, QColor(48, 52, 59)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.Midlight, QColor(51, 56, 63)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Midlight, QColor(51, 56, 63)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Dark, QColor(18, 19, 22)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.Dark, QColor(20, 22, 25)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Dark, QColor(20, 22, 25)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Mid, QColor(28, 30, 34)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.Mid, QColor(32, 35, 39)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Mid, QColor(32, 35, 39)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Shadow, QColor(13, 14, 16)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.Shadow, QColor(15, 16, 18)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Shadow, QColor(15, 16, 18)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Highlight, QColor(32, 35, 39)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.Highlight, QColor(14, 14, 17)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Highlight, QColor(27, 28, 33)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.HighlightedText, QColor(89, 95, 104)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.HighlightedText, QColor(217, 234, 253)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.HighlightedText, QColor(223, 237, 255)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.Link, QColor(79, 100, 118)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.Link, QColor(156, 212, 255)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.Link, QColor(156, 212, 255)) | |||||
self.fPalBlue.setColor(QPalette.Disabled, QPalette.LinkVisited, QColor(51, 74, 118)) | |||||
self.fPalBlue.setColor(QPalette.Active, QPalette.LinkVisited, QColor(64, 128, 255)) | |||||
self.fPalBlue.setColor(QPalette.Inactive, QPalette.LinkVisited, QColor(64, 128, 255)) | |||||
self.fApp.setPalette(self.fPalBlue) | |||||
def exec_(self): | def exec_(self): | ||||
return self.fApp.exec_() | return self.fApp.exec_() | ||||
@@ -20,11 +20,20 @@ | |||||
# Imports (Global) | # Imports (Global) | ||||
from abc import abstractmethod | from abc import abstractmethod | ||||
from ctypes import * | |||||
from platform import architecture | from platform import architecture | ||||
from struct import pack | from struct import pack | ||||
from sys import platform, maxsize | from sys import platform, maxsize | ||||
# ------------------------------------------------------------------------------------------------------------ | |||||
# Imports (ctypes) | |||||
from ctypes import ( | |||||
c_bool, c_char_p, c_double, c_float, c_int, c_long, c_longdouble, c_longlong, c_ubyte, c_uint, c_void_p, | |||||
c_int8, c_int16, c_int32, c_int64, c_uint8, c_uint16, c_uint32, c_uint64, | |||||
cast, Structure, | |||||
CDLL, CFUNCTYPE, RTLD_GLOBAL, RTLD_LOCAL, POINTER | |||||
) | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# 64bit check | # 64bit check | ||||
@@ -126,8 +135,10 @@ def toPythonType(value, attr): | |||||
return value | return value | ||||
if isinstance(value, bytes): | if isinstance(value, bytes): | ||||
return charPtrToString(value) | return charPtrToString(value) | ||||
# pylint: disable=consider-merging-isinstance | |||||
if isinstance(value, c_intp_types) or isinstance(value, c_floatp_types): | if isinstance(value, c_intp_types) or isinstance(value, c_floatp_types): | ||||
return numPtrToList(value) | return numPtrToList(value) | ||||
# pylint: enable=consider-merging-isinstance | |||||
if isinstance(value, POINTER(c_char_p)): | if isinstance(value, POINTER(c_char_p)): | ||||
return charPtrPtrToStringList(value) | return charPtrPtrToStringList(value) | ||||
print("..............", attr, ".....................", value, ":", type(value)) | print("..............", attr, ".....................", value, ":", type(value)) | ||||
@@ -137,7 +148,9 @@ def toPythonType(value, attr): | |||||
# Convert a ctypes struct into a python dict | # Convert a ctypes struct into a python dict | ||||
def structToDict(struct): | def structToDict(struct): | ||||
# pylint: disable=protected-access | |||||
return dict((attr, toPythonType(getattr(struct, attr), attr)) for attr, value in struct._fields_) | return dict((attr, toPythonType(getattr(struct, attr), attr)) for attr, value in struct._fields_) | ||||
# pylint: enable=protected-access | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Carla Backend API (base definitions) | # Carla Backend API (base definitions) | ||||
@@ -2877,6 +2890,9 @@ class CarlaHostDLL(CarlaHostMeta): | |||||
self.handle = self.lib.carla_standalone_host_init() | self.handle = self.lib.carla_standalone_host_init() | ||||
self._engineCallback = None | |||||
self._fileCallback = None | |||||
# -------------------------------------------------------------------------------------------------------- | # -------------------------------------------------------------------------------------------------------- | ||||
def get_engine_driver_count(self): | def get_engine_driver_count(self): | ||||
@@ -3647,8 +3663,8 @@ class CarlaHostPlugin(CarlaHostMeta): | |||||
if pluginId < len(self.fPluginsInfo): | if pluginId < len(self.fPluginsInfo): | ||||
return | return | ||||
for id in range(len(self.fPluginsInfo), pluginId+1): | |||||
self.fPluginsInfo[id] = PluginStoreInfo() | |||||
for pid in range(len(self.fPluginsInfo), pluginId+1): | |||||
self.fPluginsInfo[pid] = PluginStoreInfo() | |||||
def _set_pluginInfo(self, pluginId, info): | def _set_pluginInfo(self, pluginId, info): | ||||
plugin = self.fPluginsInfo.get(pluginId, None) | plugin = self.fPluginsInfo.get(pluginId, None) | ||||
@@ -3718,7 +3734,7 @@ class CarlaHostPlugin(CarlaHostMeta): | |||||
plugin.parameterValues = [] | plugin.parameterValues = [] | ||||
# add placeholders | # add placeholders | ||||
for x in range(count): | |||||
for _ in range(count): | |||||
plugin.parameterInfo.append(PyCarlaParameterInfo.copy()) | plugin.parameterInfo.append(PyCarlaParameterInfo.copy()) | ||||
plugin.parameterData.append(PyParameterData.copy()) | plugin.parameterData.append(PyParameterData.copy()) | ||||
plugin.parameterRanges.append(PyParameterRanges.copy()) | plugin.parameterRanges.append(PyParameterRanges.copy()) | ||||
@@ -3731,7 +3747,7 @@ class CarlaHostPlugin(CarlaHostMeta): | |||||
return | return | ||||
plugin.programCount = count | plugin.programCount = count | ||||
plugin.programNames = ["" for x in range(count)] | |||||
plugin.programNames = ["" for _ in range(count)] | |||||
def _set_midiProgramCount(self, pluginId, count): | def _set_midiProgramCount(self, pluginId, count): | ||||
plugin = self.fPluginsInfo.get(pluginId, None) | plugin = self.fPluginsInfo.get(pluginId, None) | ||||
@@ -3740,7 +3756,7 @@ class CarlaHostPlugin(CarlaHostMeta): | |||||
return | return | ||||
plugin.midiProgramCount = count | plugin.midiProgramCount = count | ||||
plugin.midiProgramData = [PyMidiProgramData.copy() for x in range(count)] | |||||
plugin.midiProgramData = [PyMidiProgramData.copy() for _ in range(count)] | |||||
def _set_customDataCount(self, pluginId, count): | def _set_customDataCount(self, pluginId, count): | ||||
plugin = self.fPluginsInfo.get(pluginId, None) | plugin = self.fPluginsInfo.get(pluginId, None) | ||||
@@ -3749,7 +3765,7 @@ class CarlaHostPlugin(CarlaHostMeta): | |||||
return | return | ||||
plugin.customDataCount = count | plugin.customDataCount = count | ||||
plugin.customData = [PyCustomData.copy() for x in range(count)] | |||||
plugin.customData = [PyCustomData.copy() for _ in range(count)] | |||||
def _set_parameterInfo(self, pluginId, paramIndex, info): | def _set_parameterInfo(self, pluginId, paramIndex, info): | ||||
plugin = self.fPluginsInfo.get(pluginId, None) | plugin = self.fPluginsInfo.get(pluginId, None) | ||||
@@ -2,7 +2,7 @@ | |||||
# -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||||
# Carla Backend code (Qt stuff) | # Carla Backend code (Qt stuff) | ||||
# Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com> | |||||
# Copyright (C) 2011-2020 Filipe Coelho <falktx@falktx.com> | |||||
# | # | ||||
# This program is free software; you can redistribute it and/or | # This program is free software; you can redistribute it and/or | ||||
# modify it under the terms of the GNU General Public License as | # modify it under the terms of the GNU General Public License as | ||||
@@ -24,7 +24,7 @@ from PyQt5.QtCore import pyqtSignal, QObject | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Imports (Custom) | # Imports (Custom) | ||||
from carla_backend import * | |||||
from carla_backend import CarlaHostNull, CarlaHostDLL, CarlaHostPlugin | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Carla Host PyQt signals | # Carla Host PyQt signals | ||||
@@ -98,9 +98,11 @@ class CarlaHostQtDLL(CarlaHostDLL, CarlaHostSignals): | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Carla Host object for plugins (using pipes) | # Carla Host object for plugins (using pipes) | ||||
# pylint: disable=abstract-method | |||||
class CarlaHostQtPlugin(CarlaHostPlugin, CarlaHostSignals): | class CarlaHostQtPlugin(CarlaHostPlugin, CarlaHostSignals): | ||||
def __init__(self): | def __init__(self): | ||||
CarlaHostSignals.__init__(self) | CarlaHostSignals.__init__(self) | ||||
CarlaHostPlugin.__init__(self) | CarlaHostPlugin.__init__(self) | ||||
# pylint: enable=abstract-method | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ |
@@ -26,6 +26,7 @@ from PyQt5.QtCore import QEventLoop | |||||
import ui_carla_osc_connect | import ui_carla_osc_connect | ||||
from carla_backend_qt import CarlaHostQtPlugin | |||||
from carla_host import * | from carla_host import * | ||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
@@ -104,10 +105,10 @@ class ConnectDialog(QDialog): | |||||
self.ui.rb_reported_auto.setChecked(False) | self.ui.rb_reported_auto.setChecked(False) | ||||
self.ui.rb_reported_custom.setChecked(True) | self.ui.rb_reported_custom.setChecked(True) | ||||
self.ui.le_host.setText(settings.value("Host", "127.0.0.1", type=str)) | |||||
self.ui.le_reported_host.setText(settings.value("ReportedHost", "", type=str)) | |||||
self.ui.sb_tcp_port.setValue(settings.value("TCPPort", CARLA_DEFAULT_OSC_TCP_PORT_NUMBER, type=int)) | |||||
self.ui.sb_udp_port.setValue(settings.value("UDPPort", CARLA_DEFAULT_OSC_UDP_PORT_NUMBER, type=int)) | |||||
self.ui.le_host.setText(settings.value("Host", "127.0.0.1", str)) | |||||
self.ui.le_reported_host.setText(settings.value("ReportedHost", "", str)) | |||||
self.ui.sb_tcp_port.setValue(settings.value("TCPPort", CARLA_DEFAULT_OSC_TCP_PORT_NUMBER, int)) | |||||
self.ui.sb_udp_port.setValue(settings.value("UDPPort", CARLA_DEFAULT_OSC_UDP_PORT_NUMBER, int)) | |||||
self.checkIfButtonBoxShouldBeEnabled(self.ui.le_host.text(), | self.checkIfButtonBoxShouldBeEnabled(self.ui.le_host.text(), | ||||
self.ui.rb_reported_auto.isChecked(), | self.ui.rb_reported_auto.isChecked(), | ||||
@@ -717,9 +718,9 @@ class HostWindowOSC(HostWindow): | |||||
def loadSettings(self, firstTime): | def loadSettings(self, firstTime): | ||||
settings = HostWindow.loadSettings(self, firstTime) | settings = HostWindow.loadSettings(self, firstTime) | ||||
if self.fCustomOscAddress is not None: | if self.fCustomOscAddress is not None: | ||||
self.fOscAddressTCP = settings.value("RemoteAddressTCP", "osc.tcp://127.0.0.1:22752/Carla", type=str) | |||||
self.fOscAddressUDP = settings.value("RemoteAddressUDP", "osc.udp://127.0.0.1:22752/Carla", type=str) | |||||
self.fOscReportedHost = settings.value("RemoteReportedHost", "", type=str) | |||||
self.fOscAddressTCP = settings.value("RemoteAddressTCP", "osc.tcp://127.0.0.1:22752/Carla", str) | |||||
self.fOscAddressUDP = settings.value("RemoteAddressUDP", "osc.udp://127.0.0.1:22752/Carla", str) | |||||
self.fOscReportedHost = settings.value("RemoteReportedHost", "", str) | |||||
def saveSettings(self): | def saveSettings(self): | ||||
settings = HostWindow.saveSettings(self) | settings = HostWindow.saveSettings(self) | ||||
@@ -33,6 +33,7 @@ import ui_carla_add_jack | |||||
import ui_carla_database | import ui_carla_database | ||||
import ui_carla_refresh | import ui_carla_refresh | ||||
from carla_backend import * | |||||
from carla_shared import * | from carla_shared import * | ||||
from carla_utils import getPluginTypeAsString, getPluginCategoryAsString | from carla_utils import getPluginTypeAsString, getPluginCategoryAsString | ||||
@@ -1006,10 +1007,6 @@ class PluginRefreshW(QDialog): | |||||
self.ui = ui_carla_refresh.Ui_PluginRefreshW() | self.ui = ui_carla_refresh.Ui_PluginRefreshW() | ||||
self.ui.setupUi(self) | self.ui.setupUi(self) | ||||
if False: | |||||
# kdevelop likes this :) | |||||
self.host = host = CarlaHostNull() | |||||
# ------------------------------------------------------------------------------------------------------------- | # ------------------------------------------------------------------------------------------------------------- | ||||
# Internal stuff | # Internal stuff | ||||
@@ -1378,12 +1375,6 @@ class PluginRefreshW(QDialog): | |||||
QDialog.closeEvent(self, event) | QDialog.closeEvent(self, event) | ||||
# ----------------------------------------------------------------------------------------------------------------- | |||||
def done(self, r): | |||||
QDialog.done(self, r) | |||||
self.close() | |||||
# --------------------------------------------------------------------------------------------------------------------- | # --------------------------------------------------------------------------------------------------------------------- | ||||
# Plugin Database Dialog | # Plugin Database Dialog | ||||
@@ -1400,11 +1391,6 @@ class PluginDatabaseW(QDialog): | |||||
self.ui = ui_carla_database.Ui_PluginDatabaseW() | self.ui = ui_carla_database.Ui_PluginDatabaseW() | ||||
self.ui.setupUi(self) | self.ui.setupUi(self) | ||||
if False: | |||||
# kdevelop likes this :) | |||||
host = CarlaHostNull() | |||||
self.host = host | |||||
# ---------------------------------------------------------------------------------------------------- | # ---------------------------------------------------------------------------------------------------- | ||||
# Internal stuff | # Internal stuff | ||||
@@ -2218,10 +2204,6 @@ class PluginDatabaseW(QDialog): | |||||
self.ui.lineEdit.setFocus() | self.ui.lineEdit.setFocus() | ||||
QDialog.showEvent(self, event) | QDialog.showEvent(self, event) | ||||
def done(self, r): | |||||
QDialog.done(self, r) | |||||
self.close() | |||||
# --------------------------------------------------------------------------------------------------------------------- | # --------------------------------------------------------------------------------------------------------------------- | ||||
# Jack Application Dialog | # Jack Application Dialog | ||||
@@ -2374,24 +2356,21 @@ class JackApplicationW(QDialog): | |||||
settings.setValue("CaptureFirstWindow", self.ui.cb_capture_first_window.isChecked()) | settings.setValue("CaptureFirstWindow", self.ui.cb_capture_first_window.isChecked()) | ||||
settings.setValue("MidiOutMixdown", self.ui.cb_out_midi_mixdown.isChecked()) | settings.setValue("MidiOutMixdown", self.ui.cb_out_midi_mixdown.isChecked()) | ||||
# ----------------------------------------------------------------------------------------------------------------- | |||||
def done(self, r): | |||||
QDialog.done(self, r) | |||||
self.close() | |||||
# --------------------------------------------------------------------------------------------------------------------- | # --------------------------------------------------------------------------------------------------------------------- | ||||
# Main | # Main | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
from carla_app import CarlaApplication | from carla_app import CarlaApplication | ||||
from carla_host import initHost, loadHostSettings | |||||
from carla_host import initHost as _initHost, loadHostSettings as _loadHostSettings | |||||
# pylint: disable=ungrouped-imports | |||||
from carla_shared import handleInitialCommandLineArguments | |||||
# pylint: enable=ungrouped-imports | |||||
initName, libPrefix = handleInitialCommandLineArguments(__file__ if "__file__" in dir() else None) | initName, libPrefix = handleInitialCommandLineArguments(__file__ if "__file__" in dir() else None) | ||||
app = CarlaApplication("Carla2-Database", libPrefix) | app = CarlaApplication("Carla2-Database", libPrefix) | ||||
host = initHost("Carla2-Database", libPrefix, False, False, False) | |||||
loadHostSettings(host) | |||||
host = _initHost("Carla2-Database", libPrefix, False, False, False) | |||||
_loadHostSettings(host) | |||||
gui = PluginDatabaseW(None, host) | gui = PluginDatabaseW(None, host) | ||||
gui.show() | gui.show() | ||||
@@ -21,6 +21,16 @@ | |||||
import json | import json | ||||
# ------------------------------------------------------------------------------------------------------------ | |||||
# Imports (ctypes) | |||||
from ctypes import ( | |||||
byref, pointer | |||||
) | |||||
# ------------------------------------------------------------------------------------------------------------ | |||||
# Imports (PyQt5) | |||||
# This fails in some configurations, assume >= 5.6.0 in that case | # This fails in some configurations, assume >= 5.6.0 in that case | ||||
try: | try: | ||||
from PyQt5.Qt import PYQT_VERSION | from PyQt5.Qt import PYQT_VERSION | ||||
@@ -28,7 +38,7 @@ except ImportError: | |||||
PYQT_VERSION = 0x50600 | PYQT_VERSION = 0x50600 | ||||
from PyQt5.QtCore import QT_VERSION, qCritical, QEventLoop, QFileInfo, QModelIndex, QPointF, QTimer, QEvent | from PyQt5.QtCore import QT_VERSION, qCritical, QEventLoop, QFileInfo, QModelIndex, QPointF, QTimer, QEvent | ||||
from PyQt5.QtGui import QImage, QImageWriter, QPalette, QBrush | |||||
from PyQt5.QtGui import QImage, QImageWriter, QPainter, QPalette, QBrush | |||||
from PyQt5.QtWidgets import QAction, QApplication, QInputDialog, QFileSystemModel, QListWidgetItem, QGraphicsView, QMainWindow | from PyQt5.QtWidgets import QAction, QApplication, QInputDialog, QFileSystemModel, QListWidgetItem, QGraphicsView, QMainWindow | ||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
@@ -37,6 +47,7 @@ from PyQt5.QtWidgets import QAction, QApplication, QInputDialog, QFileSystemMode | |||||
import ui_carla_host | import ui_carla_host | ||||
from carla_app import * | from carla_app import * | ||||
from carla_backend_qt import CarlaHostQtDLL, CarlaHostQtNull | |||||
from carla_database import * | from carla_database import * | ||||
from carla_settings import * | from carla_settings import * | ||||
from carla_utils import * | from carla_utils import * | ||||
@@ -3332,7 +3343,7 @@ def runHostWithoutUI(host): | |||||
if not isinstance(gCarla.nogui, int): | if not isinstance(gCarla.nogui, int): | ||||
oscPort = None | oscPort = None | ||||
projectFile = getInitialProjectFile(QCoreApplication.instance(), True) | |||||
projectFile = getInitialProjectFile(True) | |||||
if not projectFile: | if not projectFile: | ||||
print("Carla no-gui mode can only be used together with a project file.") | print("Carla no-gui mode can only be used together with a project file.") | ||||
@@ -2,7 +2,7 @@ | |||||
# -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||||
# Carla settings code | # Carla settings code | ||||
# Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com> | |||||
# Copyright (C) 2011-2020 Filipe Coelho <falktx@falktx.com> | |||||
# | # | ||||
# This program is free software; you can redistribute it and/or | # This program is free software; you can redistribute it and/or | ||||
# modify it under the terms of the GNU General Public License as | # modify it under the terms of the GNU General Public License as | ||||
@@ -17,11 +17,10 @@ | |||||
# For a full copy of the GNU General Public License see the doc/GPL.txt file. | # For a full copy of the GNU General Public License see the doc/GPL.txt file. | ||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Imports (Global) | |||||
# Imports (PyQt5) | |||||
from PyQt5.QtCore import pyqtSlot, QByteArray, QDir | |||||
from PyQt5.QtGui import QColor, QCursor, QPainter, QPainterPath | |||||
from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QFrame, QInputDialog, QLineEdit, QMenu, QVBoxLayout, QWidget | |||||
from PyQt5.QtCore import pyqtSlot, Qt | |||||
from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QFileDialog | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Imports (Custom) | # Imports (Custom) | ||||
@@ -29,8 +28,152 @@ from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QFrame, QInputDialog, QLi | |||||
import ui_carla_settings | import ui_carla_settings | ||||
import ui_carla_settings_driver | import ui_carla_settings_driver | ||||
from carla_shared import * | |||||
from patchcanvas.theme import * | |||||
from carla_backend import ( | |||||
LINUX, MACOS, WINDOWS, | |||||
ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL, | |||||
ENGINE_DRIVER_DEVICE_CAN_TRIPLE_BUFFER, | |||||
ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE, | |||||
ENGINE_DRIVER_DEVICE_VARIABLE_SAMPLE_RATE, | |||||
ENGINE_PROCESS_MODE_CONTINUOUS_RACK, | |||||
ENGINE_OPTION_FILE_PATH, | |||||
ENGINE_OPTION_PLUGIN_PATH, | |||||
FILE_AUDIO, | |||||
FILE_MIDI, | |||||
PLUGIN_LADSPA, | |||||
PLUGIN_DSSI, | |||||
PLUGIN_LV2, | |||||
PLUGIN_VST2, | |||||
PLUGIN_VST3, | |||||
PLUGIN_SF2, | |||||
PLUGIN_SFZ | |||||
) | |||||
from carla_shared import ( | |||||
CARLA_KEY_MAIN_PROJECT_FOLDER, | |||||
CARLA_KEY_MAIN_USE_PRO_THEME, | |||||
CARLA_KEY_MAIN_PRO_THEME_COLOR, | |||||
CARLA_KEY_MAIN_REFRESH_INTERVAL, | |||||
CARLA_KEY_MAIN_CONFIRM_EXIT, | |||||
CARLA_KEY_MAIN_SHOW_LOGS, | |||||
CARLA_KEY_MAIN_EXPERIMENTAL, | |||||
CARLA_KEY_CANVAS_THEME, | |||||
CARLA_KEY_CANVAS_SIZE, | |||||
CARLA_KEY_CANVAS_USE_BEZIER_LINES, | |||||
CARLA_KEY_CANVAS_AUTO_HIDE_GROUPS, | |||||
CARLA_KEY_CANVAS_AUTO_SELECT_ITEMS, | |||||
#CARLA_KEY_CANVAS_EYE_CANDY, | |||||
CARLA_KEY_CANVAS_FANCY_EYE_CANDY, | |||||
CARLA_KEY_CANVAS_USE_OPENGL, | |||||
CARLA_KEY_CANVAS_ANTIALIASING, | |||||
CARLA_KEY_CANVAS_HQ_ANTIALIASING, | |||||
CARLA_KEY_CANVAS_INLINE_DISPLAYS, | |||||
CARLA_KEY_CANVAS_FULL_REPAINTS, | |||||
CARLA_KEY_ENGINE_DRIVER_PREFIX, | |||||
CARLA_KEY_ENGINE_AUDIO_DRIVER, | |||||
CARLA_KEY_ENGINE_PROCESS_MODE, | |||||
CARLA_KEY_ENGINE_FORCE_STEREO, | |||||
CARLA_KEY_ENGINE_PREFER_PLUGIN_BRIDGES, | |||||
CARLA_KEY_ENGINE_PREFER_UI_BRIDGES, | |||||
CARLA_KEY_ENGINE_MANAGE_UIS, | |||||
CARLA_KEY_ENGINE_UIS_ALWAYS_ON_TOP, | |||||
CARLA_KEY_ENGINE_MAX_PARAMETERS, | |||||
CARLA_KEY_ENGINE_RESET_XRUNS, | |||||
CARLA_KEY_ENGINE_UI_BRIDGES_TIMEOUT, | |||||
CARLA_KEY_OSC_ENABLED, | |||||
CARLA_KEY_OSC_TCP_PORT_ENABLED, | |||||
CARLA_KEY_OSC_TCP_PORT_NUMBER, | |||||
CARLA_KEY_OSC_TCP_PORT_RANDOM, | |||||
CARLA_KEY_OSC_UDP_PORT_ENABLED, | |||||
CARLA_KEY_OSC_UDP_PORT_NUMBER, | |||||
CARLA_KEY_OSC_UDP_PORT_RANDOM, | |||||
CARLA_KEY_PATHS_AUDIO, | |||||
CARLA_KEY_PATHS_MIDI, | |||||
CARLA_KEY_PATHS_LADSPA, | |||||
CARLA_KEY_PATHS_DSSI, | |||||
CARLA_KEY_PATHS_LV2, | |||||
CARLA_KEY_PATHS_VST2, | |||||
CARLA_KEY_PATHS_VST3, | |||||
CARLA_KEY_PATHS_SF2, | |||||
CARLA_KEY_PATHS_SFZ, | |||||
CARLA_KEY_WINE_EXECUTABLE, | |||||
CARLA_KEY_WINE_AUTO_PREFIX, | |||||
CARLA_KEY_WINE_FALLBACK_PREFIX, | |||||
CARLA_KEY_WINE_RT_PRIO_ENABLED, | |||||
CARLA_KEY_WINE_BASE_RT_PRIO, | |||||
CARLA_KEY_WINE_SERVER_RT_PRIO, | |||||
CARLA_KEY_EXPERIMENTAL_PLUGIN_BRIDGES, | |||||
CARLA_KEY_EXPERIMENTAL_WINE_BRIDGES, | |||||
CARLA_KEY_EXPERIMENTAL_JACK_APPS, | |||||
CARLA_KEY_EXPERIMENTAL_EXPORT_LV2, | |||||
CARLA_KEY_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR, | |||||
CARLA_KEY_EXPERIMENTAL_LOAD_LIB_GLOBAL, | |||||
CARLA_DEFAULT_MAIN_PROJECT_FOLDER, | |||||
CARLA_DEFAULT_MAIN_USE_PRO_THEME, | |||||
CARLA_DEFAULT_MAIN_PRO_THEME_COLOR, | |||||
CARLA_DEFAULT_MAIN_REFRESH_INTERVAL, | |||||
CARLA_DEFAULT_MAIN_CONFIRM_EXIT, | |||||
CARLA_DEFAULT_MAIN_SHOW_LOGS, | |||||
#CARLA_DEFAULT_MAIN_EXPERIMENTAL, | |||||
CARLA_DEFAULT_CANVAS_THEME, | |||||
CARLA_DEFAULT_CANVAS_SIZE, | |||||
CARLA_DEFAULT_CANVAS_USE_BEZIER_LINES, | |||||
CARLA_DEFAULT_CANVAS_AUTO_HIDE_GROUPS, | |||||
CARLA_DEFAULT_CANVAS_AUTO_SELECT_ITEMS, | |||||
#CARLA_DEFAULT_CANVAS_EYE_CANDY, | |||||
CARLA_DEFAULT_CANVAS_FANCY_EYE_CANDY, | |||||
CARLA_DEFAULT_CANVAS_USE_OPENGL, | |||||
CARLA_DEFAULT_CANVAS_ANTIALIASING, | |||||
CARLA_DEFAULT_CANVAS_HQ_ANTIALIASING, | |||||
CARLA_DEFAULT_CANVAS_INLINE_DISPLAYS, | |||||
CARLA_DEFAULT_CANVAS_FULL_REPAINTS, | |||||
CARLA_DEFAULT_FORCE_STEREO, | |||||
CARLA_DEFAULT_PREFER_PLUGIN_BRIDGES, | |||||
CARLA_DEFAULT_PREFER_UI_BRIDGES, | |||||
CARLA_DEFAULT_MANAGE_UIS, | |||||
CARLA_DEFAULT_UIS_ALWAYS_ON_TOP, | |||||
CARLA_DEFAULT_MAX_PARAMETERS, | |||||
CARLA_DEFAULT_RESET_XRUNS, | |||||
CARLA_DEFAULT_UI_BRIDGES_TIMEOUT, | |||||
CARLA_DEFAULT_AUDIO_BUFFER_SIZE, | |||||
CARLA_DEFAULT_AUDIO_SAMPLE_RATE, | |||||
CARLA_DEFAULT_AUDIO_TRIPLE_BUFFER, | |||||
CARLA_DEFAULT_AUDIO_DRIVER, | |||||
CARLA_DEFAULT_PROCESS_MODE, | |||||
CARLA_DEFAULT_OSC_ENABLED, | |||||
CARLA_DEFAULT_OSC_TCP_PORT_ENABLED, | |||||
CARLA_DEFAULT_OSC_TCP_PORT_NUMBER, | |||||
CARLA_DEFAULT_OSC_TCP_PORT_RANDOM, | |||||
CARLA_DEFAULT_OSC_UDP_PORT_ENABLED, | |||||
CARLA_DEFAULT_OSC_UDP_PORT_NUMBER, | |||||
CARLA_DEFAULT_OSC_UDP_PORT_RANDOM, | |||||
CARLA_DEFAULT_WINE_EXECUTABLE, | |||||
CARLA_DEFAULT_WINE_AUTO_PREFIX, | |||||
CARLA_DEFAULT_WINE_FALLBACK_PREFIX, | |||||
CARLA_DEFAULT_WINE_RT_PRIO_ENABLED, | |||||
CARLA_DEFAULT_WINE_BASE_RT_PRIO, | |||||
CARLA_DEFAULT_WINE_SERVER_RT_PRIO, | |||||
CARLA_DEFAULT_EXPERIMENTAL_PLUGIN_BRIDGES, | |||||
CARLA_DEFAULT_EXPERIMENTAL_WINE_BRIDGES, | |||||
CARLA_DEFAULT_EXPERIMENTAL_JACK_APPS, | |||||
CARLA_DEFAULT_EXPERIMENTAL_LV2_EXPORT, | |||||
CARLA_DEFAULT_EXPERIMENTAL_PREVENT_BAD_BEHAVIOUR, | |||||
CARLA_DEFAULT_EXPERIMENTAL_LOAD_LIB_GLOBAL, | |||||
CARLA_DEFAULT_FILE_PATH_AUDIO, | |||||
CARLA_DEFAULT_FILE_PATH_MIDI, | |||||
CARLA_DEFAULT_LADSPA_PATH, | |||||
CARLA_DEFAULT_DSSI_PATH, | |||||
CARLA_DEFAULT_LV2_PATH, | |||||
CARLA_DEFAULT_VST2_PATH, | |||||
CARLA_DEFAULT_VST3_PATH, | |||||
CARLA_DEFAULT_SF2_PATH, | |||||
CARLA_DEFAULT_SFZ_PATH, | |||||
getAndSetPath, | |||||
fontMetricsHorizontalAdvance, | |||||
splitter, | |||||
QSafeSettings | |||||
) | |||||
from patchcanvas.theme import Theme, getThemeName | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# ... | # ... | ||||
@@ -50,11 +193,6 @@ class DriverSettingsW(QDialog): | |||||
self.ui = ui_carla_settings_driver.Ui_DriverSettingsW() | self.ui = ui_carla_settings_driver.Ui_DriverSettingsW() | ||||
self.ui.setupUi(self) | self.ui.setupUi(self) | ||||
if False: | |||||
# kdevelop likes this :) | |||||
host = CarlaHostNull() | |||||
self.host = host | |||||
# ---------------------------------------------------------------------------------------------------- | # ---------------------------------------------------------------------------------------------------- | ||||
# Internal stuff | # Internal stuff | ||||
@@ -169,7 +307,7 @@ class DriverSettingsW(QDialog): | |||||
else: | else: | ||||
self.ui.b_panel.setEnabled(False) | self.ui.b_panel.setEnabled(False) | ||||
if len(self.fBufferSizes) > 0: | |||||
if self.fBufferSizes: | |||||
for bsize in self.fBufferSizes: | for bsize in self.fBufferSizes: | ||||
sbsize = str(bsize) | sbsize = str(bsize) | ||||
self.ui.cb_buffersize.addItem(sbsize) | self.ui.cb_buffersize.addItem(sbsize) | ||||
@@ -181,7 +319,7 @@ class DriverSettingsW(QDialog): | |||||
self.ui.cb_buffersize.addItem(self.AUTOMATIC_OPTION) | self.ui.cb_buffersize.addItem(self.AUTOMATIC_OPTION) | ||||
self.ui.cb_buffersize.setCurrentIndex(0) | self.ui.cb_buffersize.setCurrentIndex(0) | ||||
if len(self.fSampleRates) > 0: | |||||
if self.fSampleRates: | |||||
for srate in self.fSampleRates: | for srate in self.fSampleRates: | ||||
ssrate = str(int(srate)) | ssrate = str(int(srate)) | ||||
self.ui.cb_samplerate.addItem(ssrate) | self.ui.cb_samplerate.addItem(ssrate) | ||||
@@ -193,12 +331,6 @@ class DriverSettingsW(QDialog): | |||||
self.ui.cb_samplerate.addItem(self.AUTOMATIC_OPTION) | self.ui.cb_samplerate.addItem(self.AUTOMATIC_OPTION) | ||||
self.ui.cb_samplerate.setCurrentIndex(0) | self.ui.cb_samplerate.setCurrentIndex(0) | ||||
# -------------------------------------------------------------------------------------------------------- | |||||
def done(self, r): | |||||
QDialog.done(self, r) | |||||
self.close() | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Runtime Driver Settings | # Runtime Driver Settings | ||||
@@ -209,11 +341,6 @@ class RuntimeDriverSettingsW(QDialog): | |||||
self.ui = ui_carla_settings_driver.Ui_DriverSettingsW() | self.ui = ui_carla_settings_driver.Ui_DriverSettingsW() | ||||
self.ui.setupUi(self) | self.ui.setupUi(self) | ||||
if False: | |||||
# kdevelop likes this :) | |||||
host = CarlaHostNull() | |||||
self.host = host | |||||
driverDeviceInfo = host.get_runtime_engine_driver_device_info() | driverDeviceInfo = host.get_runtime_engine_driver_device_info() | ||||
# ---------------------------------------------------------------------------------------------------- | # ---------------------------------------------------------------------------------------------------- | ||||
@@ -251,7 +378,7 @@ class RuntimeDriverSettingsW(QDialog): | |||||
self.ui.cb_device.addItem(driverDeviceInfo['name']) | self.ui.cb_device.addItem(driverDeviceInfo['name']) | ||||
self.ui.cb_device.setCurrentIndex(0) | self.ui.cb_device.setCurrentIndex(0) | ||||
if len(driverDeviceInfo['bufferSizes']) > 0: | |||||
if driverDeviceInfo['bufferSizes']: | |||||
for bsize in driverDeviceInfo['bufferSizes']: | for bsize in driverDeviceInfo['bufferSizes']: | ||||
sbsize = str(bsize) | sbsize = str(bsize) | ||||
self.ui.cb_buffersize.addItem(sbsize) | self.ui.cb_buffersize.addItem(sbsize) | ||||
@@ -266,7 +393,7 @@ class RuntimeDriverSettingsW(QDialog): | |||||
if (driverDeviceInfo['hints'] & ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE) == 0x0: | if (driverDeviceInfo['hints'] & ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE) == 0x0: | ||||
self.ui.cb_buffersize.setEnabled(False) | self.ui.cb_buffersize.setEnabled(False) | ||||
if len(driverDeviceInfo['sampleRates']) > 0: | |||||
if driverDeviceInfo['sampleRates']: | |||||
for srate in driverDeviceInfo['sampleRates']: | for srate in driverDeviceInfo['sampleRates']: | ||||
ssrate = str(int(srate)) | ssrate = str(int(srate)) | ||||
self.ui.cb_samplerate.addItem(ssrate) | self.ui.cb_samplerate.addItem(ssrate) | ||||
@@ -309,12 +436,6 @@ class RuntimeDriverSettingsW(QDialog): | |||||
def slot_showDevicePanel(self): | def slot_showDevicePanel(self): | ||||
self.host.show_engine_device_control_panel() | self.host.show_engine_device_control_panel() | ||||
# -------------------------------------------------------------------------------------------------------- | |||||
def done(self, r): | |||||
QDialog.done(self, r) | |||||
self.close() | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Settings Dialog | # Settings Dialog | ||||
@@ -356,11 +477,6 @@ class CarlaSettingsW(QDialog): | |||||
self.ui = ui_carla_settings.Ui_CarlaSettingsW() | self.ui = ui_carla_settings.Ui_CarlaSettingsW() | ||||
self.ui.setupUi(self) | self.ui.setupUi(self) | ||||
if False: | |||||
# kdevelop likes this :) | |||||
host = CarlaHostNull() | |||||
self.host = host | |||||
# ---------------------------------------------------------------------------------------------------- | # ---------------------------------------------------------------------------------------------------- | ||||
# Set-up GUI | # Set-up GUI | ||||
@@ -636,11 +752,13 @@ class CarlaSettingsW(QDialog): | |||||
midiPaths.sort() | midiPaths.sort() | ||||
for audioPath in audioPaths: | for audioPath in audioPaths: | ||||
if not audioPath: continue | |||||
if not audioPath: | |||||
continue | |||||
self.ui.lw_files_audio.addItem(audioPath) | self.ui.lw_files_audio.addItem(audioPath) | ||||
for midiPath in midiPaths: | for midiPath in midiPaths: | ||||
if not midiPath: continue | |||||
if not midiPath: | |||||
continue | |||||
self.ui.lw_files_midi.addItem(midiPath) | self.ui.lw_files_midi.addItem(midiPath) | ||||
# ---------------------------------------------------------------------------------------------------- | # ---------------------------------------------------------------------------------------------------- | ||||
@@ -663,31 +781,38 @@ class CarlaSettingsW(QDialog): | |||||
sfzs.sort() | sfzs.sort() | ||||
for ladspa in ladspas: | for ladspa in ladspas: | ||||
if not ladspa: continue | |||||
if not ladspa: | |||||
continue | |||||
self.ui.lw_ladspa.addItem(ladspa) | self.ui.lw_ladspa.addItem(ladspa) | ||||
for dssi in dssis: | for dssi in dssis: | ||||
if not dssi: continue | |||||
if not dssi: | |||||
continue | |||||
self.ui.lw_dssi.addItem(dssi) | self.ui.lw_dssi.addItem(dssi) | ||||
for lv2 in lv2s: | for lv2 in lv2s: | ||||
if not lv2: continue | |||||
if not lv2: | |||||
continue | |||||
self.ui.lw_lv2.addItem(lv2) | self.ui.lw_lv2.addItem(lv2) | ||||
for vst2 in vst2s: | for vst2 in vst2s: | ||||
if not vst2: continue | |||||
if not vst2: | |||||
continue | |||||
self.ui.lw_vst.addItem(vst2) | self.ui.lw_vst.addItem(vst2) | ||||
for vst3 in vst3s: | for vst3 in vst3s: | ||||
if not vst3: continue | |||||
if not vst3: | |||||
continue | |||||
self.ui.lw_vst3.addItem(vst3) | self.ui.lw_vst3.addItem(vst3) | ||||
for sf2 in sf2s: | for sf2 in sf2s: | ||||
if not sf2: continue | |||||
if not sf2: | |||||
continue | |||||
self.ui.lw_sf2.addItem(sf2) | self.ui.lw_sf2.addItem(sf2) | ||||
for sfz in sfzs: | for sfz in sfzs: | ||||
if not sfz: continue | |||||
if not sfz: | |||||
continue | |||||
self.ui.lw_sfz.addItem(sfz) | self.ui.lw_sfz.addItem(sfz) | ||||
# ---------------------------------------------------------------------------------------------------- | # ---------------------------------------------------------------------------------------------------- | ||||
@@ -699,7 +824,7 @@ class CarlaSettingsW(QDialog): | |||||
self.ui.cb_wine_prefix_detect.setChecked(settings.value(CARLA_KEY_WINE_AUTO_PREFIX, | self.ui.cb_wine_prefix_detect.setChecked(settings.value(CARLA_KEY_WINE_AUTO_PREFIX, | ||||
CARLA_DEFAULT_WINE_AUTO_PREFIX, | CARLA_DEFAULT_WINE_AUTO_PREFIX, | ||||
bool)) | |||||
bool)) | |||||
self.ui.le_wine_prefix_fallback.setText(settings.value(CARLA_KEY_WINE_FALLBACK_PREFIX, | self.ui.le_wine_prefix_fallback.setText(settings.value(CARLA_KEY_WINE_FALLBACK_PREFIX, | ||||
CARLA_DEFAULT_WINE_FALLBACK_PREFIX, | CARLA_DEFAULT_WINE_FALLBACK_PREFIX, | ||||
@@ -1020,7 +1145,8 @@ class CarlaSettingsW(QDialog): | |||||
self.ui.lw_ladspa.clear() | self.ui.lw_ladspa.clear() | ||||
for path in paths: | for path in paths: | ||||
if not path: continue | |||||
if not path: | |||||
continue | |||||
self.ui.lw_ladspa.addItem(path) | self.ui.lw_ladspa.addItem(path) | ||||
elif curIndex == self.PLUGINPATH_INDEX_DSSI: | elif curIndex == self.PLUGINPATH_INDEX_DSSI: | ||||
@@ -1029,7 +1155,8 @@ class CarlaSettingsW(QDialog): | |||||
self.ui.lw_dssi.clear() | self.ui.lw_dssi.clear() | ||||
for path in paths: | for path in paths: | ||||
if not path: continue | |||||
if not path: | |||||
continue | |||||
self.ui.lw_dssi.addItem(path) | self.ui.lw_dssi.addItem(path) | ||||
elif curIndex == self.PLUGINPATH_INDEX_LV2: | elif curIndex == self.PLUGINPATH_INDEX_LV2: | ||||
@@ -1038,7 +1165,8 @@ class CarlaSettingsW(QDialog): | |||||
self.ui.lw_lv2.clear() | self.ui.lw_lv2.clear() | ||||
for path in paths: | for path in paths: | ||||
if not path: continue | |||||
if not path: | |||||
continue | |||||
self.ui.lw_lv2.addItem(path) | self.ui.lw_lv2.addItem(path) | ||||
elif curIndex == self.PLUGINPATH_INDEX_VST2: | elif curIndex == self.PLUGINPATH_INDEX_VST2: | ||||
@@ -1047,7 +1175,8 @@ class CarlaSettingsW(QDialog): | |||||
self.ui.lw_vst.clear() | self.ui.lw_vst.clear() | ||||
for path in paths: | for path in paths: | ||||
if not path: continue | |||||
if not path: | |||||
continue | |||||
self.ui.lw_vst.addItem(path) | self.ui.lw_vst.addItem(path) | ||||
elif curIndex == self.PLUGINPATH_INDEX_VST3: | elif curIndex == self.PLUGINPATH_INDEX_VST3: | ||||
@@ -1056,7 +1185,8 @@ class CarlaSettingsW(QDialog): | |||||
self.ui.lw_vst3.clear() | self.ui.lw_vst3.clear() | ||||
for path in paths: | for path in paths: | ||||
if not path: continue | |||||
if not path: | |||||
continue | |||||
self.ui.lw_vst3.addItem(path) | self.ui.lw_vst3.addItem(path) | ||||
elif curIndex == self.PLUGINPATH_INDEX_SF2: | elif curIndex == self.PLUGINPATH_INDEX_SF2: | ||||
@@ -1065,7 +1195,8 @@ class CarlaSettingsW(QDialog): | |||||
self.ui.lw_sf2.clear() | self.ui.lw_sf2.clear() | ||||
for path in paths: | for path in paths: | ||||
if not path: continue | |||||
if not path: | |||||
continue | |||||
self.ui.lw_sf2.addItem(path) | self.ui.lw_sf2.addItem(path) | ||||
elif curIndex == self.PLUGINPATH_INDEX_SFZ: | elif curIndex == self.PLUGINPATH_INDEX_SFZ: | ||||
@@ -1074,7 +1205,8 @@ class CarlaSettingsW(QDialog): | |||||
self.ui.lw_sfz.clear() | self.ui.lw_sfz.clear() | ||||
for path in paths: | for path in paths: | ||||
if not path: continue | |||||
if not path: | |||||
continue | |||||
self.ui.lw_sfz.addItem(path) | self.ui.lw_sfz.addItem(path) | ||||
# ---------------------------------------------------------------------------------------------------- | # ---------------------------------------------------------------------------------------------------- | ||||
@@ -1357,28 +1489,25 @@ class CarlaSettingsW(QDialog): | |||||
self.ui.b_filepaths_remove.setEnabled(check) | self.ui.b_filepaths_remove.setEnabled(check) | ||||
self.ui.b_filepaths_change.setEnabled(check) | self.ui.b_filepaths_change.setEnabled(check) | ||||
# -------------------------------------------------------------------------------------------------------- | |||||
def done(self, r): | |||||
QDialog.done(self, r) | |||||
self.close() | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Main | # Main | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
from carla_app import CarlaApplication | from carla_app import CarlaApplication | ||||
from carla_host import initHost, loadHostSettings | |||||
from carla_host import initHost as _initHost, loadHostSettings as _loadHostSettings | |||||
# pylint: disable=ungrouped-imports | |||||
from carla_shared import handleInitialCommandLineArguments | |||||
# pylint: enable=ungrouped-imports | |||||
initName, libPrefix = handleInitialCommandLineArguments(__file__ if "__file__" in dir() else None) | initName, libPrefix = handleInitialCommandLineArguments(__file__ if "__file__" in dir() else None) | ||||
app = CarlaApplication("Carla2-Settings", libPrefix) | |||||
host = initHost("Carla2-Settings", libPrefix, False, False, False) | |||||
loadHostSettings(host) | |||||
_app = CarlaApplication("Carla2-Settings", libPrefix) | |||||
_host = _initHost("Carla2-Settings", libPrefix, False, False, False) | |||||
_loadHostSettings(_host) | |||||
gui = CarlaSettingsW(None, host, True, True) | |||||
gui.show() | |||||
_gui = CarlaSettingsW(None, _host, True, True) | |||||
_gui.show() | |||||
app.exit_exec() | |||||
_app.exit_exec() | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ |
@@ -31,13 +31,8 @@ import sys | |||||
from math import fmod | from math import fmod | ||||
from PyQt5.Qt import PYQT_VERSION_STR | |||||
from PyQt5.QtCore import qFatal, QT_VERSION, QT_VERSION_STR, qWarning, QDir, QSettings | |||||
from PyQt5.QtGui import QIcon | |||||
from PyQt5.QtWidgets import QFileDialog, QMessageBox | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Import Signal | |||||
# Imports (Signal) | |||||
from signal import signal, SIGINT, SIGTERM | from signal import signal, SIGINT, SIGTERM | ||||
@@ -47,10 +42,25 @@ try: | |||||
except: | except: | ||||
haveSIGUSR1 = False | haveSIGUSR1 = False | ||||
# ------------------------------------------------------------------------------------------------------------ | |||||
# Imports (PyQt5) | |||||
from PyQt5.Qt import PYQT_VERSION_STR | |||||
from PyQt5.QtCore import qFatal, QT_VERSION, QT_VERSION_STR, qWarning, QDir, QSettings | |||||
from PyQt5.QtGui import QIcon | |||||
from PyQt5.QtWidgets import QFileDialog, QMessageBox | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Imports (Custom) | # Imports (Custom) | ||||
from carla_backend_qt import * | |||||
from carla_backend import ( | |||||
kIs64bit, HAIKU, LINUX, MACOS, WINDOWS, | |||||
MAX_DEFAULT_PARAMETERS, | |||||
ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS, | |||||
ENGINE_PROCESS_MODE_PATCHBAY, | |||||
ENGINE_TRANSPORT_MODE_INTERNAL, | |||||
ENGINE_TRANSPORT_MODE_JACK | |||||
) | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Platform specific stuff | # Platform specific stuff | ||||
@@ -487,19 +497,21 @@ readEnvVars = True | |||||
if WINDOWS: | if WINDOWS: | ||||
# Check if running Wine. If yes, ignore env vars | # Check if running Wine. If yes, ignore env vars | ||||
# pylint: disable=import-error | |||||
from winreg import ConnectRegistry, OpenKey, CloseKey, HKEY_CURRENT_USER | from winreg import ConnectRegistry, OpenKey, CloseKey, HKEY_CURRENT_USER | ||||
reg = ConnectRegistry(None, HKEY_CURRENT_USER) | |||||
# pylint: enable=import-error | |||||
_reg = ConnectRegistry(None, HKEY_CURRENT_USER) | |||||
try: | try: | ||||
key = OpenKey(reg, r"SOFTWARE\Wine") | |||||
CloseKey(key) | |||||
del key | |||||
_key = OpenKey(_reg, r"SOFTWARE\Wine") | |||||
CloseKey(_key) | |||||
del _key | |||||
readEnvVars = False | readEnvVars = False | ||||
except: | except: | ||||
pass | pass | ||||
CloseKey(reg) | |||||
del reg | |||||
CloseKey(_reg) | |||||
del _reg | |||||
if readEnvVars: | if readEnvVars: | ||||
CARLA_DEFAULT_LADSPA_PATH = os.getenv("LADSPA_PATH", DEFAULT_LADSPA_PATH).split(splitter) | CARLA_DEFAULT_LADSPA_PATH = os.getenv("LADSPA_PATH", DEFAULT_LADSPA_PATH).split(splitter) | ||||
@@ -534,18 +546,13 @@ del DEFAULT_SFZ_PATH | |||||
# Global Carla object | # Global Carla object | ||||
class CarlaObject(object): | class CarlaObject(object): | ||||
__slots__ = [ | |||||
'gui', # Host Window | |||||
'nogui', # Skip UI | |||||
'term', # Terminated by OS signal | |||||
'utils' # Utils object | |||||
] | |||||
def __init__(self): | |||||
self.gui = None # Host Window | |||||
self.nogui = False # Skip UI | |||||
self.term = False # Terminated by OS signal | |||||
self.utils = None # Utils object | |||||
gCarla = CarlaObject() | gCarla = CarlaObject() | ||||
gCarla.gui = None | |||||
gCarla.nogui = False | |||||
gCarla.term = False | |||||
gCarla.utils = None | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Set CWD | # Set CWD | ||||
@@ -605,10 +612,9 @@ def isNumber(value): | |||||
def toList(value): | def toList(value): | ||||
if value is None: | if value is None: | ||||
return [] | return [] | ||||
elif not isinstance(value, list): | |||||
if not isinstance(value, list): | |||||
return [value] | return [value] | ||||
else: | |||||
return value | |||||
return value | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Get Icon from user theme, using our own as backup (Oxygen) | # Get Icon from user theme, using our own as backup (Oxygen) | ||||
@@ -672,10 +678,9 @@ def handleInitialCommandLineArguments(file): | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Get initial project file (as passed in the command-line parameters) | # Get initial project file (as passed in the command-line parameters) | ||||
def getInitialProjectFile(app, skipExistCheck = False): | |||||
# FIXME - PyQt mishandles unicode characters, we'll use direct sys.argv for now | |||||
def getInitialProjectFile(skipExistCheck = False): | |||||
# NOTE: PyQt mishandles unicode characters, we directly use sys.argv instead of qApp->arguments() | |||||
# see https://riverbankcomputing.com/pipermail/pyqt/2015-January/035395.html | # see https://riverbankcomputing.com/pipermail/pyqt/2015-January/035395.html | ||||
#args = app.arguments()[1:] | |||||
args = sys.argv[1:] | args = sys.argv[1:] | ||||
for arg in args: | for arg in args: | ||||
if arg.startswith("--with-appname=") or arg.startswith("--with-libprefix=") or arg.startswith("--osc-gui="): | if arg.startswith("--with-appname=") or arg.startswith("--with-libprefix=") or arg.startswith("--osc-gui="): | ||||
@@ -784,7 +789,7 @@ class QMessageBoxWithBetterWidth(QMessageBox): | |||||
lines = self.text().strip().split("\n") + self.informativeText().strip().split("\n") | lines = self.text().strip().split("\n") + self.informativeText().strip().split("\n") | ||||
if len(lines) > 0: | |||||
if lines: | |||||
width = 0 | width = 0 | ||||
for line in lines: | for line in lines: | ||||
@@ -798,18 +803,19 @@ class QMessageBoxWithBetterWidth(QMessageBox): | |||||
# Safer QSettings class, which does not throw if type mismatches | # Safer QSettings class, which does not throw if type mismatches | ||||
class QSafeSettings(QSettings): | class QSafeSettings(QSettings): | ||||
def value(self, key, defaultValue, type): | |||||
if not isinstance(defaultValue, type): | |||||
def value(self, key, defaultValue, valueType): | |||||
if not isinstance(defaultValue, valueType): | |||||
print("QSafeSettings.value() - defaultValue type mismatch for key", key) | print("QSafeSettings.value() - defaultValue type mismatch for key", key) | ||||
try: | try: | ||||
return QSettings.value(self, key, defaultValue, type) | |||||
return QSettings.value(self, key, defaultValue, valueType) | |||||
except: | except: | ||||
return defaultValue | return defaultValue | ||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Custom MessageBox | # Custom MessageBox | ||||
# pylint: disable=too-many-arguments | |||||
def CustomMessageBox(parent, icon, title, text, | def CustomMessageBox(parent, icon, title, text, | ||||
extraText="", | extraText="", | ||||
buttons=QMessageBox.Yes|QMessageBox.No, | buttons=QMessageBox.Yes|QMessageBox.No, | ||||
@@ -822,5 +828,6 @@ def CustomMessageBox(parent, icon, title, text, | |||||
msgBox.setStandardButtons(buttons) | msgBox.setStandardButtons(buttons) | ||||
msgBox.setDefaultButton(defButton) | msgBox.setDefaultButton(defButton) | ||||
return msgBox.exec_() | return msgBox.exec_() | ||||
# pylint: enable=too-many-arguments | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ |
@@ -19,9 +19,9 @@ | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Imports (Global) | # Imports (Global) | ||||
from PyQt5.QtCore import Qt, QRectF, QLineF | |||||
from PyQt5.QtGui import QFont, QFontDatabase, QPen | |||||
from PyQt5.QtWidgets import QColorDialog, QFrame, QPushButton | |||||
from PyQt5.QtCore import Qt, QRectF, QLineF, QTimer | |||||
from PyQt5.QtGui import QColor, QFont, QFontDatabase, QPainter, QPainterPath, QPen | |||||
from PyQt5.QtWidgets import QColorDialog, QFrame, QLineEdit, QPushButton | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Imports (Custom) | # Imports (Custom) | ||||
@@ -32,8 +32,11 @@ import ui_carla_plugin_compact | |||||
import ui_carla_plugin_default | import ui_carla_plugin_default | ||||
import ui_carla_plugin_presets | import ui_carla_plugin_presets | ||||
from carla_backend import * | |||||
from carla_shared import * | |||||
from carla_widgets import * | from carla_widgets import * | ||||
from widgets.digitalpeakmeter import DigitalPeakMeter | from widgets.digitalpeakmeter import DigitalPeakMeter | ||||
from widgets.paramspinbox import CustomInputDialog | |||||
from widgets.scalabledial import ScalableDial | from widgets.scalabledial import ScalableDial | ||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
@@ -205,11 +208,6 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta): | |||||
self.host = host | self.host = host | ||||
self.fParent = parent | self.fParent = parent | ||||
if False: | |||||
# kdevelop likes this :) | |||||
host = CarlaHostNull() | |||||
self.host = host | |||||
# ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
# Get plugin info | # Get plugin info | ||||
@@ -2005,13 +2003,6 @@ class PluginSlot_Presets(AbstractPluginSlot): | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
def getColorAndSkinStyle(host, pluginId): | def getColorAndSkinStyle(host, pluginId): | ||||
if False: | |||||
# kdevelop likes this :) | |||||
host = CarlaHostNull() | |||||
progCount = 0 | |||||
pluginInfo = PyCarlaPluginInfo | |||||
pluginName = "" | |||||
pluginInfo = host.get_plugin_info(pluginId) | pluginInfo = host.get_plugin_info(pluginId) | ||||
pluginName = host.get_real_plugin_name(pluginId) | pluginName = host.get_real_plugin_name(pluginId) | ||||
pluginLabel = pluginInfo['label'].lower() | pluginLabel = pluginInfo['label'].lower() | ||||
@@ -2,7 +2,7 @@ | |||||
# -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||||
# Carla Backend utils | # Carla Backend utils | ||||
# Copyright (C) 2011-2018 Filipe Coelho <falktx@falktx.com> | |||||
# Copyright (C) 2011-2020 Filipe Coelho <falktx@falktx.com> | |||||
# | # | ||||
# This program is free software; you can redistribute it and/or | # This program is free software; you can redistribute it and/or | ||||
# modify it under the terms of the GNU General Public License as | # modify it under the terms of the GNU General Public License as | ||||
@@ -22,10 +22,48 @@ | |||||
from os import environ | from os import environ | ||||
from sys import argv | from sys import argv | ||||
# ------------------------------------------------------------------------------------------------------------ | |||||
# Imports (ctypes) | |||||
from ctypes import ( | |||||
c_bool, c_char_p, c_double, c_int, c_uint, c_uint32, c_void_p, | |||||
cdll, Structure, | |||||
CFUNCTYPE, POINTER | |||||
) | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Imports (Custom) | # Imports (Custom) | ||||
from carla_backend import * | |||||
from carla_backend import ( | |||||
PLUGIN_NONE, | |||||
PLUGIN_INTERNAL, | |||||
PLUGIN_LADSPA, | |||||
PLUGIN_DSSI, | |||||
PLUGIN_LV2, | |||||
PLUGIN_VST2, | |||||
PLUGIN_VST3, | |||||
PLUGIN_AU, | |||||
PLUGIN_DLS, | |||||
PLUGIN_GIG, | |||||
PLUGIN_SF2, | |||||
PLUGIN_SFZ, | |||||
PLUGIN_JACK, | |||||
PLUGIN_CATEGORY_NONE, | |||||
PLUGIN_CATEGORY_SYNTH, | |||||
PLUGIN_CATEGORY_DELAY, | |||||
PLUGIN_CATEGORY_EQ, | |||||
PLUGIN_CATEGORY_FILTER, | |||||
PLUGIN_CATEGORY_DISTORTION, | |||||
PLUGIN_CATEGORY_DYNAMICS, | |||||
PLUGIN_CATEGORY_MODULATOR, | |||||
PLUGIN_CATEGORY_UTILITY, | |||||
PLUGIN_CATEGORY_OTHER, | |||||
WINDOWS, | |||||
c_enum, c_uintptr, | |||||
charPtrToString, | |||||
charPtrPtrToStringList, | |||||
structToDict | |||||
) | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
@@ -46,6 +84,10 @@ def getPluginTypeAsString(ptype): | |||||
return "VST3" | return "VST3" | ||||
if ptype == PLUGIN_AU: | if ptype == PLUGIN_AU: | ||||
return "AU" | return "AU" | ||||
if ptype == PLUGIN_DLS: | |||||
return "DLS" | |||||
if ptype == PLUGIN_GIG: | |||||
return "GIG" | |||||
if ptype == PLUGIN_SF2: | if ptype == PLUGIN_SF2: | ||||
return "SF2" | return "SF2" | ||||
if ptype == PLUGIN_SFZ: | if ptype == PLUGIN_SFZ: | ||||
@@ -53,7 +95,7 @@ def getPluginTypeAsString(ptype): | |||||
if ptype == PLUGIN_JACK: | if ptype == PLUGIN_JACK: | ||||
return "JACK" | return "JACK" | ||||
print("getPluginTypeAsString(%i) - invalid type" % ptype); | |||||
print("getPluginTypeAsString(%i) - invalid type" % ptype) | |||||
return "Unknown" | return "Unknown" | ||||
def getPluginTypeFromString(stype): | def getPluginTypeFromString(stype): | ||||
@@ -78,6 +120,10 @@ def getPluginTypeFromString(stype): | |||||
return PLUGIN_VST3 | return PLUGIN_VST3 | ||||
if stype in ("au", "audiounit"): | if stype in ("au", "audiounit"): | ||||
return PLUGIN_AU | return PLUGIN_AU | ||||
if stype == "dls": | |||||
return PLUGIN_DLS | |||||
if stype == "gig": | |||||
return PLUGIN_GIG | |||||
if stype == "sf2": | if stype == "sf2": | ||||
return PLUGIN_SF2 | return PLUGIN_SF2 | ||||
if stype == "sfz": | if stype == "sfz": | ||||
@@ -295,14 +341,19 @@ class CarlaUtils(object): | |||||
self.lib.carla_x11_get_window_pos.argtypes = [c_uintptr] | self.lib.carla_x11_get_window_pos.argtypes = [c_uintptr] | ||||
self.lib.carla_x11_get_window_pos.restype = POINTER(c_int) | self.lib.carla_x11_get_window_pos.restype = POINTER(c_int) | ||||
self._pipeClientFunc = None | |||||
self._pipeClientCallback = None | |||||
# use _putenv on windows | # use _putenv on windows | ||||
if not WINDOWS: | if not WINDOWS: | ||||
self.msvcrt = None | self.msvcrt = None | ||||
return | return | ||||
self.msvcrt = cdll.msvcrt | self.msvcrt = cdll.msvcrt | ||||
# pylint: disable=protected-access | |||||
self.msvcrt._putenv.argtypes = [c_char_p] | self.msvcrt._putenv.argtypes = [c_char_p] | ||||
self.msvcrt._putenv.restype = None | self.msvcrt._putenv.restype = None | ||||
# pylint: enable=protected-access | |||||
# -------------------------------------------------------------------------------------------------------- | # -------------------------------------------------------------------------------------------------------- | ||||
@@ -312,7 +363,9 @@ class CarlaUtils(object): | |||||
if WINDOWS: | if WINDOWS: | ||||
keyvalue = "%s=%s" % (key, value) | keyvalue = "%s=%s" % (key, value) | ||||
# pylint: disable=protected-access | |||||
self.msvcrt._putenv(keyvalue.encode("utf-8")) | self.msvcrt._putenv(keyvalue.encode("utf-8")) | ||||
# pylint: enable=protected-access | |||||
# unset environment variable | # unset environment variable | ||||
def unsetenv(self, key): | def unsetenv(self, key): | ||||
@@ -321,7 +374,9 @@ class CarlaUtils(object): | |||||
if WINDOWS: | if WINDOWS: | ||||
keyrm = "%s=" % key | keyrm = "%s=" % key | ||||
# pylint: disable=protected-access | |||||
self.msvcrt._putenv(keyrm.encode("utf-8")) | self.msvcrt._putenv(keyrm.encode("utf-8")) | ||||
# pylint: enable=protected-access | |||||
# -------------------------------------------------------------------------------------------------------- | # -------------------------------------------------------------------------------------------------------- | ||||
@@ -19,9 +19,14 @@ | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Imports (Global) | # Imports (Global) | ||||
from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QByteArray, QTimer | |||||
from PyQt5.QtGui import QColor, QCursor, QFontMetrics, QPainter, QPainterPath, QPalette, QPixmap | |||||
from PyQt5.QtWidgets import QDialog, QGroupBox, QInputDialog, QLineEdit, QMenu, QScrollArea, QVBoxLayout, QWidget | |||||
from abc import abstractmethod | |||||
# ------------------------------------------------------------------------------------------------------------ | |||||
# Imports (PyQt5) | |||||
from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QByteArray | |||||
from PyQt5.QtGui import QCursor, QIcon, QPalette, QPixmap | |||||
from PyQt5.QtWidgets import QDialog, QFileDialog, QInputDialog, QMenu, QMessageBox, QScrollArea, QVBoxLayout, QWidget | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Imports (Custom) | # Imports (Custom) | ||||
@@ -31,10 +36,61 @@ import ui_carla_about_juce | |||||
import ui_carla_edit | import ui_carla_edit | ||||
import ui_carla_parameter | import ui_carla_parameter | ||||
from carla_shared import * | |||||
from carla_utils import * | |||||
from carla_backend import ( | |||||
MACOS, WINDOWS, | |||||
BINARY_NATIVE, | |||||
PLUGIN_INTERNAL, | |||||
PLUGIN_DSSI, | |||||
PLUGIN_LV2, | |||||
PLUGIN_VST2, | |||||
PLUGIN_SF2, | |||||
PLUGIN_SFZ, | |||||
PLUGIN_CAN_DRYWET, | |||||
PLUGIN_CAN_VOLUME, | |||||
PLUGIN_CAN_BALANCE, | |||||
PLUGIN_CAN_PANNING, | |||||
PLUGIN_CATEGORY_SYNTH, | |||||
PLUGIN_OPTION_FIXED_BUFFERS, | |||||
PLUGIN_OPTION_FORCE_STEREO, | |||||
PLUGIN_OPTION_MAP_PROGRAM_CHANGES, | |||||
PLUGIN_OPTION_USE_CHUNKS, | |||||
PLUGIN_OPTION_SEND_CONTROL_CHANGES, | |||||
PLUGIN_OPTION_SEND_CHANNEL_PRESSURE, | |||||
PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH, | |||||
PLUGIN_OPTION_SEND_PITCHBEND, | |||||
PLUGIN_OPTION_SEND_ALL_SOUND_OFF, | |||||
PLUGIN_OPTION_SEND_PROGRAM_CHANGES, | |||||
PARAMETER_DRYWET, | |||||
PARAMETER_VOLUME, | |||||
PARAMETER_BALANCE_LEFT, | |||||
PARAMETER_BALANCE_RIGHT, | |||||
PARAMETER_PANNING, | |||||
PARAMETER_CTRL_CHANNEL, | |||||
PARAMETER_IS_ENABLED, | |||||
PARAMETER_IS_AUTOMABLE, | |||||
PARAMETER_IS_READ_ONLY, | |||||
PARAMETER_USES_SCALEPOINTS, | |||||
PARAMETER_USES_CUSTOM_TEXT, | |||||
PARAMETER_CAN_BE_CV_CONTROLLED, | |||||
PARAMETER_INPUT, PARAMETER_OUTPUT, | |||||
CONTROL_VALUE_NONE, | |||||
CONTROL_VALUE_MIDI_PITCHBEND, | |||||
CONTROL_VALUE_CV | |||||
) | |||||
from carla_shared import ( | |||||
MIDI_CC_LIST, MAX_MIDI_CC_LIST_ITEM, | |||||
VERSION, | |||||
countDecimalPoints, | |||||
fontMetricsHorizontalAdvance, | |||||
setUpSignals, | |||||
gCarla | |||||
) | |||||
from carla_utils import getPluginTypeAsString | |||||
#) | |||||
from widgets.collapsablewidget import CollapsibleBox | from widgets.collapsablewidget import CollapsibleBox | ||||
from widgets.paramspinbox import CustomInputDialog | |||||
from widgets.pixmapkeyboard import PixmapKeyboardHArea | from widgets.pixmapkeyboard import PixmapKeyboardHArea | ||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
@@ -54,10 +110,6 @@ class CarlaAboutW(QDialog): | |||||
self.ui = ui_carla_about.Ui_CarlaAboutW() | self.ui = ui_carla_about.Ui_CarlaAboutW() | ||||
self.ui.setupUi(self) | self.ui.setupUi(self) | ||||
if False: | |||||
# kdevelop likes this :) | |||||
host = CarlaHostNull() | |||||
if host.isControl: | if host.isControl: | ||||
extraInfo = " - <b>%s</b>" % self.tr("OSC Bridge Version") | extraInfo = " - <b>%s</b>" % self.tr("OSC Bridge Version") | ||||
elif host.isPlugin: | elif host.isPlugin: | ||||
@@ -66,10 +118,10 @@ class CarlaAboutW(QDialog): | |||||
extraInfo = "" | extraInfo = "" | ||||
self.ui.l_about.setText(self.tr("" | self.ui.l_about.setText(self.tr("" | ||||
"<br>Version %s" | |||||
"<br>Carla is a fully-featured audio plugin host%s.<br>" | |||||
"<br>Copyright (C) 2011-2020 falkTX<br>" | |||||
"" % (VERSION, extraInfo))) | |||||
"<br>Version %s" | |||||
"<br>Carla is a fully-featured audio plugin host%s.<br>" | |||||
"<br>Copyright (C) 2011-2020 falkTX<br>" | |||||
"" % (VERSION, extraInfo))) | |||||
if self.ui.about.palette().color(QPalette.Background).blackF() < 0.5: | if self.ui.about.palette().color(QPalette.Background).blackF() < 0.5: | ||||
self.ui.l_icons.setPixmap(QPixmap(":/bitmaps/carla_about_black.png")) | self.ui.l_icons.setPixmap(QPixmap(":/bitmaps/carla_about_black.png")) | ||||
@@ -181,10 +233,6 @@ class CarlaAboutW(QDialog): | |||||
self.setWindowFlags(flags) | self.setWindowFlags(flags) | ||||
def done(self, r): | |||||
QDialog.done(self, r) | |||||
self.close() | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# JUCE About dialog | # JUCE About dialog | ||||
@@ -207,10 +255,6 @@ class JuceAboutW(QDialog): | |||||
self.setWindowFlags(flags) | self.setWindowFlags(flags) | ||||
def done(self, r): | |||||
QDialog.done(self, r) | |||||
self.close() | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Plugin Parameter | # Plugin Parameter | ||||
@@ -226,11 +270,6 @@ class PluginParameter(QWidget): | |||||
self.ui = ui_carla_parameter.Ui_PluginParameter() | self.ui = ui_carla_parameter.Ui_PluginParameter() | ||||
self.ui.setupUi(self) | self.ui.setupUi(self) | ||||
if False: | |||||
# kdevelop likes this :) | |||||
host = CarlaHostNull() | |||||
self.host = host | |||||
# ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
# Internal stuff | # Internal stuff | ||||
@@ -562,12 +601,6 @@ class PluginEdit(QDialog): | |||||
self.ui = ui_carla_edit.Ui_PluginEdit() | self.ui = ui_carla_edit.Ui_PluginEdit() | ||||
self.ui.setupUi(self) | self.ui.setupUi(self) | ||||
if False: | |||||
# kdevelop likes this :) | |||||
parent = PluginEditParentMeta() | |||||
host = CarlaHostNull() | |||||
self.host = host | |||||
# ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
# Internal stuff | # Internal stuff | ||||
@@ -708,7 +741,8 @@ class PluginEdit(QDialog): | |||||
@pyqtSlot(int, int, int, int) | @pyqtSlot(int, int, int, int) | ||||
def slot_handleNoteOnCallback(self, pluginId, channel, note, velocity): | def slot_handleNoteOnCallback(self, pluginId, channel, note, velocity): | ||||
if self.fPluginId != pluginId: return | |||||
if self.fPluginId != pluginId: | |||||
return | |||||
if self.fControlChannel == channel: | if self.fControlChannel == channel: | ||||
self.ui.keyboard.sendNoteOn(note, False) | self.ui.keyboard.sendNoteOn(note, False) | ||||
@@ -723,7 +757,8 @@ class PluginEdit(QDialog): | |||||
@pyqtSlot(int, int, int) | @pyqtSlot(int, int, int) | ||||
def slot_handleNoteOffCallback(self, pluginId, channel, note): | def slot_handleNoteOffCallback(self, pluginId, channel, note): | ||||
if self.fPluginId != pluginId: return | |||||
if self.fPluginId != pluginId: | |||||
return | |||||
if self.fControlChannel == channel: | if self.fControlChannel == channel: | ||||
self.ui.keyboard.sendNoteOff(note, False) | self.ui.keyboard.sendNoteOff(note, False) | ||||
@@ -733,7 +768,7 @@ class PluginEdit(QDialog): | |||||
if playItem in self.fPlayingNotes: | if playItem in self.fPlayingNotes: | ||||
self.fPlayingNotes.remove(playItem) | self.fPlayingNotes.remove(playItem) | ||||
if len(self.fPlayingNotes) == 0 and self.fParent is not None: | |||||
if self.fPlayingNotes and self.fParent is not None: | |||||
self.fParent.editDialogMidiActivityChanged(self.fPluginId, False) | self.fParent.editDialogMidiActivityChanged(self.fPluginId, False) | ||||
@pyqtSlot(int) | @pyqtSlot(int) | ||||
@@ -784,7 +819,7 @@ class PluginEdit(QDialog): | |||||
self.ui.cb_midi_programs.setItemText(mpIndex, "%03i:%03i - %s" % (mpBank+1, mpProg+1, mpName)) | self.ui.cb_midi_programs.setItemText(mpIndex, "%03i:%03i - %s" % (mpBank+1, mpProg+1, mpName)) | ||||
# Update all parameter values | # Update all parameter values | ||||
for paramType, paramId, paramWidget in self.fParameterList: | |||||
for _, paramId, paramWidget in self.fParameterList: | |||||
paramWidget.blockSignals(True) | paramWidget.blockSignals(True) | ||||
paramWidget.setValue(self.host.get_current_parameter_value(self.fPluginId, paramId)) | paramWidget.setValue(self.host.get_current_parameter_value(self.fPluginId, paramId)) | ||||
paramWidget.blockSignals(False) | paramWidget.blockSignals(False) | ||||
@@ -922,7 +957,7 @@ class PluginEdit(QDialog): | |||||
self.fTabIconTimers = [] | self.fTabIconTimers = [] | ||||
# Remove all previous parameters | # Remove all previous parameters | ||||
for x in range(self.ui.tabWidget.count()-1): | |||||
for _ in range(self.ui.tabWidget.count()-1): | |||||
self.ui.tabWidget.widget(1).deleteLater() | self.ui.tabWidget.widget(1).deleteLater() | ||||
self.ui.tabWidget.removeTab(1) | self.ui.tabWidget.removeTab(1) | ||||
@@ -1074,8 +1109,8 @@ class PluginEdit(QDialog): | |||||
#------------------------------------------------------------------ | #------------------------------------------------------------------ | ||||
def clearNotes(self): | def clearNotes(self): | ||||
self.fPlayingNotes = [] | |||||
self.ui.keyboard.allNotesOff() | |||||
self.fPlayingNotes = [] | |||||
self.ui.keyboard.allNotesOff() | |||||
def noteOn(self, channel, note, velocity): | def noteOn(self, channel, note, velocity): | ||||
if self.fControlChannel == channel: | if self.fControlChannel == channel: | ||||
@@ -1109,25 +1144,25 @@ class PluginEdit(QDialog): | |||||
self.fParametersToUpdate.append([parameterId, value]) | self.fParametersToUpdate.append([parameterId, value]) | ||||
def setParameterDefault(self, parameterId, value): | def setParameterDefault(self, parameterId, value): | ||||
for paramType, paramId, paramWidget in self.fParameterList: | |||||
for _, paramId, paramWidget in self.fParameterList: | |||||
if paramId == parameterId: | if paramId == parameterId: | ||||
paramWidget.setDefault(value) | paramWidget.setDefault(value) | ||||
break | break | ||||
def setParameterMappedControlIndex(self, parameterId, control): | def setParameterMappedControlIndex(self, parameterId, control): | ||||
for paramType, paramId, paramWidget in self.fParameterList: | |||||
for _, paramId, paramWidget in self.fParameterList: | |||||
if paramId == parameterId: | if paramId == parameterId: | ||||
paramWidget.setMappedControlIndex(control) | paramWidget.setMappedControlIndex(control) | ||||
break | break | ||||
def setParameterMappedRange(self, parameterId, minimum, maximum): | def setParameterMappedRange(self, parameterId, minimum, maximum): | ||||
for paramType, paramId, paramWidget in self.fParameterList: | |||||
for _, paramId, paramWidget in self.fParameterList: | |||||
if paramId == parameterId: | if paramId == parameterId: | ||||
paramWidget.setMappedRange(minimum, maximum) | paramWidget.setMappedRange(minimum, maximum) | ||||
break | break | ||||
def setParameterMidiChannel(self, parameterId, channel): | def setParameterMidiChannel(self, parameterId, channel): | ||||
for paramType, paramId, paramWidget in self.fParameterList: | |||||
for _, paramId, paramWidget in self.fParameterList: | |||||
if paramId == parameterId: | if paramId == parameterId: | ||||
paramWidget.setMidiChannel(channel+1) | paramWidget.setMidiChannel(channel+1) | ||||
break | break | ||||
@@ -1282,7 +1317,7 @@ class PluginEdit(QDialog): | |||||
self.fCurrentStateFilename = None | self.fCurrentStateFilename = None | ||||
fileFilter = self.tr("Carla State File (*.carxs)") | fileFilter = self.tr("Carla State File (*.carxs)") | ||||
filename, ok = QFileDialog.getSaveFileName(self, self.tr("Save Plugin State File"), filter=fileFilter) | |||||
filename, _ = QFileDialog.getSaveFileName(self, self.tr("Save Plugin State File"), filter=fileFilter) | |||||
# FIXME use ok value, test if it works as expected | # FIXME use ok value, test if it works as expected | ||||
if not filename: | if not filename: | ||||
@@ -1312,7 +1347,7 @@ class PluginEdit(QDialog): | |||||
return | return | ||||
fileFilter = self.tr("Carla State File (*.carxs)") | fileFilter = self.tr("Carla State File (*.carxs)") | ||||
filename, ok = QFileDialog.getOpenFileName(self, self.tr("Open Plugin State File"), filter=fileFilter) | |||||
filename, _ = QFileDialog.getOpenFileName(self, self.tr("Open Plugin State File"), filter=fileFilter) | |||||
# FIXME use ok value, test if it works as expected | # FIXME use ok value, test if it works as expected | ||||
if not filename: | if not filename: | ||||
@@ -1541,7 +1576,8 @@ class PluginEdit(QDialog): | |||||
if actSelected == actSet: | if actSelected == actSet: | ||||
current = minimum + (maximum-minimum)*(float(sender.value())/10000) | current = minimum + (maximum-minimum)*(float(sender.value())/10000) | ||||
value, ok = QInputDialog.getInt(self, self.tr("Set value"), label, round(current*100.0), round(minimum*100.0), round(maximum*100.0), 1) | value, ok = QInputDialog.getInt(self, self.tr("Set value"), label, round(current*100.0), round(minimum*100.0), round(maximum*100.0), 1) | ||||
if ok: value = float(value)/100.0 | |||||
if ok: | |||||
value = float(value)/100.0 | |||||
if not ok: | if not ok: | ||||
return | return | ||||
@@ -1594,7 +1630,7 @@ class PluginEdit(QDialog): | |||||
groupWidgets = {} | groupWidgets = {} | ||||
for paramList, width in paramListFull: | for paramList, width in paramListFull: | ||||
if len(paramList) == 0: | |||||
if not paramList: | |||||
break | break | ||||
tabIndex = self.ui.tabWidget.count() | tabIndex = self.ui.tabWidget.count() | ||||
@@ -1678,7 +1714,7 @@ class PluginEdit(QDialog): | |||||
self.setMidiProgram(mpIndex) | self.setMidiProgram(mpIndex) | ||||
def _updateParameterValues(self): | def _updateParameterValues(self): | ||||
for paramType, paramId, paramWidget in self.fParameterList: | |||||
for _, paramId, paramWidget in self.fParameterList: | |||||
paramWidget.blockSignals(True) | paramWidget.blockSignals(True) | ||||
paramWidget.setValue(self.host.get_current_parameter_value(self.fPluginId, paramId)) | paramWidget.setValue(self.host.get_current_parameter_value(self.fPluginId, paramId)) | ||||
paramWidget.blockSignals(False) | paramWidget.blockSignals(False) | ||||
@@ -1694,7 +1730,7 @@ class PluginEdit(QDialog): | |||||
def testTimerClose(self): | def testTimerClose(self): | ||||
self.close() | self.close() | ||||
app.quit() | |||||
_app.quit() | |||||
#------------------------------------------------------------------ | #------------------------------------------------------------------ | ||||
@@ -1714,30 +1750,26 @@ class PluginEdit(QDialog): | |||||
QDialog.timerEvent(self, event) | QDialog.timerEvent(self, event) | ||||
def done(self, r): | |||||
QDialog.done(self, r) | |||||
self.close() | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Main | # Main | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
from carla_app import CarlaApplication | from carla_app import CarlaApplication | ||||
from carla_host import initHost, loadHostSettings | |||||
from carla_host import initHost as _initHost, loadHostSettings as _loadHostSettings | |||||
app = CarlaApplication() | |||||
host = initHost("Widgets", None, False, False, False) | |||||
loadHostSettings(host) | |||||
_app = CarlaApplication() | |||||
_host = _initHost("Widgets", None, False, False, False) | |||||
_loadHostSettings(_host) | |||||
host.engine_init("JACK", "Carla-Widgets") | |||||
host.add_plugin(BINARY_NATIVE, PLUGIN_DSSI, "/usr/lib/dssi/karplong.so", "karplong", "karplong", 0, None, 0x0) | |||||
host.set_active(0, True) | |||||
_host.engine_init("JACK", "Carla-Widgets") | |||||
_host.add_plugin(BINARY_NATIVE, PLUGIN_DSSI, "/usr/lib/dssi/karplong.so", "karplong", "karplong", 0, None, 0x0) | |||||
_host.set_active(0, True) | |||||
gui1 = CarlaAboutW(None, host) | |||||
gui1 = CarlaAboutW(None, _host) | |||||
gui1.show() | gui1.show() | ||||
gui2 = PluginEdit(None, host, 0) | |||||
gui2 = PluginEdit(None, _host, 0) | |||||
gui2.testTimer() | gui2.testTimer() | ||||
gui2.show() | gui2.show() | ||||
app.exit_exec() | |||||
_app.exit_exec() |