a couple of GTK2 issues

Hello,
I just wanted to report a couple of things I noticed about the new
release. If it turns out that they're unknown bugs, I'll open bug reports
at SF.

Platform: slackware 9, gcc 3.2.2, GTK 2.2.1, wxPython 2.4.1.2 Unicode
(built from sources).

- according to the demo:
  """When unicode is enabled, then all functions and methods in wxPython
that return a wxString from the C++ function will return a Python
unicode object, and parameters to C++ functions/methods that expect a
wxString can accept either a Python string or unicode object. If a
string object is passed then it will be decoded into unicode using the
converter pointed to by wxConvCurrent, which will use the default
system encoding. [...]""" ^^^^^^^^^^^^^^^^^^^^
                                           
Well, this is not true. For GTK2, wxConvCurrent is always wxConvUTF8,
and this is annoying, because for example here (where I use ISO-8859-1),
every string that contains an accented letter fails to get encoded, and
is replaced by an empty string. I know I can solve the problem by
encoding the string myself, but this is not optimal. So I'd like to know
if the issue can be solved (and if not, the docs should be fixed IMHO)

- The demo crashes immediately if I try to drag the text in the
wxDragImage demo. This is the message I get:

"""
** (demo.py:4160): CRITICAL **: file pango-layout.c: line 266
(pango_layout_new): assertion `context != NULL' failed

** (demo.py:4160): CRITICAL **: file pango-layout.c: line 543
(pango_layout_set_font_description): assertion `layout != NULL' failed

** (demo.py:4160): CRITICAL **: file pango-layout.c: line 727
(pango_layout_set_text): assertion `layout != NULL' failed

** (demo.py:4160): CRITICAL **: file pango-layout.c: line 2002
(pango_layout_get_extents): assertion `layout != NULL' failed

(demo.py:4160): GLib-GObject-CRITICAL **: file gobject.c: line 1337
(g_object_unref): assertion `G_IS_OBJECT (object)' failed The program
'demo.py' received an X Window System error. This probably reflects a bug
in the program. The error was 'BadAlloc (insufficient resources for
operation)'. (Details: serial 15014 error_code 11 request_code 53
minor_code 0) (Note to programmers: normally, X errors are reported
asynchronously; that is, you will receive the error a while after
causing it. To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error()
function.)
"""
  
  (But this is probably a wxWindows issue)

- It seems to me that DrawXXXList don't work as expected. With
2.4.0.6-GTK1.2, the "canvas" contents were updated "live", i.e. I could
see the various shapes getting painted. Now the "canvas" is frozen, and
painted all-at-once when all the shapes have been drawn.

- wxEditor: text selection doesn't work.

- Finally, not really a bug, and you may know it already, but...
wxStyledTextCtrl is so slow to be unusable (and I don't consider my
hardware too outdated - FWIW PIII 700 with 256Mb RAM and an 8Mb ATI-Rage
mobility card)

Hope this helps, and sorry if they have already been reported.

Cheers,
Alberto

sorry this has nothing to do with your problem, but how do I run the
demo on linux ? it looks as if it wasn't installed on my system (gentoo)

···

On Sun, 22 Jun 2003 14:44:08 +0200 Alberto Griggio <albgrig@tiscalinet.it> wrote:

Hello,
I just wanted to report a couple of things I noticed about the new
release. If it turns out that they're unknown bugs, I'll open bug
reports at SF.

Platform: slackware 9, gcc 3.2.2, GTK 2.2.1, wxPython 2.4.1.2 Unicode
(built from sources).

- according to the demo:

--
luc wastiaux

sorry this has nothing to do with your problem, but how do I run the
demo on linux ? it looks as if it wasn't installed on my system (gentoo)

I don't know about Gentoo, but you have generally two options:

- if you downloaded the source package wxPythonSrc-blah-blah.tgz, you can
find the demo under wxPython/demo

- otherwise, you can always download it separately from here:
http://prdownloads.sourceforge.net/wxpython/wxPythonDemo-2.4.1.2.tar.gz?download

Alberto Griggio wrote:

Hello,
I just wanted to report a couple of things I noticed about the new
release.

