[wxPython] An XML editor/viewer (announcement and request for help)

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[wxPython] An XML editor/viewer (announcement and request for help)

Sean Mc Grath
I have just picked myself up off the floor having
looked at the wxHTML stuff in the new beta!
wxPython is moving from *excellent* to *completely
awesome* very quickly indeed.

I have developed an XML editor/viewer in wxPython
called C3[1]. It will be used heavily in my upcoming
book "XML processing with Python" and will be part
of an open source XML processing with Python
project called Pyxie (it will live at www.pyxie.org).

With C3, you can load arbitrary well formed XML,
edit the data content, change elements, cut and
paste branches, display/edit/add attributes and
so on.

With the wxHTML stuff, we can now look at adding
CSS stylesheet editing and on-the-fly rendering
of XML to HTML. I am looking forward to tackling
this!

I have an immediate problem though. C3 has
stability problems on Windows and on Linux.
The problem seems to be related to attribute display
in a a list control. If I comment out the code
for attribute display, the problem goes away.

I am anxious to hear from wxPython developers
who have the Python xml package installed and
who are willing to eyeball my code to see if
they can spot the problem. Help cannot come
soon enough because I need to commit code
to a master CD-ROM for the book within
the next week or two!

thanks in advance,

regards
<Sean URI="http://www.digitome.com/sean.html">
Developers Day Co-Chair, 9th International World Wide Web Conference
16-19, May, 2000, Amsterdam, The Netherlands http://www9.org
</Sean>



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] An XML editor/viewer (announcement and request for help)

Harm van der Heijden
Sean Mc Grath wrote:
> I have an immediate problem though. C3 has
> stability problems on Windows and on Linux.
> The problem seems to be related to attribute display
> in a a list control. If I comment out the code
> for attribute display, the problem goes away.

I have xml installed and am quite willing to give C3 a try. However, if
you've got a specific problem with a widget, it might be easier to solve if
you just send a small python example that demonstrates the problem.

Regards,

Harm

_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] An XML editor/viewer (announcement and request for help)

Robin Dunn
In reply to this post by Sean Mc Grath
> I have just picked myself up off the floor having
> looked at the wxHTML stuff in the new beta!
> wxPython is moving from *excellent* to *completely
> awesome* very quickly indeed.
>

I love quotes like this!  <grin>


>
> I have an immediate problem though. C3 has
> stability problems on Windows and on Linux.
> The problem seems to be related to attribute display
> in a a list control. If I comment out the code
> for attribute display, the problem goes away.
>
> I am anxious to hear from wxPython developers
> who have the Python xml package installed and
> who are willing to eyeball my code to see if
> they can spot the problem. Help cannot come
> soon enough because I need to commit code
> to a master CD-ROM for the book within
> the next week or two!
>

I can take a look at it.

--
Robin Dunn
Software Craftsman
[hidden email]
http://AllDunn.com/robin/
http://AllDunn.com/wxPython/  Check it out!




_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] An XML editor/viewer (announcement and request for help)

Robin Dunn
In reply to this post by Sean Mc Grath
It's a simple solution to an obscure problem...

When the window is closed it deletes its children.  When the tree control is
being destroyed it deletes all the items in the tree.  As the items are
being cleaned up, the selected item will have to change so it generates a
EVT_TREE_SEL_CHANGED event which means that your OnwxTreeSelChanged method
is called.

In your OnwxTreeSelChanged method you call self.CharacterData.Clear() but
apparently the C++ version of the CharacterData text control has already
been destroyed by its parent and so the pointer to is is now bad.

The solution is to prevent OnwxTreeSelChanged from doing anything when the
program is being shut down.  At the begining of the method add something
like "if self.closing: return" and then intialize it with false in __init__
and set it to true in OnExit and anywhere else that you might terminate the
program.

BTW, you also have a wxFileDialog left in memory.  You need to call its
Destroy() method when you are done with it.

--
Robin Dunn
Software Craftsman
[hidden email]
http://AllDunn.com/robin/
http://AllDunn.com/wxPython/  Check it out!


----- Original Message -----
From: Sean Mc Grath <[hidden email]>
To: Robin Dunn <[hidden email]>
Sent: Friday, September 03, 1999 9:51 AM
Subject: Re: [wxPython] An XML editor/viewer (announcement and request for
help)


> Thanks for the offer to help out Robin! Much appreciated.
>
> Please find attached a zip containing:-
>   the Pyxie XML processing library
>   the C3 XML viewer/editor
>   A test xml file
>
> The following sequence of events will cause a GPF on Windows
>  1) Load test.xml
>  2) Double click the root element A
>  3) Single click the text "World" to make it appear in the data pane
>  4) Exit the program via File-Exit
>
> Thanks again,
>
> At 09:04 03/09/99 -0700, you wrote:
> >> I have just picked myself up off the floor having
> >> looked at the wxHTML stuff in the new beta!
> >> wxPython is moving from *excellent* to *completely
> >> awesome* very quickly indeed.
> >>
> >
> >I love quotes like this!  <grin>
> >
> >
> >>
> >> I have an immediate problem though. C3 has
> >> stability problems on Windows and on Linux.
> >> The problem seems to be related to attribute display
> >> in a a list control. If I comment out the code
> >> for attribute display, the problem goes away.
> >>
> >> I am anxious to hear from wxPython developers
> >> who have the Python xml package installed and
> >> who are willing to eyeball my code to see if
> >> they can spot the problem. Help cannot come
> >> soon enough because I need to commit code
> >> to a master CD-ROM for the book within
> >> the next week or two!
> >>
> >
> >I can take a look at it.
> >
> >--
> >Robin Dunn
> >Software Craftsman
> >[hidden email]
> >http://AllDunn.com/robin/
> >http://AllDunn.com/wxPython/  Check it out!
> >
> >
> >
> >


