Author: Mike Mabey
Posted: 2009-06-26 at 13:32:35
Hi everyone,
I've got an app that has a dPageFrame separating the various functions. One
of the pages is dedicated as a Help tab. I discovered the dHtmlBox widget
and thought this might be a good way to display a help page inside the app.
The problem is I've been trying to link the dHtmlBox widget to a locally
stored .htm file with no success. Here's what I've tried:
- Putting the file name inthe Source property. Then I figured out that
this was for displaying HTML source code.
- Putting the file name in the Page property. According to what I
understand from the documentation, this should have worked, but the widget
kept trying to find http://help.htm
- Setting the dHtmlBox's Page property to os.path.join(os.getcwd(),
'help.htm') when the form initializes. The problem I ran into doing it this
way was setting the RegID of the dHtmlBox. I don't know why, but in
ClassDesigner, I could only type numbers and the letter 'e' in the RegID
field of the Object Info window. I tried setting it manually in the .cdxml
file, but when I ran the code, I got the following error:
Traceback (most recent call last):
File "PreferenceManager.py", line 22, in <module>
main()
File "PreferenceManager.py", line 15, in main
app.start()
File "C:\Python25\lib\site-packages\dabo\dApp.py", line 372, in start
self.setup()
File "C:\Python25\lib\site-packages\dabo\dApp.py", line 328, in setup
self.initUIApp()
File "C:\Python25\lib\site-packages\dabo\dApp.py", line 364, in initUIApp
self.uiApp.setup()
File "C:\Python25\lib\site-packages\dabo\ui\uiwx\uiApp.py", line 412, in
setup
frm = self.dApp.MainForm = dabo.ui.createForm(mfc)
File "C:\Python25\lib\site-packages\dabo\ui\uiwx\__init__.py", line 1145,
in createForm
frm = cls(*args, **kwargs)
File "c:\users\ecegra~1\appdata\local\temp\tmpeow3q3.py", line 9, in
__init__
super(dForm_31058, self).__init__(parent=parent,
attProperties=attProperties, *args, **kwargs)
File "C:\Python25\lib\site-packages\dabo\ui\uiwx\dForm.py", line 931, in
__init__
BaseForm.__init__(self, preClass, parent, properties, attProperties,
*args,**kwargs)
File "C:\Python25\lib\site-packages\dabo\ui\uiwx\dForm.py", line 44, in
__init__
fm.dFormMixin.__init__(self, preClass, parent, properties,
attProperties, *args, **kwargs)
File "C:\Python25\lib\site-packages\dabo\ui\uiwx\dFormMixin.py", line 89,
in __init__
attProperties, *args, **kwargs)
File "C:\Python25\lib\site-packages\dabo\ui\uiwx\dPemMixin.py", line 86,
in __init__
self._initProperties()
File "C:\Python25\lib\site-packages\dabo\dObject.py", line 177, in
_initProperties
self.initProperties()
File "c:\users\ecegra~1\appdata\local\temp\tmpeow3q3.py", line 585, in
initProperties
self.Form.HelpPage.Page = tmp
AttributeError: 'NoneType' object has no attribute 'HelpPage'
Obviously, the string I set as the RegID was 'HelpPage'. I am trying to
change the property with the following code:
def initProperties(self):
self.ShowStatusBar = False
tmp = os.path.join(os.getcwd(), 'help.htm')
print "Opening "+str(tmp)
self.Form.HelpPage.Page = os.path.join(os.getcwd(), 'help.htm')
The initProperties() method belongs to the dForm object. I'm not sure if
that's where I should have put it, but I was trying a few different places
and none of them seemed to make any more sense or work any better than this.
I'm sorry this is such a complicated problem, but any help you can offer
would be very appreciated. Oh, and by the way, I'm running Python 2.5 in
Win Vista Pro under revision 5270.
Thanks,
Mike M.
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---