Global list needed or not ?

Pekka Niiranen pekka.niiranen at wlanmail.com
Sun Feb 16 12:58:18 EST 2003


I am selecting 3 serial ports out of 12 available.
I am selecting them by calling dialogbox class
(PortsFrame) in wxWindows 3 times.

I am closing the dialog box between selections.
On each dialogbox I would like to disable
the previously selected ports
om the list of available ports.

What is the common design pattern to remember allready
selected ports ? Currently I am using global list of available
ports in my main program. Does this question have anything
to with "Borg" -pattern ? Can list of available ports be
stored in the dialogbox class between the calls ?

--- code starts ---

dlg = PortsFrame(self, "Input Port", defs)
if dlg.ShowModal() == wxID_CANCEL:
    self.in_port = etc.....
dlg.Destroy()

# Call PortsFrame again and remember what port
# was selected above:

dlg = PortsFrame(self, "Input Port", defs)
    etc....

--- code ends ----

-pekka-





More information about the Python-list mailing list