³ņ p9Fc@s<dZddklZlZlZdefd„ƒYZdS(s’ This module documents a class that performs bookmark operations for the text editor. @author: Lateef Alabi-Oki @organization: The Scribes Project @copyright: Copyright Ā© 2005 Lateef Alabi-Oki @license: GNU GPLv2 or Later @contact: mystilleef@gmail.com i’’’’(tGObjecttSIGNAL_RUN_LASTt TYPE_NONEtBookmarkManagercBsČeZdZheedfd|iƒ}x|D]}|i|ƒqW|iitƒdS(sŠ Remove all bookmarks in a buffer. @param self: Reference to the BookmarkManager instance. @type self: A BookmarkManager object. N(tget_bookmarked_linesR2RR(R(RtlinesR((splugins/Bookmark/Manager.pytremove_all_bookmarks’s  cCso|iiƒ\}}|ii||ƒ}g}x8|D]0}|iƒdjo|i|iƒƒq7q7W|S(sŲ Return a list of bookmarked lines in a buffer. @param self: Reference to the BookmarkManager instance. @type self: A BookmarkManager object. @return: A list of bookmarked lines. @rtype: A List object. R!(Rt get_boundstget_markers_in_regionR/R&tget_line(Rtbegin_positiont end_positionRtbookmarked_linesR-((splugins/Bookmark/Manager.pyR3Ÿs cCs³ddkl}||iƒ}|iƒ}t|ƒptSn|iƒxb|D]Z}||joGddkl}|ii|ƒ}|ii |ƒ||i ƒt SqQqQWtS(s£ Move the cursor to the next bookmarked line in the buffer. @param self: Reference to the BookmarkManager instance. @type self: A BookmarkManager object. i’’’’(tget_cursor_line(tmove_view_to_cursor( tSCRIBES.cursorR<RR3tlenRtsortR=R$t place_cursorRR(RR<t cursor_lineR;RR=R,((splugins/Bookmark/Manager.pytmove_to_next_bookmark±s      cCs½ddkl}||iƒ}|iƒ}t|ƒptSn|iƒ|iƒxb|D]Z}||joGddkl}|ii |ƒ}|ii |ƒ||i ƒt Sq[q[WtS(s§ Move the cursor to the previous bookmarked line in the buffer. @param self: Reference to the BookmarkManager instance. @type self: A BookmarkManager object. i’’’’(R<(R=( R>R<RR3R?RR@treverseR=R$RARR(RR<RBR;RR=R,((splugins/Bookmark/Manager.pytmove_to_previous_bookmarkĒs        cCsUt|iƒƒ}|ii|ƒ}|ii|ƒddkl}||iƒdS(s¤ Move the cursor to the first bookmarked line in the buffer. @param self: Reference to the BookmarkManager instance. @type self: A BookmarkManager object. i’’’’(R=N(tminR3RR$RAR>R=R(RRR,R=((splugins/Bookmark/Manager.pytmove_to_first_bookmarkŽs  cCsUt|iƒƒ}|ii|ƒ}|ii|ƒddkl}||iƒdS(s£ Move the cursor to the last bookmarked line in the buffer. @param self: Reference to the BookmarkManager instance. @type self: A BookmarkManager object. i’’’’(R=N(tmaxR3RR$RAR>R=R(RRR,R=((splugins/Bookmark/Manager.pytmove_to_last_bookmarkģs  cCsi|iƒdjoR|ii|ƒ|iƒp|iitƒnddkl}||i ƒntS(sĆ Handles callback when the "mark-deleted" signal is emitted. @param self: Reference to the BookmarkManager instance. @type self: A BookmarkManager object. @param textbuffer: The text editor's buffer. @type textbuffer: A ScribesTextBuffer object. @param textmark: The mark that is being deleted. @type textmark: A gtksourceview.SourceMarker object. @return: True to propagate signals to parent widgets. @type: A Boolean Object. R!i’’’’(R#( R/RtremoveR3RR(RR*R#R+(RRttextmarkR#((splugins/Bookmark/Manager.pyt__manager_mark_deleted_cbśs cCs-ddkl}l}||id|ƒdS(sų Handles callback when the "saved-document" signal is emitted. @param self: Reference to the BookmarkManager instance. @type self: A BookmarkManager object. @param editor: Reference to the text editor. @type editor: An Editor object. i’’’’(R#t PRIORITY_LOWtpriorityN(R*R#RMR+(RRturiR#RM((splugins/Bookmark/Manager.pyt__manager_saved_document_cbs cCs«ddkl}l}|iƒ|io*|iio|iiid|iƒn||i|ƒ||i |i ƒ||i |iƒ|i ƒ||ƒ~d}dS(s Handles callback when the "quit" signal is emitted. @param self: Reference to the BookmarkManager instance. @type self: A BookmarkManager object. @param manager: Reference to the BookmarkManager instance. @type manager: A BookmarkManager object. i’’’’(tdelete_attributestdisconnect_signalRN(R'RQRRR+R RRt remove_objectR RRRR5R(RtmanagerRQRR((splugins/Bookmark/Manager.pyt__manager_destroy_cb s    cCs“|ii|ƒ}|iƒ}|iƒg}|ii||ƒ}xI|D]A}|iƒdjo(|iƒ|jo|i|ƒq‹qJqJW|S(s6 Get the bookmark on a particular line. @param self: Reference to the BookmarkManager instance. @type self: A BookmarkManager object. @param line: The line to get the bookmark from. @type line: An Integer object. @return: A bookmark on the line. @rtype: A gtksourceview.SourceMarker object. R!(RR$tcopytforward_to_line_endR7R/R8R&(RRR9R:t bookmarksRR-((splugins/Bookmark/Manager.pyt__get_bookmark_on_line9s   cCsT|iidjotSnddkl}|iƒ}|t|iiƒ|ƒtS(s„ Store the position of bookmarks in the buffer in a database. @param self: Reference to the BookmarkManager instance. @type self: A BookmarkManager object. i’’’’(tupdate_bookmarks_in_databaseN(RRORRtBookmarkMetadataRZR3tstr(RRZR4((splugins/Bookmark/Manager.pyt__update_bookmark_databaseQs  cCsB|iƒ}ddkl}|ƒ}|i|ƒ|iƒ}|S(sč Create the bookmark image for the text editor. @param self: Reference to the BookmarkManager instance. @type self: A BookmarkManager object. @return: An image representing a bookmark. @rtype: A gtk.gdk.Pixbuf object. i’’’’(tImage(t%_BookmarkManager__find_bookmark_imagetgtkR^t set_from_filet get_pixbuf(Rt image_fileR^timagetpixbuf((splugins/Bookmark/Manager.pyt__create_bookmark_image_s    cCsIy6ddkl}ddkl}|i|dƒ}Wn dGHnX|S(sģ Return the path to the bookmark image on the host's file system. @param self: Reference to the BookmarkManager instance. @type self: A BookmarkManager object. @return: Path to the bookmark image. @rtype: A String object. i’’’’(tscribes_data_folder(tpaths bookmarks.pngs)Error: Could not find scribes data files.(t SCRIBES.infoRgtosRhtjoin(RRgRht image_path((splugins/Bookmark/Manager.pyt__find_bookmark_imageps  ((t__name__t __module__t__doc__RRt __gsignals__RRR R.R2R5R3RCRERGRIRRR RR+RR_(((splugins/Bookmark/Manager.pyR"s*                 N(RpR*RRRR(((splugins/Bookmark/Manager.pyss