Various layout tweaks, wx.FIXED_SIZE added, etc.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26655 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
a78cb66358
commit
102e2b26c0
@ -28,10 +28,10 @@ class TestPanel( wx.Panel ):
|
||||
|
||||
grid = wx.FlexGridSizer( 0, 2, 0, 0 )
|
||||
grid.Add( self.set_min, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
|
||||
grid.Add( self.min, 0, wx.ALIGN_LEFT|wx.ALL, 5 )
|
||||
grid.Add( self.min, 0, wx.FIXED_SIZE|wx.ALIGN_LEFT|wx.ALL, 5 )
|
||||
|
||||
grid.Add(self.set_max, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
|
||||
grid.Add( self.max, 0, wx.ALIGN_LEFT|wx.ALL, 5 )
|
||||
grid.Add( self.max, 0, wx.FIXED_SIZE|wx.ALIGN_LEFT|wx.ALL, 5 )
|
||||
|
||||
grid.Add( self.limit_target, 0, wx.ALIGN_LEFT|wx.ALL, 5 )
|
||||
grid.Add( (20, 0), 0, wx.ALIGN_LEFT|wx.ALL, 5 )
|
||||
|
@ -43,10 +43,10 @@ class MimeTypesDemoPanel(wx.Panel):
|
||||
# Text control for ext / type entry plus label.
|
||||
t = wx.StaticText(self, -1, 'Extension / MIME type: ', style = wx.ALIGN_RIGHT )
|
||||
t.SetFont(bfont)
|
||||
usizer.Add(t, 0, wx.ALL | wx.EXPAND | wx.ALIGN_CENTER | wx.ALIGN_CENTER_VERTICAL, 2)
|
||||
usizer.Add(t, 0, wx.ALL | wx.ALIGN_CENTER | wx.ALIGN_CENTER_VERTICAL, 2)
|
||||
|
||||
self.ext = wx.TextCtrl(self, -1, value="wav", style = wx.TE_PROCESS_ENTER )
|
||||
usizer.Add(self.ext, 0, wx.ALL | wx.ALIGN_TOP, 4)
|
||||
usizer.Add(self.ext, 0, wx.FIXED_SIZE | wx.ALL | wx.ALIGN_TOP, 4)
|
||||
self.Bind(wx.EVT_TEXT_ENTER, self.OnLookup, self.ext)
|
||||
|
||||
# Select how to look it up
|
||||
@ -85,13 +85,13 @@ class MimeTypesDemoPanel(wx.Panel):
|
||||
llsizer.Add(t, (0, 0), (1, 1), wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 2)
|
||||
|
||||
self.icon = wx.StaticBitmap(self, -1, images.getNoIconBitmap())
|
||||
llsizer.Add(self.icon, (0, 1), (1, 1), wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 2)
|
||||
llsizer.Add(self.icon, (0, 1), (1, 1), wx.FIXED_SIZE | wx.ALL | wx.ALIGN_CENTER, 2)
|
||||
|
||||
self.iconsource = wx.TextCtrl(self, -1, value="", style = wx.TE_READONLY )
|
||||
llsizer.Add(self.iconsource, (0, 2), (1, 1), wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 2)
|
||||
self.iconsource = wx.TextCtrl(self, -1, value="", size=(125, -1), style = wx.TE_READONLY )
|
||||
llsizer.Add(self.iconsource, (0, 2), (1, 1), wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 2)
|
||||
|
||||
self.iconoffset = wx.TextCtrl(self, -1, value="", style = wx.TE_READONLY )
|
||||
llsizer.Add(self.iconoffset, (0, 3), (1, 1), wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 2)
|
||||
self.iconoffset = wx.TextCtrl(self, -1, value="", size=(25,-1), style = wx.TE_READONLY )
|
||||
llsizer.Add(self.iconoffset, (0, 3), (1, 1), wx.FIXED_SIZE | wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)
|
||||
|
||||
#------- MIME Type
|
||||
|
||||
|
@ -12,7 +12,7 @@ resourceText = r'''<?xml version="1.0"?>
|
||||
<object class="MyCustomPanel" name="MyPanel">
|
||||
<size>200,100</size>
|
||||
<object class="wxStaticText" name="label1">
|
||||
<label>This blue panel is a class derived from wx.Panel,\nand is loaded by a custom XmlResourceHandler.</label>
|
||||
<label>This panel is a custom class derived from wx.Panel,\nand is loaded by a custom XmlResourceHandler.</label>
|
||||
<pos>10,10</pos>
|
||||
</object>
|
||||
</object>
|
||||
|
@ -14,8 +14,7 @@ resourceText = r'''<?xml version="1.0"?>
|
||||
<object class="wxPanel" subclass="XmlResourceSubclass.MyCustomPanel" name="MyPanel">
|
||||
<size>200,100</size>
|
||||
<object class="wxStaticText" name="label1">
|
||||
<label>This blue panel is a class derived from wx.Panel
|
||||
and is loaded by a using a subclass attribute of the object tag.</label>
|
||||
<label>This panel is a custom class derived from wx.Panel,\nand is loaded by a custom XmlResourceHandler.</label>
|
||||
<pos>10,10</pos>
|
||||
</object>
|
||||
</object>
|
||||
@ -48,7 +47,7 @@ class MyCustomPanel(wx.Panel):
|
||||
# On OSX the EVT_SIZE happens before EVT_WINDOW_CREATE !?!
|
||||
# so give it another kick
|
||||
wx.CallAfter(self.OnSize, None)
|
||||
|
||||
evt.Skip()
|
||||
|
||||
def OnSize(self, evt):
|
||||
if hasattr(self, 't'):
|
||||
@ -80,9 +79,7 @@ class TestPanel(wx.Panel):
|
||||
res.LoadFromString(resourceText)
|
||||
|
||||
# Now create a panel from the resource data
|
||||
#panel = res.LoadPanel(self, "MyPanel")
|
||||
panel = MyCustomPanel()
|
||||
panel.Create(self, -1)
|
||||
panel = res.LoadPanel(self, "MyPanel")
|
||||
|
||||
# and do the layout
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
|
@ -74,7 +74,7 @@
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<flag>wxALIGN_CENTRE|wxLEFT|wxTOP</flag>
|
||||
<flag>wxALIGN_CENTRE|wxLEFT|wxTOP|wxFIXED_SIZE</flag>
|
||||
<border>5</border>
|
||||
<object class="wxTextCtrl" name="ID_StateField">
|
||||
<size>30,-1</size>
|
||||
@ -82,7 +82,7 @@
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem">
|
||||
<flag>wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxTOP</flag>
|
||||
<flag>wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxTOP|wxFIXED_SIZE</flag>
|
||||
<border>5</border>
|
||||
<object class="wxTextCtrl" name="ID_ZipField">
|
||||
<size>50,-1</size>
|
||||
|
@ -51,14 +51,14 @@ TICKS_DECIMAL = 16
|
||||
TICKS_ROMAN = 32
|
||||
|
||||
|
||||
class AnalogClockWindow(wx.Window):
|
||||
class AnalogClockWindow(wx.PyWindow):
|
||||
"""An analog clock window"""
|
||||
|
||||
def __init__(self, parent, ID=-1, pos=wx.DefaultPosition, size=wx.DefaultSize,
|
||||
style=0, name="clock"):
|
||||
|
||||
# Initialize the wxWindow...
|
||||
wx.Window.__init__(self, parent, ID, pos, size, style, name)
|
||||
wx.PyWindow.__init__(self, parent, ID, pos, size, style, name)
|
||||
|
||||
# Initialize some variables and defaults...
|
||||
self.clockStep = 1
|
||||
@ -124,6 +124,8 @@ class AnalogClockWindow(wx.Window):
|
||||
self.timer = wx.Timer(self)
|
||||
self.timer.Start(500)
|
||||
|
||||
def DoGetBestSize(self):
|
||||
return wx.Size(25,25)
|
||||
|
||||
def OnPaint(self, event):
|
||||
self._doDrawHands(wx.BufferedPaintDC(self), True)
|
||||
|
@ -33,12 +33,12 @@ class PyColourBox(wx.Panel):
|
||||
def __init__(self, parent, id, colour=(0, 0, 0), size=(25, 20)):
|
||||
"""Creates a new colour box instance and initializes the colour
|
||||
content."""
|
||||
wx.Panel.__init__(self, parent, id, size=size)
|
||||
wx.Panel.__init__(self, parent, id, size=size, style=wx.NO_BORDER)
|
||||
|
||||
self.colour_box = wx.Panel(self, -1, style=wx.SIMPLE_BORDER)
|
||||
self.colour_box = wx.Window(self, -1, style=wx.SIMPLE_BORDER)
|
||||
|
||||
sizer = wx.GridSizer(1, 1)
|
||||
sizer.Add(self.colour_box, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL)
|
||||
sizer.Add(self.colour_box, 0, wx.FIXED_SIZE | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL)
|
||||
sizer.SetItemMinSize(self.colour_box, size[0] - 5, size[1] - 5)
|
||||
self.SetAutoLayout(True)
|
||||
self.SetSizer(sizer)
|
||||
|
@ -202,9 +202,9 @@ class PyColourChooser(wx.Panel):
|
||||
self.ventry.SetSize((40, -1))
|
||||
hsvgrid = wx.FlexGridSizer(1, 6, 2, 2)
|
||||
hsvgrid.AddMany ([
|
||||
(hlabel, 0, wx.ALIGN_CENTER_VERTICAL), (self.hentry, 0, 0),
|
||||
(slabel, 0, wx.ALIGN_CENTER_VERTICAL), (self.sentry, 0, 0),
|
||||
(vlabel, 0, wx.ALIGN_CENTER_VERTICAL), (self.ventry, 0, 0),
|
||||
(hlabel, 0, wx.ALIGN_CENTER_VERTICAL), (self.hentry, 0, wx.FIXED_SIZE),
|
||||
(slabel, 0, wx.ALIGN_CENTER_VERTICAL), (self.sentry, 0, wx.FIXED_SIZE),
|
||||
(vlabel, 0, wx.ALIGN_CENTER_VERTICAL), (self.ventry, 0, wx.FIXED_SIZE),
|
||||
])
|
||||
|
||||
rlabel = wx.StaticText(self, -1, _("R:"))
|
||||
@ -218,9 +218,9 @@ class PyColourChooser(wx.Panel):
|
||||
self.bentry.SetSize((40, -1))
|
||||
lgrid = wx.FlexGridSizer(1, 6, 2, 2)
|
||||
lgrid.AddMany([
|
||||
(rlabel, 0, wx.ALIGN_CENTER_VERTICAL), (self.rentry, 0, 0),
|
||||
(glabel, 0, wx.ALIGN_CENTER_VERTICAL), (self.gentry, 0, 0),
|
||||
(blabel, 0, wx.ALIGN_CENTER_VERTICAL), (self.bentry, 0, 0),
|
||||
(rlabel, 0, wx.ALIGN_CENTER_VERTICAL), (self.rentry, 0, wx.FIXED_SIZE),
|
||||
(glabel, 0, wx.ALIGN_CENTER_VERTICAL), (self.gentry, 0, wx.FIXED_SIZE),
|
||||
(blabel, 0, wx.ALIGN_CENTER_VERTICAL), (self.bentry, 0, wx.FIXED_SIZE),
|
||||
])
|
||||
|
||||
gsizer = wx.GridSizer(2, 1)
|
||||
|
@ -37,7 +37,7 @@ class UpdateThrobberEvent(wx.PyEvent):
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
class Throbber(wx.Panel):
|
||||
class Throbber(wx.PyPanel):
|
||||
"""
|
||||
The first argument is either the name of a file that will be split into frames
|
||||
(a composite image) or a list of strings of image names that will be treated
|
||||
@ -60,7 +60,7 @@ class Throbber(wx.Panel):
|
||||
reverse = 0, # reverse direction at end of animation
|
||||
style = 0, # window style
|
||||
name = "throbber"):
|
||||
wx.Panel.__init__(self, parent, id, pos, size, style, name)
|
||||
wx.PyPanel.__init__(self, parent, id, pos, size, style, name)
|
||||
self.name = name
|
||||
self.label = label
|
||||
self.running = (1 != 1)
|
||||
@ -127,7 +127,11 @@ class Throbber(wx.Panel):
|
||||
self.Bind(wx.EVT_PAINT, self.OnPaint)
|
||||
self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer)
|
||||
self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroyWindow)
|
||||
|
||||
|
||||
|
||||
def DoGetBestSize(self):
|
||||
return (self.width, self.height)
|
||||
|
||||
|
||||
def OnTimer(self, event):
|
||||
wx.PostEvent(self, UpdateThrobberEvent())
|
||||
|
Loading…
Reference in New Issue
Block a user