Hi all,
For the past year, I've been working on a major re-write of my application
to switch from the StyledTextCtrl to the RichTextCtrl. I've resolved a lot
of issues, large and small, and am generally really pleased with the
results. Except that there are a couple of problems that I have to resolve
before I can do a release, and I'm stuck. I'd appreciate any guidance you
can offer.
I did most of my development with the wxPython 2.8.x series. I have almost
everything working perfectly. I can produce long documents with embedded
images and fancy formatting that look great and export to Rich Text Format.
(During stress testing, I transcribed The Matrix, including about 100 screen
shots, producing an 18MB RTF document.) The last obstacle I've run across,
during final pre-release testing, is that if I try to change the formatting
on a large selection of text, I run into problems. On Windows, the Windows
GDI handles in use rapidly increase, and when they hit 10,000, my program
slows and then crashes. On OS X, the equivalent large selection format
change just crashes. A bit of investigation shows that this is due to an
issue in wxWidgets, which I have reported. But they've moved on from 2.8 to
2.9, so the issue won't (I don't think) receive much attention.
So yesterday, I decided to look into the latest wxPython, 2.9.2.4, to see if
that fixes the problem. My initial tests suggest that the GDI issue has
been resolved, that the RichTextCtrl doesn't leak GDI resources on Windows
any more. Yay! Problem solved, right? Not so fast.
1) I'm seeing odd formatting problems in the RichTextCtrl under 2.9.2.4.
I've attached a sample app, RTC_2_9_2_4_Problem.py, along with two images
that show the printout of that app under different wxPython versions.
RTC_Problem_2.8.12.1.jpg shows the sample app printout under wxPython
2.8.12.1, and everything works exactly as I would expect it to. All of my
section headings and text are formatted correctly.
As RTC_Problem_2.9.2.4.jpg shows, lines with a left indent wrap unexpectedly
when they are too short to need to wrap. This messes up the section headers
in my reports and causes the types of documents that my program is used for
(transcription of media files) to look like crap more often than not.
I noticed that wxPython 2.9.2.4 was a quick release claiming to fix indent
problems, so I wondered if this might be a variation on the theme that
wasn't caught before. I'm hoping against hope that this issue is something
on the wxPython level that can be fixed quickly and easily. I'm not
optimistic about this possibility, but I thought I'd at least ask. If not,
let me know and I'll see if I can recreate the problem in a wxWidget/C
example.
2) I also notice that with 2.9.2.4, the RichTextPrinting and
RichTextPrintout objects no longer exist in the wx.richtext module. Is
there a standard replacement for these objects that allows printing of
RichTextCtrl contents that I'm just not seeing?
3) Finally, although the GDI issue has been solved on Windows, I see that
large numbers of formatting changes (somewhere between 4681 characters and
4752 characters, given my particular application, which admittedly has some
unusual formatting conditions that leave me changing formatting one
character at a time) still crash the program. I will pursue this issue more
systematically once I've sorted out the other two issue.
Thanks in advance for your thoughts.
David K. Woods, Ph.D.
Researcher, Transana Lead Developer
Wisconsin Center for Education Research
University of Wisconsin, Madison
http://www.transana.org
RTC_2_9_2_4_Problem.py (11.9 KB)