%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python3.8/idlelib/__pycache__/
Upload File :
Create Path :
Current File : //usr/local/lib/python3.8/idlelib/__pycache__/outwin.cpython-38.pyc

U

qaM@sdZddlZddlmZddlmZddddd	gZdad
dZdd
Z	GdddeZ
GdddZedkrddl
mZedddddS)z0Editor window that can serve as an output file.
N)
messagebox)EditorWindowzfile "([^"]*)", line (\d+)z([^\s]+)\((\d+)\)z^(\s*\S.*?):\s*(\d+):z([^\s]+):\s*(\d+):z^\s*(\S.*?):\s*(\d+):cCsddtDadS)z?Compile the patterns for matching to file name and line number.cSsg|]}t|tjqS)recompile
IGNORECASE).0patrr*/usr/local/lib/python3.8/idlelib/outwin.py
<listcomp>sz!compile_progs.<locals>.<listcomp>N)file_line_patsfile_line_progsrrrr

compile_progssrc	Csts
ttD]X}||}|r|dd\}}zt|d}|WqlWqtk
rdYqYqXqdSz|t|fWStk
rYdSXdS)a-Extract file name and line number from line of text.

    Check if line of text contains one of the file/line patterns.
    If it does and if the file and line are valid, return
    a tuple of the file name and line number.  If it doesn't match
    or if the file or line is invalid, return None.
    rN)	r
rsearchgroupopencloseOSErrorint	TypeError)lineprogmatchfilenamelinenofrrr
file_line_helpers"


rc@sneZdZdZdddddgZdZdd	Zd
dZdd
ZddZ	dddZ
ddZddZddZ
dddZdS)OutputWindowzAn editor window that can serve as an output file.

    Also the future base class for the Python shell window.
    This class has no input facilities.

    Adds binding to open a file at a line to the text widget.
    )ZCutz<<cut>>Zrmenu_check_cut)ZCopyz<<copy>>Zrmenu_check_copy)ZPastez	<<paste>>Zrmenu_check_paste)NNN)zGo to file/line<<goto-file-line>>NFcGs$tj|f||jd|jdS)Nr!)r__init__textbindgoto_file_line)selfargsrrr
r"NszOutputWindow.__init__cCsdS)z6Python source is only part of output: do not colorize.Fr)r&rrrr
ispythonsourceSszOutputWindow.ispythonsourcecCsdS)zCustomize EditorWindow title.ZOutputrr&rrr
short_titleWszOutputWindow.short_titlecCs|rdSdS)z;Customize EditorWindow to not display save file messagebox.Zyesno)Z	get_savedr)rrr
	maybesave[szOutputWindow.maybesaverinsertcCs<t|tst|j||||j||jt|S)aWrite text to text widget.

        The text is inserted at the given index with the provided
        tags.  The text widget is then scrolled to make it visible
        and updated to display it, giving the effect of seeing each
        line as it is added.

        Args:
            s: Text to insert into text widget.
            tags: Tuple of tag strings to apply on the insert.
            mark: Index for the insert.

        Return:
            Length of text inserted.
        )
isinstancestrAssertionErrorr#r-Zseeupdatelenr&sZtagsZmarkrrr
write`s

zOutputWindow.writecCs|D]}||qdS)z"Write each item in lines iterable.N)r5)r&linesrrrr

writelinesvszOutputWindow.writelinescCsdS)z8No flushing needed as write() directly writes to widget.Nrr)rrr
flush{szOutputWindow.flushcOstj||dSN)r	showerror)r&r'kwargsrrr
r:szOutputWindow.showerrorNcCsd|jdd}t|}|sJ|jdd}t|}|sJ|jdd|jddS|\}}|j||dS)	aHandle request to open file/line.

        If the selected or previous line in the output window
        contains a file name and line number, then open that file
        name in a new window and position on the line number.

        Otherwise, display an error messagebox.
        zinsert linestartzinsert lineendzinsert -1line linestartzinsert -1line lineendzNo special linezTThe line you point at doesn't look like a valid file name followed by a line number.)parentN)r#getrr:flistZgotofileline)r&eventrresultrrrrr
r%s 	zOutputWindow.goto_file_line)rr-)N)__name__
__module____qualname____doc__Zrmenu_specsZallow_code_contextr"r(r*r,r5r7r8r:r%rrrr
r :s"

r c@s6eZdZddiddidZddZddZd	d
ZdS)OnDemandOutputWindowZ
foregroundZbluez#007700)stdoutstderrcCs||_d|_dSr9)r>owin)r&r>rrr
r"szOnDemandOutputWindow.__init__cCs"|js||j|||dSr9)rHsetupr5r3rrr
r5szOnDemandOutputWindow.writecCsTt|j|_}|j}|jD]\}}|r |j|f|q |d|jj|_dS)NZsel)	r r>rHr#tagdefsitemsZ
tag_configureZ	tag_raiser5)r&rHr#tagZcnfrrr
rIs
zOnDemandOutputWindow.setupN)rArBrCrJr"r5rIrrrr
rEsrE__main__)mainzidlelib.idle_test.test_outwinrF)	verbosityexit)rDrtkinterrZidlelib.editorrrr
rrr rErAZunittestrNrrrr
<module>s"	e

Zerion Mini Shell 1.0