ͯt_c@sddlZddlZddlZddlZddlmZmZmZmZm Z m Z m Z ddl Z ddlmZy3ddlZejdejdejZWndZnXde jfdYZdS( iN(tGLibtGiotGObjecttPangotGtktGdktGediti(tVirtualDirectorytgeditcCs|S(N((ts((s+/usr/lib64/gedit/plugins/quickopen/popup.pyt!stPopupcBsCeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZd#dZdZdZdZdZdZdZdZdZ dZ!dZ"d Z#d!Z$d"Z%RS($tQuickOpenPopupc Csmtjj|dtdd|dtdt|jtdtjj|jtdtjj|_ ||_ |j d |_ g|_ i|_d|_d|_d|_tjtjj|_tj}|jtjtjjd|j|j|g}xF|D]>}|j|kr|j j ||j |jqqW|jd |j!dS( Nttitles Quick Opent transient_fortmodaltdestroy_with_parentt_Cancelt_Openitshow(ii("RtDialogt__init__t_tTruet add_buttont ResponseTypetCANCELtACCEPTt _open_buttont_handlert _build_uit_sizet_dirst_cachetNonet_themet_cursort _shift_startRtCursort CursorTypetWATCHt _busy_cursort AccelGrouptconnecttKEY_lt ModifierTypet CONTROL_MASKton_focus_entrytadd_accel_grouptget_uritappendton_show(tselftwindowtpathsthandlert accel_grouptuniquetpath((s+/usr/lib64/gedit/plugins/quickopen/popup.pyR&s:               cCs|jS(N(R(R4((s+/usr/lib64/gedit/plugins/quickopen/popup.pytget_final_sizeNsc Cs|jd|j}|jd|j}|jd|jdtj|_|jjtd|jj d|j |jj d|j tj }|j tjjtjj|jtjjtj}|jttjtjttjtj|_|j|j||_|j d|j tj!}tj"}|j#|t|j$|dd tj%}|j#|t&|j$|d d |j'||j(d|j*||j+||j,}|j d|j-|j.tj/j0|j#|jttd |j#|t&t&d tj1}|j2tj3j4|j5t6j7j8||_9|j#|ttd |j-|j,|j:dS( NiiisType to search…tchangedskey-press-events row-activatedtgiconitmarkupi(;tset_border_widthtget_content_areat set_spacingtget_action_areaRt SearchEntryt_entrytset_placeholder_textRR+t on_changedton_key_press_eventtScrolledWindowt set_policyt PolicyTypet AUTOMATICtset_shadow_typet ShadowTypetOUTtTreeViewtset_headers_visibletFalset ListStoreRtIcontstrRtObjecttFileTypet_storet set_modelt _treeviewton_row_activatedtTreeViewColumntCellRendererPixbuft pack_startt add_attributetCellRendererTextRtset_cell_data_functon_cell_data_cbR"t append_columntaddt get_selectionton_selection_changedtset_modet SelectionModetMULTIPLEtLabelt set_haligntAligntSTARTt set_ellipsizeRt EllipsizeModetMIDDLEt _info_labeltshow_all( R4tvboxt action_areatswttvtcolumntrenderert selectiontlbl((s+/usr/lib64/gedit/plugins/quickopen/popup.pyRQsX                   c Cs|j|}|jrx||jjkrx|jj}|jtjj}|jd||jdt j j n |jdt |jdt dS(Nscell-background-gdktstylescell-background-sets style-set( tget_pathR$RYt get_styletbgRt StateTypetPRELIGHTt set_propertyRtStyletITALICRQ( R4Rvtcelltmodeltpitert user_dataR:RzR}((s+/usr/lib64/gedit/plugins/quickopen/popup.pyRascCs|j}|dks'tj|r+tStjdkrVtj|drtSn/tj|drltStj|dkrtSt S(NtWindowss text/plainttext( tget_content_typeR"Rtcontent_type_is_unknownRtplatformtsystemtcontent_type_is_atcontent_type_get_mime_typeRQ(R4tentryt content_type((s+/usr/lib64/gedit/plugins/quickopen/popup.pyt_is_texts cCs:g}y|jdtjjd}Wntjk r=}nXt|tjrx]t r|j d}|srPn|j sS|j |j |j|fqSqSWn|}g}x}|D]u}|dj}|tjjkr|j|dsqqn|j |d|dj||djfqW|S(Ns standard::*ii(tenumerate_childrenRtFileQueryInfoFlagstNONER"RtErrort isinstancetFileEnumeratorRt next_filet get_is_backupR2t get_childtget_namet get_file_typeRVtREGULARRtget_icon(R4tgfiletentriestretteRtchildrent file_type((s+/usr/lib64/gedit/plugins/quickopen/popup.pyt _list_dirs4     ,    cCs||krj||krc|j||j|kr:dS|j||j|kr\dSdSq~dSn||krzdSdSdS(Niii(tindex(R4tatbtlpart((s+/usr/lib64/gedit/plugins/quickopen/popup.pyt_compare_entriess   cCs#|r|d7}ntj||S(Nt*(tfnmatch(R4R tglob((s+/usr/lib64/gedit/plugins/quickopen/popup.pyt _match_globs c s| s| rgS|jkr1j|}n/j|}|jdd|j|%s(trangeRR2Rtostseptjoin(R4RR:Rti((s+/usr/lib64/gedit/plugins/quickopen/popup.pyt make_markup+s(cCs6|jtjtjjd}|s(dS|jSdS(N(t query_infoRtFILE_ATTRIBUTE_STANDARD_ICONRRR"R(R4tftquery((s+/usr/lib64/gedit/plugins/quickopen/popup.pyt _get_icon3s    cCs|g}t|d}x_|dkrw||dkrH|jddn"|jd|j|j}|d8}qW|S(Niis..(Rtinsertt get_basenameR(R4tparenttchildtppRtidx((s+/usr/lib64/gedit/plugins/quickopen/popup.pyt _make_parts=s cCs|s gS|j|d }|ddkrp| sV|ddksVt|dkrf|jdq|d=n|j|d|S(Nis..i(tnormalize_relativeRR2(R4RR((s+/usr/lib64/gedit/plugins/quickopen/popup.pyRNs) cCsF|dj}||jkrB|jj||jj|ndS(Ni(R1t _stored_itemsRWR2Rc(R4titemturi((s+/usr/lib64/gedit/plugins/quickopen/popup.pyt_append_to_store^scCs|jjt|_dS(N(RWtcleartsetR(R4((s+/usr/lib64/gedit/plugins/quickopen/popup.pyt _clear_storees cCsx|jD]}t|tr xj|jdddD]P}|j|djtjj j |dj |d|dj fq5Wq q WdS(Ns standard::*ii( R RRRR"RRRRRRRR(R4RR((s+/usr/lib64/gedit/plugins/quickopen/popup.pyt_show_virtualsiscCs@|r|jj|jn|jjdtjdS(N(t get_windowt set_cursorR)R"Rtflush(R4tbusy((s+/usr/lib64/gedit/plugins/quickopen/popup.pyt _set_busyrscCsG|jrC|jj}d|_|jj||jj|ndS(N(R$R{R"RWt row_changedtget_iter(R4R:((s+/usr/lib64/gedit/plugins/quickopen/popup.pyt_remove_cursorys  c Cs<|jt|j|jjj}|j|dkrO|jn|j|j t j }g}xx|j D]m}xd|j ||D]P}|j||d|}|j|d|j|||d|dfqWqzW|jj}|r+|jj|}|jjj|n|jtdS(NRiii(RRRRDtget_texttstripRRRtsplitRRR RRRRRWtget_iter_firstR{RYRdt select_pathRQ( R4RRtfilesRRt pathpartsRR:((s+/usr/lib64/gedit/plugins/quickopen/popup.pyt do_searchs(      cCs+|jj|jjd|jdS(NR(RDt grab_focustset_textR(R4tdata((s+/usr/lib64/gedit/plugins/quickopen/popup.pyR3s cCs$|j|j|jjdS(N(RReRYRd(R4teditable((s+/usr/lib64/gedit/plugins/quickopen/popup.pyRFs cCs|jj}|jsR|j\}}|d}tjj|j||_n|jj}|j |j ||dS(Ni( RYRdR%tget_selected_rowsRtTreeRowReferencetnewRWR{t unselect_allt select_range(R4ttowhereRxRtrowststart((s+/usr/lib64/gedit/plugins/quickopen/popup.pyt _shift_extends   cCs|f}|p|s+|jjjn|rA|j|n(d|_|si|jjj|n|jj|dtdd|j |s|rt j |j ||_ |j j|}|j j||ndS(Ng?i(RYRdRRR"R%Rtscroll_to_cellRRRRRWR$RR(R4RthasctrlthasshiftR:R((s+/usr/lib64/gedit/plugins/quickopen/popup.pyt _select_indexs     c Cs:|jjd}|dkr"tSd}|jrC|jj}n:|jjj\}}t |dkr}|d}n|s|dkr|j d||q6|j |d||nw|j d}||dkr|j d||nA|||kr|j |d||n|j ||||tS(Nii( RWtiter_n_childrenR"RR$R{RYRdRRRt get_indices( R4thowmanyRRtnumR:RRR((s+/usr/lib64/gedit/plugins/quickopen/popup.pyt_move_selections(    cCsW|jj}tj|}tj|sKtjj|rO|j rO|SdSdS(N( RDRRtfile_new_for_uriRtutils_is_valid_locationRR:tisabst query_existsR"(R4RR((s+/usr/lib64/gedit/plugins/quickopen/popup.pyt _direct_files c Cs|jjj\}}t}x|D] }|j|}|j|dd}|dtjjkr|o~|j |d}q(|j j }x;t t |dddD]}||tjkrPqqW|j jtjj|| tjj|djtj|j jd|j jtSq(W|rU|rUtj|jn|s|j} | r|j | rtj|jqt}nt}|S(Niiiii(RYRdRRRtgetRRVRRRDRRRRRRR:RtbasenameR1t set_positionRRtidle_addtdestroyRRQ( R4RRRtrowR tinfoRRR((s+/usr/lib64/gedit/plugins/quickopen/popup.pyt _activates0 #@    cCs[|js dS|jj}|jj}|j|rJ|j|n |j|dS(N(R$R{RYRdtpath_is_selectedt unselect_pathR(R4R:Rx((s+/usr/lib64/gedit/plugins/quickopen/popup.pyt toggle_cursor"s cCsidtj6dtj6dtj6dtj6}|jtjkrN|jtS|j|kr|j ||j|j tj j @|j tj j @S|jtjtjtjtjgkr|jS|jtjkr|j tj j @r|jntS(Niiii(RtKEY_DowntKEY_Upt KEY_Page_Downt KEY_Page_Uptkeyvalt KEY_EscapeRRR tstateR-R.t SHIFT_MASKt KEY_Returnt KEY_KP_EntertKEY_TabtKEY_ISO_Left_TabRt KEY_spaceRRQ(R4twidgetteventt move_mapping((s+/usr/lib64/gedit/plugins/quickopen/popup.pyRG.s     4' % cCs|jdS(N(R(R4tviewR:Rv((s+/usr/lib64/gedit/plugins/quickopen/popup.pyRZBscCs0|tjjks|j r,|jndS(N(RRRRR(R4tresponse((s+/usr/lib64/gedit/plugins/quickopen/popup.pyt do_responseEscCsC|jr0|j}|j|jf|_ntjj||S(N(t get_realizedtget_allocationtwidththeightRRRtdo_configure_event(R4R+talloc((s+/usr/lib64/gedit/plugins/quickopen/popup.pyR4Is  cCs|j\}}d}d}|s3|j}n>t|dkrk|j|j|ddd}nd}|r|jrtjj j |j }qtjj j |j }n|j j|dk |jj|pddS(NiiiR(RR"RRRRt is_nativeRRRRR{R1Rt set_sensitiveRpt set_markup(R4RxRRRtfname((s+/usr/lib64/gedit/plugins/quickopen/popup.pyRePs& cCs|jjdS(N(RDR(R4tgrouptaccelR!tmodifier((s+/usr/lib64/gedit/plugins/quickopen/popup.pyR/fsN(&t__name__t __module__t__gtype_name__RR;RRaRRRRRRRRRRRRRRRRR"R3RFRRR RRRRGRZR/R4ReR/(((s+/usr/lib64/gedit/plugins/quickopen/popup.pyR #sF (  ?  &   *              " '     (RRRRt gi.repositoryRRRRRRRtxml.sax.saxutilsRt virtualdirsRtgettexttbindtextdomaint textdomainRRR (((s+/usr/lib64/gedit/plugins/quickopen/popup.pyts    4