ó «‡Uc@sÎdZddlZejdƒddlZddlZddlmZmZmZdZ dZ dde fdde fd de fgZ d „Z d ej fd „ƒYZd „ZedkrÊeƒndS(s“Drag and Drop This is a test of the drag and drop capabilities of gtk. It is a fairly straight forward port of the example distributed with gtk. iÿÿÿÿNs2.0(t drag_icon_xpmttrashcan_open_xpmttrashcan_closed_xpmiitSTRINGs text/plainsapplication/x-rootwin-dropcCstjjd|jƒd|ƒS(N(tgtktgdkt!pixmap_colormap_create_from_xpm_dtNonet get_colormap(twidgettxpm_data((s!/usr/lib/pygtk27/2.0/demos/dnd.pyt create_pixmaps tDragAndDropDemocBsÑeZdZdZdZdZdZdZe Z e Z e Z dZ dZdZdd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd „Zd „Zd „Zd „Zd „Zd„ZRS(icCsötjj|ƒy|j|jƒƒWn$tk rM|jdd„ƒnX|j|jj ƒtj ddƒ}|j |ƒt |t ƒ\|_|_t |tƒ\|_|_t |tƒ\|_|_tjdƒ}|jtjtd tjjtjjBƒ|jd|jƒ|j|ddddƒtjd ƒ}|jtjtd tjjtjjBƒ|j|ddddƒ|jd |jƒ|jd |j ƒtj!ƒ}|j"|j|jƒ|jdgdƒ|j|ddddƒ|jd |j#ƒ|jd |j$ƒ|jd |j%ƒ|jd|j&ƒtj'd ƒ}|j(tjj)tjj*BttjjtjjBƒ|j+|j,ƒ|j|jƒ|j|ddddƒ|jd|j-ƒ|jd|j.ƒ|j/ƒdS(NtdestroycWs tjƒS(N(Rt main_quit(tw((s!/usr/lib/pygtk27/2.0/demos/dnd.pyt0sisDrop to Trashcan! iÿÿÿÿtdrag_data_receivediisPopup t drag_motiont drag_leavet drag_dropsDrag from Here t drag_data_gettdrag_data_delete(0RtWindowt__init__t set_screent get_screentAttributeErrortconnectt set_titlet __class__t__name__tTabletaddR Rt drag_icont drag_maskRt trashcan_openttrashcan_open_maskRttrashcan_closedttrashcan_closed_masktLabelt drag_dest_settDEST_DEFAULT_ALLttargetRt ACTION_COPYt ACTION_MOVEtlabel_drag_data_receivedtattachtpopsite_motiont popsite_leavetImagetset_from_pixmapttarget_drag_leavettarget_drag_motionttarget_drag_dropttarget_drag_data_receivedtButtontdrag_source_sett BUTTON1_MASKt BUTTON3_MASKtdrag_source_set_iconRtsource_drag_data_gettsource_drag_data_deletetshow_all(tselftparentttabletlabeltimagetb((s!/usr/lib/pygtk27/2.0/demos/dnd.pyR+sL   cCsN|r7|jdkr7d|jGH|jtt|ƒn|jtt|ƒdS(NisReceived "%s" in label(tformattdatatfinishtTruetFalse(R@RtcontexttxtyRGtinfottime((s!/usr/lib/pygtk27/2.0/demos/dnd.pyR.\s cCs(|js$tjd|jƒ|_ntS(Niô(t popup_timertgobjectt timeout_addtpopup_cbRI(R@RRKRLRMRO((s!/usr/lib/pygtk27/2.0/demos/dnd.pyR0cs cCs)|jr%tj|jƒd|_ndS(Ni(RPRQt source_remove(R@RRKRO((s!/usr/lib/pygtk27/2.0/demos/dnd.pyR1hs cCsHdGH|jsDt|_|jrDdGHtj|jƒd|_qDntS(Nt popup_motionsremoved popdowni(tin_popupRIt popdown_timerRQRT(R@RRKRLRMRO((s!/usr/lib/pygtk27/2.0/demos/dnd.pyRUms   cCsGdGH|jrCt|_|jsCdGHtjd|jƒ|_qCndS(Nt popup_leaves added popdowniô(RVRJRWRQRRt popdown_cb(R@RRKRO((s!/usr/lib/pygtk27/2.0/demos/dnd.pyRXws    cCsh|js>|jdkr%tjtjƒ|_|jjtjƒtjddƒ}x³t dƒD]¥}t |dƒ\}}tj d||fƒ}|j tj td tjjtjjBƒ|jd|jƒ|jd|jƒ|j|||d||dƒq_W|jƒ|jj|ƒn|jjƒt|_ntjd|jƒ|_d GHd |_tS( Nii s%d,%diÿÿÿÿRRiiôs added popdowni( t popped_upt popup_winRRRt WINDOW_POPUPt set_positiont WIN_POS_MOUSER trangetdivmodR8R)R*R+RR,R-RRURXR/R?R!tpresentRIRQRRRYRWRPRJ(R@RBtktitjRE((s!/usr/lib/pygtk27/2.0/demos/dnd.pyRSs* %    cCs(dGHd|_|jjƒt|_tS(Ntpopdowni(RWR[thideRJRZ(R@((s!/usr/lib/pygtk27/2.0/demos/dnd.pyRY–s    cCs(dGHt|_|j|j|jƒdS(Ntleave(RJt have_dragR3R&R'(R@timgRKRO((s!/usr/lib/pygtk27/2.0/demos/dnd.pyR4Ÿs cCsq|jtkr1t|_|j|j|jƒn|jƒ}dG|rU|jjGHndGH|j |j |ƒtS(Nsmotion, source tunknown( RhRJRIR3R$R%tget_source_widgetRRt drag_statustsuggested_action(R@RiRKRLRMROt source_widget((s!/usr/lib/pygtk27/2.0/demos/dnd.pyR5¤s  cCsOdGHt|_|j|j|jƒ|jrK|j||jd|ƒtStS(Ntdropi(RJRhR3R&R'ttargetst drag_get_dataRI(R@RiRKRLRMRO((s!/usr/lib/pygtk27/2.0/demos/dnd.pyR6±s  cCsH|jdkr1d|jGH|jtt|ƒn|jtt|ƒdS(NisReceived "%s" in trashcan(RFRGRHRIRJ(R@RiRKRLRMRGRNRO((s!/usr/lib/pygtk27/2.0/demos/dnd.pyR7ºs cCs.|tkrdGHn|j|jddƒdS(NsI was dropped on the rootwinis I'm Data!(tTARGET_ROOTWINtsetR+(R@tbtnRKtselection_dataRNRO((s!/usr/lib/pygtk27/2.0/demos/dnd.pyR=Ás cCs dGHdS(NsDelete the data!((R@RtRKRG((s!/usr/lib/pygtk27/2.0/demos/dnd.pyR>ÇsN(Rt __module__RR$R%R&R'R"R#RJRhRZRVRPRWR[RR.R0R1RURXRSRYR4R5R6R7R=R>(((s!/usr/lib/pygtk27/2.0/demos/dnd.pyR s4 1        cCstƒtjƒdS(N(R Rtmain(((s!/usr/lib/pygtk27/2.0/demos/dnd.pyRwÊst__main__(t__doc__tpygtktrequireRRQt dndpixmapRRRt TARGET_STRINGRrR+R RR RwR(((s!/usr/lib/pygtk27/2.0/demos/dnd.pyts       ­