Browse Source

Move Qt backend stuff into a new file

tags/1.9.6
falkTX 10 years ago
parent
commit
a885573065
5 changed files with 114 additions and 63 deletions
  1. +2
    -0
      Makefile
  2. +4
    -60
      source/carla_backend.py
  3. +105
    -0
      source/carla_backend_qt.py
  4. +2
    -2
      source/carla_host.py
  5. +1
    -1
      source/carla_shared.py

+ 2
- 0
Makefile View File

@@ -249,6 +249,7 @@ wine64:
RES = \ RES = \
bin/resources/carla_app.py \ bin/resources/carla_app.py \
bin/resources/carla_backend.py \ bin/resources/carla_backend.py \
bin/resources/carla_backend_qt.py \
bin/resources/carla_config.py \ bin/resources/carla_config.py \
bin/resources/carla_database.py \ bin/resources/carla_database.py \
bin/resources/carla_host.py \ bin/resources/carla_host.py \
@@ -516,6 +517,7 @@ endif
# Install resources (re-use python files) # Install resources (re-use python files)
$(LINK) $(PREFIX)/share/carla/carla_app.py $(DESTDIR)$(PREFIX)/share/carla/resources/ $(LINK) $(PREFIX)/share/carla/carla_app.py $(DESTDIR)$(PREFIX)/share/carla/resources/
$(LINK) $(PREFIX)/share/carla/carla_backend.py $(DESTDIR)$(PREFIX)/share/carla/resources/ $(LINK) $(PREFIX)/share/carla/carla_backend.py $(DESTDIR)$(PREFIX)/share/carla/resources/
$(LINK) $(PREFIX)/share/carla/carla_backend_qt.py $(DESTDIR)$(PREFIX)/share/carla/resources/
$(LINK) $(PREFIX)/share/carla/carla_config.py $(DESTDIR)$(PREFIX)/share/carla/resources/ $(LINK) $(PREFIX)/share/carla/carla_config.py $(DESTDIR)$(PREFIX)/share/carla/resources/
$(LINK) $(PREFIX)/share/carla/carla_database.py $(DESTDIR)$(PREFIX)/share/carla/resources/ $(LINK) $(PREFIX)/share/carla/carla_database.py $(DESTDIR)$(PREFIX)/share/carla/resources/
$(LINK) $(PREFIX)/share/carla/carla_host.py $(DESTDIR)$(PREFIX)/share/carla/resources/ $(LINK) $(PREFIX)/share/carla/carla_host.py $(DESTDIR)$(PREFIX)/share/carla/resources/


+ 4
- 60
source/carla_backend.py View File

@@ -16,11 +16,6 @@
# #
# 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 (Config)

from carla_config import *

# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Imports (Global) # Imports (Global)


@@ -30,11 +25,6 @@ from os import environ
from platform import architecture from platform import architecture
from sys import platform, maxsize from sys import platform, maxsize


if config_UseQt5:
from PyQt5.QtCore import pyqtSignal, pyqtWrapperType, QObject
else:
from PyQt4.QtCore import pyqtSignal, pyqtWrapperType, QObject

# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# 64bit check # 64bit check


@@ -1252,59 +1242,13 @@ elif WINDOWS:
else: else:
BINARY_NATIVE = BINARY_OTHER BINARY_NATIVE = BINARY_OTHER


# ------------------------------------------------------------------------------------------------------------
# An empty class used to resolve metaclass conflicts between ABC and PyQt modules

class PyQtMetaClass(pyqtWrapperType, ABCMeta):
pass

# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Carla Host object (Meta) # Carla Host object (Meta)


