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

Method __init__

tools/python-3.11.9-amd64/Lib/idlelib/pyshell.py:883–959  ·  view source on GitHub ↗
(self, flist=None)

Source from the content-addressed store, hash-verified

881 from idlelib.sidebar import ShellSidebar
882
883 def __init__(self, flist=None):
884 if use_subprocess:
885 ms = self.menu_specs
886 if ms[2][0] != "shell":
887 ms.insert(2, ("shell", "She_ll"))
888 self.interp = ModifiedInterpreter(self)
889 if flist is None:
890 root = Tk()
891 fixwordbreaks(root)
892 root.withdraw()
893 flist = PyShellFileList(root)
894
895 self.shell_sidebar = None # initialized below
896
897 OutputWindow.__init__(self, flist, None, None)
898
899 self.usetabs = False
900 # indentwidth must be 8 when using tabs. See note in EditorWindow:
901 self.indentwidth = 4
902
903 self.sys_ps1 = sys.ps1 if hasattr(sys, 'ps1') else '>>>\n'
904 self.prompt_last_line = self.sys_ps1.split('\n')[-1]
905 self.prompt = self.sys_ps1 # Changes when debug active
906
907 text = self.text
908 text.configure(wrap="char")
909 text.bind("<<newline-and-indent>>", self.enter_callback)
910 text.bind("<<plain-newline-and-indent>>", self.linefeed_callback)
911 text.bind("<<interrupt-execution>>", self.cancel_callback)
912 text.bind("<<end-of-file>>", self.eof_callback)
913 text.bind("<<open-stack-viewer>>", self.open_stack_viewer)
914 text.bind("<<toggle-debugger>>", self.toggle_debugger)
915 text.bind("<<toggle-jit-stack-viewer>>", self.toggle_jit_stack_viewer)
916 text.bind("<<copy-with-prompts>>", self.copy_with_prompts_callback)
917 if use_subprocess:
918 text.bind("<<view-restart>>", self.view_restart_mark)
919 text.bind("<<restart-shell>>", self.restart_shell)
920 self.squeezer = self.Squeezer(self)
921 text.bind("<<squeeze-current-text>>",
922 self.squeeze_current_text_event)
923
924 self.save_stdout = sys.stdout
925 self.save_stderr = sys.stderr
926 self.save_stdin = sys.stdin
927 from idlelib import iomenu
928 self.stdin = StdInputFile(self, "stdin",
929 iomenu.encoding, iomenu.errors)
930 self.stdout = StdOutputFile(self, "stdout",
931 iomenu.encoding, iomenu.errors)
932 self.stderr = StdOutputFile(self, "stderr",
933 iomenu.encoding, "backslashreplace")
934 self.console = StdOutputFile(self, "console",
935 iomenu.encoding, iomenu.errors)
936 if not use_subprocess:
937 sys.stdout = self.stdout
938 sys.stderr = self.stderr
939 sys.stdin = self.stdin
940 try:

Callers 2

__init__Method · 0.45
__init__Method · 0.45

Calls 12

fixwordbreaksFunction · 0.90
StdInputFileClass · 0.90
StdOutputFileClass · 0.90
ModifiedInterpreterClass · 0.85
PyShellFileListClass · 0.85
insertfilterMethod · 0.80
TkClass · 0.50
insertMethod · 0.45
splitMethod · 0.45
configureMethod · 0.45
bindMethod · 0.45

Tested by

no test coverage detected