|
From: Kevin A. <al...@se...> - 2001-10-04 22:10:57
|
I modified the samples launcher (samples.py) to use sizers and have checked
it into cvs. The code uses nested wxBoxSizers and is similar to the sizers
in the doodle and hopalong samples, but more complex.
It looks fine under Windows 2000. I would appreciate it if someone running
Linux or Solaris could try it out and let me know if there are any alignment
or overlap issues with the widgets using a variety of themes; a reply to the
list with a JPEG shot of the window would be great, especially if there is a
problem with the layout. The description field expands with the window to
simplify viewing source and resource files.
The code appears below, but the code and .rsrc.py file may change slightly
depending on how the layout looks on Linux and Solaris. Remember that this
isn't what the final user code will look like, I'm using wxPython directly
to try and see what common elements are used by a variety of layouts. The
final user code will be much simpler.
One interesting thing to note is that it is still possible to use the
resourceEditor to do the basic fixed position layout without impacting the
sizer layout.
ka
---
def setupSizers(self):
sizer1 = wxBoxSizer(wxVERTICAL)
sizer2 = wxBoxSizer(wxHORIZONTAL)
sizer3 = wxBoxSizer(wxVERTICAL)
sizer4 = wxBoxSizer(wxHORIZONTAL)
comp = self.components
btnFlags = wxLEFT | wxALIGN_BOTTOM
vertFlags = wxLEFT | wxTOP | wxALIGN_LEFT
sizer4.Add(comp.btnLaunch._delegate, 1, btnFlags, 5)
sizer4.Add(comp.btnDescription._delegate, 1, btnFlags, 5)
sizer4.Add(comp.btnSource._delegate, 1, btnFlags, 5)
sizer4.Add(comp.btnResource._delegate, 1, btnFlags, 5)
sizer3.Add(comp.stcCmdLineArgs._delegate, 0, wxLEFT | wxBOTTOM |
wxALIGN_TOP, 5)
sizer3.Add(comp.chkLogging._delegate, 0, vertFlags, 5)
sizer3.Add(comp.chkMessageWatcher._delegate, 0, vertFlags, 5)
sizer3.Add(comp.chkNamespaceViewer._delegate, 0, vertFlags, 5)
sizer3.Add(comp.chkPropertyEditor._delegate, 0, vertFlags, 5)
sizer3.Add(comp.chkShell._delegate, 0, vertFlags, 5)
sizer3.Add(5, 5, 1) # spacer
sizer3.Add(sizer4, 1, wxALIGN_BOTTOM | wxEXPAND)
sizer2.Add(comp.listSamples._delegate, 0, wxRIGHT | wxALIGN_TOP, 5)
sizer2.Add(sizer3, 1, wxEXPAND)
sizer1.Add(sizer2, 0, vertFlags)
sizer1.Add(5, 5, 0) # spacer
sizer1.Add(comp.stcDescription._delegate, 0, wxLEFT | wxTOP |
wxBOTTOM | wxALIGN_LEFT, 5)
sizer1.Add(comp.fldDescription._delegate, 1, wxEXPAND)
sizer1.Fit(self)
sizer1.SetSizeHints(self)
self.panel.SetSizer(sizer1)
self.panel.SetAutoLayout(true)
self.panel.Layout()
|