* wx.Panel doesn't have a SetTitle anymore. What was this used for
anyway? * Allow wxMenuBar to be created inside a wxFrame * More robust clipboard handling git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38324 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -187,7 +187,6 @@ class ParamExStyle(ParamBinaryOr):
|
|||||||
else:
|
else:
|
||||||
self.values = []
|
self.values = []
|
||||||
ParamBinaryOr.__init__(self, parent, name)
|
ParamBinaryOr.__init__(self, parent, name)
|
||||||
self.SetTitle('Extended window styles')
|
|
||||||
|
|
||||||
class ParamColour(PPanel):
|
class ParamColour(PPanel):
|
||||||
def __init__(self, parent, name):
|
def __init__(self, parent, name):
|
||||||
@@ -234,7 +233,7 @@ class ParamColour(PPanel):
|
|||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
# Mapping from wx constants ro XML strings
|
# Mapping from wx constants to XML strings
|
||||||
fontFamiliesWx2Xml = {wxDEFAULT: 'default', wxDECORATIVE: 'decorative',
|
fontFamiliesWx2Xml = {wxDEFAULT: 'default', wxDECORATIVE: 'decorative',
|
||||||
wxROMAN: 'roman', wxSCRIPT: 'script', wxSWISS: 'swiss',
|
wxROMAN: 'roman', wxSCRIPT: 'script', wxSWISS: 'swiss',
|
||||||
wxMODERN: 'modern'}
|
wxMODERN: 'modern'}
|
||||||
|
@@ -285,5 +285,7 @@ class Tools(wxPanel):
|
|||||||
self.EnableGroup(GROUP_SIZERS)
|
self.EnableGroup(GROUP_SIZERS)
|
||||||
if not (xxx.isSizer or xxx.parent and xxx.parent.isSizer):
|
if not (xxx.isSizer or xxx.parent and xxx.parent.isSizer):
|
||||||
self.EnableGroupItem(GROUP_SIZERS, ID_NEW.SPACER, False)
|
self.EnableGroupItem(GROUP_SIZERS, ID_NEW.SPACER, False)
|
||||||
|
if xxx.__class__ == xxxFrame:
|
||||||
|
self.EnableGroupItem(GROUP_MENUS, ID_NEW.MENU_BAR)
|
||||||
# Save state
|
# Save state
|
||||||
self.state = state
|
self.state = state
|
||||||
|
@@ -298,6 +298,7 @@ class PullDownMenu:
|
|||||||
(ID_NEW.SPLITTER_WINDOW, 'SplitterWindow', 'Create splitter window'),
|
(ID_NEW.SPLITTER_WINDOW, 'SplitterWindow', 'Create splitter window'),
|
||||||
(ID_NEW.TOOL_BAR, 'ToolBar', 'Create toolbar'),
|
(ID_NEW.TOOL_BAR, 'ToolBar', 'Create toolbar'),
|
||||||
(ID_NEW.STATUS_BAR, 'StatusBar', 'Create status bar'),
|
(ID_NEW.STATUS_BAR, 'StatusBar', 'Create status bar'),
|
||||||
|
(ID_NEW.MENU_BAR, 'MenuBar', 'Create menubar'),
|
||||||
# (ID_NEW.WIZARD_PAGE, 'Wizard Page', 'Create wizard page'),
|
# (ID_NEW.WIZARD_PAGE, 'Wizard Page', 'Create wizard page'),
|
||||||
(ID_NEW.WIZARD_PAGE_SIMPLE, 'WizardPageSimple', 'Create simple wizard page'),
|
(ID_NEW.WIZARD_PAGE_SIMPLE, 'WizardPageSimple', 'Create simple wizard page'),
|
||||||
],
|
],
|
||||||
@@ -1070,6 +1071,8 @@ class XML_Tree(wxTreeCtrl):
|
|||||||
m.Enable(m.FindItem('sizer'), False)
|
m.Enable(m.FindItem('sizer'), False)
|
||||||
elif not (xxx.isSizer or xxx.parent and xxx.parent.isSizer):
|
elif not (xxx.isSizer or xxx.parent and xxx.parent.isSizer):
|
||||||
m.Enable(ID_NEW.SPACER, False)
|
m.Enable(ID_NEW.SPACER, False)
|
||||||
|
if xxx.__class__ is not xxxFrame:
|
||||||
|
m.Enable(ID_NEW.MENU_BAR, False)
|
||||||
m.AppendSeparator()
|
m.AppendSeparator()
|
||||||
m.Append(ID_NEW.REF, 'reference...', 'Create object_ref node')
|
m.Append(ID_NEW.REF, 'reference...', 'Create object_ref node')
|
||||||
# Select correct label for create menu
|
# Select correct label for create menu
|
||||||
|
@@ -103,6 +103,7 @@ class Frame(wxFrame):
|
|||||||
self.res = wxXmlResource('')
|
self.res = wxXmlResource('')
|
||||||
# !!! Blocking of assert failure occurring in older unicode builds
|
# !!! Blocking of assert failure occurring in older unicode builds
|
||||||
try:
|
try:
|
||||||
|
quietlog = wx.LogNull()
|
||||||
self.res.Load(os.path.join(basePath, 'xrced.xrc'))
|
self.res.Load(os.path.join(basePath, 'xrced.xrc'))
|
||||||
except wx._core.PyAssertionError:
|
except wx._core.PyAssertionError:
|
||||||
print 'PyAssertionError was ignored'
|
print 'PyAssertionError was ignored'
|
||||||
@@ -413,12 +414,14 @@ class Frame(wxFrame):
|
|||||||
selected = tree.selection
|
selected = tree.selection
|
||||||
if not selected: return # key pressed event
|
if not selected: return # key pressed event
|
||||||
xxx = tree.GetPyData(selected)
|
xxx = tree.GetPyData(selected)
|
||||||
wx.TheClipboard.Open()
|
if wx.TheClipboard.Open():
|
||||||
data = wx.CustomDataObject('XRCED')
|
data = wx.CustomDataObject('XRCED')
|
||||||
data.SetData(cPickle.dumps(xxx.element.toxml()))
|
data.SetData(cPickle.dumps(xxx.element.toxml()))
|
||||||
wx.TheClipboard.SetData(data)
|
wx.TheClipboard.SetData(data)
|
||||||
wx.TheClipboard.Close()
|
wx.TheClipboard.Close()
|
||||||
self.SetStatusText('Copied')
|
self.SetStatusText('Copied')
|
||||||
|
else:
|
||||||
|
wx.MessageBox("Unable to open the clipboard", "Error")
|
||||||
|
|
||||||
def OnPaste(self, evt):
|
def OnPaste(self, evt):
|
||||||
selected = tree.selection
|
selected = tree.selection
|
||||||
@@ -447,14 +450,19 @@ class Frame(wxFrame):
|
|||||||
parent = tree.GetPyData(parentLeaf).treeObject()
|
parent = tree.GetPyData(parentLeaf).treeObject()
|
||||||
|
|
||||||
# Create a copy of clipboard pickled element
|
# Create a copy of clipboard pickled element
|
||||||
wx.TheClipboard.Open()
|
success = False
|
||||||
data = wx.CustomDataObject('XRCED')
|
if wx.TheClipboard.Open():
|
||||||
if not wx.TheClipboard.IsSupported(data.GetFormat()):
|
data = wx.CustomDataObject('XRCED')
|
||||||
|
if wx.TheClipboard.IsSupported(data.GetFormat()):
|
||||||
|
success = wx.TheClipboard.GetData(data)
|
||||||
wx.TheClipboard.Close()
|
wx.TheClipboard.Close()
|
||||||
wx.LogError('unsupported clipboard format')
|
|
||||||
|
if not success:
|
||||||
|
wx.MessageBox(
|
||||||
|
"There is no data in the clipboard in the required format",
|
||||||
|
"Error")
|
||||||
return
|
return
|
||||||
wx.TheClipboard.GetData(data)
|
|
||||||
wx.TheClipboard.Close()
|
|
||||||
xml = cPickle.loads(data.GetData()) # xml representation of element
|
xml = cPickle.loads(data.GetData()) # xml representation of element
|
||||||
elem = minidom.parseString(xml).childNodes[0]
|
elem = minidom.parseString(xml).childNodes[0]
|
||||||
# Tempopary xxx object to test things
|
# Tempopary xxx object to test things
|
||||||
@@ -549,6 +557,7 @@ class Frame(wxFrame):
|
|||||||
self.SetModified()
|
self.SetModified()
|
||||||
self.SetStatusText('Pasted')
|
self.SetStatusText('Pasted')
|
||||||
|
|
||||||
|
|
||||||
def OnCutDelete(self, evt):
|
def OnCutDelete(self, evt):
|
||||||
selected = tree.selection
|
selected = tree.selection
|
||||||
if not selected: return # key pressed event
|
if not selected: return # key pressed event
|
||||||
@@ -577,11 +586,13 @@ class Frame(wxFrame):
|
|||||||
elem = tree.RemoveLeaf(selected)
|
elem = tree.RemoveLeaf(selected)
|
||||||
undoMan.RegisterUndo(UndoCutDelete(index, parent, elem))
|
undoMan.RegisterUndo(UndoCutDelete(index, parent, elem))
|
||||||
if evt.GetId() == wxID_CUT:
|
if evt.GetId() == wxID_CUT:
|
||||||
wx.TheClipboard.Open()
|
if wx.TheClipboard.Open():
|
||||||
data = wx.CustomDataObject('XRCED')
|
data = wx.CustomDataObject('XRCED')
|
||||||
data.SetData(cPickle.dumps(elem.toxml()))
|
data.SetData(cPickle.dumps(elem.toxml()))
|
||||||
wx.TheClipboard.SetData(data)
|
wx.TheClipboard.SetData(data)
|
||||||
wx.TheClipboard.Close()
|
wx.TheClipboard.Close()
|
||||||
|
else:
|
||||||
|
wx.MessageBox("Unable to open the clipboard", "Error")
|
||||||
tree.pendingHighLight = None
|
tree.pendingHighLight = None
|
||||||
tree.UnselectAll()
|
tree.UnselectAll()
|
||||||
tree.selection = None
|
tree.selection = None
|
||||||
@@ -1141,6 +1152,7 @@ Homepage: http://xrced.sourceforge.net\
|
|||||||
'Save before too late?', flags )
|
'Save before too late?', flags )
|
||||||
say = dlg.ShowModal()
|
say = dlg.ShowModal()
|
||||||
dlg.Destroy()
|
dlg.Destroy()
|
||||||
|
wxYield()
|
||||||
if say == wxID_YES:
|
if say == wxID_YES:
|
||||||
self.OnSaveOrSaveAs(wxCommandEvent(wxID_SAVE))
|
self.OnSaveOrSaveAs(wxCommandEvent(wxID_SAVE))
|
||||||
# If save was successful, modified flag is unset
|
# If save was successful, modified flag is unset
|
||||||
@@ -1213,7 +1225,6 @@ Please upgrade wxWindows to %d.%d.%d or higher.''' % MinWxVersion)
|
|||||||
conf.panic = not conf.HasEntry('nopanic')
|
conf.panic = not conf.HasEntry('nopanic')
|
||||||
# Add handlers
|
# Add handlers
|
||||||
wxFileSystem_AddHandler(wxMemoryFSHandler())
|
wxFileSystem_AddHandler(wxMemoryFSHandler())
|
||||||
wxInitAllImageHandlers()
|
|
||||||
# Create main frame
|
# Create main frame
|
||||||
frame = Frame(pos, size)
|
frame = Frame(pos, size)
|
||||||
frame.Show(True)
|
frame.Show(True)
|
||||||
|
Reference in New Issue
Block a user