관리-도구
편집 파일: IdleHistory.pyc
� {fc @ sb d Z d d l m Z d d d � � YZ e d k r^ d d l m Z e d d d d e �n d S( s9 Implement Idle Shell history mechanism with History classi����( t idleConft Historyc B s; e Z d Z d � Z d � Z d � Z d � Z d � Z RS( s@ Implement Idle Shell history mechanism. store - Store source statement (called from PyShell.resetoutput). fetch - Fetch stored statement matching prefix already entered. history_next - Bound to <<history-next>> event (default Alt-N). history_prev - Bound to <<history-prev>> event (default Alt-P). c C sl | | _ g | _ d | _ d | _ t j d d d d d � | _ | j d | j � | j d | j � d S( sd Initialize data attributes and bind event methods. .text - Idle wrapper of tk Text widget, with .bell(). .history - source statements, possibly with multiple lines. .prefix - source already entered at prompt; filters history list. .pointer - index into history. .cyclic - wrap around history list (or not). t mainR t cyclici t bools <<history-previous>>s <<history-next>>N( t textt historyt Nonet prefixt pointerR t GetOptionR t bindt history_prevt history_next( t selfR ( ( s+ /usr/lib64/python2.7/idlelib/IdleHistory.pyt __init__ s c C s | j d t � d S( s4 Fetch later statement; start with ealiest if cyclic.t reverset break( t fetcht False( R t event( ( s+ /usr/lib64/python2.7/idlelib/IdleHistory.pyR s c C s | j d t � d S( s0 Fetch earlier statement; start with most recent.R R ( R t True( R R ( ( s+ /usr/lib64/python2.7/idlelib/IdleHistory.pyR # s c C sG t | j � } | j } | j } | d k r� | d k r� | j j d d d � ss | j j d d � | j | k r� d } } | j j d d � q� n | d k s� | d k r� | j j d d � } | r� | } q� | j r� d } q� | j j � d Sn t | � } x| | rd n d 7} | d k s5| | k r�| j j � | j r\| d k r\d S| j j d d � | k r�| j j d d � | j j d | � n d } } Pn | j | } | | | k rt | � | k r| j j d d � | j j d | � PqqW| j j d � | j j d d d � | | _ | | _ d S( s+ Fetch statememt and replace current line in text widget. Set prefix and pointer as needed for successive fetches. Reset them to None, None when returning to the start line. Sound bell when return to start line or cannot leave a line because cyclic is False. t inserts !=s end-1ct iomarki����Ni i t sels 1.0t end( t lenR R R R R t comparet gett mark_setR t bellt deleteR t seet tag_remove( R R t nhistR R t nprefixt item( ( s+ /usr/lib64/python2.7/idlelib/IdleHistory.pyR ( sJ " " c C so | j � } t | � d k rY y | j j | � Wn t k rE n X| j j | � n d | _ d | _ d S( s. Store Shell input statement into history list.i N( t stripR R t removet ValueErrort appendR R R ( R t source( ( s+ /usr/lib64/python2.7/idlelib/IdleHistory.pyt storeY s ( t __name__t __module__t __doc__R R R R R* ( ( ( s+ /usr/lib64/python2.7/idlelib/IdleHistory.pyR s 1t __main__( R s"