📄 aui_dockingwindowmgr.py
字号:
self._sash_color = wx.BitmapButton(self, ID_SashColor, b, wx.DefaultPosition, wx.Size(50,25))
s5.Add((1, 1), 1, wx.EXPAND)
s5.Add(wx.StaticText(self, -1, "Sash Color:"))
s5.Add(self._sash_color)
s5.Add((1, 1), 1, wx.EXPAND)
s5.SetItemMinSize(1, (180, 20))
s6 = wx.BoxSizer(wx.HORIZONTAL)
self._inactive_caption_color = wx.BitmapButton(self, ID_InactiveCaptionColor, b,
wx.DefaultPosition, wx.Size(50,25))
s6.Add((1, 1), 1, wx.EXPAND)
s6.Add(wx.StaticText(self, -1, "Normal Caption:"))
s6.Add(self._inactive_caption_color)
s6.Add((1, 1), 1, wx.EXPAND)
s6.SetItemMinSize(1, (180, 20))
s7 = wx.BoxSizer(wx.HORIZONTAL)
self._inactive_caption_gradient_color = wx.BitmapButton(self, ID_InactiveCaptionGradientColor,
b, wx.DefaultPosition, wx.Size(50,25))
s7.Add((1, 1), 1, wx.EXPAND)
s7.Add(wx.StaticText(self, -1, "Normal Caption Gradient:"))
s7.Add(self._inactive_caption_gradient_color)
s7.Add((1, 1), 1, wx.EXPAND)
s7.SetItemMinSize(1, (180, 20))
s8 = wx.BoxSizer(wx.HORIZONTAL)
self._inactive_caption_text_color = wx.BitmapButton(self, ID_InactiveCaptionTextColor, b,
wx.DefaultPosition, wx.Size(50,25))
s8.Add((1, 1), 1, wx.EXPAND)
s8.Add(wx.StaticText(self, -1, "Normal Caption Text:"))
s8.Add(self._inactive_caption_text_color)
s8.Add((1, 1), 1, wx.EXPAND)
s8.SetItemMinSize(1, (180, 20))
s9 = wx.BoxSizer(wx.HORIZONTAL)
self._active_caption_color = wx.BitmapButton(self, ID_ActiveCaptionColor, b,
wx.DefaultPosition, wx.Size(50,25))
s9.Add((1, 1), 1, wx.EXPAND)
s9.Add(wx.StaticText(self, -1, "Active Caption:"))
s9.Add(self._active_caption_color)
s9.Add((1, 1), 1, wx.EXPAND)
s9.SetItemMinSize(1, (180, 20))
s10 = wx.BoxSizer(wx.HORIZONTAL)
self._active_caption_gradient_color = wx.BitmapButton(self, ID_ActiveCaptionGradientColor,
b, wx.DefaultPosition, wx.Size(50,25))
s10.Add((1, 1), 1, wx.EXPAND)
s10.Add(wx.StaticText(self, -1, "Active Caption Gradient:"))
s10.Add(self._active_caption_gradient_color)
s10.Add((1, 1), 1, wx.EXPAND)
s10.SetItemMinSize(1, (180, 20))
s11 = wx.BoxSizer(wx.HORIZONTAL)
self._active_caption_text_color = wx.BitmapButton(self, ID_ActiveCaptionTextColor,
b, wx.DefaultPosition, wx.Size(50,25))
s11.Add((1, 1), 1, wx.EXPAND)
s11.Add(wx.StaticText(self, -1, "Active Caption Text:"))
s11.Add(self._active_caption_text_color)
s11.Add((1, 1), 1, wx.EXPAND)
s11.SetItemMinSize(1, (180, 20))
s12 = wx.BoxSizer(wx.HORIZONTAL)
self._border_color = wx.BitmapButton(self, ID_BorderColor, b, wx.DefaultPosition,
wx.Size(50,25))
s12.Add((1, 1), 1, wx.EXPAND)
s12.Add(wx.StaticText(self, -1, "Border Color:"))
s12.Add(self._border_color)
s12.Add((1, 1), 1, wx.EXPAND)
s12.SetItemMinSize(1, (180, 20))
s13 = wx.BoxSizer(wx.HORIZONTAL)
self._gripper_color = wx.BitmapButton(self, ID_GripperColor, b, wx.DefaultPosition,
wx.Size(50,25))
s13.Add((1, 1), 1, wx.EXPAND)
s13.Add(wx.StaticText(self, -1, "Gripper Color:"))
s13.Add(self._gripper_color)
s13.Add((1, 1), 1, wx.EXPAND)
s13.SetItemMinSize(1, (180, 20))
grid_sizer = wx.GridSizer(0, 2)
grid_sizer.SetHGap(5)
grid_sizer.Add(s1)
grid_sizer.Add(s4)
grid_sizer.Add(s2)
grid_sizer.Add(s5)
grid_sizer.Add(s3)
grid_sizer.Add(s13)
grid_sizer.Add((1, 1))
grid_sizer.Add(s12)
grid_sizer.Add(s6)
grid_sizer.Add(s9)
grid_sizer.Add(s7)
grid_sizer.Add(s10)
grid_sizer.Add(s8)
grid_sizer.Add(s11)
cont_sizer = wx.BoxSizer(wx.VERTICAL)
cont_sizer.Add(grid_sizer, 1, wx.EXPAND | wx.ALL, 5)
self.SetSizer(cont_sizer)
self.GetSizer().SetSizeHints(self)
self._border_size.SetValue(frame.GetDockArt().GetMetric(wx.aui.AUI_DOCKART_PANE_BORDER_SIZE))
self._sash_size.SetValue(frame.GetDockArt().GetMetric(wx.aui.AUI_DOCKART_SASH_SIZE))
self._caption_size.SetValue(frame.GetDockArt().GetMetric(wx.aui.AUI_DOCKART_CAPTION_SIZE))
self.UpdateColors()
self.Bind(wx.EVT_SPINCTRL, self.OnPaneBorderSize, id=ID_PaneBorderSize)
self.Bind(wx.EVT_SPINCTRL, self.OnSashSize, id=ID_SashSize)
self.Bind(wx.EVT_SPINCTRL, self.OnCaptionSize, id=ID_CaptionSize)
self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_BackgroundColor)
self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_SashColor)
self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_InactiveCaptionColor)
self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_InactiveCaptionGradientColor)
self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_InactiveCaptionTextColor)
self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_ActiveCaptionColor)
self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_ActiveCaptionGradientColor)
self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_ActiveCaptionTextColor)
self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_BorderColor)
self.Bind(wx.EVT_BUTTON, self.OnSetColor, id=ID_GripperColor)
def CreateColorBitmap(self, c):
image = wx.EmptyImage(25, 14)
for x in xrange(25):
for y in xrange(14):
pixcol = c
if x == 0 or x == 24 or y == 0 or y == 13:
pixcol = wx.BLACK
image.SetRGB(x, y, pixcol.Red(), pixcol.Green(), pixcol.Blue())
return image.ConvertToBitmap()
def UpdateColors(self):
bk = self._frame.GetDockArt().GetColour(wx.aui.AUI_DOCKART_BACKGROUND_COLOUR)
self._background_color.SetBitmapLabel(self.CreateColorBitmap(bk))
cap = self._frame.GetDockArt().GetColour(wx.aui.AUI_DOCKART_INACTIVE_CAPTION_COLOUR)
self._inactive_caption_color.SetBitmapLabel(self.CreateColorBitmap(cap))
capgrad = self._frame.GetDockArt().GetColour(wx.aui.AUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR)
self._inactive_caption_gradient_color.SetBitmapLabel(self.CreateColorBitmap(capgrad))
captxt = self._frame.GetDockArt().GetColour(wx.aui.AUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR)
self._inactive_caption_text_color.SetBitmapLabel(self.CreateColorBitmap(captxt))
acap = self._frame.GetDockArt().GetColour(wx.aui.AUI_DOCKART_ACTIVE_CAPTION_COLOUR)
self._active_caption_color.SetBitmapLabel(self.CreateColorBitmap(acap))
acapgrad = self._frame.GetDockArt().GetColour(wx.aui.AUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR)
self._active_caption_gradient_color.SetBitmapLabel(self.CreateColorBitmap(acapgrad))
acaptxt = self._frame.GetDockArt().GetColour(wx.aui.AUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR)
self._active_caption_text_color.SetBitmapLabel(self.CreateColorBitmap(acaptxt))
sash = self._frame.GetDockArt().GetColour(wx.aui.AUI_DOCKART_SASH_COLOUR)
self._sash_color.SetBitmapLabel(self.CreateColorBitmap(sash))
border = self._frame.GetDockArt().GetColour(wx.aui.AUI_DOCKART_BORDER_COLOUR)
self._border_color.SetBitmapLabel(self.CreateColorBitmap(border))
gripper = self._frame.GetDockArt().GetColour(wx.aui.AUI_DOCKART_GRIPPER_COLOUR)
self._gripper_color.SetBitmapLabel(self.CreateColorBitmap(gripper))
def OnPaneBorderSize(self, event):
self._frame.GetDockArt().SetMetric(wx.aui.AUI_DOCKART_PANE_BORDER_SIZE,
event.GetInt())
self._frame.DoUpdate()
def OnSashSize(self, event):
self._frame.GetDockArt().SetMetric(wx.aui.AUI_DOCKART_SASH_SIZE,
event.GetInt())
self._frame.DoUpdate()
def OnCaptionSize(self, event):
self._frame.GetDockArt().SetMetric(wx.aui.AUI_DOCKART_CAPTION_SIZE,
event.GetInt())
self._frame.DoUpdate()
def OnSetColor(self, event):
dlg = wx.ColourDialog(self._frame)
dlg.SetTitle("Color Picker")
if dlg.ShowModal() != wx.ID_OK:
return
var = 0
if event.GetId() == ID_BackgroundColor:
var = wx.aui.AUI_DOCKART_BACKGROUND_COLOUR
elif event.GetId() == ID_SashColor:
var = wx.aui.AUI_DOCKART_SASH_COLOUR
elif event.GetId() == ID_InactiveCaptionColor:
var = wx.aui.AUI_DOCKART_INACTIVE_CAPTION_COLOUR
elif event.GetId() == ID_InactiveCaptionGradientColor:
var = wx.aui.AUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR
elif event.GetId() == ID_InactiveCaptionTextColor:
var = wx.aui.AUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR
elif event.GetId() == ID_ActiveCaptionColor:
var = wx.aui.AUI_DOCKART_ACTIVE_CAPTION_COLOUR
elif event.GetId() == ID_ActiveCaptionGradientColor:
var = wx.aui.AUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR
elif event.GetId() == ID_ActiveCaptionTextColor:
var = wx.aui.AUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR
elif event.GetId() == ID_BorderColor:
var = wx.aui.AUI_DOCKART_BORDER_COLOUR
elif event.GetId() == ID_GripperColor:
var = wx.aui.AUI_DOCKART_GRIPPER_COLOUR
else:
return
self._frame.GetDockArt().SetColor(var, dlg.GetColourData().GetColour())
self._frame.DoUpdate()
self.UpdateColors()
#----------------------------------------------------------------------
class TestPanel(wx.Panel):
def __init__(self, parent, log):
self.log = log
wx.Panel.__init__(self, parent, -1)
b = wx.Button(self, -1, "Show the wx.aui Demo Frame", (50,50))
self.Bind(wx.EVT_BUTTON, self.OnButton, b)
def OnButton(self, evt):
frame = PyAUIFrame(self, wx.ID_ANY, "wx.aui wxPython Demo", size=(750, 590))
frame.Show()
#----------------------------------------------------------------------
def runTest(frame, nb, log):
win = TestPanel(nb, log)
return win
#----------------------------------------------------------------------
overview = """\
<html><body>
<h3>wx.aui, the Advanced User Interface module</h3>
<br/><b>Overview</b><br/>
<p>wx.aui is an Advanced User Interface library for the wxWidgets toolkit
that allows developers to create high-quality, cross-platform user
interfaces quickly and easily.</p>
<p><b>Features</b></p>
<p>With wx.aui developers can create application frameworks with:</p>
<ul>
<li>Native, dockable floating frames</li>
<li>Perspective saving and loading</li>
<li>Native toolbars incorporating real-time, "spring-loaded" dragging</li>
<li>Customizable floating/docking behavior</li>
<li>Completely customizable look-and-feel</li>
<li>Optional transparent window effects (while dragging or docking)</li>
</ul>
</body></html>
"""
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -