Opened 6 years ago

Closed 5 years ago

#14473 closed defect (fixed)

floatspin background color incorrect on OS X

Reported by: osvenskan Owned by:
Priority: normal Milestone:
Component: AGW Version: stable-latest
Keywords: floatspin Cc: osvenskan@…
Blocked By: Blocking:
Patch: yes

Description

The floatspin background color is black under OS X when using wxPython 2.9. The patch I added to fix the background color on OS X under wxPython 2.8 is the culprit. The attached patch simplifies the code and fixes the problem under OS X/wxPython 2.9.3.1 for me. I also tested it under Windows XP.

I don't have a Linux/GTK system with wxPython 2.9, so this change is untested on that platform!

Attachments (1)

floatspin.patch download (787 bytes) - added by osvenskan 6 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 6 years ago by osvenskan

  • Cc osvenskan@… added

I forgot to mention that this problem has been discussed here:
https://groups.google.com/forum/?fromgroups#!msg/wxpython-users/Deh1MvaO2B0/QE_GQXpplcoJ

comment:2 Changed 6 years ago by vadz

FWIW setting the parent colour for the children is rarely (never?) the right thing to do anyhow, the child should normally just override ShouldInheritColours() or HasTransparentBackground() to return true.

comment:3 Changed 6 years ago by infinity77

  • Status changed from new to infoneeded_new

Hi,

thank you for the patch. Have you checked that it doesn't break under wxPython 2.8? As far as I understood (but please correct me if I am wrong), the previous patch was working in 2.8 but not in 2.9.

If it does indeed work on 2.8, I'll apply the patch. Please do test it for me as I have no Mac.

Andrea.

comment:4 Changed 6 years ago by osvenskan

@vadz: I was aware of neither ShouldInheritColours() nor HasTransparentBackground(), so thanks for the tip.

However, I added both methods to floatspin.py here on my test systems, and what I see is that ShouldInheritColours() is never called, and HasTransparentBackground() is called only on Windows. Here's my test results:
WinXP, wx2.8 - only HasTransparentBackground() called
WinXP, wx2.9 - only HasTransparentBackground() called
OS X, wx2.8 - neither called
OS X, wx2.9 - neither called
Linux/GTK, wx2.8 - neither called
Linux/GTK, wx2.9 - not tested

So perhaps the floatspin control should implement HasTransparentBackground() and return True, but it's not a solution to this particular problem.

@Andrea: I'll leave it up to you whether or not to implement HasTransparentBackground().

With regards to my proposed patch, I'm having trouble recreating the background paint problems I saw on OS X/wx2.8. I'm using 2.8.12.0 now; I believe I was using 2.8.8 when I made the original patch for background paint problems on OS X. It may be that in the transition from 2.8.8 ==> 2.8.12, something changed in wx outside of floatspin.py made my original change irrelevant. I'm not even sure any call to SetBackgroundColour() is necessary. I'll do some more testing.

comment:5 Changed 6 years ago by osvenskan

  • Status changed from infoneeded_new to new

Hi,
I haven't been able to recreate any background paint problems under 2.8 with the troublesome code removed, so it looks like the best thing to do for wx2.8 and wx2.9 is to just leave the background alone. That attached patch does just that.

Please note that it has not been tested on GTK!

Changed 6 years ago by osvenskan

comment:6 Changed 6 years ago by osvenskan

BTW I originally attached a different patch file under the same name (floatspin.patch) which was probably not a good idea. Anyway, the currently attached floatspin.patch is the correct one.

comment:7 Changed 5 years ago by AG

  • Resolution set to fixed
  • Status changed from new to closed

(In [72304]) FloatSpin: apply patch to fix #14473. Thanks to osvenskan for the patch.

Note: See TracTickets for help on using tickets.