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
---
On Jun 26, 2009, at 12:32 PM, Mike Mabey wrote:
> 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'
The initProperties() method fires *before* the object is created. The
'Form' property will return None if the object is not on a Form, or
doesn't yet exist. The only thing that should be set in
initProperties() are properties for the object to be created.
I would recommend that you put the following in the initProperties()
of the dHtmlBox control:
self.Page = /path/to/html/file
That should do what you want.
-- Ed Leafe
On Friday 26 June 2009 10:32:35 am Mike Mabey wrote:
> 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.
Mike, I can't confirm entering the RegID problem with ClassDesigner. I had no
trouble. Of course I tested on Linux and NOT windows (maybe a vista thing).
Can you post a simple test case? I'll test on XP and Linux.
--
John Fabiani
Hi Ed,
On Fri, Jun 26, 2009 at 11:44 AM, Ed Leafe <ed@leafe.com> wrote:
>
> I would recommend that you put the following in the initProperties()
> of the dHtmlBox control:
>
> self.Page = /path/to/html/file
>
> That should do what you want.
>
>
Thanks for the suggestion. I don't know why I have trouble remembering at
which point various objects come into existence.
This was actually something I had already tried, but had gotten an error for
some reason. I've put the code back where it belongs and get this
traceback:
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\tmp5kvvjl.py", line 507, in
__init__
obj = self.getCustControlClass('dHtmlBox_84958')(currParent)
File "c:\users\ecegra~1\appdata\local\temp\tmp5kvvjl.py", line 641, in
__init__
dabo.ui.dHtmlBox.__init__(self, parent=parent,
attProperties=attProperties,*args, **kwargs)
File "C:\Python25\lib\site-packages\dabo\ui\uiwx\dHtmlBox.py", line 37, in
__init__
*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\tmp5kvvjl.py", line 647, in
initProperties
self.Page = os.path.join(os.getcwd(), 'help.htm')
File "C:\Python25\lib\site-packages\dabo\ui\uiwx\dHtmlBox.py", line 127,
in _setPage
self.LoadFile(val)
File "C:\Python25\lib\site-packages\wx-2.8-msw-ansi\wx\html.py", line
1012, in LoadFile
return _html.HtmlWindow_LoadFile(*args, **kwargs)
TypeError: in method 'HtmlWindow_LoadFile', expected argument 1 of type
'wxPyHtmlWindow *'
I'm not sure I understand what's going on here. Why is it choking on that
parameter?
Thanks,
Mike M.
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---
Mike Mabey wrote:
> 1012, in LoadFile
> return _html.HtmlWindow_LoadFile(*args, **kwargs)
> TypeError: in method 'HtmlWindow_LoadFile', expected argument 1 of type
> 'wxPyHtmlWindow *'
>
>
> I'm not sure I understand what's going on here. Why is it choking on that
> parameter?
Not your fault. I looked at dHtmlBox.py just now and saw that the test
was setting self.Source in afterInit() instead of initProperties(). I
then tried moving that call into initProperties() and got the same error
as you.
I guess we figured out early on that setting this in initProperties()
wasn't working, which is why we coded the test to set it in afterInit().
While afterInit() is also a perfectly acceptable place to set these
properties as well, initProperties() really ought to work, too.
So, I made the needed fixes to the Page and Source properties. Please
update your dabo to r5271 to test.
Thanks for persisting!
Paul
On Fri, Jun 26, 2009 at 12:19 PM, Paul McNett <p@ulmcnett.com> wrote:
>
>
>
> So, I made the needed fixes to the Page and Source properties. Please
> update your dabo to r5271 to test.
>
Hi Paul,
Thanks so much to you and Ed. It all works now.
>
> Thanks for persisting!
>
>
Thank *you* for continually improving Dabo and taking time to answer
questions from people like me!
Mike M.
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---
On Fri, Jun 26, 2009 at 11:50 AM, johnf <jfabiani@yolo.com> wrote:
>
>
>
> Mike, I can't confirm entering the RegID problem with ClassDesigner. I had
> no
> trouble. Of course I tested on Linux and NOT windows (maybe a vista
> thing).
> Can you post a simple test case? I'll test on XP and Linux.
>
>
>
John,
Thanks for replying. For some reason, this problem seems to be unique to
the dHtmlBox object. Were you testing it on a dHtmlBox object, or something
else? If you still have no trouble changing it, let me know and then tell
me what will be useful information for me to post as a "simple test case" so
we can get this figured out.
Thanks,
Mike M.
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---
On Friday 26 June 2009 12:10:02 pm Mike Mabey wrote:
> On Fri, Jun 26, 2009 at 11:50 AM, johnf <jfabiani@yolo.com> wrote:
> > Mike, I can't confirm entering the RegID problem with ClassDesigner. I
> > had no
> > trouble. Of course I tested on Linux and NOT windows (maybe a vista
> > thing).
> > Can you post a simple test case? I'll test on XP and Linux.
>
> John,
>
> Thanks for replying. For some reason, this problem seems to be unique to
> the dHtmlBox object. Were you testing it on a dHtmlBox object, or
> something else? If you still have no trouble changing it, let me know and
> then tell me what will be useful information for me to post as a "simple
> test case" so we can get this figured out.
>
> Thanks,
> Mike M.
I created a form that contained a pageframe with three tabs. I then added a
vert-sizer to one of the tabs. Next just add an dHtmlBox to the vert-sizer.
Then I entered a RegID. It took chars without issue. I saved it and
re-opened it. I then changed the RegID. All worked.
Try doing the same thing and post it.
--
John Fabiani
On Fri, Jun 26, 2009 at 1:51 PM, johnf <jfabiani@yolo.com> wrote:
>
>
>
> I created a form that contained a pageframe with three tabs. I then added
> a
> vert-sizer to one of the tabs. Next just add an dHtmlBox to the
> vert-sizer.
> Then I entered a RegID. It took chars without issue. I saved it and
> re-opened it. I then changed the RegID. All worked.
>
> Try doing the same thing and post it.
>
>
>
Hmmm... Sounds just like what I have in my form. I unfortunately don't have
time today to try to troubleshoot this anymore, and I'm on vacation all next
week, so I'll have to go at it again on July 6.
Thanks,
Mike M.
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---