コード例 #1
0
ファイル: assistanthelper.py プロジェクト: whigg/PySOL
    def startAssistant(self):
        if not self.proc:
            self.proc = QtCore.QProcess()

        if self.proc.state() != QtCore.QProcess.Running:
            app = QtCore.QLibraryInfo.location(
                QtCore.QLibraryInfo.BinariesPath)
            app += QtCore.QDir.separator()
            if sys.platform == 'darwin':
                app += QtCore.QLatin1String(
                    'Assistant.app/Contents/MacOS/Assistant')
            else:
                app += QtCore.QLatin1String('assistant')

            args = [
                QtCore.QLatin1String('-collectionFile'),
                QtCore.QLatin1String('path to .qhc'),
                QtCore.QLatin1String('-enableRemoteControl'),
            ]

            self.proc.start(app, args)

            if not self.proc.waitForStarted():
                if QtGui.aApp is not None:
                    tr = QtGui.qApp.tr
                else:
                    tr = str
                QtGui.QMessageBox.critical(
                    0, tr('Simple Text Viewer'),
                    tr('Unable to launch Qt Assistant (%s)') % app)
                return False

        return True