³ò â’BFc@sFdZddklZddklZlZdefd„ƒYZdS(s This module documents a class that creates the treeview for the automatic replacement dialog. @author: Lateef Alabi-Oki @organization: The Scribes Project @copyright: Copyright © 2006 Lateef Alabi-Oki @license: GNU GPLv2 or Later @contact: mystilleef@gmail.com iÿÿÿÿ(tTreeView(tSIGNAL_RUN_LASTt TYPE_NONEtAutoReplaceTreeViewcBs³eZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z d „Z d „Zd „Zd„Zd„Zd„Zdd„Zd„ZRS(s¹ This class implements the treeview for the automatic replacement dialog. The treeview has two columns. One for abbreviations and the other for text to be inserted into the buffer. cCsti|ƒ|i||ƒ|iƒ|iƒ|iid|iƒ|_|i id|i |i dfƒ|_ |i id|i ƒ|_|iid|i|i dfƒ|_|i id|iƒ|_|id|iƒ|_dd kl}l}||i||iƒ|_d S( sJ Initialize the object. @param self: Reference to the AutoReplaceTreeView instance. @type self: An AutoReplaceTreeView object. @param manager: Reference to the AutoReplaceManager instance. @type manager: An AutoReplaceManager object. @param editor: Reference to the text editor. @type editor: An Editor object. tdestroyteditedis row-changedis row-deletedtmapiÿÿÿÿ(t monitor_addt MONITOR_FILEN(Rt__init__t%_AutoReplaceTreeView__init_attributest$_AutoReplaceTreeView__set_propertiest$_AutoReplaceTreeView__populate_modelt_AutoReplaceTreeView__managertconnectt)_AutoReplaceTreeView__treeview_destroy_cbt!_AutoReplaceTreeView__signal_id_1t+_AutoReplaceTreeView__abbreviation_renderert-_AutoReplaceTreeView__treeview_abbr_edited_cbt_AutoReplaceTreeView__modelt!_AutoReplaceTreeView__signal_id_2t-_AutoReplaceTreeView__treeview_row_changed_cbt!_AutoReplaceTreeView__signal_id_4t*_AutoReplaceTreeView__replacement_renderert4_AutoReplaceTreeView__treeview_replacement_edited_cbt!_AutoReplaceTreeView__signal_id_3t-_AutoReplaceTreeView__treeview_row_deleted_cbt!_AutoReplaceTreeView__signal_id_5t connect_aftert%_AutoReplaceTreeView__treeview_map_cbt!_AutoReplaceTreeView__signal_id_6tgnomevfsRRt"_AutoReplaceTreeView__database_urit2_AutoReplaceTreeView__treeview_database_changed_cbt _AutoReplaceTreeView__monitor_id(tselftmanagerteditorRR((s"plugins/AutoReplaceGUI/Treeview.pyR *s   '' cCsß||_||_t|_|iƒ|_|iƒ|_|iƒ|_|i ƒ|_ |i ƒ|_ d|_d|_d|_d|_d|_d|_ddkl}|d|_ddkl}||iƒ|_dS(sO Initialize data attributes. @param self: Reference to the AutoReplaceTreeView instance. @type self: An AutoReplaceTreeView object. @param manager: Reference to the AutoReplaceManager instance. @type manager: An AutoReplaceManager object. @param editor: Reference to the text editor. @type editor: An Editor object. iÿÿÿÿ(tmetadata_foldersabbreviations.gdb(tget_uri_from_local_pathN(t_AutoReplaceTreeView__editorR tTruet!_AutoReplaceTreeView__can_monitort"_AutoReplaceTreeView__create_modelRt%_AutoReplaceTreeView__create_rendererRRt0_AutoReplaceTreeView__create_abbreviation_columnt)_AutoReplaceTreeView__abbreviation_columnt/_AutoReplaceTreeView__create_replacement_columnt(_AutoReplaceTreeView__replacement_columntNoneRRRRRR"t SCRIBES.infoR&t#_AutoReplaceTreeView__database_pathRR'R (R#R$R%R&R'((s"plugins/AutoReplaceGUI/Treeview.pyt__init_attributesFs&          cCst|id|iƒ|idtƒ|iddƒ|idtƒ|i|iƒ|i|iƒ|iiƒdS(s­ Set the description view's default properties. @param self: Reference to the TemplateEditorLanguageView instance. @type self: A TemplateEditorLanguageView object. tmodels rules-hints search-columnisheaders-clickableN(t set_propertyRR)t append_columnR.R0tclicked(R#((s"plugins/AutoReplaceGUI/Treeview.pyt__set_propertieshs cCs˜|io*|ii|iƒ|ii|iƒn|iiƒ|iƒ}|djoL|idtƒ|io*|ii |iƒ|ii |iƒndSn|i ƒpV|idtƒ|i ƒ|io*|ii |iƒ|ii |iƒndSnx0|i ƒD]"\}}|ii ||gƒqW|i ƒ|io*|ii |iƒ|ii |iƒnddkl}||ƒdS(s’ Populate the treeview with data. @param self: Reference to the AutoReplaceTreeView instance. @type self: An AutoReplaceTreeView object. t sensitiveNiÿÿÿÿ(t select_row(RRt handler_blockRtcleart0_AutoReplaceTreeView__get_abbreviations_databaseR1R6tFalsethandler_unblocktkeystclosetitemstappendt SCRIBES.utilsR;(R#tdatabasetkeytvalueR;((s"plugins/AutoReplaceGUI/Treeview.pyt__populate_modelxs8            cCs#ddkl}|ttƒ}|S(sß Create model for the treeview. @param self: Reference to the AutoReplaceTreeView instance. @type self: An AutoReplaceTreeView object. @return: Return a model for the treeview. @rtype: A gtk.ListStore object. iÿÿÿÿ(t ListStore(tgtkRJtstr(R#RJR5((s"plugins/AutoReplaceGUI/Treeview.pyt__create_model›s cCs-ddkl}|ƒ}|idtƒ|S(sø Create the renderer for the treeview's columns. @param self: Reference to the AutoReplaceTreeView instance. @type self: A AutoReplaceTreeView object. @return: A renderer for treeview's columns. @rtype: A gtk.CellRendererText object. iÿÿÿÿ(tCellRendererTextteditable(RKRNR6R)(R#RNtrenderer((s"plugins/AutoReplaceGUI/Treeview.pyt__create_renderer©s  cCs¯ddkl}l}ddkl}ddkl}|||iddƒ}|idtƒ|id|ƒ|id t ƒ|i dƒ|id t ƒ|id |ƒ|S( sä Create the column for abbreviations. @param self: Reference to the AutoReplaceTreeView instance. @type self: A AutoReplaceTreeView object. @return: A column for abbreviations. @rtype: A gtk.TreeViewColumn object. iÿÿÿÿ(tTreeViewColumntTREE_VIEW_COLUMN_GROW_ONLY(tSORT_ASCENDING(tmsg0002ttextitexpandtsizingt clickablessort-indicators sort-order( RKRRRSRTti18nRURR6R?R)tset_sort_column_id(R#RRRSRTRUtcolumn((s"plugins/AutoReplaceGUI/Treeview.pyt__create_abbreviation_column¸s  cCsrddkl}l}ddkl}ddkl}|||iddƒ}|idtƒ|id|ƒ|S( s Create the column for the template editor's description view. @param self: Reference to the TemplateEditorDescriptionView instance. @type self: A TemplateEditorDescriptionView object. @return: A column for the description view. @rtype: A gtk.TreeViewColumn object. iÿÿÿÿ(RRRS(RT(tmsg0003RViRWRX( RKRRRSRTRZR^RR6R)(R#RRRSRTR^R\((s"plugins/AutoReplaceGUI/Treeview.pyt__create_replacement_columnÎs cCsddkl}||ƒtS(Niÿÿÿÿ(R;(RER;R?(R#ttreeviewR;((s"plugins/AutoReplaceGUI/Treeview.pyt__treeview_map_cbàs cCsÁddkl}l}||i|iƒ||i|iƒ||i|iƒ||i |i ƒ||i |i ƒddk l }|io||iƒn|iƒ||ƒ~d}dS(s Handles callback when "destroy" signal is emitted. @param self: Reference to the AutoReplaceTreeView instance. @type self: An AutoReplaceTreeView object. @param manager: Reference to the AutoReplaceManager instance. @type manager: An AutoReplaceManager object. iÿÿÿÿ(tdisconnect_signaltdelete_attributes(tmonitor_cancelN(RERbRcRR RRRRRRRRRdR"RR1(R#R$RbRcRd((s"plugins/AutoReplaceGUI/Treeview.pyt__treeview_destroy_cbås    cCs|iƒtS(s Handles callback when the "row-changed" signal is emitted. @param self: Reference to the AutoReplaceTreeView instance. @type self: An AutoReplaceTreeView object. @param model: The model for the treeview. @type model: An gtk.ListStore object. @param path: An object representing a row. @type path: A gtk.TreePath object. @param iterator: An object pointing to a row. @type iterator: A gtk.TreeIter object. @return: True to propagate signals to parent widgets. @type: A Boolean Object. (t3_AutoReplaceTreeView__update_abbreviations_databaseR?(R#R5tpathtiterator((s"plugins/AutoReplaceGUI/Treeview.pyt__treeview_row_changed_cbþs cCsL|iƒt|iƒp|idtƒnddkl}||ƒtS(s Handles callback when the "row-changed" signal is emitted. @param self: Reference to the AutoReplaceTreeView instance. @type self: An AutoReplaceTreeView object. @param model: The model for the treeview. @type model: An gtk.ListStore object. @param path: An object representing a row. @type path: A gtk.TreePath object. @param iterator: An object pointing to a row. @type iterator: A gtk.TreeIter object. @return: True to propagate signals to parent widgets. @type: A Boolean Object. R:iÿÿÿÿ(R;(RftlenRR6R?RER;(R#R5RgR;((s"plugins/AutoReplaceGUI/Treeview.pyt__treeview_row_deleted_cbs   c Csâ|\}}|p |i|ƒ}|i|ƒn¬|iddƒ}xˆ|iD]}}|idt|ƒjoqOn||djoEddkl} | |} |ii i | ƒ|i i i ƒdSqOqOW||||R1R=RRB(R#RFt abbreviationt replacement((s"plugins/AutoReplaceGUI/Treeview.pyt__update_abbreviations_database‘s     (t__name__t __module__t__doc__R R R R R+R,R-R/RRRRRRR!t'_AutoReplaceTreeView__treeview_empty_cbR>Rf(((s"plugins/AutoReplaceGUI/Treeview.pyR#s&  "  #           N(R”RKRtgobjectRRR(((s"plugins/AutoReplaceGUI/Treeview.pyss