MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / EditorWindow

Class EditorWindow

tools/python-3.11.9-amd64/Lib/idlelib/editor.py:51–1603  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49
50
51class EditorWindow:
52 from idlelib.percolator import Percolator
53 from idlelib.colorizer import ColorDelegator, color_config
54 from idlelib.undo import UndoDelegator
55 from idlelib.iomenu import IOBinding, encoding
56 from idlelib import mainmenu
57 from idlelib.statusbar import MultiStatusBar
58 from idlelib.autocomplete import AutoComplete
59 from idlelib.autoexpand import AutoExpand
60 from idlelib.calltip import Calltip
61 from idlelib.codecontext import CodeContext
62 from idlelib.sidebar import LineNumbers
63 from idlelib.format import FormatParagraph, FormatRegion, Indents, Rstrip
64 from idlelib.parenmatch import ParenMatch
65 from idlelib.zoomheight import ZoomHeight
66
67 filesystemencoding = sys.getfilesystemencoding() # for file names
68 help_url = None
69
70 allow_code_context = True
71 allow_line_numbers = True
72 user_input_insert_tags = None
73
74 def __init__(self, flist=None, filename=None, key=None, root=None):
75 # Delay import: runscript imports pyshell imports EditorWindow.
76 from idlelib.runscript import ScriptBinding
77
78 if EditorWindow.help_url is None:
79 dochome = os.path.join(sys.base_prefix, 'Doc', 'index.html')
80 if sys.platform.count('linux'):
81 # look for html docs in a couple of standard places
82 pyver = 'python-docs-' + '%s.%s.%s' % sys.version_info[:3]
83 if os.path.isdir('/var/www/html/python/'): # "python2" rpm
84 dochome = '/var/www/html/python/index.html'
85 else:
86 basepath = '/usr/share/doc/' # standard location
87 dochome = os.path.join(basepath, pyver,
88 'Doc', 'index.html')
89 elif sys.platform[:3] == 'win':
90 import winreg # Windows only, block only executed once.
91 docfile = ''
92 KEY = (rf"Software\Python\PythonCore\{sys.winver}"
93 r"\Help\Main Python Documentation")
94 try:
95 docfile = winreg.QueryValue(winreg.HKEY_CURRENT_USER, KEY)
96 except FileNotFoundError:
97 try:
98 docfile = winreg.QueryValue(winreg.HKEY_LOCAL_MACHINE,
99 KEY)
100 except FileNotFoundError:
101 pass
102 if os.path.isfile(docfile):
103 dochome = docfile
104 elif sys.platform == 'darwin':
105 # documentation may be stored inside a python framework
106 dochome = os.path.join(sys.base_prefix,
107 'Resources/English.lproj/Documentation/index.html')
108 dochome = os.path.normpath(dochome)

Callers 4

test_initMethod · 0.90
setUpClassMethod · 0.90
setUpClassMethod · 0.90
_editor_windowFunction · 0.85

Calls

no outgoing calls

Tested by 3

test_initMethod · 0.72
setUpClassMethod · 0.72
setUpClassMethod · 0.72