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


Python QtCore.QProcess方法代碼示例

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


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

示例1: generate_key

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QProcess [as 別名]
def generate_key(self):
        format = self.formatSelect.currentData()
        length = self.lengthSelect.currentData()

        if format == "rsa":
            length = length[0]
        else:
            length = length[1]

        output_path = os.path.expanduser(self.outputFileTextBox.text())
        if os.path.isfile(output_path):
            self.errors.setText("Key file already exists. Not overwriting.")
        else:
            self.sshproc = QProcess(self)
            self.sshproc.finished.connect(self.generate_key_result)
            self.sshproc.start(
                "ssh-keygen", ["-t", format, "-b", length, "-f", output_path, "-N", ""]
            ) 
開發者ID:Mebus,項目名稱:restatic,代碼行數:20,代碼來源:ssh_add.py

示例2: info_preview

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QProcess [as 別名]
def info_preview(self, command, picn, length, change_aspect, tsec, counter, x, y, use_existing=None, lock=None):
        if self.preview_process.processId() != 0:
            self.preview_process.kill()
        if self.preview_process.processId() == 0 and lock is False and not use_existing:
            ui.logger.debug('\npreview_generating - {} - {}\n'.format(length, tsec))
            self.preview_process = QtCore.QProcess()
            self.preview_process.finished.connect(partial(self.preview_generated, picn, length, change_aspect, tsec, counter, x, y))
            QtCore.QTimer.singleShot(1, partial(self.preview_process.start, command))
        elif use_existing:
            newpicn = os.path.join(self.preview_dir, "{}.jpg".format(int(tsec)))
            if ui.live_preview == 'fast':
                self.apply_pic(newpicn, x, y, length)
                ui.logger.debug('\n use existing preview image \n')
            else:
                self.preview_process = QtCore.QProcess()
                command = 'echo "hello"'
                self.preview_process.finished.connect(partial(self.preview_generated, picn, length, change_aspect, tsec, counter, x, y))
                QtCore.QTimer.singleShot(1, partial(self.preview_process.start, command)) 
開發者ID:kanishka-linux,項目名稱:kawaii-player,代碼行數:20,代碼來源:optionwidgets.py

示例3: __init__

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QProcess [as 別名]
def __init__(self):
        super(ProgressWindow, self).__init__()
        self.setupUi(self)
        self.setWindowIcon(
            QtGui.QIcon(pkg_resources.resource_filename('pipgui', ASSETS_DIR + 'googledev.png')))
        
        # QProcess object for external app
        self.process = QtCore.QProcess(self)
        # QProcess emits `readyRead` when there is data to be read
        
        self.process.readyRead.connect(self.dataReady)
        self.process.started.connect(
            lambda: self.btnContinue.setEnabled(False))
        self.process.finished.connect(
            lambda: self.btnContinue.setEnabled(True))
        self.process.finished.connect(self.onFinished)
        self.btnContinue.clicked.connect(self.continueFn) 
開發者ID:GDGVIT,項目名稱:pip-gui,代碼行數:19,代碼來源:__main__.py

示例4: show_term

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QProcess [as 別名]
def show_term(self):
        term = self.config.get("Applications", 'Shell')

        args = [
            "-bg", self.config.get("Applications", "backgroundColor"),
            "-fg", self.config.get("Applications", "foregroundColor"),
            # blink cursor
            "-bc",
            # title
            "-T", QtWidgets.QApplication.translate(
                "pychemqt", "pychemqt python console")]

        if self.config.getboolean("Applications", "maximized"):
            args.append("-maximized")

        if self.config.getboolean("Applications", 'ipython') and \
                which("ipython"):
            args.append("ipython3")
        else:
            args.append("python3")

        self.start(term, args)
        if self.error() == QtCore.QProcess.FailedToStart:
            print("xterm not installed") 
開發者ID:jjgomera,項目名稱:pychemqt,代碼行數:26,代碼來源:terminal.py

示例5: generate_key

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QProcess [as 別名]
def generate_key(self):
        format = self.formatSelect.currentData()
        length = self.lengthSelect.currentData()

        if format == 'rsa':
            length = length[0]
        else:
            length = length[1]

        output_path = os.path.expanduser(self.outputFileTextBox.text())
        if os.path.isfile(output_path):
            self.errors.setText(self.tr('Key file already exists. Not overwriting.'))
        else:
            self.sshproc = QProcess(self)
            self.sshproc.finished.connect(self.generate_key_result)
            self.sshproc.start('ssh-keygen', ['-t', format, '-b', length, '-f', output_path, '-N', '']) 
開發者ID:borgbase,項目名稱:vorta,代碼行數:18,代碼來源:ssh_dialog.py

示例6: generateTagFile

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QProcess [as 別名]
def generateTagFile(self, directoryLocation: str) -> bool:

        location = shutil.which("ctags")
        appDir = os.getcwd()

        if location is None:
            print("Please download universal ctags from the website https://github.com/universal-ctags/ctags")
            return False

        else:
            os.chdir(directoryLocation)
            generateProcess = QProcess(self)
            command = [location, "-R"]
            generateProcess.start(" ".join(command))
            self.tagInfo.setText("Generating tags file...")
            self.status.addWidget(self.tagInfo, Qt.AlignRight)
            generateProcess.finished.connect(lambda: self.afterTagGeneration(appDir)) 
