Esempio n. 1
0
    def startProcess(self):
        os.environ['NSM_CLIENT_ID'] = self.jack_client_name
        os.environ['RAY_CLIENT_ID'] = self.client_id
        os.environ['RAY_SESSION_NAME'] = self.session_name

        # enable environment vars in config_file
        config_file = os.path.expandvars(self.config_file)
        os.environ['CONFIG_FILE'] = config_file

        # because that is not done by python itself
        os.environ['PWD'] = os.getcwd()

        # Useful for launching NSM compatible clients with specifics arguments
        nsm_url = os.getenv('NSM_URL')
        ray_port_str = nsm_url.rpartition(':')[2]
        if ray_port_str.endswith('/'):
            ray_port_str = ray_port_str[:-1]
        if ray_port_str.isdigit():
            os.environ['RAY_CONTROL_PORT'] = ray_port_str

        os.unsetenv('NSM_URL')

        arguments_line = os.path.expandvars(self.arguments_line)
        arguments = ray.shell_line_to_args(arguments_line)

        self._config_file_used = bool(config_file and config_file in arguments)
        self.sendNoSaveLevel()

        self.process.start(self.executable, arguments)
        self.timer_open.start()
Esempio n. 2
0
    def readFile(self):
        self.is_launchable = False
        try:
            file = open(self.path, 'r')
        except BaseException:
            return

        xml = QDomDocument()
        xml.setContent(file.read())

        content = xml.documentElement()

        if content.tagName() != "RAY-PROXY":
            file.close()
            return

        cte = content.toElement()
        file_version = cte.attribute('VERSION')
        self.executable = cte.attribute('executable')
        self.config_file = cte.attribute('config_file')
        self.arguments_line = cte.attribute('arguments')
        save_signal = cte.attribute('save_signal')
        no_save_level = cte.attribute('no_save_level')
        stop_signal = cte.attribute('stop_signal')

        wait_window = cte.attribute('wait_window')

        if wait_window.isdigit():
            self.wait_window = bool(int(wait_window))
        else:
            self.wait_window = False

        file.close()

        if save_signal.isdigit():
            self.save_signal = int(save_signal)

        if no_save_level.isdigit():
            self.no_save_level = int(no_save_level)
        else:
            self.no_save_level = 2

        versions = [file_version, '0.7.1']
        versions.sort()

        if file_version != versions[0]:
            # something was wrong in old version,
            # save signal was saved as stop signal too.
            # so don't read stop signal if this is an old file.
            if stop_signal.isdigit():
                self.stop_signal = int(stop_signal)

        if not self.executable:
            return

        arguments = ray.shell_line_to_args(self.arguments_line)
        if arguments is None:
            return

        self.is_launchable = True
Esempio n. 3
0
 def lineEditArgumentsChanged(self, text):
     self.checkAllowStart()
     if ray.shell_line_to_args(text) is not None:
         self.ui.lineEditArguments.setStyleSheet('')
     else:
         self.ui.lineEditArguments.setStyleSheet(
             'QLineEdit{background: red}')
         self.ui.pushButtonStart.setEnabled(False)
Esempio n. 4
0
    def checkAllowStart(self):
        self.fields_allow_start = True
        if not self.ui.lineEditExecutable.text():
            self.fields_allow_start = False

        if ray.shell_line_to_args(self.ui.lineEditArguments.text()) is None:
            self.fields_allow_start = False

        self.ui.pushButtonStart.setEnabled(
            bool(not self.process_is_running and self.fields_allow_start))
    def _line_edit_arguments_changed(self, text: str):
        if ray.shell_line_to_args(text) is not None:
            self._acceptable_arguments = True
            self.rhack.lineEditArguments.setStyleSheet('')
        else:
            self._acceptable_arguments = False
            self.rhack.lineEditArguments.setStyleSheet(
                'QLineEdit{background: red}')

        self.rhack.pushButtonStart.setEnabled(
            bool(self._acceptable_arguments
                 and self._current_status == ray.ClientStatus.STOPPED))
        self.ui.pushButtonSaveChanges.setEnabled(self._is_allowed())