- The user is viewing a record in the read-only frame and clicks on the
EDIT button. This frame sends out a general message asking "are thereany edit frames currently editing this record?" If no frames respond,
the read-only frame would create a new edit frame. If a frame does
respond, the read-only frame activates it by bringing it to the frontand giving it the focus (and restoring it if it had been minimized).
I’m not sure how to best accomplish this two-way communication; I’d probably myself implement a manager class and if a frame starts editing a record, it just informs the manager. Then when it stops, it tells the manager that. So the manager maintains the state of ‘who is editing any records at any given time’; so you don’t have to deal with these multiple frames “responding” that they are or are not editing.
- The user clicks update on the edit frame. This frame sends out a
general message "any frame viewing this record, the data has beenupdated". It is acceptable for there to be zero or more frames that are
viewing the given record.
This one is easier, and you could use wx.lib.pubsub. I personally prefer pydispatcher, but hey They’re both a generic “send out a message to anyone, if anyone cares, is listening” mechanism.
- is harder then 2) in that you are communicating two ways; you ask a question and are expecting a response, and also the condition of /not/ responding-- so you’re expecting a response or a timeout. Etc. Which is doable, but just seems like not the best way to address that problem.
–Stephen