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


Python QtCore.QProcessEnvironment類代碼示例

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


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

示例1: __main_execution

 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,代碼行數:16,代碼來源:run_widget.py

示例2: __init__

 def __init__(self, vcs, parent=None):
     """
     Constructor
     
     @param vcs reference to the vcs object
     @param parent parent widget (QWidget)
     """
     super(SvnPropListDialog, self).__init__(parent)
     self.setupUi(self)
     
     self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
     self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
     
     self.process = QProcess()
     env = QProcessEnvironment.systemEnvironment()
     env.insert("LANG", "C")
     self.process.setProcessEnvironment(env)
     self.vcs = vcs
     
     self.propsList.headerItem().setText(self.propsList.columnCount(), "")
     self.propsList.header().setSortIndicator(0, Qt.AscendingOrder)
     
     self.process.finished.connect(self.__procFinished)
     self.process.readyReadStandardOutput.connect(self.__readStdout)
     self.process.readyReadStandardError.connect(self.__readStderr)
     
     self.rx_path = QRegExp(r"Properties on '([^']+)':\s*")
     self.rx_prop = QRegExp(r"  (.*) *: *(.*)[\r\n]")
     self.lastPath = None
     self.lastProp = None
     self.propBuffer = ""
開發者ID:Darriall,項目名稱:eric,代碼行數:31,代碼來源:SvnPropListDialog.py

示例3: run

    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,代碼行數:16,代碼來源:outputpane.py

示例4: init_broker

    def init_broker(self):
        print "[*] init_broker"
        modname = self.input.text().encode('ascii', 'replace')
        cmdline = u"\"%s\" -u \"%s\" --idb \"%s\"" % (
                  os.path.join(PYTHON_PATH, PYTHON_BIN),
                  BROKER_PATH, modname)
        print "[*] init broker,", cmdline

        self.broker = Broker(self.parser)
        env = QProcessEnvironment.systemEnvironment()
        env.insert("IDB_PATH", IDB_PATH)
        env.insert("PYTHON_PATH", os.path.realpath(PYTHON_PATH))
        env.insert("PYTHON_BIN", PYTHON_BIN)

        try:
            self.broker.started.connect(self.cb_broker_started)
            self.broker.finished.connect(self.cb_broker_finished)
            self.broker.setProcessEnvironment(env)
            self.broker.start(cmdline)
        except Exception as e:
            print "[-] failed to start broker: %s\n%s" % (str(e), traceback.format_exc())
            return

        self.init_hotkeys()
        self.broker.worker.name = modname
開發者ID:aguinet,項目名稱:ret-sync,代碼行數:25,代碼來源:SyncPlugin.py

示例5: startProcess

 def startProcess(self, args, workingDir=None, setLanguage=False):
     """
     Public slot used to start the process.
     
     @param args list of arguments for the process (list of strings)
     @param workingDir working directory for the process (string)
     @param setLanguage flag indicating to set the language to "C" (boolean)
     @return flag indicating a successful start of the process
     """
     self.errorGroup.hide()
     self.normal = False
     self.intercept = False
     
     self.__hasAddOrDelete = False
     
     self.proc = QProcess()
     if setLanguage:
         env = QProcessEnvironment.systemEnvironment()
         env.insert("LANG", "C")
         self.proc.setProcessEnvironment(env)
     nargs = []
     lastWasPwd = False
     for arg in args:
         if lastWasPwd:
             lastWasPwd = True
             continue
         nargs.append(arg)
         if arg == '--password':
             lastWasPwd = True
             nargs.append('*****')
         
     self.resultbox.append(' '.join(nargs))
     self.resultbox.append('')
     
     self.proc.finished.connect(self.__procFinished)
     self.proc.readyReadStandardOutput.connect(self.__readStdout)
     self.proc.readyReadStandardError.connect(self.__readStderr)
     
     if workingDir:
         self.proc.setWorkingDirectory(workingDir)
     self.proc.start('svn', args)
     procStarted = self.proc.waitForStarted(5000)
     if not procStarted:
         self.buttonBox.setFocus()
         self.inputGroup.setEnabled(False)
         self.inputGroup.hide()
         E5MessageBox.critical(
             self,
             self.tr('Process Generation Error'),
             self.tr(
                 'The process {0} could not be started. '
                 'Ensure, that it is in the search path.'
             ).format('svn'))
     else:
         self.inputGroup.setEnabled(True)
         self.inputGroup.show()
     return procStarted
