[Chandler-dev] Fwd: [commits] (dan) [16094] a new recorded script

Robin Dunn robin at alldunn.com
Tue Dec 11 12:16:01 PST 2007


D John Anderson wrote:
> 
> On Dec 11, 2007, at 11:34 AM, Robin Dunn wrote:
> 
>> D John Anderson wrote:
>>> On Dec 11, 2007, at 9:56 AM, Robin Dunn wrote:
>>>> D John Anderson wrote:
>>>>> Hi Dan:
>>>>> This test is failing on the Tiger tinderboxes. It looks to me like 
>>>>> a bug I fixed last week: OSX doesn't allow focus to be set to 
>>>>> GenButtons.
>>>>
>>>> It should, and does in the wxPython demo.  Perhaps there is 
>>>> something in the implementation of the derived classes in Chandler 
>>>> that is affecting it?
>>> That's interesting, Surprisingly, setting the focus to GenButtons 
>>> works on non-OSX platforms, so it seems unlikely that it's 
>>> implementation dependent, but I should look into it further. In 
>>> wxPython demo, after you call SetFocus, do you verify that it 
>>> actually got the focus by calling wx.Window.FindFocus?
>>
>> Yes, I did it via the pyshell in the widget inspector.  I used 
>> wx.CallLater to call the button's SetFocus via a timer, and then 
>> another wx.CallLater with a slightly longer timeout to call a function 
>> that print's the results of the FindFocus.  I then switched back to 
>> the demo window and waited for the timers to expire.
> 
> That make me suspect that the problem might be timing related. 

Probably, but maybe it is the timing of other events related to the 
change in focus, that are resulting in the focus being shifted away from 
the button...  Just a shot in the dark.

> My test 
> does a SetFocus, then verifies it, without any delay. If call to 
> SetFocus didn't when verified, I call Yield, then test again, and that's 
> the test that fails.

However it works for me with an immediate test too.  Here obj is one of 
the generic buttons in the sample that doesn't currently have the focus, 
and while waiting for the timer to expire I manually make the main 
window the active one:

     >>>
     >>> def test():
     ...     obj.SetFocus()
     ...     shell.write("%s\n" % (wx.Window.FindFocus() is obj))
     ...
     >>> wx.CallLater(4000, test)
     <wx._core.CallLater instance at 0x187c88c8>
     >>> True


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



More information about the chandler-dev mailing list