| @@ -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): | |||
| HostWindow.resizeEvent(self, event) | |||
| self.updateInfoLabelXandSize() | |||
| @@ -307,41 +314,28 @@ class CarlaHostW(HostWindow): | |||
| # Main | |||
| if __name__ == '__main__': | |||
| # ------------------------------------------------------------- | |||
| # App initialization | |||
| app = CarlaApplication() | |||
| # ------------------------------------------------------------- | |||
| # Set-up custom signal handling | |||
| setUpSignals() | |||
| # ------------------------------------------------------------- | |||
| # 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 | |||
| 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 | |||
| @@ -350,21 +344,25 @@ if __name__ == '__main__': | |||
| gCarla.isLocal = True | |||
| gCarla.isPlugin = False | |||
| initHost(appName, libPrefix) | |||
| initHost(initName, libPrefix) | |||
| # ------------------------------------------------------------- | |||
| # Create GUI | |||
| 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 | |||
| 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 | |||
| @@ -374,4 +372,4 @@ if __name__ == '__main__': | |||
| # ------------------------------------------------------------- | |||
| # App-Loop | |||
| sys.exit(app.exec_()) | |||
| app.exit_exec() | |||
| @@ -32,45 +32,41 @@ class CarlaHostW(HostWindow): | |||
| self.fContainer = CarlaPatchbayW(self) | |||
| 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 | |||
| 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 | |||
| 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 | |||
| @@ -80,21 +76,25 @@ if __name__ == '__main__': | |||
| gCarla.isPlugin = False | |||
| gCarla.processMode = ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS | |||
| initHost(appName, libPrefix) | |||
| initHost(initName, libPrefix) | |||
| # ------------------------------------------------------------- | |||
| # Create GUI | |||
| 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 | |||
| 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 | |||
| @@ -104,4 +104,4 @@ if __name__ == '__main__': | |||
| # ------------------------------------------------------------- | |||
| # App-Loop | |||
| sys.exit(app.exec_()) | |||
| app.exit_exec() | |||
| @@ -531,6 +531,13 @@ class CarlaMiniW(HostWindow, ExternalUI): | |||
| # ------------------------------------------------------------------- | |||
| # 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): | |||
| self.closeExternalUI() | |||
| HostWindow.closeEvent(self, event) | |||
| @@ -728,9 +735,10 @@ if __name__ == '__main__': | |||
| # ------------------------------------------------------------- | |||
| # 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 | |||
| @@ -744,9 +752,6 @@ if __name__ == '__main__': | |||
| 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 | |||
| 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.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 | |||
| 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 | |||
| 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 | |||
| @@ -80,21 +76,25 @@ if __name__ == '__main__': | |||
| gCarla.isPlugin = False | |||
| gCarla.processMode = ENGINE_PROCESS_MODE_CONTINUOUS_RACK | |||
| initHost(appName, libPrefix) | |||
| initHost(initName, libPrefix) | |||
| # ------------------------------------------------------------- | |||
| # Create GUI | |||
| 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 | |||
| 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 | |||
| @@ -104,4 +104,4 @@ if __name__ == '__main__': | |||
| # ------------------------------------------------------------- | |||
| # App-Loop | |||
| sys.exit(app.exec_()) | |||
| app.exit_exec() | |||
| @@ -485,7 +485,7 @@ def findTool(toolDir, toolName): | |||
| # ------------------------------------------------------------------------------------------------------------ | |||
| # Init host | |||
| def initHost(appName, libPrefix = None, failError = True): | |||
| def initHost(initName, libPrefix = None, failError = True): | |||
| # ------------------------------------------------------------- | |||
| # Set Carla library name | |||
| @@ -43,25 +43,23 @@ from carla_shared import * | |||
| # ------------------------------------------------------------------------------------------------------------ | |||
| class CarlaApplication(object): | |||
| def __init__(self, appName = "Carla2"): | |||
| def __init__(self, appName = "Carla2", libPrefix = None): | |||
| object.__init__(self) | |||
| # 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")) | |||
| foundDir = True | |||
| elif os.path.exists(os.path.join(CWD, "styles")): | |||
| QApplication.addLibraryPath(CWD) | |||
| foundDir = True | |||
| elif os.path.exists(os.path.join(CWD, "..", "styles")): | |||
| QApplication.addLibraryPath(os.path.join(CWD, "..")) | |||
| foundDir = True | |||
| if not foundDir: | |||
| else: | |||
| self._createApp(appName) | |||
| return | |||
| @@ -235,13 +233,6 @@ class CarlaApplication(object): | |||
| else: | |||
| 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): | |||
| return self.fApp.arguments() | |||