Ana Gomez wrote:
Hello everyone!
 We are trying to use QAssistant to show the help without success.
 We have implemented a class that looks like ...
*
from PyQt4 import QtCore, QtGui, QtAssistant
class MainWindow(QtGui.QMainWindow, Ui_qto_main_window):
     def __init__(self):
         ....
         self.qto_assistant = QtAssistant.QAssistantClient('')
         qto_args = QtCore.QStringList(QtCore.QString
(QtCore.QLatin1String("-profile /tmp/test.adp")))
         self.qto_assistant.setArguments(qto_args)
         ...
         self.__connect_slots()

     def __connect_slots(self):
         ...
         self.connect(self.qto_action_help, QtCore.SIGNAL("triggered ()"),
self.__help_slot)

     def  __help_slot(self):
         self.qto_assistant.showPage('/tmp/doc/index.html') *

 When we invoke the help, nothing happens. And we have also tried, with the
same result:
*
 def  __help_slot(self):
         #Forget about self.qto_assistant attribute
         qto_process = QtCore.QProcess(self)
         qto_args = QtCore.QStringList("-collectionFile /tmp/test.qch
-enableRemoteControl")
         qto_process.start('assistant', qto_args)
         if not qto_process.waitForStarted():
             return *

 What is happing? How can we solve it?
 Thanks in advance.

hello ana

try this:

import sys
from PyQt4 import QtCore, QtGui

def handleButton():
    path = QtCore.QLibraryInfo.location(
            QtCore.QLibraryInfo.BinariesPath) + '/assistant'
    args = QtCore.QStringList() << '-enableRemoteControl'
    process.start(path, args)

def handleStarted():
    docs = QtCore.QLibraryInfo.location(
            QtCore.QLibraryInfo.DocumentationPath)
    stream = QtCore.QTextStream(process)
    stream << 'setSource ' << docs << '/html/assistant-manual.html\n'

def handleError(error):
    QtGui.QMessageBox.critical(
        button, 'Error', 'Could not start Qt Assistant')

app = QtGui.QApplication(sys.argv)
app.connect(app, QtCore.SIGNAL('lastWindowClosed()'),
            app, QtCore.SLOT('quit()'))
process = QtCore.QProcess(app)
process.connect(process, QtCore.SIGNAL('started()'), handleStarted)
process.connect(process, QtCore.SIGNAL('error(QProcess::ProcessError)'),
                handleError)
button = QtGui.QPushButton('Show Qt Assistant')
button.connect(button, QtCore.SIGNAL('clicked()'), handleButton)
button.resize(200, 50)
button.move(400, 400)
button.show()

sys.exit(app.exec_())


regards
baz walter
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to