| @@ -293,6 +293,13 @@ class CarlaHostW(HostWindow): | |||||
| # ----------------------------------------------------------------- | # ----------------------------------------------------------------- | ||||
| def showEvent(self, event): | |||||
| HostWindow.showEvent(self, event) | |||||
| # set our gui as parent for all plugins UIs | |||||
| if gCarla.host is not None: | |||||
| gCarla.host.set_engine_option(ENGINE_OPTION_FRONTEND_WIN_ID, 0, str(self.winId())) | |||||
| def resizeEvent(self, event): | def resizeEvent(self, event): | ||||
| HostWindow.resizeEvent(self, event) | HostWindow.resizeEvent(self, event) | ||||
| self.updateInfoLabelXandSize() | self.updateInfoLabelXandSize() | ||||
| @@ -307,41 +314,28 @@ class CarlaHostW(HostWindow): | |||||
| # Main | # Main | ||||
| if __name__ == '__main__': | if __name__ == '__main__': | ||||
| # ------------------------------------------------------------- | |||||
| # App initialization | |||||
| app = CarlaApplication() | |||||
| # ------------------------------------------------------------- | |||||
| # Set-up custom signal handling | |||||
| setUpSignals() | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # Read CLI args | # Read CLI args | ||||
| appName = os.path.basename(__file__) if ("__file__" in dir() and os.path.dirname(__file__) in PATH) else sys.argv[0] | |||||
| initName = os.path.basename(__file__) if ("__file__" in dir() and os.path.dirname(__file__) in PATH) else sys.argv[0] | |||||
| libPrefix = None | libPrefix = None | ||||
| projectFilename = None | |||||
| argv = app.arguments() | |||||
| argc = len(argv) | |||||
| for arg in sys.argv: | |||||
| if arg.startswith("--with-appname="): | |||||
| initName = os.path.basename(arg.replace("--with-initname=", "")) | |||||
| for i in range(argc): | |||||
| if i == 0: continue | |||||
| argument = argv[i] | |||||
| elif arg.startswith("--with-libprefix="): | |||||
| libPrefix = arg.replace("--with-libprefix=", "") | |||||
| if argument.startswith("--with-appname="): | |||||
| appName = os.path.basename(argument.replace("--with-appname=", "")) | |||||
| # ------------------------------------------------------------- | |||||
| # App initialization | |||||
| elif argument.startswith("--with-libprefix="): | |||||
| libPrefix = argument.replace("--with-libprefix=", "") | |||||
| app = CarlaApplication("Carla2", libPrefix) | |||||
| elif os.path.exists(argument): | |||||
| projectFilename = argument | |||||
| # ------------------------------------------------------------- | |||||
| # Set-up custom signal handling | |||||
| if libPrefix is not None: | |||||
| app.addLibraryPath(os.path.join(libPrefix, "lib", "carla")) | |||||
| setUpSignals() | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # Init host backend | # Init host backend | ||||
| @@ -350,21 +344,25 @@ if __name__ == '__main__': | |||||
| gCarla.isLocal = True | gCarla.isLocal = True | ||||
| gCarla.isPlugin = False | gCarla.isPlugin = False | ||||
| initHost(appName, libPrefix) | |||||
| initHost(initName, libPrefix) | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # Create GUI | # Create GUI | ||||
| gCarla.gui = CarlaHostW() | gCarla.gui = CarlaHostW() | ||||
| # set our gui as parent for all plugins UIs | |||||
| gCarla.host.set_engine_option(ENGINE_OPTION_FRONTEND_WIN_ID, 0, str(gCarla.gui.winId())) | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # Load project file if set | # Load project file if set | ||||
| if projectFilename is not None: | |||||
| gCarla.gui.loadProjectLater(projectFilename) | |||||
| args = app.arguments() | |||||
| if len(args) > 1: | |||||
| arg = args[-1] | |||||
| if arg.startswith("--with-appname=") or arg.startswith("--with-libprefix="): | |||||
| pass | |||||
| elif os.path.exists(arg): | |||||
| gCarla.gui.loadProjectLater(arg) | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # Show GUI | # Show GUI | ||||
| @@ -374,4 +372,4 @@ if __name__ == '__main__': | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # App-Loop | # App-Loop | ||||
| sys.exit(app.exec_()) | |||||
| app.exit_exec() | |||||
| @@ -32,45 +32,41 @@ class CarlaHostW(HostWindow): | |||||
| self.fContainer = CarlaPatchbayW(self) | self.fContainer = CarlaPatchbayW(self) | ||||
| self.setupContainer(True, self.fContainer.themeData) | self.setupContainer(True, self.fContainer.themeData) | ||||
| # ------------------------------------------------------------------------------------------------------------ | |||||
| # Main | |||||
| if __name__ == '__main__': | |||||
| # ------------------------------------------------------------- | |||||
| # App initialization | |||||
| # ----------------------------------------------------------------- | |||||
| app = CarlaApplication("Carla2-Patchbay") | |||||
| def showEvent(self, event): | |||||
| HostWindow.showEvent(self, event) | |||||
| # ------------------------------------------------------------- | |||||
| # Set-up custom signal handling | |||||
| # set our gui as parent for all plugins UIs | |||||
| if gCarla.host is not None: | |||||
| gCarla.host.set_engine_option(ENGINE_OPTION_FRONTEND_WIN_ID, 0, str(self.winId())) | |||||
| setUpSignals() | |||||
| # ------------------------------------------------------------------------------------------------------------ | |||||
| # Main | |||||
| if __name__ == '__main__': | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # Read CLI args | # Read CLI args | ||||
| appName = os.path.basename(__file__) if ("__file__" in dir() and os.path.dirname(__file__) in PATH) else sys.argv[0] | |||||
| initName = os.path.basename(__file__) if ("__file__" in dir() and os.path.dirname(__file__) in PATH) else sys.argv[0] | |||||
| libPrefix = None | libPrefix = None | ||||
| projectFilename = None | |||||
| argv = app.arguments() | |||||
| argc = len(argv) | |||||
| for arg in sys.argv: | |||||
| if arg.startswith("--with-appname="): | |||||
| initName = os.path.basename(arg.replace("--with-initname=", "")) | |||||
| for i in range(argc): | |||||
| if i == 0: continue | |||||
| argument = argv[i] | |||||
| elif arg.startswith("--with-libprefix="): | |||||
| libPrefix = arg.replace("--with-libprefix=", "") | |||||
| if argument.startswith("--with-appname="): | |||||
| appName = os.path.basename(argument.replace("--with-appname=", "")) | |||||
| # ------------------------------------------------------------- | |||||
| # App initialization | |||||
| elif argument.startswith("--with-libprefix="): | |||||
| libPrefix = argument.replace("--with-libprefix=", "") | |||||
| app = CarlaApplication("Carla2-Patchbay", libPrefix) | |||||
| elif os.path.exists(argument): | |||||
| projectFilename = argument | |||||
| # ------------------------------------------------------------- | |||||
| # Set-up custom signal handling | |||||
| if libPrefix is not None: | |||||
| app.addLibraryPath(os.path.join(libPrefix, "lib", "carla")) | |||||
| setUpSignals() | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # Init host backend | # Init host backend | ||||
| @@ -80,21 +76,25 @@ if __name__ == '__main__': | |||||
| gCarla.isPlugin = False | gCarla.isPlugin = False | ||||
| gCarla.processMode = ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS | gCarla.processMode = ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS | ||||
| initHost(appName, libPrefix) | |||||
| initHost(initName, libPrefix) | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # Create GUI | # Create GUI | ||||
| gCarla.gui = CarlaHostW() | gCarla.gui = CarlaHostW() | ||||
| # set our gui as parent for all plugins UIs | |||||
| gCarla.host.set_engine_option(ENGINE_OPTION_FRONTEND_WIN_ID, 0, str(gCarla.gui.winId())) | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # Load project file if set | # Load project file if set | ||||
| if projectFilename is not None: | |||||
| gCarla.gui.loadProjectLater(projectFilename) | |||||
| args = app.arguments() | |||||
| if len(args) > 1: | |||||
| arg = args[-1] | |||||
| if arg.startswith("--with-appname=") or arg.startswith("--with-libprefix="): | |||||
| pass | |||||
| elif os.path.exists(arg): | |||||
| gCarla.gui.loadProjectLater(arg) | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # Show GUI | # Show GUI | ||||
| @@ -104,4 +104,4 @@ if __name__ == '__main__': | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # App-Loop | # App-Loop | ||||
| sys.exit(app.exec_()) | |||||
| app.exit_exec() | |||||
| @@ -531,6 +531,13 @@ class CarlaMiniW(HostWindow, ExternalUI): | |||||
| # ------------------------------------------------------------------- | # ------------------------------------------------------------------- | ||||
| # Qt events | # Qt events | ||||
| def showEvent(self, event): | |||||
| HostWindow.showEvent(self, event) | |||||
| # set our gui as parent for all plugins UIs | |||||
| if gCarla.host is not None: | |||||
| gCarla.host.set_engine_option(ENGINE_OPTION_FRONTEND_WIN_ID, 0, str(self.winId())) | |||||
| def closeEvent(self, event): | def closeEvent(self, event): | ||||
| self.closeExternalUI() | self.closeExternalUI() | ||||
| HostWindow.closeEvent(self, event) | HostWindow.closeEvent(self, event) | ||||
| @@ -728,9 +735,10 @@ if __name__ == '__main__': | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # Init plugin host data | # Init plugin host data | ||||
| gCarla.isControl = False | |||||
| gCarla.isLocal = True | |||||
| gCarla.isPlugin = True | |||||
| gCarla.isControl = False | |||||
| gCarla.isLocal = True | |||||
| gCarla.isPlugin = True | |||||
| gCarla.processMode = ENGINE_PROCESS_MODE_CONTINUOUS_RACK | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # Create GUI first | # Create GUI first | ||||
| @@ -744,9 +752,6 @@ if __name__ == '__main__': | |||||
| initHost("Carla-Plugin") | initHost("Carla-Plugin") | ||||
| # set our gui as parent for all plugins UIs | |||||
| gCarla.host.set_engine_option(ENGINE_OPTION_FRONTEND_WIN_ID, 0, str(gCarla.gui.winId())) | |||||
| # simulate an engire started callback | # simulate an engire started callback | ||||
| engineCallback(None, ENGINE_CALLBACK_ENGINE_STARTED, 0, ENGINE_PROCESS_MODE_CONTINUOUS_RACK, ENGINE_TRANSPORT_MODE_PLUGIN, 0.0, "Plugin") | engineCallback(None, ENGINE_CALLBACK_ENGINE_STARTED, 0, ENGINE_PROCESS_MODE_CONTINUOUS_RACK, ENGINE_TRANSPORT_MODE_PLUGIN, 0.0, "Plugin") | ||||
| @@ -32,45 +32,41 @@ class CarlaHostW(HostWindow): | |||||
| self.fContainer = CarlaRackW(self) | self.fContainer = CarlaRackW(self) | ||||
| self.setupContainer(False) | self.setupContainer(False) | ||||
| # ------------------------------------------------------------------------------------------------------------ | |||||
| # Main | |||||
| if __name__ == '__main__': | |||||
| # ------------------------------------------------------------- | |||||
| # App initialization | |||||
| # ----------------------------------------------------------------- | |||||
| app = CarlaApplication("Carla2-Rack") | |||||
| def showEvent(self, event): | |||||
| HostWindow.showEvent(self, event) | |||||
| # ------------------------------------------------------------- | |||||
| # Set-up custom signal handling | |||||
| # set our gui as parent for all plugins UIs | |||||
| if gCarla.host is not None: | |||||
| gCarla.host.set_engine_option(ENGINE_OPTION_FRONTEND_WIN_ID, 0, str(self.winId())) | |||||
| setUpSignals() | |||||
| # ------------------------------------------------------------------------------------------------------------ | |||||
| # Main | |||||
| if __name__ == '__main__': | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # Read CLI args | # Read CLI args | ||||
| appName = os.path.basename(__file__) if ("__file__" in dir() and os.path.dirname(__file__) in PATH) else sys.argv[0] | |||||
| initName = os.path.basename(__file__) if ("__file__" in dir() and os.path.dirname(__file__) in PATH) else sys.argv[0] | |||||
| libPrefix = None | libPrefix = None | ||||
| projectFilename = None | |||||
| argv = app.arguments() | |||||
| argc = len(argv) | |||||
| for arg in sys.argv: | |||||
| if arg.startswith("--with-appname="): | |||||
| initName = os.path.basename(arg.replace("--with-initname=", "")) | |||||
| for i in range(argc): | |||||
| if i == 0: continue | |||||
| argument = argv[i] | |||||
| elif arg.startswith("--with-libprefix="): | |||||
| libPrefix = arg.replace("--with-libprefix=", "") | |||||
| if argument.startswith("--with-appname="): | |||||
| appName = os.path.basename(argument.replace("--with-appname=", "")) | |||||
| # ------------------------------------------------------------- | |||||
| # App initialization | |||||
| elif argument.startswith("--with-libprefix="): | |||||
| libPrefix = argument.replace("--with-libprefix=", "") | |||||
| app = CarlaApplication("Carla2-Rack", libPrefix) | |||||
| elif os.path.exists(argument): | |||||
| projectFilename = argument | |||||
| # ------------------------------------------------------------- | |||||
| # Set-up custom signal handling | |||||
| if libPrefix is not None: | |||||
| app.addLibraryPath(os.path.join(libPrefix, "lib", "carla")) | |||||
| setUpSignals() | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # Init host backend | # Init host backend | ||||
| @@ -80,21 +76,25 @@ if __name__ == '__main__': | |||||
| gCarla.isPlugin = False | gCarla.isPlugin = False | ||||
| gCarla.processMode = ENGINE_PROCESS_MODE_CONTINUOUS_RACK | gCarla.processMode = ENGINE_PROCESS_MODE_CONTINUOUS_RACK | ||||
| initHost(appName, libPrefix) | |||||
| initHost(initName, libPrefix) | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # Create GUI | # Create GUI | ||||
| gCarla.gui = CarlaHostW() | gCarla.gui = CarlaHostW() | ||||
| # set our gui as parent for all plugins UIs | |||||
| gCarla.host.set_engine_option(ENGINE_OPTION_FRONTEND_WIN_ID, 0, str(gCarla.gui.winId())) | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # Load project file if set | # Load project file if set | ||||
| if projectFilename is not None: | |||||
| gCarla.gui.loadProjectLater(projectFilename) | |||||
| args = app.arguments() | |||||
| if len(args) > 1: | |||||
| arg = args[-1] | |||||
| if arg.startswith("--with-appname=") or arg.startswith("--with-libprefix="): | |||||
| pass | |||||
| elif os.path.exists(arg): | |||||
| gCarla.gui.loadProjectLater(arg) | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # Show GUI | # Show GUI | ||||
| @@ -104,4 +104,4 @@ if __name__ == '__main__': | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # App-Loop | # App-Loop | ||||
| sys.exit(app.exec_()) | |||||
| app.exit_exec() | |||||
| @@ -485,7 +485,7 @@ def findTool(toolDir, toolName): | |||||
| # ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
| # Init host | # Init host | ||||
| def initHost(appName, libPrefix = None, failError = True): | |||||
| def initHost(initName, libPrefix = None, failError = True): | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # Set Carla library name | # Set Carla library name | ||||
| @@ -43,25 +43,23 @@ from carla_shared import * | |||||
| # ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
| class CarlaApplication(object): | class CarlaApplication(object): | ||||
| def __init__(self, appName = "Carla2"): | |||||
| def __init__(self, appName = "Carla2", libPrefix = None): | |||||
| object.__init__(self) | object.__init__(self) | ||||
| # try to find style dir | # try to find style dir | ||||
| foundDir = False | |||||
| if libPrefix is not None: | |||||
| QApplication.addLibraryPath(os.path.join(libPrefix, "lib", "carla")) | |||||
| if os.path.exists(os.path.join(CWD, "modules", "theme", "styles")): | |||||
| elif os.path.exists(os.path.join(CWD, "modules", "theme", "styles")): | |||||
| QApplication.addLibraryPath(os.path.join(CWD, "modules", "theme")) | QApplication.addLibraryPath(os.path.join(CWD, "modules", "theme")) | ||||
| foundDir = True | |||||
| elif os.path.exists(os.path.join(CWD, "styles")): | elif os.path.exists(os.path.join(CWD, "styles")): | ||||
| QApplication.addLibraryPath(CWD) | QApplication.addLibraryPath(CWD) | ||||
| foundDir = True | |||||
| elif os.path.exists(os.path.join(CWD, "..", "styles")): | elif os.path.exists(os.path.join(CWD, "..", "styles")): | ||||
| QApplication.addLibraryPath(os.path.join(CWD, "..")) | QApplication.addLibraryPath(os.path.join(CWD, "..")) | ||||
| foundDir = True | |||||
| if not foundDir: | |||||
| else: | |||||
| self._createApp(appName) | self._createApp(appName) | ||||
| return | return | ||||
| @@ -235,13 +233,6 @@ class CarlaApplication(object): | |||||
| else: | else: | ||||
| self.fApp.setWindowIcon(QIcon(":/scalable/carla.svg")) | self.fApp.setWindowIcon(QIcon(":/scalable/carla.svg")) | ||||
| def addLibraryPath(self, libdir): | |||||
| if not os.path.exists(libdir): | |||||
| return | |||||
| #QApplication.addLibraryPath(libdir) | |||||
| #self.loadSettings() | |||||
| def arguments(self): | def arguments(self): | ||||
| return self.fApp.arguments() | return self.fApp.arguments() | ||||