;ò ɉ$Dc@s3dkZeiƒZeiƒZeiƒZdeifd„ƒYZdeifd„ƒYZdei fd„ƒYZ dei fd„ƒYZ d eifd „ƒYZ d eifd „ƒYZd „ZdZedjoPdkZdkZdkZeideiieidƒgeidƒndS(Ns ClipTextPanelcBs,tZd„Zd„Zd„Zd„ZRS(NcCsÈtii||dƒ||_titiƒ}|i ti |ddƒdti ti Bdƒti |dddtitiBƒ|_|i |idti ƒtitiƒ}|i ti|tdƒdti ti Bdƒ|i ti|td ƒdti ti Bdƒ|i |dti ƒ|i ti|td ƒdti ti Bdƒ|iti|id tƒ|iti|id tƒ|iti|id tƒ|itƒ|i|ƒdS( Niÿÿÿÿs2Copy/Paste text to/from this window and other appsiissstyleis Copy s Paste s Copy Bitmap sid(swxsPanels__init__sselfsparentslogsBoxSizersVERTICALssizersAdds StaticTextsEXPANDsALLsTextCtrls TE_MULTILINEsHSCROLLstexts HORIZONTALshszsButtons ID_CopyBtns ID_PasteBtns ID_BitmapBtnsBinds EVT_BUTTONsOnCopysOnPastes OnCopyBitmaps SetAutoLayoutsTruesSetSizer(sselfsparentslogssizershsz((sk/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/DragAndDrop.pys__init__ s$ (// cCsptiƒ|_|ii|iiƒƒtiiƒo$tii |iƒtii ƒnti ddƒdS(NsUnable to open the clipboardsError( swxsTextDataObjectsselfsdosSetTextstextsGetValues TheClipboardsOpensSetDatasCloses MessageBox(sselfsevt((sk/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/DragAndDrop.pysOnCopy0s cCszt}tiƒ}tiiƒo#tii|ƒ}tiiƒn|o|i i |i ƒƒnti ddƒdS(Ns8There is no data in the clipboard in the required formatsError(sFalsessuccessswxsTextDataObjectsdos TheClipboardsOpensGetDatasClosesselfstextsSetValuesGetTexts MessageBox(sselfsevtsdossuccess((sk/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/DragAndDrop.pysOnPaste:s  cCs¸ti|dddƒ}|iƒtijo|ti|iƒtiƒ}ti |ƒ}ti i ƒo.ti i|ƒti iƒtidƒqªtiddƒn|iƒdS(NsChoose a bitmap to copyswildcards*.bmpsYThe bitmap is now in the Clipboard. Switch to a graphics editor and try pasting it in...s8There is no data in the clipboard in the required formatsError(swxs FileDialogsselfsdlgs ShowModalsID_OKsBitmapsGetPathsBITMAP_TYPE_BMPsbmpsBitmapDataObjectsbmpdos TheClipboardsOpensSetDatasCloses MessageBoxsDestroy(sselfsevtsdlgsbmpdosbmp((sk/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/DragAndDrop.pys OnCopyBitmapIs   (s__name__s __module__s__init__sOnCopysOnPastes OnCopyBitmap(((sk/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/DragAndDrop.pys ClipTextPanel s # sOtherDropTargetcBs5tZd„Zd„Zd„Zd„Zd„ZRS(NcCs<tii|ƒ||_tiƒ|_|i|iƒdS(N(swxs PyDropTargets__init__sselfslogsFileDataObjectsdos SetDataObject(sselfswindowslog((sk/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/DragAndDrop.pys__init__bs cCs(|iid|||fƒtiSdS(NsOnEnter: %d, %d, %d (sselfslogs WriteTextsxsysdswxsDragCopy(sselfsxsysd((sk/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/DragAndDrop.pysOnEnterhscCs|iidƒdS(NsOnLeave (sselfslogs WriteText(sself((sk/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/DragAndDrop.pysOnLeavepscCs"|iid||fƒtSdS(NsOnDrop: %d %d (sselfslogs WriteTextsxsysTrue(sselfsxsy((sk/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/DragAndDrop.pysOnDropsscCsL|iid|||fƒ|iƒ|iid|iiƒƒ|SdS(NsOnData: %d, %d, %d s%s ( sselfslogs WriteTextsxsysdsGetDatasdos GetFilenames(sselfsxsysd((sk/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/DragAndDrop.pysOnDataws (s__name__s __module__s__init__sOnEntersOnLeavesOnDropsOnData(((sk/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/DragAndDrop.pysOtherDropTargetas     sMyFileDropTargetcBstZd„Zd„ZRS(NcCs&tii|ƒ||_||_dS(N(swxsFileDropTargets__init__sselfswindowslog(sselfswindowslog((sk/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/DragAndDrop.pys__init__s cCsY|iiƒ|iidt|ƒ||fƒx"|D]}|ii|dƒq7WdS(Ns %d file(s) dropped at %d,%d: s ( sselfswindowsSetInsertionPointEnds WriteTextslens filenamessxsysfile(sselfsxsys filenamessfile((sk/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/DragAndDrop.pys OnDropFiles„s  #(s__name__s __module__s__init__s OnDropFiles(((sk/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/DragAndDrop.pysMyFileDropTarget~s sMyTextDropTargetcBs#tZd„Zd„Zd„ZRS(NcCs&tii|ƒ||_||_dS(N(swxsTextDropTargets__init__sselfswindowslog(sselfswindowslog((sk/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/DragAndDrop.pys__init__Žs cCs!|iid|||fƒdS(Ns (%d, %d) %s (sselfswindows WriteTextsxsystext(sselfsxsystext((sk/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/DragAndDrop.pys OnDropText“scCs tiSdS(N(swxsDragCopy(sselfsxsysd((sk/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/DragAndDrop.pys OnDragOver–s(s__name__s __module__s__init__s OnDropTexts OnDragOver(((sk/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/DragAndDrop.pysMyTextDropTargets  s FileDropPanelcBs#tZd„Zd„Zd„ZRS(NcCsutii||dƒtitiƒ}|iti |ddƒdti ti Bdƒti |dddti tiBtiBƒ|_t||ƒ}|ii|ƒ|i|idti ƒ|iti |ddƒdti ti Bdƒti |dddti tiBtiBƒ|_t|i|ƒ}|ii|ƒ|i|idti ƒ|itƒ|i|ƒdS( Niÿÿÿÿs Drag some files here:iissstyleis Drag some text here:(swxsPanels__init__sselfsparentsBoxSizersVERTICALssizersAdds StaticTextsEXPANDsALLsTextCtrls TE_MULTILINEsHSCROLLs TE_READONLYstextsMyFileDropTargetslogsdts SetDropTargetstext2sMyTextDropTargets SetAutoLayoutsTruesSetSizer(sselfsparentslogssizersdt((sk/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/DragAndDrop.pys__init__›s$   cCs|ii|ƒdS(N(sselfstexts WriteText(sselfstext((sk/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/DragAndDrop.pys WriteTextÁscCs|iiƒdS(N(sselfstextsSetInsertionPointEnd(sself((sk/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/DragAndDrop.pysSetInsertionPointEndÄs(s__name__s __module__s__init__s WriteTextsSetInsertionPointEnd(((sk/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/DragAndDrop.pys FileDropPanelšs & s TestPanelcBstZd„ZRS(Nc CsŒtii||dƒ|itƒtitiƒ}d}ti |dddti ƒ}|itidtitititƒƒ|i|ƒ|i|ƒ\}}|iti||dƒƒ|itiƒ|i|dtitiBdƒ|iti|dƒdtiƒtiti ƒ}|it"||ƒdtiƒ|it$||ƒdtiƒ|i|dtiƒ|i%|ƒdS( NiÿÿÿÿsClipboard / Drag-And-Dropssstyleiiii(&swxsPanels__init__sselfsparents SetAutoLayoutsTruesBoxSizersVERTICALs outsideSizersmsgs StaticTexts ALIGN_CENTREstextsSetFontsFontsSWISSsNORMALsBOLDsFalsesSetLabels GetTextExtentswshsSetSizesSizesSetForegroundColoursBLUEsAddsEXPANDsALLs StaticLines HORIZONTALsinSizers ClipTextPanelslogs FileDropPanelsSetSizer( sselfsparentslogsinSizers outsideSizerstextswshsmsg((sk/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/DragAndDrop.pys__init__Ìs" +  "(s__name__s __module__s__init__(((sk/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/DragAndDrop.pys TestPanelËscCst||ƒ}|SdS(N(s TestPanelsnbslogswin(sframesnbslogswin((sk/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/DragAndDrop.pysrunTestçss This demo shows some examples of data transfer through clipboard or drag and drop. In wxWindows, these two ways to transfer data (either between different applications or inside one and the same) are very similar which allows to implement both of them using almost the same code - or, in other words, if you implement drag and drop support for your application, you get clipboard support for free and vice versa.

At the heart of both clipboard and drag and drop operations lies the wxDataObject class. The objects of this class (or, to be precise, classes derived from it) represent the data which is being carried by the mouse during drag and drop operation or copied to or pasted from the clipboard. wxDataObject is a "smart" piece of data because it knows which formats it supports (see GetFormatCount and GetAllFormats) and knows how to render itself in any of them (see GetDataHere). It can also receive its value from the outside in a format it supports if it implements the SetData method. Please see the documentation of this class for more details.

Both clipboard and drag and drop operations have two sides: the source and target, the data provider and the data receiver. These which may be in the same application and even the same window when, for example, you drag some text from one position to another in a word processor. Let us describe what each of them should do. s__main__sii(swxsNewIds ID_CopyBtns ID_PasteBtns ID_BitmapBtnsPanels ClipTextPanels PyDropTargetsOtherDropTargetsFileDropTargetsMyFileDropTargetsTextDropTargetsMyTextDropTargets FileDropPanels TestPanelsrunTestsoverviews__name__ssyssossrunsmainspathsbasenamesargv(ssyssrunsoss ID_BitmapBtns ClipTextPanelsMyTextDropTargetsrunTestsOtherDropTargets ID_PasteBtnsMyFileDropTargetsoverviews ID_CopyBtns TestPanels FileDropPanelswx((sk/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/demo/DragAndDrop.pys?s    U 1