def eatAttributes(cls, parsed_args): for attr_name in dir(parsed_args): if not attr_name.startswith('_'): setattr(cls, attr_name, getattr(parsed_args, attr_name)) if cls.debug_only: cls.debug = True if cls.config_dir and not os.access(cls.config_dir, os.W_OK): sys.stderr.write( '%s is not a writable config dir, try another one\n' % cls.config_dir) sys.exit(1) if os.getenv('NSM_URL'): try: cls.NSM_URL = ray.getLibloAddress(os.getenv('NSM_URL')) except BaseException: sys.stderr.write('%s is not a valid NSM_URL\n' % os.getenv('NSM_URL')) sys.exit(1) cls.under_nsm = True if not cls.session_root: cls.session_root = RS.settings.value( 'default_session_root', '%s/Ray Sessions' % os.getenv('HOME')) if cls.session_root.endswith('/'): cls.session_root = cls.session_root[:-1]
def changeUrl(self, new_url): try: self.setOscAddress(ray.getLibloAddress(new_url)) except BaseException: return self.callDaemon()
def allowUrl(self, text): if not text: self.ui.lineEdit.completer().complete() self.ui.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) return if not text.startswith('osc.udp://'): self.ui.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) return try: addr = ray.getLibloAddress(text) self.ui.buttonBox.button(QDialogButtonBox.Ok).setEnabled(True) except BaseException: self.ui.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
def showOptionalGui(self): if not self.gui_process.state(): self.gui_process.start('slgui', ['-P', str(self.sl_port)]) def hideOptionalGui(self): if self.gui_process.state(): self.gui_process.terminate() if __name__ == '__main__': NSM_URL = os.getenv('NSM_URL') if not NSM_URL: sys.stderr.write('Could not register as NSM client.\n') sys.exit() daemon_address = ray.getLibloAddress(NSM_URL) signal.signal(signal.SIGINT, signalHandler) signal.signal(signal.SIGTERM, signalHandler) app = QCoreApplication(sys.argv) app.setApplicationName("SooperLooperNSM") app.setOrganizationName("SooperLooperNSM") timer = QTimer() timer.setInterval(200) timer.timeout.connect(lambda: None) timer.start() signaler = nsm_client.NSMSignaler()
def setOscAddressViaUrl(self, url): self.setOscAddress(ray.getLibloAddress(url))