FileBrowseButtonWithHistory callback on Windows...

Hello all!

(environment: Python 2.5.1, wxPython 2.8.7.1, Windows XP SP3)

I’ve been trying to use the FileBrowseButtonWithHistory (henceforth, FBBWH). It looks great - convenient, nice formatting, etc… but it doesn’t generate the events I was expecting, so my callbacks don’t happen.

Looking at the source, I find this comment:

changeCallback – as for FileBrowseButton, but with a work-around for win32 systems which don’t appear to create wx.EVT_COMBOBOX events properly. There is a (slight) chance that this work-around will cause some systems to create two events for each Combobox selection. If you discover this condition, please report it!"

OK, I thought, so someone else has been here before me. But why does it still not work?
Only today did I take a closer look and find that the work-around is on lines 315 to 333 - but someone had bypassed it:

if False:
#if wx.Platform == “WXMSW”:

I commented the “if False” and un-commented the “if wx.Platform…”, and it now works properly.

My questions:

  • why was this workaround removed? Has it, indeed, caused problems on some systems?

  • is there a “clean” way to propagate this change to my users, or should I just edit the file on their machines? (so far, my installed base is small enough that that’s possible…)

  • what’s the plan for future wxPython releases - if I or my users update, will I need to do this again?

  • I realize I could simply make a fork of FBBWH and package it with my
    app… that seems wrong, somehow. Maybe I’m wrong, though. Let me
    know!

Thanks!

···


www.fsrtechnologies.com

Marc Tompkins wrote:

Hello all!

(environment: Python 2.5.1, wxPython 2.8.7.1 <http://2.8.7.1>, Windows XP SP3)

I've been trying to use the FileBrowseButtonWithHistory (henceforth, FBBWH). It looks great - convenient, nice formatting, etc... but it doesn't generate the events I was expecting, so my callbacks don't happen.

Looking at the source, I find this comment:

    changeCallback -- as for FileBrowseButton, but with a work-around
    for win32 systems which don't appear to create wx.EVT_COMBOBOX
    events properly. There is a (slight) chance that this work-around
    will cause some systems to create two events for each Combobox
    selection. If you discover this condition, please report it!"

OK, I thought, so someone else has been here before me. But why does it still not work?
Only today did I take a closer look and find that the work-around is on lines 315 to 333 - but someone had bypassed it:

        if False:
        #if wx.Platform == "__WXMSW__":

I commented the "if False" and un-commented the "if wx.Platform...", and it now works properly.

My questions:
- why was this workaround removed? Has it, indeed, caused problems on some systems?

I seem to recall reading about this double-event, but I can't remember if it was in relation to this specific widget or not.

- is there a "clean" way to propagate this change to my users, or should I just edit the file on their machines? (so far, my installed base is small enough that that's possible...)

If you can connect to your user's PCs using UNC paths, you could use the shutil module and do a shutil.copyfile(src,dst). Other than that, nothing really good springs to mind.

- what's the plan for future wxPython releases - if I or my users update, will I need to do this again?
- I realize I could simply make a fork of FBBWH and package it with my app... that seems wrong, somehow. Maybe I'm wrong, though. Let me know!

Thanks!
--
www.fsrtechnologies.com <http://www.fsrtechnologies.com>

Hopefully the core developers will have a little more insight than me as to your other question(s).

···

-------------------
Mike Driscoll

Blog: http:\\blog.pythonlibrary.org
Python Extension Building Network: http:\\www.pythonlibrary.org

I’m pretty certain, for a number of reasons, that I didn’t. (For one thing, it’s not my style: when I comment-out a block of code, I put triple quotes around it.) On the other hand, it’s hard to imagine something like that slipping all the way through to being posted as a binary on the website without showing up in SVN… so perhaps my evil twin dunnit. Or I have a poultrygeist?

Mystery aside, I’m relieved to hear that I probably won’t have to deal with this on other people’s machines. Thank you for the heads-up!

···

On Wed, Jun 4, 2008 at 3:06 PM, Cody Precord codyprecord@gmail.com wrote:

Well by looking at the wx/lib/filebrowserbutton.py (I assume this is the file you make reference to) on the 2.8 branch in svn I don’t see any evidence of this ‘if False’ statement ever being in that file. Perhaps you put it there yourself at an earlier time and forgot about it?

ref: http://svn.wxwidgets.org/viewvc/wx/wxPython/branches/WX_2_8_BRANCH/wx/lib/filebrowsebutton.py?view=log


www.fsrtechnologies.com

Marc Tompkins wrote:

···

On Wed, Jun 4, 2008 at 3:06 PM, Cody Precord <codyprecord@gmail.com > <mailto:codyprecord@gmail.com>> wrote:

    Well by looking at the wx/lib/filebrowserbutton.py (I assume this is
    the file you make reference to) on the 2.8 branch in svn I don't see
    any evidence of this 'if False' statement ever being in that file.
    Perhaps you put it there yourself at an earlier time and forgot
    about it?

    ref: http://svn.wxwidgets.org/viewvc/wx/wxPython/branches/WX_2_8_BRANCH/wx/lib/filebrowsebutton.py?view=log

I'm pretty certain, for a number of reasons, that I didn't. (For one thing, it's not my style: when I comment-out a block of code, I put triple quotes around it.) On the other hand, it's hard to imagine something like that slipping all the way through to being posted as a binary on the website without showing up in SVN... so perhaps my evil twin dunnit. Or I have a poultrygeist?

Watch out for that spooky turkey...

According to SVN that line has not been changed since 2003, and that was just to change it from wxPlatform to wx.Platform.

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