def copy(files): """\ Returns True on success, False otherwise. """ global _cornice_cutting _cornice_cutting = False if wx.TheClipboard.Open(): try: cdo = wx.DataObjectComposite() fdo = wx.FileDataObject() for f in files: fdo.AddFile(f) cdo.Add(fdo) cdo.Add(wx.DataObjectSimple(_cornice_marker_format)) if not wx.TheClipboard.SetData(cdo): print(_("Data can't be copied to the clipboard.")) return False return True finally: wx.TheClipboard.Close() else: print(_("The clipboard can't be opened.")) return False
def test_DataObjectSimple1(self): df = wx.DataFormat(wx.DF_TEXT) dobj = wx.DataObjectSimple(df) self.assertTrue(dobj.GetFormatCount() == 1) self.assertTrue(dobj.GetFormat() == df) self.assertTrue(dobj.GetAllFormats()[0] == df)