Browse Source

Adjust some stuff to new bin dir; Allow to override default qt

tags/1.9.4
falkTX 11 years ago
parent
commit
8eb817499d
4 changed files with 55 additions and 99 deletions
  1. +2
    -2
      source/Makefile.mk
  2. +32
    -80
      source/carla_shared.py
  3. +18
    -14
      source/carla_style.py
  4. +3
    -3
      source/modules/theme/Makefile

+ 2
- 2
source/Makefile.mk View File

@@ -131,12 +131,12 @@ HAVE_QT4 = $(shell pkg-config --exists QtCore QtXml && echo true)
HAVE_QT5 = $(shell pkg-config --exists Qt5Core Qt5Xml && echo true)

ifeq ($(MACOS_OR_WIN32),true)
DEFAULT_QT=5
DEFAULT_QT ?= 5
ifneq ($(HAVE_QT5),true)
$(error Qt5 missing, cannot continue)
endif
else
DEFAULT_QT=4
DEFAULT_QT ?= 4
ifneq ($(HAVE_QT4),true)
$(error Qt4 missing, cannot continue)
endif


+ 32
- 80
source/carla_shared.py View File

@@ -247,12 +247,10 @@ class CarlaObject(object):
'transportMode',
# current max parameters
'maxParameters',
# discovery tools
'discovery_native',
'discovery_posix32',
'discovery_posix64',
'discovery_win32',
'discovery_win64',
# binary dir
'pathBinaries',
# resources dir
'pathResources',
# default paths
'DEFAULT_LADSPA_PATH',
'DEFAULT_DSSI_PATH',
@@ -278,11 +276,8 @@ gCarla.processMode = ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS if LINUX else EN
gCarla.processModeForced = False
gCarla.transportMode = ENGINE_TRANSPORT_MODE_JACK if LINUX else ENGINE_TRANSPORT_MODE_INTERNAL
gCarla.maxParameters = MAX_DEFAULT_PARAMETERS
gCarla.discovery_native = ""
gCarla.discovery_posix32 = ""
gCarla.discovery_posix64 = ""
gCarla.discovery_win32 = ""
gCarla.discovery_win64 = ""
gCarla.pathBinaries = ""
gCarla.pathResources = ""

# ------------------------------------------------------------------------------------------------------------
# Default Plugin Folders (get)
@@ -482,18 +477,12 @@ else:
CWD = sys.path[0]

# make it work with cxfreeze
if WINDOWS and CWD.lower().endswith(".exe"):
CWD = CWD.rsplit("\\", 1)[0]
elif CWD.lower().endswith(("/carla", "/carla-plugin", "/carla-patchbay", "/carla-rack")):
CWD = CWD.rsplit("/", 1)[0]
if os.path.isfile(CWD):
CWD = os.path.dirname(CWD)

# find tool
def findTool(toolDir, toolName):
path = os.path.join(CWD, toolName)
if os.path.exists(path):
return path

path = os.path.join(CWD, toolDir, toolName)
def findTool(binDir, toolName):
path = os.path.join(CWD, binDir, toolName)
if os.path.exists(path):
return path

@@ -532,42 +521,12 @@ def initHost(initName, libPrefix = None, failError = True):

if libPrefix is not None:
libfilename = os.path.join(libPrefix, "lib", "carla", libname)
else:
path = os.path.join(CWD, "backend", libname)

if os.path.exists(path):
libfilename = path
else:
path = os.getenv("CARLA_LIB_PATH")

if path and os.path.exists(path):
CARLA_LIB_PATH = (path,)
elif WINDOWS:
CARLA_LIB_PATH = (os.path.join(PROGRAMFILES, "Carla"),)
elif MACOS:
CARLA_LIB_PATH = ("/opt/local/lib", "/usr/local/lib/", "/usr/lib")
else:
CARLA_LIB_PATH = ("/usr/local/lib/", "/usr/lib")

for libpath in CARLA_LIB_PATH:
path = os.path.join(libpath, "carla", libname)
if os.path.exists(path):
libfilename = path
break
elif CWD.endswith("resources"):
libfilename = os.path.join(CWD, "..", libname)

# -------------------------------------------------------------
# find windows tools

gCarla.discovery_win32 = findTool("discovery", "carla-discovery-win32.exe")
gCarla.discovery_win64 = findTool("discovery", "carla-discovery-win64.exe")

# -------------------------------------------------------------
# find native and posix tools

if not WINDOWS:
gCarla.discovery_native = findTool("discovery", "carla-discovery-native")
gCarla.discovery_posix32 = findTool("discovery", "carla-discovery-posix32")
gCarla.discovery_posix64 = findTool("discovery", "carla-discovery-posix64")
elif CWD.endswith("source"):
libfilename = os.path.join(CWD, "..", "bin", libname)

# -------------------------------------------------------------

@@ -578,38 +537,31 @@ def initHost(initName, libPrefix = None, failError = True):
return

# -------------------------------------------------------------
# Init host
# Set paths

if gCarla.host is None:
gCarla.host = Host(libfilename)
gCarla.pathBinaries = libfilename.replace(libname, "")
gCarla.pathResources = os.path.join(gCarla.pathBinaries, "resources")

if not (gCarla.isControl or gCarla.isPlugin):
gCarla.host.set_engine_option(ENGINE_OPTION_NSM_INIT, os.getpid(), initName)
print("Carla %s started, status:" % VERSION)
print(" backend lib: %s" % libfilename)
print(" binary dir: %s" % gCarla.pathBinaries)
print(" resources dir: %s" % gCarla.pathResources)

# -------------------------------------------------------------
# Set binary path