開發者ID:pycom,項目名稱:EricShort,代碼行數:57,代碼來源:SvnDialog.py

示例6: launchQml

    def launchQml(self, name):
        import_path = self.resolveDataDir(name)
        qml = self.resolveQmlFile(name)

        process = QProcess(self)
        process.error.connect(self.launchError)

        env = QProcessEnvironment.systemEnvironment()
        env.insert('QML2_IMPORT_PATH', import_path)
        process.setProcessEnvironment(env)

        executable = QLibraryInfo.location(QLibraryInfo.BinariesPath) + '/qmlscene'
        Colors.debug("Launching:", executable)
        process.start(executable, [qml])
開發者ID:CarlosAndres12,項目名稱:pyqt5,代碼行數:14,代碼來源:menumanager.py

示例7: __startProcess

 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,代碼行數:24,代碼來源:DebuggerInterfaceRuby.py

示例8: open_app

 def open_app(self, instance, path, args, vproject):
     current_state = instance.state()
     if current_state == QProcess.NotRunning:
         env = QProcessEnvironment.systemEnvironment()
         env.insert('VPROJECT', vproject)
         instance.setProcessEnvironment(env)
         instance.start('"{}"'.format(path), args)
         instance.waitForStarted()
     else:
         show_dialog(
             title='Instance Already Running',
             text='A instance of that app is already running!',
             icon='Information',
             parent=self,
         )
開發者ID:chipolux,項目名稱:source-tools,代碼行數:15,代碼來源:launcher.py

示例9: _start

    def _start(self, args, env):
        """Actually start the process."""
        executable, exec_args = self._executable_args()
        if args is None:
            args = self._default_args()

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

        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:Dietr1ch,項目名稱:qutebrowser,代碼行數:17,代碼來源:testprocess.py

示例10: _run_process

    def _run_process(self, cmd, *args, env):
        """Start the given command via QProcess.

        Args:
            cmd: The command to be started.
            *args: The arguments to hand to the command
            env: A dictionary of environment variables to add.
        """
        self._proc = QProcess(self)
        procenv = QProcessEnvironment.systemEnvironment()
        procenv.insert('QUTE_FIFO', self._filepath)
        if env is not None:
            for k, v in env.items():
                procenv.insert(k, v)
        self._proc.setProcessEnvironment(procenv)
        self._proc.error.connect(self.on_proc_error)
        self._proc.finished.connect(self.on_proc_finished)
        self._proc.start(cmd, args)
開發者ID:larryhynes,項目名稱:qutebrowser,代碼行數:18,代碼來源:userscripts.py

示例11: prepareProcess

def prepareProcess(proc, encoding="", language=""):
    """
    Public function to prepare the given process.
    
    @param proc reference to the proces to be prepared (QProcess)
    @param encoding encoding to be used by the process (string)
    @param language language to be set (string)
    """
    env = QProcessEnvironment.systemEnvironment()
    env.insert("HGPLAIN", '1')
    
    # set the encoding for the process
    if encoding:
        env.insert("HGENCODING", encoding)
    
    # set the language for the process
    if language:
        env.insert("LANGUAGE", language)
    
    proc.setProcessEnvironment(env)
開發者ID:pycom,項目名稱:EricShort,代碼行數:20,代碼來源:HgUtilities.py

示例12: qtDesignerStart

def qtDesignerStart():
    """ Set widgets/plugins paths and start QtDesigner """

    # Get base path and QProcess system environment
    base = os.path.dirname(__file__)
    env = QProcessEnvironment.systemEnvironment()

    # Path for tell python where it can find the widgets directory
    pybase = os.path.join(base, 'python')
    # Path for tell QtDesigner where it can find the plugins directory
    wbase = os.path.join(base, 'widgets')

    # Insert paths to QProcess system environment
    env.insert('PYQTDESIGNERPATH', pybase)
    env.insert('PYTHONPATH', wbase)

    # inform user
    inform('env add "PYQTDESIGNERPATH" plugins path - ' + pybase)
    inform('env add "PYTHONPATH" widgets path - ' + wbase)

    # Create QProcess and set environment
    designer = QProcess()
    designer.setProcessEnvironment(env)

    # Get QtDesigner binaries path
    designer_bin = QLibraryInfo.location(QLibraryInfo.BinariesPath)

    # Platform specefic
    if sys.platform == 'darwin':
        designer_bin += '/Designer.app/Contents/MacOS/Designer'
    else:
        designer_bin += '/designer'

    # inform user
    inform('designer bin - ' + designer_bin)
    inform('start QtDesigner...')

    # Start QtDesigner
    designer.start(designer_bin)
    designer.waitForFinished(-1)
    sys.exit(designer.exitCode())
