[PyQt] PyQt.QtHelp - QFSFileEngine::open: No file name specified

romain rbe at arxsys.fr
Wed Nov 24 12:54:50 GMT 2010


Hans-Peter Jansen wrote:
 > On Tuesday 23 November 2010, 14:28:16 romain wrote:
 >> Hi everybody,
 >>
 >> I am facing an issue when I use the PyQt.QtHelp module. I have
 >> generated a .qhc file containing the documentation I want to embed
 >> into my soft so users can access it directly. It is made up with
 >> .html pages.
 >>
 >> I have joined the code in attachment. I simplified it so it can be
 >> used in a "stand-alone" software, but it is in fact part of a bigger
 >> program. My problem is the same in both cases anyway.
 >>
 >> (This code is more or less the same as in the QtHelp example from Qt
 >> : http://doc.trolltech.com/qq/qq28-qthelp.html and
 >> http://doc.trolltech.com/qq/qq28-qthelp.zip for the example code).
 >>
 >> When I launch my soft, and click on one of the link of the table of
 >> content, the error message "QFSFileEngine::open: No file name
 >> specified" is displayed, and consequently the documentation is not
 >> displayed. The HelpBrowser.loadResources() method is called by
 >> HelpBrowser.setSource() when a link of the table of content is
 >> double-clicked.
 >
 > No, a method named HelpBrowser.loadResource() is called.
 >
 > Btw, you are covering a few python keywords in your code (type, help).
 >
 > It's usually a good practice to call parent methods with super (will
 > save you from editing every method invocation, if you rebase your
 > class one day, which usually results in _nasty_ behavior), and you
 > and your typing fingers _really_ want to use PyQt's new style signals,
 > I sure.

Thanks for your answer. I changed that and added a few documentation in
the code.

The class QHelpEngine is used to embed documentation in a program (as Qt
assistant does). It provides widgets for the search, index and table of
content (I only use the TOC in the example).

The documentation itself is generated from html files and results in
.qhc and .qch files. The generation is done by using the qhelpgenerator
and the qcollectiongenerator tools provided by Qt. These files are a
kind of compressed documentation, including the table of content.

Then, to access the content of these files a QHelpEngine musts be used,
and more precisely the method QHelpEngine.fileData(QUrl url). The URL
musts be something like
"qthelp://namespace/virtual_folder/resource.html". `namespace` and
`virtual_folder` are defined when the documentation is generated.
`resource.html` is the page we want to display. The method fileData of
the QHelpEngine extracts the html contained in the resource.

To summarize, I generate the doc, load it with a QHelpEngine and display
the TOC. A click on a link in the TOC emits the signal
`linkActivated(QUrl)`, which in my case is connected to
`HelpBrowser.setSource(QUrl)` slot.

But the documentation is not displayed due to the fact that the error
"QFSFileEngine::open: No file name specified" occurs. I do not
understand why. The method HelpBrowser.loadResources should be called 
for each style sheets and images of the page.

   Regards,

-- 
Romain BERTHOLON
rbe at arxsys.fr
http://www.arxsys.fr - http://www.digital-forensic.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: help.py
Type: text/x-python
Size: 3308 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20101124/708333fa/attachment.py>


More information about the PyQt mailing list