* bugfixes for tree move operations and undo/redo
* Mac LnF ameliorations * some sizing/spacing changes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45870 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
c24937e4cc
commit
fa64a0c396
@ -70,7 +70,7 @@ class Panel(wx.Notebook):
|
||||
if g.conf.panic:
|
||||
topSizer.Add(sizer, 1, wx.EXPAND)
|
||||
else:
|
||||
topSizer.Add(sizer, 0, wx.ALL, 5)
|
||||
topSizer.Add(sizer, 1, wx.ALL, 5)
|
||||
return sizer
|
||||
|
||||
def SetData(self, xxx):
|
||||
@ -281,7 +281,7 @@ class PropPage(ParamPage):
|
||||
def __init__(self, parent, label, xxx):
|
||||
ParamPage.__init__(self, parent, xxx)
|
||||
self.box = wx.StaticBox(self, -1, label)
|
||||
self.box.SetFont(g.labelFont())
|
||||
#self.box.SetFont(g.labelFont())
|
||||
topSizer = wx.StaticBoxSizer(self.box, wx.VERTICAL)
|
||||
sizer = wx.FlexGridSizer(len(xxx.allParams), 2, 1, 5)
|
||||
sizer.AddGrowableCol(1)
|
||||
@ -370,7 +370,7 @@ class StylePage(ParamPage):
|
||||
def __init__(self, parent, label, xxx):
|
||||
ParamPage.__init__(self, parent, xxx)
|
||||
box = wx.StaticBox(self, -1, label)
|
||||
box.SetFont(g.labelFont())
|
||||
#box.SetFont(g.labelFont())
|
||||
topSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
|
||||
sizer = wx.FlexGridSizer(len(xxx.styles), 2, 1, 5)
|
||||
sizer.AddGrowableCol(1)
|
||||
|
@ -263,7 +263,7 @@ class ParamFont(PPanel):
|
||||
PPanel.OnChange(self, evt)
|
||||
self.textModified = True
|
||||
def _defaultValue(self):
|
||||
return [`g._sysFont.GetPointSize()`, 'default', 'normal', 'normal', '0', '', '']
|
||||
return [`g.sysFont().GetPointSize()`, 'default', 'normal', 'normal', '0', '', '']
|
||||
def GetValue(self):
|
||||
if self.textModified: # text has newer value
|
||||
try:
|
||||
@ -287,7 +287,7 @@ class ParamFont(PPanel):
|
||||
self.value = self._defaultValue()
|
||||
# Make initial font
|
||||
# Default values
|
||||
size = g._sysFont.GetPointSize()
|
||||
size = g.sysFont().GetPointSize()
|
||||
family = wx.DEFAULT
|
||||
style = weight = wx.NORMAL
|
||||
underlined = 0
|
||||
|
@ -56,7 +56,6 @@ class Tools(wx.Panel):
|
||||
(ID_NEW.STATIC_TEXT, images.getToolStaticTextBitmap()),
|
||||
(ID_NEW.STATIC_BITMAP, images.getToolStaticBitmapBitmap()),
|
||||
(ID_NEW.STATIC_LINE, images.getToolStaticLineBitmap()),
|
||||
|
||||
(ID_NEW.BUTTON, images.getToolButtonBitmap()),
|
||||
(ID_NEW.BITMAP_BUTTON, images.getToolBitmapButtonBitmap()),
|
||||
(ID_NEW.STATIC_BOX, images.getToolStaticBoxBitmap()),
|
||||
@ -102,7 +101,6 @@ class Tools(wx.Panel):
|
||||
# wxMSW does not generate click events for StaticBox
|
||||
if wx.Platform == '__WXMSW__':
|
||||
self.Bind(wx.EVT_LEFT_DOWN, self.OnClickBox)
|
||||
|
||||
self.drag = None
|
||||
|
||||
def AddButton(self, id, image, text):
|
||||
@ -129,9 +127,9 @@ class Tools(wx.Panel):
|
||||
box.gnum = len(self.groups)
|
||||
box.Bind(wx.EVT_LEFT_DOWN, self.OnClickBox)
|
||||
boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
|
||||
boxSizer.Add((0, 4))
|
||||
boxSizer.Add((0, 0))
|
||||
self.boxes[id] = box
|
||||
self.curSizer = wx.GridSizer(0, 3)
|
||||
self.curSizer = wx.GridSizer(0, 3, 3, 3)
|
||||
boxSizer.Add(self.curSizer)
|
||||
self.sizer.Add(boxSizer, 0, wx.TOP | wx.LEFT | wx.RIGHT | wx.EXPAND, 4)
|
||||
self.groups.append((box,{}))
|
||||
@ -139,7 +137,6 @@ class Tools(wx.Panel):
|
||||
# Enable/disable group
|
||||
def EnableGroup(self, gnum, enable = True):
|
||||
grp = self.groups[gnum]
|
||||
#grp[0].Enable(enable)
|
||||
for b in grp[1].values(): b.Enable(enable)
|
||||
|
||||
# Show/hide group
|
||||
@ -367,3 +364,4 @@ class Tools(wx.Panel):
|
||||
self.EnableGroupItem(GROUP_MENUS, ID_NEW.MENU_BAR)
|
||||
# Save state
|
||||
self.state = state
|
||||
self.Refresh()
|
||||
|
@ -1109,8 +1109,9 @@ class XML_Tree(wx.TreeCtrl):
|
||||
n = 0 # index of sibling
|
||||
prev = self.GetPrevSibling(item)
|
||||
while prev.IsOk():
|
||||
# MenuBar is not a child
|
||||
if not isinstance(self.GetPyData(prev), xxxMenuBar):
|
||||
# MenuBar and sizers are not real children (who else?)
|
||||
if not isinstance(self.GetPyData(prev), xxxMenuBar) and not \
|
||||
isinstance(self.GetPyData(prev), xxxSizer):
|
||||
n += 1
|
||||
prev = self.GetPrevSibling(prev)
|
||||
return n
|
||||
|
@ -210,6 +210,10 @@ class UndoMove:
|
||||
|
||||
selected = g.tree.InsertNode(self.oldParent, parent, elem, nextItem)
|
||||
g.tree.EnsureVisible(selected)
|
||||
# Highlight is outdated
|
||||
if g.testWin and g.testWin.highLight:
|
||||
g.testWin.highLight.Remove()
|
||||
g.tree.needUpdate = True
|
||||
g.tree.SelectItem(selected)
|
||||
def redo(self):
|
||||
item = g.tree.GetFirstChild(self.oldParent)[0]
|
||||
@ -248,6 +252,10 @@ class UndoMove:
|
||||
for i in range(self.newIndex): nextItem = g.tree.GetNextSibling(nextItem)
|
||||
selected = g.tree.InsertNode(self.newParent, parent, elem, nextItem)
|
||||
g.tree.EnsureVisible(selected)
|
||||
# Highlight is outdated
|
||||
if g.testWin and g.testWin.highLight:
|
||||
g.testWin.highLight.Remove()
|
||||
g.tree.needUpdate = True
|
||||
g.tree.SelectItem(selected)
|
||||
|
||||
class UndoEdit:
|
||||
|
@ -92,14 +92,29 @@ class Locator(wx.EvtHandler):
|
||||
def ProcessEvent(self, evt):
|
||||
print evt
|
||||
|
||||
class TaskBarIcon(wx.TaskBarIcon):
|
||||
def __init__(self, frame):
|
||||
wx.TaskBarIcon.__init__(self)
|
||||
self.frame = frame
|
||||
# Set the image
|
||||
self.SetIcon(images.getIconIcon(), "XRCed")
|
||||
|
||||
class Frame(wx.Frame):
|
||||
def __init__(self, pos, size):
|
||||
wx.Frame.__init__(self, None, -1, '', pos, size)
|
||||
pre = wx.PreFrame()
|
||||
# pre.SetExtraStyle(wx.FRAME_EX_METAL)
|
||||
pre.Create(None, -1, '', pos, size)
|
||||
self.PostCreate(pre)
|
||||
#wx.Frame.__init__(self, None, -1, '', pos, size)
|
||||
global frame
|
||||
frame = g.frame = self
|
||||
bar = self.CreateStatusBar(2)
|
||||
bar.SetStatusWidths([-1, 40])
|
||||
self.SetIcon(images.getIconIcon())
|
||||
try:
|
||||
self.tbicon = TaskBarIcon(self)
|
||||
except:
|
||||
self.tbicon = None
|
||||
|
||||
# Idle flag
|
||||
self.inIdle = False
|
||||
@ -156,7 +171,6 @@ class Frame(wx.Frame):
|
||||
self.ID_TOOL_PASTE = wx.NewId()
|
||||
menu.Append(self.ID_LOCATE, '&Locate\tCtrl-L', 'Locate control in test window and select it')
|
||||
menuBar.Append(menu, '&Edit')
|
||||
|
||||
menu = wx.Menu()
|
||||
self.ID_EMBED_PANEL = wx.NewId()
|
||||
menu.Append(self.ID_EMBED_PANEL, '&Embed Panel',
|
||||
@ -204,11 +218,12 @@ class Frame(wx.Frame):
|
||||
|
||||
# Create toolbar
|
||||
tb = self.CreateToolBar(wx.TB_HORIZONTAL | wx.NO_BORDER | wx.TB_FLAT)
|
||||
tb.SetToolBitmapSize((24,24))
|
||||
|
||||
# Hide some icons on Mac to reduce the toolbar size,
|
||||
# and comply more with the Apple LnF, besides
|
||||
# wxMac icons are ugly
|
||||
if wx.Platform != '__WXMAC__':
|
||||
tb.SetToolBitmapSize((24,24))
|
||||
new_bmp = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE, wx.ART_TOOLBAR)
|
||||
open_bmp = wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_TOOLBAR)
|
||||
save_bmp = wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE, wx.ART_TOOLBAR)
|
||||
@ -231,7 +246,7 @@ class Frame(wx.Frame):
|
||||
tb.AddSimpleTool(self.ID_TOOL_LOCATE,
|
||||
images.getLocateBitmap(), #images.getLocateArmedBitmap(),
|
||||
'Locate', 'Locate control in test window and select it', True)
|
||||
tb.AddControl(wx.StaticLine(tb, -1, size=(-1,23), style=wx.LI_VERTICAL))
|
||||
# tb.AddControl(wx.StaticLine(tb, -1, size=(-1,23), style=wx.LI_VERTICAL))
|
||||
tb.AddSimpleTool(self.ID_TEST, images.getTestBitmap(), 'Test', 'Test window')
|
||||
tb.AddSimpleTool(self.ID_REFRESH, images.getRefreshBitmap(),
|
||||
'Refresh', 'Refresh view')
|
||||
@ -343,7 +358,10 @@ class Frame(wx.Frame):
|
||||
sizer2.Add(panel, 1, wx.EXPAND)
|
||||
miniFrame.Show(True)
|
||||
splitter.Initialize(tree)
|
||||
sizer1.Add(splitter, 1, wx.EXPAND)
|
||||
if wx.Platform == '__WXMAC__':
|
||||
sizer1.Add(splitter, 1, wx.EXPAND|wx.RIGHT, 5)
|
||||
else:
|
||||
sizer1.Add(splitter, 1, wx.EXPAND)
|
||||
sizer.Add(sizer1, 1, wx.EXPAND)
|
||||
self.SetAutoLayout(True)
|
||||
self.SetSizer(sizer)
|
||||
@ -763,10 +781,9 @@ class Frame(wx.Frame):
|
||||
# Check compatibility
|
||||
if not self.ItemsAreCompatible(tree.GetPyData(pparent).treeObject(), tree.GetPyData(selected).treeObject()): return
|
||||
|
||||
# Remove highlight, update testWin
|
||||
if g.testWin and g.testWin.highLight:
|
||||
g.testWin.highLight.Remove()
|
||||
tree.needUpdate = True
|
||||
tree.needUpdate = True
|
||||
|
||||
# Undo info
|
||||
self.lastOp = 'MOVELEFT'
|
||||
@ -807,7 +824,6 @@ class Frame(wx.Frame):
|
||||
|
||||
selected = tree.InsertNode(pparent, tree.GetPyData(pparent).treeObject(), elem, nextItem)
|
||||
newIndex = tree.ItemIndex(selected)
|
||||
tree.oldItem = None
|
||||
tree.SelectItem(selected)
|
||||
|
||||
undoMan.RegisterUndo(UndoMove(oldParent, oldIndex, pparent, newIndex))
|
||||
@ -833,7 +849,7 @@ class Frame(wx.Frame):
|
||||
# Remove highlight, update testWin
|
||||
if g.testWin and g.testWin.highLight:
|
||||
g.testWin.highLight.Remove()
|
||||
tree.needUpdate = True
|
||||
tree.needUpdate = True
|
||||
|
||||
# Undo info
|
||||
self.lastOp = 'MOVERIGHT'
|
||||
@ -871,7 +887,6 @@ class Frame(wx.Frame):
|
||||
selected = tree.InsertNode(newParent, tree.GetPyData(newParent).treeObject(), elem, wx.TreeItemId())
|
||||
|
||||
newIndex = tree.ItemIndex(selected)
|
||||
tree.oldItem = None
|
||||
tree.SelectItem(selected)
|
||||
|
||||
undoMan.RegisterUndo(UndoMove(oldParent, oldIndex, newParent, newIndex))
|
||||
@ -1324,8 +1339,11 @@ Homepage: http://xrced.sourceforge.net\
|
||||
menuId = evt.GetMenuId()
|
||||
if menuId != -1:
|
||||
menu = evt.GetEventObject()
|
||||
help = menu.GetHelpString(menuId)
|
||||
self.SetStatusText(help)
|
||||
try:
|
||||
help = menu.GetHelpString(menuId)
|
||||
self.SetStatusText(help)
|
||||
except:
|
||||
self.SetStatusText('')
|
||||
else:
|
||||
self.SetStatusText('')
|
||||
|
||||
@ -1346,6 +1364,7 @@ Homepage: http://xrced.sourceforge.net\
|
||||
def OnIdle(self, evt):
|
||||
if self.inIdle: return # Recursive call protection
|
||||
self.inIdle = True
|
||||
#print 'onidle',tree.needUpdate,tree.pendingHighLight
|
||||
try:
|
||||
if tree.needUpdate:
|
||||
if conf.autoRefresh:
|
||||
|
Loading…
Reference in New Issue
Block a user