003 File Manager
Current Path:
/usr/local/lib/python3.8/idlelib
usr
/
local
/
lib
/
python3.8
/
idlelib
/
📁
..
📄
CREDITS.txt
(1.82 KB)
📄
ChangeLog
(55.04 KB)
📄
HISTORY.txt
(10.07 KB)
📁
Icons
📄
NEWS.txt
(49.62 KB)
📄
NEWS2x.txt
(26.54 KB)
📄
README.txt
(9.37 KB)
📄
TODO.txt
(8.28 KB)
📄
__init__.py
(396 B)
📄
__main__.py
(159 B)
📁
__pycache__
📄
autocomplete.py
(8.94 KB)
📄
autocomplete_w.py
(19.64 KB)
📄
autoexpand.py
(3.14 KB)
📄
browser.py
(8.12 KB)
📄
calltip.py
(7.1 KB)
📄
calltip_w.py
(6.99 KB)
📄
codecontext.py
(11.15 KB)
📄
colorizer.py
(12.89 KB)
📄
config-extensions.def
(2.21 KB)
📄
config-highlight.def
(2.8 KB)
📄
config-keys.def
(10.65 KB)
📄
config-main.def
(3.09 KB)
📄
config.py
(37.28 KB)
📄
config_key.py
(14.2 KB)
📄
configdialog.py
(102.6 KB)
📄
debugger.py
(18.66 KB)
📄
debugger_r.py
(11.88 KB)
📄
debugobj.py
(3.96 KB)
📄
debugobj_r.py
(1.06 KB)
📄
delegator.py
(1.02 KB)
📄
dynoption.py
(1.97 KB)
📄
editor.py
(64.16 KB)
📄
extend.txt
(3.55 KB)
📄
filelist.py
(3.79 KB)
📄
format.py
(15.41 KB)
📄
grep.py
(7.3 KB)
📄
help.html
(66.72 KB)
📄
help.py
(11.57 KB)
📄
help_about.py
(8.77 KB)
📄
history.py
(3.95 KB)
📄
hyperparser.py
(12.58 KB)
📄
idle.bat
(177 B)
📄
idle.py
(454 B)
📄
idle.pyw
(570 B)
📁
idle_test
📄
iomenu.py
(15.36 KB)
📄
macosx.py
(9.44 KB)
📄
mainmenu.py
(3.83 KB)
📄
multicall.py
(18.21 KB)
📄
outwin.py
(5.58 KB)
📄
parenmatch.py
(7.04 KB)
📄
pathbrowser.py
(3.12 KB)
📄
percolator.py
(3.06 KB)
📄
pyparse.py
(19.48 KB)
📄
pyshell.py
(56.09 KB)
📄
query.py
(14.72 KB)
📄
redirector.py
(6.71 KB)
📄
replace.py
(9.66 KB)
📄
rpc.py
(20.58 KB)
📄
run.py
(20.45 KB)
📄
runscript.py
(8.08 KB)
📄
scrolledlist.py
(4.36 KB)
📄
search.py
(5.44 KB)
📄
searchbase.py
(7.67 KB)
📄
searchengine.py
(7.19 KB)
📄
sidebar.py
(13.27 KB)
📄
squeezer.py
(12.52 KB)
📄
stackviewer.py
(4.35 KB)
📄
statusbar.py
(1.44 KB)
📄
textview.py
(6.65 KB)
📄
tooltip.py
(6.4 KB)
📄
tree.py
(15.99 KB)
📄
undo.py
(10.79 KB)
📄
window.py
(2.55 KB)
📄
zoomheight.py
(4.1 KB)
📄
zzdummy.py
(1.96 KB)
Editing: zzdummy.py
"""Example extension, also used for testing. See extend.txt for more details on creating an extension. See config-extension.def for configuring an extension. """ from idlelib.config import idleConf from functools import wraps def format_selection(format_line): "Apply a formatting function to all of the selected lines." @wraps(format_line) def apply(self, event=None): head, tail, chars, lines = self.formatter.get_region() for pos in range(len(lines) - 1): line = lines[pos] lines[pos] = format_line(self, line) self.formatter.set_region(head, tail, chars, lines) return 'break' return apply class ZzDummy: """Prepend or remove initial text from selected lines.""" # Extend the format menu. menudefs = [ ('format', [ ('Z in', '<<z-in>>'), ('Z out', '<<z-out>>'), ] ) ] def __init__(self, editwin): "Initialize the settings for this extension." self.editwin = editwin self.text = editwin.text self.formatter = editwin.fregion @classmethod def reload(cls): "Load class variables from config." cls.ztext = idleConf.GetOption('extensions', 'ZzDummy', 'z-text') @format_selection def z_in_event(self, line): """Insert text at the beginning of each selected line. This is bound to the <<z-in>> virtual event when the extensions are loaded. """ return f'{self.ztext}{line}' @format_selection def z_out_event(self, line): """Remove specific text from the beginning of each selected line. This is bound to the <<z-out>> virtual event when the extensions are loaded. """ zlength = 0 if not line.startswith(self.ztext) else len(self.ztext) return line[zlength:] ZzDummy.reload() if __name__ == "__main__": import unittest unittest.main('idlelib.idle_test.test_zzdummy', verbosity=2, exit=False)
Upload File
Create Folder