class CarlaHostMeta(QObject):
#class CarlaHostMeta(QObject, metaclass=PyQtMetaClass):
# signals
DebugCallback = pyqtSignal(int, int, int, float, str)
PluginAddedCallback = pyqtSignal(int, str)
PluginRemovedCallback = pyqtSignal(int)
PluginRenamedCallback = pyqtSignal(int, str)
PluginUnavailableCallback = pyqtSignal(int, str)
ParameterValueChangedCallback = pyqtSignal(int, int, float)
ParameterDefaultChangedCallback = pyqtSignal(int, int, float)
ParameterMidiCcChangedCallback = pyqtSignal(int, int, int)
ParameterMidiChannelChangedCallback = pyqtSignal(int, int, int)
ProgramChangedCallback = pyqtSignal(int, int)
MidiProgramChangedCallback = pyqtSignal(int, int)
OptionChangedCallback = pyqtSignal(int, int, bool)
UiStateChangedCallback = pyqtSignal(int, int)
NoteOnCallback = pyqtSignal(int, int, int, int)
NoteOffCallback = pyqtSignal(int, int, int)
UpdateCallback = pyqtSignal(int)
ReloadInfoCallback = pyqtSignal(int)
ReloadParametersCallback = pyqtSignal(int)
ReloadProgramsCallback = pyqtSignal(int)
ReloadAllCallback = pyqtSignal(int)
PatchbayClientAddedCallback = pyqtSignal(int, int, int, str)
PatchbayClientRemovedCallback = pyqtSignal(int)
PatchbayClientRenamedCallback = pyqtSignal(int, str)
PatchbayClientDataChangedCallback = pyqtSignal(int, int, int)
PatchbayPortAddedCallback = pyqtSignal(int, int, int, str)
PatchbayPortRemovedCallback = pyqtSignal(int, int)
PatchbayPortRenamedCallback = pyqtSignal(int, int, str)
PatchbayConnectionAddedCallback = pyqtSignal(int, int, int, int, int)
PatchbayConnectionRemovedCallback = pyqtSignal(int, int, int)
EngineStartedCallback = pyqtSignal(int, int, str)
EngineStoppedCallback = pyqtSignal()
ProcessModeChangedCallback = pyqtSignal(int)
TransportModeChangedCallback = pyqtSignal(int)
BufferSizeChangedCallback = pyqtSignal(int)
SampleRateChangedCallback = pyqtSignal(float)
InfoCallback = pyqtSignal(str)
ErrorCallback = pyqtSignal(str)
QuitCallback = pyqtSignal()

class CarlaHostMeta(object):
#class CarlaHostMeta(object, metaclass=ABCMeta):
def __init__(self): def __init__(self):
QObject.__init__(self)
object.__init__(self)


# info about this host object # info about this host object
self.isControl = False self.isControl = False
@@ -2883,7 +2827,7 @@ class PluginStoreInfo(object):
# Carla Host object for plugins (using pipes) # Carla Host object for plugins (using pipes)


class CarlaHostPlugin(CarlaHostMeta): class CarlaHostPlugin(CarlaHostMeta):
#class CarlaHostPlugin(CarlaHostMeta, metaclass=PyQtMetaClass):
#class CarlaHostPlugin(CarlaHostMeta, metaclass=ABCMeta):
def __init__(self): def __init__(self):
CarlaHostMeta.__init__(self) CarlaHostMeta.__init__(self)




+ 105
- 0
source/carla_backend_qt.py View File

@@ -0,0 +1,105 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Carla Backend code (Qt stuff)
# Copyright (C) 2011-2014 Filipe Coelho <falktx@falktx.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of
# the License, or any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# For a full copy of the GNU General Public License see the doc/GPL.txt file.

# ------------------------------------------------------------------------------------------------------------
# Imports (Config)

from carla_config import *

# ------------------------------------------------------------------------------------------------------------
# Imports (Global)

if config_UseQt5:
from PyQt5.QtCore import pyqtSignal, pyqtWrapperType, QObject
else:
from PyQt4.QtCore import pyqtSignal, pyqtWrapperType, QObject

# ------------------------------------------------------------------------------------------------------------
# Imports (Custom)

from carla_backend import *

# ------------------------------------------------------------------------------------------------------------
# An empty class used to resolve metaclass conflicts between ABC and PyQt modules

class PyQtMetaClass(pyqtWrapperType, ABCMeta):
pass

# ------------------------------------------------------------------------------------------------------------
# Carla Host PyQt signals