開發者ID:LeftRadio,項目名稱:ngl_utils,代碼行數:41,代碼來源:nplugins.py

示例13: launchExample

    def launchExample(self, name):
        executable = self.resolveExeFile(name)

        process = QProcess(self)
        process.error.connect(self.launchError)

        if sys.platform == 'win32':
            # Make sure it finds the DLLs on Windows.
            env = QProcessEnvironment.systemEnvironment()
            env.insert('PATH',
                    QLibraryInfo.location(QLibraryInfo.BinariesPath) + ';' +
                            env.value('PATH'))
            process.setProcessEnvironment(env)

        if self.info[name]['changedirectory'] != 'false':
            workingDirectory = self.resolveDataDir(name)
            process.setWorkingDirectory(workingDirectory)
            Colors.debug("Setting working directory:", workingDirectory)

        Colors.debug("Launching:", executable)
        process.start(sys.executable, [executable])
開發者ID:CarlosAndres12,項目名稱:pyqt5,代碼行數:21,代碼來源:menumanager.py

示例14: __init__

    def __init__(self, what, *, verbose=False, additional_env=None, parent=None):
        super().__init__(parent)
        self._what = what
        self.verbose = verbose
        self._started = False
        self.cmd = None
        self.args = None

        self._proc = QProcess(self)
        self._proc.error.connect(self.on_error)
        self._proc.error.connect(self.error)
        self._proc.finished.connect(self.on_finished)
        self._proc.finished.connect(self.finished)
        self._proc.started.connect(self.on_started)
        self._proc.started.connect(self.started)

        if additional_env is not None:
            procenv = QProcessEnvironment.systemEnvironment()
            for k, v in additional_env.items():
                procenv.insert(k, v)
            self._proc.setProcessEnvironment(procenv)
開發者ID:lahwaacz,項目名稱:qutebrowser,代碼行數:21,代碼來源:guiprocess.py

示例15: flashDataPathForOS

def flashDataPathForOS():
    """
    Function to determine the OS dependent path where Flash cookies
    are stored.
    
    @return Flash data path
    @rtype str
    """
    # On Microsoft Windows NT 5.x and 6.x, they are stored in:
    # %APPDATA%\Macromedia\Flash Player\#SharedObjects\
    # %APPDATA%\Macromedia\Flash Player\macromedia.com\support\flashplayer\sys\
    # On Mac OS X, they are stored in:
    # ~/Library/Preferences/Macromedia/Flash Player/#SharedObjects/
    # ~/Library/Preferences/Macromedia/Flash Player/macromedia.com/support/⏎
    #   flashplayer/sys/
    # On Linux or Unix, they are stored in:
    # ~/.macromedia/Flash_Player/#SharedObjects/
    # ~/.macromedia/Flash_Player/macromedia.com/support/flashplayer/sys/
    # For Linux and Unix systems, if the open-source Gnash plugin is being used
    #  instead of the official Adobe Flash, they will instead be found at:
    # ~/.gnash/SharedObjects/
    
    flashPath = ""
    
    if Globals.isWindowsPlatform():
        appData = QProcessEnvironment.systemEnvironment().value("APPDATA")
        appData = appData.replace("\\", "/")
        flashPath = appData + "/Macromedia/Flash Player"
    elif Globals.isMacPlatform():
        flashPath = os.path.expanduser(
            "~/Library/Preferences/Macromedia/Flash Player")
    else:
        if os.path.exists(os.path.expanduser("~/.macromedia")):
            flashPath = os.path.expanduser("~/.macromedia/Flash_Player")
        elif os.path.exists(os.path.expanduser("~/.gnash")):
            flashPath = os.path.expanduser("~/.gnash")
    
    return flashPath
開發者ID:testmana2,項目名稱:test,代碼行數:38,代碼來源:FlashCookieUtilities.py


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