当前位置: 首页>>代码示例>>Python>>正文


Python QProcessEnvironment.systemEnvironment方法代码示例

本文整理汇总了Python中PyQt5.QtCore.QProcessEnvironment.systemEnvironment方法的典型用法代码示例。如果您正苦于以下问题:Python QProcessEnvironment.systemEnvironment方法的具体用法?Python QProcessEnvironment.systemEnvironment怎么用?Python QProcessEnvironment.systemEnvironment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtCore.QProcessEnvironment的用法示例。


在下文中一共展示了QProcessEnvironment.systemEnvironment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from PyQt5.QtCore import QProcessEnvironment [as 别名]
# 或者: from PyQt5.QtCore.QProcessEnvironment import systemEnvironment [as 别名]
 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,代码行数:33,代码来源:SvnPropListDialog.py

示例2: init_broker

# 需要导入模块: from PyQt5.QtCore import QProcessEnvironment [as 别名]
# 或者: from PyQt5.QtCore.QProcessEnvironment import systemEnvironment [as 别名]
    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,代码行数:27,代码来源:SyncPlugin.py

示例3: startProcess

# 需要导入模块: from PyQt5.QtCore import QProcessEnvironment [as 别名]
# 或者: from PyQt5.QtCore.QProcessEnvironment import systemEnvironment [as 别名]
 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,代码行数:59,代码来源:SvnDialog.py

示例4: launchQml

# 需要导入模块: from PyQt5.QtCore import QProcessEnvironment [as 别名]
# 或者: from PyQt5.QtCore.QProcessEnvironment import systemEnvironment [as 别名]
    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,代码行数:16,代码来源:menumanager.py

示例5: open_app

# 需要导入模块: from PyQt5.QtCore import QProcessEnvironment [as 别名]
# 或者: from PyQt5.QtCore.QProcessEnvironment import systemEnvironment [as 别名]
 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,代码行数:17,代码来源:launcher.py

示例6: _start

# 需要导入模块: from PyQt5.QtCore import QProcessEnvironment [as 别名]
# 或者: from PyQt5.QtCore.QProcessEnvironment import systemEnvironment [as 别名]
    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,代码行数:19,代码来源:testprocess.py

示例7: _run_process

# 需要导入模块: from PyQt5.QtCore import QProcessEnvironment [as 别名]
# 或者: from PyQt5.QtCore.QProcessEnvironment import systemEnvironment [as 别名]
    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,代码行数:20,代码来源:userscripts.py

示例8: prepareProcess

# 需要导入模块: from PyQt5.QtCore import QProcessEnvironment [as 别名]
# 或者: from PyQt5.QtCore.QProcessEnvironment import systemEnvironment [as 别名]
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,代码行数:22,代码来源:HgUtilities.py

示例9: qtDesignerStart

# 需要导入模块: from PyQt5.QtCore import QProcessEnvironment [as 别名]
# 或者: from PyQt5.QtCore.QProcessEnvironment import systemEnvironment [as 别名]
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,代码行数:43,代码来源:nplugins.py

示例10: __init__

# 需要导入模块: from PyQt5.QtCore import QProcessEnvironment [as 别名]
# 或者: from PyQt5.QtCore.QProcessEnvironment import systemEnvironment [as 别名]
    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,代码行数:23,代码来源:guiprocess.py

示例11: launchExample

# 需要导入模块: from PyQt5.QtCore import QProcessEnvironment [as 别名]
# 或者: from PyQt5.QtCore.QProcessEnvironment import systemEnvironment [as 别名]
    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,代码行数:23,代码来源:menumanager.py

示例12: flashDataPathForOS

# 需要导入模块: from PyQt5.QtCore import QProcessEnvironment [as 别名]
# 或者: from PyQt5.QtCore.QProcessEnvironment import systemEnvironment [as 别名]
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,代码行数:40,代码来源:FlashCookieUtilities.py

示例13: _start

# 需要导入模块: from PyQt5.QtCore import QProcessEnvironment [as 别名]
# 或者: from PyQt5.QtCore.QProcessEnvironment import systemEnvironment [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

示例14: start_process

