[PySide] QTextBrowser.setSource()
Tim Doty
thoromyr at mac.com
Wed Jun 19 03:01:38 CEST 2013
I got a chance to test further and it works on linux with PySIde 1.1.0 for both applications, but I was mistaken about OS X -- at least on testing now it does not work with either application so it appears to be a bug introduced in 1.1.1. Anyone know if that has been fixed in more recent releases?
Tim Doty
On Jun 17, 2013, at 8:58 PM, Tim Doty <thoromyr at mac.com> wrote:
> I'm having a problem with QTextBrowser.setSource() -- the error is:
>
> QTextBrowser: No document for /Users/tim/Documents/Development/lithophane/HCLithophaneCreator.html
>
> But… there actually is such a file and it is readable by the current user. No, there isn't a typo in the path: copying and pasting that path works with, e.g., less. What *really* puzzles me is that identical code (copy and paste) from a different project works.
>
> The code that creates the dialog holding the text browser is:
>
> class HelpContentsDlg(QDialog):
> """
> Displays a help dialog providing information about the application.
> """
> def __init__(self, page, parent=None):
> super(HelpContentsDlg, self).__init__(parent)
> browser = QTextBrowser()
> browser.setSearchPaths([":/"])
> browser.setSource(QUrl(page))
> browser.setOpenExternalLinks(True)
> layout = QVBoxLayout()
> layout.addWidget( browser )
> self.setLayout(layout)
>
> This code is invoked by:
>
> def helpContents(self):
> if not self.helpContentsDlg:
> helpFile = os.path.join(os.path.dirname( os.path.realpath( __file__ ) ), __thisHelpFileName__)
> self.helpContentsDlg = HelpContentsDlg( helpFile, self)
> self.helpContentsDlg.setWindowTitle(__thisAppName__ + ' Help')
> self.helpContentsDlg.show()
>
> the variable is defined toward the top of the application (in a block of similarly named variables)
>
> __thisHelpFileName__ = "HCLithophaneCreator.html"
>
> As already mentioned, this *identical* code (the only difference is the value for the help file name) works in a different application. Searching the Internet has not shed any light on the subject so I'm hoping someone here has an idea of what I'm doing wrong.
>
> Ah, I'm running with Python 2.7.2, Qt 4.8.0 and PySide 1.1.1 on OS X.
>
> Tim Doty
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/pyside
More information about the PySide
mailing list