----------------------------------------------------------------------------
----


>
> <Sean URI="http://www.digitome.com/sean.html">
> Developers Day Co-Chair, 9th International World Wide Web Conference
> 16-19, May, 2000, Amsterdam, The Netherlands http://www9.org
> </Sean>
>


_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] An XML editor/viewer (announcement and request for help)

Harm van der Heijden
On Fri, 03 Sep 1999, Robin Dunn wrote:
> It's a simple solution to an obscure problem...

Everything solved while I was still trying to get Elm to cough up that
zip file :-)

Anyway, on the Linux/wxGTK end of things I don't get the core dumps,
but that's probably just luck. All of Robin's remarks apply to wxGTk as
well, AFAICS.

By the way, those [expletive barely withheld] editable tree labels seem
to be acting up again; a tree item selection automatically deletes the
label and shows an empty edit box. I thought this worked a couple of
days ago. Mind you, I'm using wxWindows from cvs, not beta9.

Harm

_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] An XML editor/viewer (announcement and request for help)

Johann Spies-4
In reply to this post by Sean Mc Grath
On Fri, 3 Sep 1999, Robin Dunn wrote:

> BTW, you also have a wxFileDialog left in memory.  You need to call its
> Destroy() method when you are done with it.

Is there a debugging method to help one to detect errors like that or is
the only way to read through the program?  I ask because I have a problem
with a program that I suspects is caused by some a widget that was not
destroyed, but I could so far not detect which one.

Johann

 --------------------------------------------------------------------------
| Johann Spies                                 Windsorlaan 19              |
| [hidden email]                3201 Pietermaritzburg             |
| Tel/Faks Nr. +27 331-46-1310       Suid-Afrika (South Africa)  |
 --------------------------------------------------------------------------

     "He hath not dealt with us after our sins; nor rewarded
      us according to our iniquities. For as the heaven is
      high above the earth, so great is his mercy toward
      them that fear him. As far as the east is from the
      west, so far hath he removed our transgressions from
      us."     Psalms 103:10-12











_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] An XML editor/viewer (announcement and request for help)

Robin Dunn
>
> > BTW, you also have a wxFileDialog left in memory.  You need to call its
> > Destroy() method when you are done with it.
>
> Is there a debugging method to help one to detect errors like that or is
> the only way to read through the program?  I ask because I have a problem
> with a program that I suspects is caused by some a widget that was not
> destroyed, but I could so far not detect which one.
>

Ah, you noticed it, eh?  That comment was actually meant to be some
subliminal advertising.  Stay tuned for an announcement in a couple weeks.

--
Robin Dunn
Software Craftsman
[hidden email]
http://AllDunn.com/robin/
http://AllDunn.com/wxPython/  Check it out!



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Reply | Threaded
Open this post in threaded view
|

Re[2]: [wxPython] An XML editor/viewer (announcement and request for help)

Paul Sokolovsky-4
In reply to this post by Robin Dunn
Hello Robin,

Robin Dunn <[hidden email]> wrote:

RD> It's a simple solution to an obscure problem...

RD> When the window is closed it deletes its children.  When the tree control is
RD> being destroyed it deletes all the items in the tree.  As the items are
RD> being cleaned up, the selected item will have to change so it generates a
RD> EVT_TREE_SEL_CHANGED event which means that your OnwxTreeSelChanged method
RD> is called.

RD> In your OnwxTreeSelChanged method you call self.CharacterData.Clear() but
RD> apparently the C++ version of the CharacterData text control has already
RD> been destroyed by its parent and so the pointer to is is now bad.

    Robin, don't you consider this obscure & unpleasant problem - when
Python's data get silently invalidated by C++ and Python then gets
incredible values or simply coredumps? I had something like the story
above when I stored event gotten by grid events so other
methods know which cell is affected.

    Having coped with such issues, I can agree that it happens
"right": it's natural that owner destroys all its parts and that
event's life extent is just event handler, but still I ask: is it
possible to avoid coredumps?

    And yes, I understand that answer is "no" - after all, that's C++
which knows nothing about there's something above it. But I still
believe that something can be done with that. For example, my problem
can be solved by simply copying event (ye, memory overhead ;-( ). Part
destruction issue could be lifted if not pointer to C++ object would be
wrapped in Python object, but C++ object itself. Well, I understand
that it may be not easy to do, and probably that's SWIG who decides what
and how to wrap..., well, but just let me complain ;-)

    And last idea - if nothing is really can be done with that, I
guess it worth adding special caveat section to wxPython manual where
describe what and when may happen and how to workaround.


RD> --
RD> Robin Dunn


Best regards,
 Paul                            mailto:[hidden email]



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users