else:
self.values = []
ParamBinaryOr.__init__(self, parent, name)
- self.SetTitle('Extended window styles')
class ParamColour(PPanel):
def __init__(self, parent, name):
################################################################################
-# Mapping from wx constants ro XML strings
+# Mapping from wx constants to XML strings
fontFamiliesWx2Xml = {wxDEFAULT: 'default', wxDECORATIVE: 'decorative',
wxROMAN: 'roman', wxSCRIPT: 'script', wxSWISS: 'swiss',
wxMODERN: 'modern'}
(ID_NEW.SPLITTER_WINDOW, 'SplitterWindow', 'Create splitter window'),
(ID_NEW.TOOL_BAR, 'ToolBar', 'Create toolbar'),
(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_SIMPLE, 'WizardPageSimple', 'Create simple wizard page'),
],
m.Enable(m.FindItem('sizer'), False)
elif not (xxx.isSizer or xxx.parent and xxx.parent.isSizer):
m.Enable(ID_NEW.SPACER, False)
+ if xxx.__class__ is not xxxFrame:
+ m.Enable(ID_NEW.MENU_BAR, False)
m.AppendSeparator()
m.Append(ID_NEW.REF, 'reference...', 'Create object_ref node')
# Select correct label for create menu
self.res = wxXmlResource('')
# !!! Blocking of assert failure occurring in older unicode builds
try:
+ quietlog = wx.LogNull()
self.res.Load(os.path.join(basePath, 'xrced.xrc'))
except wx._core.PyAssertionError:
print 'PyAssertionError was ignored'
selected = tree.selection
if not selected: return # key pressed event
xxx = tree.GetPyData(selected)
- wx.TheClipboard.Open()
- data = wx.CustomDataObject('XRCED')
- data.SetData(cPickle.dumps(xxx.element.toxml()))
- wx.TheClipboard.SetData(data)
- wx.TheClipboard.Close()
- self.SetStatusText('Copied')
+ if wx.TheClipboard.Open():
+ data = wx.CustomDataObject('XRCED')
+ data.SetData(cPickle.dumps(xxx.element.toxml()))
+ wx.TheClipboard.SetData(data)
+ wx.TheClipboard.Close()
+ self.SetStatusText('Copied')
+ else:
+ wx.MessageBox("Unable to open the clipboard", "Error")
def OnPaste(self, evt):
selected = tree.selection
parent = tree.GetPyData(parentLeaf).treeObject()
# Create a copy of clipboard pickled element
- wx.TheClipboard.Open()
- data = wx.CustomDataObject('XRCED')
- if not wx.TheClipboard.IsSupported(data.GetFormat()):
+ success = False
+ if wx.TheClipboard.Open():
+ data = wx.CustomDataObject('XRCED')
+ if wx.TheClipboard.IsSupported(data.GetFormat()):
+ success = wx.TheClipboard.GetData(data)
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
- wx.TheClipboard.GetData(data)
- wx.TheClipboard.Close()
+
xml = cPickle.loads(data.GetData()) # xml representation of element
elem = minidom.parseString(xml).childNodes[0]
# Tempopary xxx object to test things
self.SetModified()
self.SetStatusText('Pasted')
+
def OnCutDelete(self, evt):
selected = tree.selection
if not selected: return # key pressed event
elem = tree.RemoveLeaf(selected)
undoMan.RegisterUndo(UndoCutDelete(index, parent, elem))
if evt.GetId() == wxID_CUT:
- wx.TheClipboard.Open()
- data = wx.CustomDataObject('XRCED')
- data.SetData(cPickle.dumps(elem.toxml()))
- wx.TheClipboard.SetData(data)
- wx.TheClipboard.Close()
+ if wx.TheClipboard.Open():
+ data = wx.CustomDataObject('XRCED')
+ data.SetData(cPickle.dumps(elem.toxml()))
+ wx.TheClipboard.SetData(data)
+ wx.TheClipboard.Close()
+ else:
+ wx.MessageBox("Unable to open the clipboard", "Error")
tree.pendingHighLight = None
tree.UnselectAll()
tree.selection = None
'Save before too late?', flags )
say = dlg.ShowModal()
dlg.Destroy()
+ wxYield()
if say == wxID_YES:
self.OnSaveOrSaveAs(wxCommandEvent(wxID_SAVE))
# If save was successful, modified flag is unset
conf.panic = not conf.HasEntry('nopanic')
# Add handlers
wxFileSystem_AddHandler(wxMemoryFSHandler())
- wxInitAllImageHandlers()
# Create main frame
frame = Frame(pos, size)
frame.Show(True)