class CarlaHostSignals(QObject):
# signals
DebugCallback = pyqtSignal(int, int, int, float, str)
PluginAddedCallback = pyqtSignal(int, str)
PluginRemovedCallback = pyqtSignal(int)
PluginRenamedCallback = pyqtSignal(int, str)
PluginUnavailableCallback = pyqtSignal(int, str)
ParameterValueChangedCallback = pyqtSignal(int, int, float)
ParameterDefaultChangedCallback = pyqtSignal(int, int, float)
ParameterMidiCcChangedCallback = pyqtSignal(int, int, int)
ParameterMidiChannelChangedCallback = pyqtSignal(int, int, int)
ProgramChangedCallback = pyqtSignal(int, int)
MidiProgramChangedCallback = pyqtSignal(int, int)
OptionChangedCallback = pyqtSignal(int, int, bool)
UiStateChangedCallback = pyqtSignal(int, int)
NoteOnCallback = pyqtSignal(int, int, int, int)
NoteOffCallback = pyqtSignal(int, int, int)
UpdateCallback = pyqtSignal(int)
ReloadInfoCallback = pyqtSignal(int)
ReloadParametersCallback = pyqtSignal(int)
ReloadProgramsCallback = pyqtSignal(int)
ReloadAllCallback = pyqtSignal(int)
PatchbayClientAddedCallback = pyqtSignal(int, int, int, str)
PatchbayClientRemovedCallback = pyqtSignal(int)
PatchbayClientRenamedCallback = pyqtSignal(int, str)
PatchbayClientDataChangedCallback = pyqtSignal(int, int, int)
PatchbayPortAddedCallback = pyqtSignal(int, int, int, str)
PatchbayPortRemovedCallback = pyqtSignal(int, int)
PatchbayPortRenamedCallback = pyqtSignal(int, int, str)
PatchbayConnectionAddedCallback = pyqtSignal(int, int, int, int, int)
PatchbayConnectionRemovedCallback = pyqtSignal(int, int, int)
EngineStartedCallback = pyqtSignal(int, int, str)
EngineStoppedCallback = pyqtSignal()
ProcessModeChangedCallback = pyqtSignal(int)
TransportModeChangedCallback = pyqtSignal(int)
BufferSizeChangedCallback = pyqtSignal(int)
SampleRateChangedCallback = pyqtSignal(float)
InfoCallback = pyqtSignal(str)
ErrorCallback = pyqtSignal(str)
QuitCallback = pyqtSignal()

# ------------------------------------------------------------------------------------------------------------
# Carla Host object using a DLL

class CarlaHostQtDLL(CarlaHostSignals, CarlaHostDLL):
#class CarlaHostQtDLL(CarlaHostSignals, CarlaHostDLL, metaclass=PyQtMetaClass):
def __init__(self, libName):
CarlaHostSignals.__init__(self)
CarlaHostDLL.__init__(self, libName)

# ------------------------------------------------------------------------------------------------------------
# Carla Host object for plugins (using pipes)

class CarlaHostQtPlugin(CarlaHostSignals, CarlaHostPlugin):
#class CarlaHostQtPlugin(CarlaHostSignals, CarlaHostPlugin, metaclass=PyQtMetaClass):
def __init__(self):
CarlaHostSignals.__init__(self)
CarlaHostPlugin.__init__(self)

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

+ 2
- 2
source/carla_host.py View File

@@ -2002,10 +2002,10 @@ def initHost(initName, libPrefixOrPluginClass, isControl, isPlugin, failError):


if failError: if failError:
# no try # no try
host = PluginClass() if isPlugin else CarlaHostDLL(os.path.join(pathBinaries, libname))
host = PluginClass() if isPlugin else CarlaHostQtDLL(os.path.join(pathBinaries, libname))
else: else:
try: try:
host = PluginClass() if isPlugin else CarlaHostDLL(os.path.join(pathBinaries, libname))
host = PluginClass() if isPlugin else CarlaHostQtDLL(os.path.join(pathBinaries, libname))
except: except:
host = CarlaHostNull() host = CarlaHostNull()




+ 1
- 1
source/carla_shared.py View File

@@ -51,7 +51,7 @@ except:
# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Imports (Custom) # Imports (Custom)


from carla_backend import *
from carla_backend_qt import *


# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Platform specific stuff # Platform specific stuff


Loading…
Cancel
Save