³ò ¡õEc@s0dZddklZdefd„ƒYZdS(sý This module documents a class that implements a treeview for the bookmark browser. @author: Lateef Alabi-Oki @organization: The Scribes Project @copyright: Copyright © 2006 Lateef Alabi-Oki @license: GNU GPLv2 or Later @contact: mystilleef@gmail.com iÿÿÿÿ(tTreeViewtBookmarkTreeViewcBs}eZdZd„Zd„Zd„Zd„Zdd„Zdeed„Z d „Z d „Z d „Z d „Z d „ZRS(s; This class creates a treeview for the bookmark browser. cCs—ti|ƒ|i||ƒ|iƒ|iid|iƒ|_|ii id|i ƒ|_ |iid|i ƒ|_ |id|iƒ|_dS(sJ Intialize an instance of this class. @param self: Reference to the BookmarkTreeView instance. @type self: A BookmarkTreeView object. @param manager: Reference to the BookmarkManager instance. @type manager: A BookmarkManager object. @param editor: Reference to the text editor. @type editor: An Editor object. tdestroytupdatedtupdates row-activatedN(Rt__init__t"_BookmarkTreeView__init_attributest!_BookmarkTreeView__set_propertiest_BookmarkTreeView__managertconnectt_BookmarkTreeView__destroy_cbt_BookmarkTreeView__signal_id_1t_BookmarkTreeView__editortstoret#_BookmarkTreeView__store_updated_cbt_BookmarkTreeView__signal_id_2t_BookmarkTreeView__update_cbt_BookmarkTreeView__signal_id_3t#_BookmarkTreeView__row_activated_cbt_BookmarkTreeView__signal_id_4(tselftmanagerteditor((s#plugins/BookmarkBrowser/Treeview.pyR's  cCsâ||_||_|iiidƒ|_g|_d|_|_|_ d|_ |i ƒ|_ |i ddƒ|_|i ƒ|_ddkl}l}|i||idttƒ|_|i||idttƒ|_dS( sA Initialize data attributes. @param self: Reference to the BookmarkTreeView instance. @type self: A BookmarkTreeView object. @param manager: Reference to the BookmarkManager instance. @type manager: A BookmarkManager object. @param editor: Reference to the text editor. @type editor: An Editor object. tBookmarkManagertxaligngð?iÿÿÿÿ(tmsg0003tmsg0004iiN(RR R t get_objectt#_BookmarkTreeView__bookmark_managert#_BookmarkTreeView__bookmarked_linestNoneR RRRt_BookmarkTreeView__create_modelt_BookmarkTreeView__modelt"_BookmarkTreeView__create_renderert _BookmarkTreeView__line_renderert _BookmarkTreeView__text_rendererti18nRRt _BookmarkTreeView__create_columntFalsetTruet_BookmarkTreeView__line_columnt_BookmarkTreeView__text_column(RRRRR((s#plugins/BookmarkBrowser/Treeview.pyt__init_attributes<s    !!cCst|id|iƒ|idtƒ|iddƒ|idtƒ|i|iƒ|i|iƒ|iiƒdS(sŒ Define the treeview's properties. @param self: Reference to the BookmarkTreeView instance. @type self: A BookmarkTreeView object. tmodels rules-hints search-columnisheaders-clickableN(t set_propertyR R't append_columnR(R)tclicked(R((s#plugins/BookmarkBrowser/Treeview.pyt__set_propertiesWs cCs&ddkl}|ttdƒ}|S(sÙ Create model for the treeview. @param self: Reference to the BookmarkTreeView instance. @type self: An BookmarkTreeView object. @return: Return a model for the treeview. @rtype: A gtk.ListStore object. iÿÿÿÿ(t ListStoretgboolean(tgtkR0tinttstr(RR0R+((s#plugins/BookmarkBrowser/Treeview.pyt__create_modelgs gcCs=ddkl}|ƒ}|iddƒ|id|ƒ|S(sò Create the renderer for the treeview's columns. @param self: Reference to the BookmarkTreeView instance. @type self: A BookmarkTreeView object. @return: A renderer for treeview's columns. @rtype: A gtk.CellRendererText object. iÿÿÿÿ(tCellRendererTextscell-backgroundtyellowR(R2R6R,(RRR6trenderer((s#plugins/BookmarkBrowser/Treeview.pyt__create_rendererus  ic Cs™ddkl}l}ddkl}|||d|ƒ} | i|ƒ| i|ƒ| i|d|ddƒ| i|ƒ| i|ƒ| i |ƒ| S(sØ Create column for the treeview. @param self: Reference to the BookmarkTreeView instance. @type self: A BookmarkTreeView object. @return: A column for the treeview. @rtype: A gtk.TreeViewColumn object. iÿÿÿÿ(tTREE_VIEW_COLUMN_AUTOSIZEtSORT_DESCENDING(tTreeViewColumnttexttcell_background_seti( R2R:R;R<t set_expandt set_sizingtset_attributestset_sort_indicatortset_sort_ordertset_sort_column_id( RttitleR8R=texpandt indicatorR:R;R<tcolumn((s#plugins/BookmarkBrowser/Treeview.pyt__create_column…s      cCsÈ|io-|ii|iƒo|ii|iƒn|io3|iii|iƒo|iii|iƒn|io-|ii|iƒo|ii|iƒn|io'|i|iƒo|i|iƒn|i o|i i ƒn|i o|i i ƒn|i o|i i ƒn|io|ii ƒn|io|ii ƒn|i ƒ|`|`|` |` |` |`|`|`|`|`|`|`|`~d}dS(s  Handles callback when the "destroy" signal is emitted. @param self: Reference to the BookmarkTreeView instance. @type self: A BookmarkTreeView object. @param manager: Reference to the BookmarkManager instance. @type manager: A BookmarkManager object. N(R Rthandler_is_connectedt disconnectRR R RRR tclearR"RR#R(R)RRR(RR((s#plugins/BookmarkBrowser/Treeview.pyt __destroy_cbšs6 #        cCs>|djo-|iio|iiidƒ|_q:ndS(sF Handles callback when the "updated" signal is emitted. @param self: Reference to the BookmarkTreeView instance. @type self: A BookmarkTreeView object. @param store: Reference to a Store object. @type store: A Store object. @param name: The name of the object that was updated. @type name: A String object. RN(sBookmarkManager(R R RR(RR tname((s#plugins/BookmarkBrowser/Treeview.pyt__store_updated_cbÀs   cCs|iƒtS(s] Handles callback when the "update" signal is emitted. @param self: Reference to the BookmarkTreeView instance. @type self: A BookmarkTreeView object. @param manager: Reference to the BookmarkManager instance. @type manager: A BookmarkManager object. @return: True to propagate signals to parent widgets. @type: A Boolean Object. (t!_BookmarkTreeView__populate_modelR&(RR((s#plugins/BookmarkBrowser/Treeview.pyt __update_cbÒs c Cs|idjodSny$|iiƒ}|p t‚nWntj o dSnXddkl}t}g}xT|D]L}||ii|ƒ}|i dƒ}|i dƒ}|i ||fƒqyW|i |jodSn||_ |ii di ƒ}|iiƒxQ|i D]F\}}||jo t}n|ii |d||gƒt}qWddkl}||ƒdS(s~ Populate the model. @param self: Reference to the BookmarkTreeView instance. @type self: A BookmarkTreeView object. Niÿÿÿÿ(tget_text_on_linet s i(t select_row(RRtget_bookmarked_linestAttributeErrortlinesRRR&R t textbuffertstriptappendRt bookmark_listtget_lineR RLR't SCRIBES.utilsRT( RRWRRtvaluetbookmarked_linestlineR=trecently_bookmarked_lineRT((s#plugins/BookmarkBrowser/Treeview.pyt__populate_modelâs>        c Cs¼|iƒ}|iƒ\}}|i|dƒ}|iiit|ƒdƒ}|iii|ƒddkl }||ii ƒddk l } | t|ƒ} |ii i| dƒtS(s“ Handles callback when the "row-activated" signal is emitted. @param treeview: The bookmark browser's treeview. @type treeview: A BookmarkBrowserView object. @param path: A row in a treeview. @type path: A row object. @param column: A column in a treeview. @type column: A gtk.TreeViewColumn object. @return: True to propagate signals to parent widgets. @type: A Boolean Object. iiiÿÿÿÿ(tmove_view_to_cursor(tmsg0006tsucceed(t get_selectiont get_selectedt get_valueR RXtget_iter_at_lineR3t place_cursortSCRIBES.cursorRcttextviewR$Rdtfeedbacktupdate_status_messageR'( RttreeviewtpathRHt selectionR+titeratorR`RcRdtmessage((s#plugins/BookmarkBrowser/Treeview.pyt__row_activated_cbs (t__name__t __module__t__doc__RRRRR!R&R%R RRRPR(((s#plugins/BookmarkBrowser/Treeview.pyR"s      &   %N(RwR2RR(((s#plugins/BookmarkBrowser/Treeview.pyss