開發者ID:CountryTk,項目名稱:Hydra,代碼行數:19,代碼來源:main.py

示例7: fake_qprocess

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QProcess [as 別名]
def fake_qprocess():
    """Factory for a QProcess mock which has the QProcess enum values."""
    m = mock.Mock(spec=QProcess)
    for name in ['NormalExit', 'CrashExit', 'FailedToStart', 'Crashed',
                 'Timedout', 'WriteError', 'ReadError', 'UnknownError']:
        setattr(m, name, getattr(QProcess, name))
    return m 
開發者ID:qutebrowser,項目名稱:qutebrowser,代碼行數:9,代碼來源:stubs.py

示例8: fixBroken

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QProcess [as 別名]
def fixBroken(self):
        self.labels[(3, 1)].setMovie(self.movie)
        self.movie.start()
        self.lbl1.setText("Cleaning up...")
        self.logger.info("Cleaning up...")
        self.progress2.setRange(0, 0)
        self.setCursor(QtCore.Qt.BusyCursor)
        process = QtCore.QProcess()
        process.finished.connect(lambda: self.onFinished(process.exitCode(), process.exitStatus()))
        process.start('bash', ['/usr/lib/resetter/data/scripts/fix-broken.sh']) 
開發者ID:gaining,項目名稱:Resetter,代碼行數:12,代碼來源:CustomApplyDialog.py

示例9: fixBroken

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QProcess [as 別名]
def fixBroken(self):
        self.labels[(3, 1)].setMovie(self.movie)
        self.movie.start()
        self.lbl1.setText("Cleaning up...")
        self.logger.info("Cleaning up...")
        self.progress.setRange(0, 0)
        self.setCursor(QtCore.Qt.BusyCursor)
        self.process = QtCore.QProcess()
        self.process.start('bash', ['/usr/lib/resetter/data/scripts/fix-broken.sh'])
        self.process.finished.connect(self.onFinished) 
開發者ID:gaining,項目名稱:Resetter,代碼行數:12,代碼來源:ApplyDialog.py

示例10: __init__

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QProcess [as 別名]
def __init__(self):
		self._p = QtCore.QProcess()
		self._qmp = None 
開發者ID:xqemu,項目名稱:xqemu-manager,代碼行數:5,代碼來源:main.py

示例11: isRunning

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QProcess [as 別名]
def isRunning(self):
		return self._p is not None and self._p.state() == QtCore.QProcess.Running 
開發者ID:xqemu,項目名稱:xqemu-manager,代碼行數:4,代碼來源:main.py

示例12: run

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QProcess [as 別名]
def run(self):
        # 執行程序
        if self.state:
            process = QProcess()
            process.startDetached('python', [self.fname]) 
開發者ID:xflywind,項目名稱:Python-Application,代碼行數:7,代碼來源:mybutton.py

示例13: open

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QProcess [as 別名]
def open(self):
        fname = self.get_file()
        # 文件名非空
        if fname:
            process = QProcess()
            process.startDetached('python', [fname])
            #subprocess.run(['python', fname], shell=True)
            #qApp.quit()
            
    # 重寫關閉事件 
開發者ID:xflywind,項目名稱:Python-Application,代碼行數:12,代碼來源:start.py

示例14: start_main_program

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QProcess [as 別名]
def start_main_program(self):
        """Restart the (updated) main program and close the updater."""
        self.download_window.setVisible(False)
        artemis = QProcess()
        try:
            artemis.startDetached(Constants.EXECUTABLE_NAME)
        except BaseException:
            pass
        qApp.quit() 
開發者ID:AresValley,項目名稱:Artemis,代碼行數:11,代碼來源:updater.py

示例15: _check_new_version

# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QProcess [as 別名]
def _check_new_version(self):
        """Check whether there is a new software version available.

        Does something only if the running program is a compiled version."""
        if not IS_BINARY:
            return None
        latest_version = self.version_controller.software.version
        if latest_version is None:
            return False
        if latest_version == self._current_version:
            return False
        answer = pop_up(
            self._owner,
            title=Messages.NEW_VERSION_AVAILABLE,
            text=Messages.NEW_VERSION_MSG(latest_version),
            informative_text=Messages.DOWNLOAD_SUGG_MSG,
            is_question=True,
        ).exec()
        if answer == QMessageBox.Yes:
            if IS_MAC:
                webbrowser.open(self.version_controller.software.url)
            else:
                updater = QProcess()
                command = Constants.UPDATER_SOFTWARE + " " + \
                    self.version_controller.software.url + \
                    " " + self.version_controller.software.hash_code + \
                    " " + str(self.version_controller.software.size)
                try:
                    updater.startDetached(command)
                except BaseException:
                    logging.error("Unable to start updater")
                    pass
                else:
                    qApp.quit()
        return True 
開發者ID:AresValley,項目名稱:Artemis,代碼行數:37,代碼來源:updatescontroller.py


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