- It seems to me that DrawXXXList don't work as expected. With
2.4.0.6-GTK1.2, the "canvas" contents were updated "live", i.e. I could
see the various shapes getting painted. Now the "canvas" is frozen, and
painted all-at-once when all the shapes have been drawn.

Hmm. There is nothing in the DrawXXXList code that should do that, and
it works like you would expect with GTK 1.*. Perhaps GTK2 has some sort
of built-in double buffering?

By the way, how to you get wxPython GTK working with GTK2?

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                        
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Hmm. There is nothing in the DrawXXXList code that should do that, and
it works like you would expect with GTK 1.*. Perhaps GTK2 has some sort
of built-in double buffering?

I don't know about this. I just have little knowledge of gtk 1.2, and
almost zero of gtk2.

By the way, how to you get wxPython GTK working with GTK2?

Well, I compiled everything from sources, first (of course) wxWindows with
--enable-gtk2, and then in setup.py change
   WXPORT='gtk'
to
   WXPORT='gtk2'
(around line 90) and you're done.

Alberto

Alberto Griggio wrote:

Hello,
I just wanted to report a couple of things I noticed about the new
release. If it turns out that they're unknown bugs, I'll open bug reports
at SF.

Platform: slackware 9, gcc 3.2.2, GTK 2.2.1, wxPython 2.4.1.2 Unicode
(built from sources).

- according to the demo: """When unicode is enabled, then all functions and methods in wxPython
that return a wxString from the C++ function will return a Python
unicode object, and parameters to C++ functions/methods that expect a
wxString can accept either a Python string or unicode object. If a
string object is passed then it will be decoded into unicode using the
converter pointed to by wxConvCurrent, which will use the default
system encoding. [...]""" ^^^^^^^^^^^^^^^^^^^^
                                            Well, this is not true. For GTK2, wxConvCurrent is always wxConvUTF8,
and this is annoying, because for example here (where I use ISO-8859-1),
every string that contains an accented letter fails to get encoded, and
is replaced by an empty string. I know I can solve the problem by
encoding the string myself, but this is not optimal. So I'd like to know
if the issue can be solved (and if not, the docs should be fixed IMHO)

Yeah, that text was written before the GTK unicode port was done. Since GTK2 uses UTF8 internally for everything then wxConvCurrent was probably set to that just for convenience. I think I may be able to change the wxString typemaps to use the true system encoding instead of relying on the wxConvCurrent, but I'll have to check into it.

- The demo crashes immediately if I try to drag the text in the
wxDragImage demo. This is the message I get:

The C++ dragimage sample crashes similarly, (although in my case it tried alloacting all of memory before I kill it...) Please enter a bug report about this.

- It seems to me that DrawXXXList don't work as expected. With
2.4.0.6-GTK1.2, the "canvas" contents were updated "live", i.e. I could
see the various shapes getting painted. Now the "canvas" is frozen, and
painted all-at-once when all the shapes have been drawn.

I still see some action going on when refreshing windows, but not as much as before. It may be some new optimizations in the window refresh/update code...

- wxEditor: text selection doesn't work.

Please enter a bug report about this one, (or a patch fixing it :wink:

- Finally, not really a bug, and you may know it already, but...
wxStyledTextCtrl is so slow to be unusable (and I don't consider my
hardware too outdated - FWIW PIII 700 with 256Mb RAM and an 8Mb ATI-Rage
mobility card)

Yes, it's slow. But then almost every app I've seen that uses GTK2 seems to be noticably slower than it's GTK1 counterpart, with great pauses while a window is rendered or refreshed... I'm not sure what it is but I expect that it has something to do with pango, or how wx and other apps are typically using it. I know anti-alias text rendering can be done quickly on GTK2, Mozilla's gecko is a great example of that (but do they even use pango or do they use Xft directly? Anybody know?) But so far that black-magic hasn't been figured out for wxGTK2. I'm sure that any help here would be appreciated...

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Chris Barker wrote:

By the way, how to you get wxPython GTK working with GTK2?

There is a set of RPMs for it on the SF download page, or you can build it yourself following the instructions in README.1st.txt.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!