Preferences for default "sizeritem" parameters for new panels and
controls can be configured ("File">"Preferences..."). Implemented comment object for including simple one-line comments and comment directives as tree nodes. No validation is performed for a valid XML string so comments must not contain "-->". Comment directive is a special comment starting with '%' character, followed by a line of python code. It is executed using 'exec' when the resource file is opened. This is useful to import plugin modules containing custom handlers which are specific to the resource file, hovewer this is of course a security hole if you use foreign XRC files. A warning is displayed if the preference option 'ask' is selected (by default). Added support for custom controls and plugin modules. Refer to this wxPythonWiki for the details: http://wiki.wxpython.org/index.cgi/XRCed#custom Tool panel sections can be collapsed/expanded by clicking on the label of a tool group. Some undo/redo and other fixes. Fixes for wxMSW (notebook highlighting, control sizes, tree Unselect). Notebook page highlighting fix. Highlight resizes when the window is resized. ParamUnit spin button detects event handler re-entry (wxGTK probably has a bug in wxSpinButton with repeated events). Fix for dealing with empty 'growable' property, using MiniFrame for properties panel, the panel is restored together with the main window. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@44949 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -87,11 +87,11 @@ class Tools(wx.Panel):
|
||||
|
||||
(ID_NEW.UNKNOWN, images.getToolUnknownBitmap())]
|
||||
]
|
||||
self.boxes = {}
|
||||
for grp in groups:
|
||||
self.AddGroup(grp[0])
|
||||
for b in grp[1:]:
|
||||
self.AddButton(b[0], b[1], g.pullDownMenu.createMap[b[0]])
|
||||
self.SetAutoLayout(True)
|
||||
self.SetSizerAndFit(self.sizer)
|
||||
# Allow to be resized in vertical direction only
|
||||
self.SetSizeHints(self.GetSize()[0], -1)
|
||||
@@ -114,13 +114,19 @@ class Tools(wx.Panel):
|
||||
|
||||
def AddGroup(self, name):
|
||||
# Each group is inside box
|
||||
box = wx.StaticBox(self, -1, name, style=wx.WANTS_CHARS)
|
||||
id = wx.NewId()
|
||||
box = wx.StaticBox(self, id, '[+] '+name, style=wx.WANTS_CHARS)
|
||||
box.show = True
|
||||
box.name = name
|
||||
box.gnum = len(self.groups)
|
||||
box.SetFont(g.smallerFont())
|
||||
box.Bind(wx.EVT_LEFT_DOWN, self.OnClickBox)
|
||||
boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
|
||||
boxSizer.Add((0, 4))
|
||||
self.boxes[id] = box
|
||||
self.curSizer = wx.GridSizer(0, 3)
|
||||
boxSizer.Add(self.curSizer)
|
||||
self.sizer.Add(boxSizer, 0, wx.TOP | wx.LEFT | wx.RIGHT, 4)
|
||||
self.sizer.Add(boxSizer, 0, wx.TOP | wx.LEFT | wx.RIGHT | wx.EXPAND, 4)
|
||||
self.groups.append((box,{}))
|
||||
|
||||
# Enable/disable group
|
||||
@@ -129,6 +135,12 @@ class Tools(wx.Panel):
|
||||
grp[0].Enable(enable)
|
||||
for b in grp[1].values(): b.Enable(enable)
|
||||
|
||||
# Show/hide group
|
||||
def ShowGroup(self, gnum, show = True):
|
||||
grp = self.groups[gnum]
|
||||
grp[0].show = show
|
||||
for b in grp[1].values(): b.Show(show)
|
||||
|
||||
# Enable/disable group item
|
||||
def EnableGroupItem(self, gnum, id, enable = True):
|
||||
grp = self.groups[gnum]
|
||||
@@ -140,6 +152,14 @@ class Tools(wx.Panel):
|
||||
for id in ids:
|
||||
grp[1][id].Enable(enable)
|
||||
|
||||
def OnClickBox(self, evt):
|
||||
box = self.boxes[evt.GetId()]
|
||||
# Collapse/restore static box, change label
|
||||
self.ShowGroup(box.gnum, not box.show)
|
||||
if box.show: box.SetLabel('[+] ' + box.name)
|
||||
else: box.SetLabel('[-] ' + box.name)
|
||||
self.Layout()
|
||||
|
||||
# Process key events
|
||||
def OnKeyDown(self, evt):
|
||||
if evt.GetKeyCode() == wx.WXK_CONTROL:
|
||||
|
Reference in New Issue
Block a user