close icon missing, checking for 2.5, FileHistory bug

I've been slowly modifying code to work with 2.4.x and 2.5.x or later. This
seems like an easier way to transition between the two. I'm not sure why I
missed this earlier, but today I noticed that under 2.5 that all of of my
static-size wxFrame windows have a dimmed close box (X). I had been defining
the style for those frames with:

        style = wx.wxMINIMIZE_BOX | wx.wxSYSTEM_MENU | wx.wxCAPTION

while resizeable windows just use wx.wxDEFAULT_FRAME_STYLE which still seems
to work. So, do we have to explicitly add the close box to the list of style
flags in 2.5? It looks like wx.wxCLOSE_BOX works, but I don't want to add it
in if this is just a 2.5 bug.

I'm just using simple if statements to support 2.4 and 2.5 and so far I'm
just using the simplistic test of if wx.__version__ >= "2.5" like this:

        # KEA 2004-01-18
        # deal with (w,h) wxPython 2.5 changes
        if wx.__version__ >= "2.5":
            sizer2.Add((5, 5), 1) # spacer
        else:
            sizer2.Add(5, 5, 1) # spacer

If there is a suggestion for a better check that will work with 2.4.x let me
know. I don't want to use try/except.

Finally, the GetNoHistoryFiles() method seems to be missing from the
wxFileHistory class.

ka

Kevin Altis wrote:

I've been slowly modifying code to work with 2.4.x and 2.5.x or later. This
seems like an easier way to transition between the two. I'm not sure why I
missed this earlier, but today I noticed that under 2.5 that all of of my
static-size wxFrame windows have a dimmed close box (X). I had been defining
the style for those frames with:

        style = wx.wxMINIMIZE_BOX | wx.wxSYSTEM_MENU | wx.wxCAPTION

while resizeable windows just use wx.wxDEFAULT_FRAME_STYLE which still seems
to work. So, do we have to explicitly add the close box to the list of style
flags in 2.5? It looks like wx.wxCLOSE_BOX works, but I don't want to add it
in if this is just a 2.5 bug.

Not a bug. The wxCLOSE_BOX style was added in 2.5 and it is also now part for the wxDEFAULT_FRAME_STYLE bitmask.

I'm just using simple if statements to support 2.4 and 2.5 and so far I'm
just using the simplistic test of if wx.__version__ >= "2.5" like this:

        # KEA 2004-01-18
        # deal with (w,h) wxPython 2.5 changes
        if wx.__version__ >= "2.5":
            sizer2.Add((5, 5), 1) # spacer
        else:
            sizer2.Add(5, 5, 1) # spacer

Actually, for this specific case you would not need to differentiate (unless you want to be compatible with really old versions) because the sizer.Add((w,h), ...) Add parameters was supported in 2.4, starting in 2.4.1 I think.

If there is a suggestion for a better check that will work with 2.4.x let me
know. I don't want to use try/except.

wx.VERSION (or wxPython.wx.wxVERSION) has existed since 2.4.1. It is a tuple of integers for the four components of the version number plus a string for build flags (like 'u' for unicode or 'p7' for the preview build.) Unlike a string this tuple would compare correctly if there is ever a 2.10.x version.

Finally, the GetNoHistoryFiles() method seems to be missing from the
wxFileHistory class.

It's now called GetCount. I had put in an alias for GetNoHistoryFiles but it looks like I had used the wrong syntax and so it got ignored by SWIG. I'll fix it for the next release.

···

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