MCPcopy Index your code
hub / github.com/python/cpython / __init__

Method __init__

Lib/idlelib/pyshell.py:877–957  ·  view source on GitHub ↗
(self, flist=None)

Source from the content-addressed store, hash-verified

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

Callers 2

__init__Method · 0.45
__init__Method · 0.45

Calls 13

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

Tested by

no test coverage detected