當前位置: 首頁>>代碼示例>>Python>>正文


Python QProcessEnvironment.insert方法代碼示例

本文整理匯總了Python中PyQt5.QtCore.QProcessEnvironment.insert方法的典型用法代碼示例。如果您正苦於以下問題:Python QProcessEnvironment.insert方法的具體用法?Python QProcessEnvironment.insert怎麽用?Python QProcessEnvironment.insert使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyQt5.QtCore.QProcessEnvironment的用法示例。


在下文中一共展示了QProcessEnvironment.insert方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: run

# 需要導入模塊: from PyQt5.QtCore import QProcessEnvironment [as 別名]
# 或者: from PyQt5.QtCore.QProcessEnvironment import insert [as 別名]
    def run(self, *args, cwd=None):
        env = QProcessEnvironment().systemEnvironment()
        for k, v in self.get_subprocess_env().items():
            env.insert(k, v)

        self.process = QProcess(self)
        self.process.setProcessEnvironment(env)
        if cwd:
            self.process.setWorkingDirectory(cwd)
        # self.process.stateChanged.connect(self.stateChanged)
        self.process.readyReadStandardOutput.connect(self.on_stdout_read)
        self.process.readyReadStandardError.connect(self.on_stderr_read)
        self.process.finished.connect(self.on_process_end)

        self.clear()
        self.process.start(args[0], args[1:], QIODevice.ReadWrite)
開發者ID:Avaren,項目名稱:puppy,代碼行數:18,代碼來源:outputpane.py

示例2: __main_execution

# 需要導入模塊: from PyQt5.QtCore import QProcessEnvironment [as 別名]
# 或者: from PyQt5.QtCore.QProcessEnvironment import insert [as 別名]
 def __main_execution(self):
     self.__elapsed.start()
     self.__current_process = self.main_process
     if not self.only_text:
         # In case a text is executed and not a file or project
         file_directory = file_manager.get_folder(self.filename)
         self.main_process.setWorkingDirectory(file_directory)
     self.main_process.setProgram(self.python_exec)
     self.main_process.setArguments(self.arguments)
     environment = QProcessEnvironment()
     system_environment = self.main_process.systemEnvironment()
     for env in system_environment:
         key, value = env.split("=", 1)
         environment.insert(key, value)
     self.main_process.setProcessEnvironment(environment)
     self.main_process.start()
開發者ID:ninja-ide,項目名稱:ninja-ide,代碼行數:18,代碼來源:run_widget.py

示例3: __startProcess

# 需要導入模塊: from PyQt5.QtCore import QProcessEnvironment [as 別名]
# 或者: from PyQt5.QtCore.QProcessEnvironment import insert [as 別名]
 def __startProcess(self, program, arguments, environment=None):
     """
     Private method to start the debugger client process.
     
     @param program name of the executable to start (string)
     @param arguments arguments to be passed to the program (list of string)
     @param environment dictionary of environment settings to pass
         (dict of string)
     @return the process object (QProcess) or None
     """
     proc = QProcess()
     if environment is not None:
         env = QProcessEnvironment()
         for key, value in list(environment.items()):
             env.insert(key, value)
         proc.setProcessEnvironment(env)
     args = []
     for arg in arguments:
         args.append(arg)
     proc.start(program, args)
     if not proc.waitForStarted(10000):
         proc = None
     
     return proc
開發者ID:Darriall,項目名稱:eric,代碼行數:26,代碼來源:DebuggerInterfaceRuby.py

示例4: _start

# 需要導入模塊: from PyQt5.QtCore import QProcessEnvironment [as 別名]
# 或者: from PyQt5.QtCore.QProcessEnvironment import insert [as 別名]
    def _start(self, args, env):
        """Actually start the process."""
        executable, exec_args = self._executable_args()
        if args is None:
            args = self._default_args()

        if env is None:
            procenv = QProcessEnvironment.systemEnvironment()
        else:
            procenv = QProcessEnvironment()
            for k, v in env.items():
                procenv.insert(k, v)

            passthrough_vars = ['DISPLAY', 'HOME']  # so --no-xvfb works
            for var in passthrough_vars:
                if var in os.environ:
                    procenv.insert(var, os.environ[var])

        self.proc.readyRead.connect(self.read_log)
        self.proc.setProcessEnvironment(procenv)
        self.proc.start(executable, exec_args + args)
        ok = self.proc.waitForStarted()
        assert ok
        assert self.is_running()
開發者ID:IsSuEat,項目名稱:qutebrowser,代碼行數:26,代碼來源:testprocess.py

示例5: __main_execution

# 需要導入模塊: from PyQt5.QtCore import QProcessEnvironment [as 別名]
# 或者: from PyQt5.QtCore.QProcessEnvironment import insert [as 別名]
    def __main_execution(self):
        """Execute the project."""
        self.output.setCurrentCharFormat(self.output.plain_format)
        message = ''
        if self.__preScriptExecuted:
            self.__preScriptExecuted = False
            message = _translate("RunWidget", 
                "Pre Execution Script Successfully executed.\n\n")
        self.output.setPlainText(message + 'Running: %s (%s)\n\n' %
            (self.fileName, time.ctime()))
        self.output.moveCursor(QTextCursor.Down)
        self.output.moveCursor(QTextCursor.Down)
        self.output.moveCursor(QTextCursor.Down)

        #runner.run_code_from_file(fileName)
        if not self.pythonPath:
            self.pythonPath = settings.PYTHON_PATH
        #change the working directory to the fileName dir
        file_directory = file_manager.get_folder(self.fileName)
        self._proc.setWorkingDirectory(file_directory)
        #force python to unbuffer stdin and stdout
        options = ['-u'] + settings.EXECUTION_OPTIONS.split()
        self.currentProcess = self._proc

        env = QProcessEnvironment()
        system_environemnt = self._proc.systemEnvironment()
        for e in system_environemnt:
            key, value = e.split('=', 1)
            env.insert(key, value)
        if self.PYTHONPATH:
            envpaths = [path for path in self.PYTHONPATH.splitlines()]
            for path in envpaths:
                env.insert('PYTHONPATH', path)
        env.insert('PYTHONIOENCODING', 'utf-8')
        self._proc.setProcessEnvironment(env)

        self._proc.start(self.pythonPath, options + [self.fileName] +
            [p.strip() for p in self.programParams.split(',') if p])
開發者ID:Salmista-94,項目名稱:Ninja_PyQt5,代碼行數:40,代碼來源:run_widget.py


注:本文中的PyQt5.QtCore.QProcessEnvironment.insert方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。