# 需要导入模块: from PyQt5.QtCore import QProcessEnvironment [as 别名]
# 或者: from PyQt5.QtCore.QProcessEnvironment import systemEnvironment [as 别名]
    def start_process(self, script_name, working_directory, interactive=True,
                      debugger=False, command_args=None, envars=None,
                      runner=None, python_args=None):
        """
        Start the child Python process.

        Will run the referenced Python script_name within the context of the
        working directory.

        If interactive is True (the default) the Python process will run in
        interactive mode (dropping the user into the REPL when the script
        completes).

        If debugger is True (the default is False) then the script will run
        within a debug runner session.

        If there is a list of command_args (the default is None), then these
        will be passed as further arguments into the script to be run.

        If there is a list of environment variables, these will be part of the
        context of the new child process.

        If runner is given, this is used as the command to start the Python
        process.

        If python_args is given, these are passed as arguments to the Python
        runtime used to launch the child process.
        """
        self.script = os.path.abspath(os.path.normcase(script_name))
        logger.info('Running script: {}'.format(self.script))
        if interactive:
            logger.info('Running with interactive mode.')
        if command_args is None:
            command_args = []
        logger.info('Command args: {}'.format(command_args))
        self.process = QProcess(self)
        self.process.setProcessChannelMode(QProcess.MergedChannels)
        # Force buffers to flush immediately.
        env = QProcessEnvironment.systemEnvironment()
        env.insert('PYTHONUNBUFFERED', '1')
        env.insert('PYTHONIOENCODING', 'utf-8')
        if sys.platform == 'darwin':
            parent_dir = os.path.dirname(__file__)
            if '.app/Contents/Resources/app/mu' in parent_dir:
                # Mu is running as a macOS app bundle. Ensure the expected
                # paths are in PYTHONPATH of the subprocess.
                env.insert('PYTHONPATH', ':'.join(sys.path))
        if envars:
            logger.info('Running with environment variables: '
                        '{}'.format(envars))
            for name, value in envars:
                env.insert(name, value)
        logger.info('Working directory: {}'.format(working_directory))
        self.process.setWorkingDirectory(working_directory)
        self.process.setProcessEnvironment(env)
        self.process.readyRead.connect(self.read_from_stdout)
        self.process.finished.connect(self.finished)
        logger.info('Python path: {}'.format(sys.path))
        if debugger:
            # Start the mu-debug runner for the script.
            parent_dir = os.path.join(os.path.dirname(__file__), '..')
            mu_dir = os.path.abspath(parent_dir)
            runner = os.path.join(mu_dir, 'mu-debug.py')
            python_exec = sys.executable
            args = [runner, self.script, ] + command_args
            self.process.start(python_exec, args)
        else:
            if runner:
                # Use the passed in Python "runner" to run the script.
                python_exec = runner
            else:
                # Use the current system Python to run the script.
                python_exec = sys.executable
            if interactive:
                # Start the script in interactive Python mode.
                args = ['-i', self.script, ] + command_args
            else:
                # Just run the command with no additional flags.
                args = [self.script, ] + command_args
            if python_args:
                args = python_args + args
            self.process.start(python_exec, args)
            self.running = True
开发者ID:ZanderBrown,项目名称:mu,代码行数:85,代码来源:panes.py

示例15: QProcess

# 需要导入模块: from PyQt5.QtCore import QProcessEnvironment [as 别名]
# 或者: from PyQt5.QtCore.QProcessEnvironment import systemEnvironment [as 别名]
        "button.</p>"
        "<p>Before doing so it sets the <tt>PYQTDESIGNERPATH</tt> environment "
        "variable to the <tt>python</tt> directory that is part of this "
        "example.  This directory contains all the example Python plugin "
        "modules.</p>"
        "<p>It also sets the <tt>PYTHONPATH</tt> environment variable to the "
        "<tt>widgets</tt> directory that is also part of this example.  This "
        "directory contains the Python modules that implement the example "
        "custom widgets.</p>"
        "<p>All of the example custom widgets should then appear in "
        "Designer's widget box in the <b>PyQt Examples</b> group.</p>")

# Tell Qt Designer where it can find the directory containing the plugins and
# Python where it can find the widgets.
base = os.path.dirname(__file__)
env = QProcessEnvironment.systemEnvironment()
env.insert('PYQTDESIGNERPATH', os.path.join(base, 'python'))
env.insert('PYTHONPATH', os.path.join(base, 'widgets'))

# Start Designer.
designer = QProcess()
designer.setProcessEnvironment(env)

designer_bin = QLibraryInfo.location(QLibraryInfo.BinariesPath)

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

designer.start(designer_bin)
开发者ID:Axel-Erfurt,项目名称:pyqt5,代码行数:33,代码来源:plugins.py


注:本文中的PyQt5.QtCore.QProcessEnvironment.systemEnvironment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。