
}_Fc           @   s    d  Z  d e f d     YZ d S(   s   
This module documents a class that implements keyboard scroll
operations.

@author: Lateef Alabi-Oki
@organization: The Scribes Project
@copyright: Copyright © 2007 Lateef Alabi-Oki
@license: GNU GPLv2 or Later
@contact: mystilleef@gmail.com
t   Managerc           B   sM   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   s5   
	This class implements keyboard scroll operations.
	c         C   s:   |  i  |  d d k l } l } | |  i d | d S(   s   
		Initialize object.

		@param self: Reference to the Manager instance.
		@type self: A Manager object.

		@param editor: Reference to the text editor.
		@type editor: An Editor object.
		i(   t   idle_addt   PRIORITY_LOWt   priorityN(   t   _Manager__init_attributest   gobjectR   R   t   _Manager__precompile_methods(   t   selft   editorR   R   (    (    sD   /home/goldenmyst/.gnome2/scribes/plugins/ScrollNavigation/Manager.pyt   __init__%   s    
c         C   s%   | |  _  | i |  _ | i |  _ d S(   s   
		Initialize object.

		@param self: Reference to the Manager instance.
		@type self: A Manager object.

		@param editor: Reference to the text editor.
		@type editor: An Editor object.
		N(   t   _Manager__editort   textviewt   _Manager__viewt   feedbackt   _Manager__feedback(   R   R   (    (    sD   /home/goldenmyst/.gnome2/scribes/plugins/ScrollNavigation/Manager.pyt   __init_attributes3   s    
	c         C   so   |  i  i   } | i | i | i | i f \ } } } } |  i  i | |  } | i   |  i  i | d  d S(   sl   
		Scroll the view up.

		@param self: Reference to the Manager instance.
		@type self: A Manager object.
		gMbP?N(	   R   t   get_visible_rectt   xt   yt   widtht   heightt   get_iter_at_locationt   backward_linet   scroll_to_iter(   R   t	   rectangleR   R   R   R   t   iterator(    (    sD   /home/goldenmyst/.gnome2/scribes/plugins/ScrollNavigation/Manager.pyt	   scroll_upH   s    *
c         C   ss   |  i  i   } | i | i | i | i f \ } } } } |  i  i | | |  } | i   |  i  i | d  d S(   sn   
		Scroll the view down.

		@param self: Reference to the Manager instance.
		@type self: A Manager object.
		gMbP?N(	   R   R   R   R   R   R   R   t   forward_lineR   (   R   R   R   R   R   R   R   (    (    sD   /home/goldenmyst/.gnome2/scribes/plugins/ScrollNavigation/Manager.pyt   scroll_downV   s    *
c         C   sX   |  i  i   } |  i i | d d t d d d d k l } |  i i | d d  d	 S(
   su   
		Center view on current line.

		@param self: Reference to the Manager instance.
		@type self: A Manager object.
		gMbP?t	   use_alignt   xaligng      ?i(   t   msg0001t   yesi   N(	   R
   t   get_cursor_iteratorR   R   t   Truet   i18nR   R   t   update_status_message(   R   R   R   (    (    sD   /home/goldenmyst/.gnome2/scribes/plugins/ScrollNavigation/Manager.pyt   centerd   s
    c         C   s   |  i  i |   ~  d }  d S(   sh   
		Destroy object.

		@param self: Reference to the Manager instance.
		@type self: A Manager object.
		N(   R
   t   delete_attributest   None(   R   (    (    sD   /home/goldenmyst/.gnome2/scribes/plugins/ScrollNavigation/Manager.pyt   destroyq   s    c         C   sU   y; d d k  l } | |  i  | |  i  | |  i  Wn t j
 o n Xt S(   su   
		Optimize methods using Psyco

		@param self: Reference to the Manager instance.
		@type self: A Manager object.
		i(   t   bind(   t   psycoR)   R   R   R%   t   ImportErrort   False(   R   R)   (    (    sD   /home/goldenmyst/.gnome2/scribes/plugins/ScrollNavigation/Manager.pyt   __precompile_methods}   s    (
   t   __name__t
   __module__t   __doc__R	   R   R   R   R%   R(   R   (    (    (    sD   /home/goldenmyst/.gnome2/scribes/plugins/ScrollNavigation/Manager.pyR        s   						N(   R0   t   objectR    (    (    (    sD   /home/goldenmyst/.gnome2/scribes/plugins/ScrollNavigation/Manager.pys   <module>   s   