libfolder = libfilename.replace(libname, "")
localBinaries = os.path.join(libfolder, "..", "bridges")
systemBinaries = os.path.join(libfolder, "bridges")

if os.path.exists(libfolder):
gCarla.host.set_engine_option(ENGINE_OPTION_PATH_BINARIES, 0, libfolder)
elif os.path.exists(localBinaries):
gCarla.host.set_engine_option(ENGINE_OPTION_PATH_BINARIES, 0, localBinaries)
elif os.path.exists(systemBinaries):
gCarla.host.set_engine_option(ENGINE_OPTION_PATH_BINARIES, 0, systemBinaries)
# Init host

# -------------------------------------------------------------
# Set resource path
if gCarla.host is None:
try:
gCarla.host = Host(libfilename)
except:
print("hmmmm...")
return

localResources = os.path.join(libfolder, "..", "modules", "native-plugins", "resources")
systemResources = os.path.join(libfolder, "resources")
if not (gCarla.isControl or gCarla.isPlugin):
gCarla.host.set_engine_option(ENGINE_OPTION_NSM_INIT, os.getpid(), initName)

if os.path.exists(localResources):
gCarla.host.set_engine_option(ENGINE_OPTION_PATH_RESOURCES, 0, localResources)
elif os.path.exists(systemResources):
gCarla.host.set_engine_option(ENGINE_OPTION_PATH_RESOURCES, 0, systemResources)
gCarla.host.set_engine_option(ENGINE_OPTION_PATH_BINARIES, 0, gCarla.pathBinaries)
gCarla.host.set_engine_option(ENGINE_OPTION_PATH_RESOURCES, 0, gCarla.pathResources)

# ------------------------------------------------------------------------------------------------------------
# Check if a value is a number (float support)


+ 18
- 14
source/carla_style.py View File

@@ -46,20 +46,22 @@ class CarlaApplication(object):
def __init__(self, appName = "Carla2", libPrefix = None):
object.__init__(self)

# try to find style dir
# try to find styles dir
stylesDir = ""

if libPrefix is not None:
QApplication.addLibraryPath(os.path.join(libPrefix, "lib", "carla"))
stylesDir = os.path.join(libPrefix, "lib", "carla")

elif os.path.exists(os.path.join(CWD, "modules", "theme", "styles")):
QApplication.addLibraryPath(os.path.join(CWD, "modules", "theme"))
elif CWD.endswith("resources"):
stylesDir = os.path.join(CWD, "..")

elif os.path.exists(os.path.join(CWD, "styles")):
QApplication.addLibraryPath(CWD)
elif CWD.endswith("source"):
stylesDir = os.path.join(CWD, "..", "bin")

elif os.path.exists(os.path.join(CWD, "..", "styles")):
QApplication.addLibraryPath(os.path.join(CWD, ".."))
if stylesDir:
QApplication.addLibraryPath(stylesDir)

else:
elif not config_UseQt5:
self._createApp(appName)
return

@@ -67,7 +69,7 @@ class CarlaApplication(object):
settings = QSettings("falkTX", appName)
useProTheme = settings.value(CARLA_KEY_MAIN_USE_PRO_THEME, True, type=bool)

if WINDOWS or not useProTheme:
if not useProTheme:
self._createApp(appName)
return

@@ -78,7 +80,7 @@ class CarlaApplication(object):
customFont.setItalic(False)
customFont.setOverline(False)
customFont.setKerning(True)
customFont.setHintingPreference(QFont.PreferFullHinting) # TODO - 4.8 only
customFont.setHintingPreference(QFont.PreferFullHinting)
customFont.setPixelSize(12)
customFont.setWeight(QFont.Normal)

@@ -86,13 +88,15 @@ class CarlaApplication(object):
QApplication.setFont(customFont)

# set style
QApplication.setStyle("carla")
QApplication.setStyle("carla" if stylesDir else "fusion")

# create app
self._createApp(appName)

#self.fApp.setFont(customFont)
self.fApp.setStyle("carla")
if config_UseQt5:
self.fApp.setFont(customFont)

self.fApp.setStyle("carla" if stylesDir else "fusion")

# create palettes
self.fPalSystem = self.fApp.palette()


+ 3
- 3
source/modules/theme/Makefile View File

@@ -26,7 +26,7 @@ QT5_LINK_FLAGS += $(shell pkg-config --libs Qt5Core Qt5Gui Qt5Widgets)
QT5_STYLES_DIR = $(shell pkg-config --variable=libdir Qt5Core)/qt5/plugins/styles
endif

ifeq ($(HAVE_QT4),true)
ifeq ($(DEFAULT_QT),4)
QT_STYLES_DIR = $(QT4_STYLES_DIR)
SHARED_LINK_FLAGS = $(QT4_LINK_FLAGS)
else
@@ -50,7 +50,7 @@ FILES_qt5 = \
moc_CarlaStylePrivate.qt5.cpp \
resources.qt5.cpp

ifeq ($(HAVE_QT4),true)
ifeq ($(DEFAULT_QT),4)
FILES_shared = $(FILES_qt4)
else
FILES_shared = $(FILES_qt5)
@@ -72,7 +72,7 @@ OBJS_qt5 = \
moc_CarlaStylePrivate.qt5.cpp.o \
resources.qt5.cpp.o

ifeq ($(HAVE_QT4),true)
ifeq ($(DEFAULT_QT),4)
OBJS_shared += $(OBJS_qt4) \
CarlaStylePlugin.cpp.qt4.o \
moc_CarlaStylePlugin.qt4.cpp.o


Loading…
Cancel
Save