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

Class PyShell

Lib/idlelib/pyshell.py:839–1450  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

837
838
839class PyShell(OutputWindow):
840 from idlelib.squeezer import Squeezer
841
842 shell_title = "IDLE Shell"
843
844 # Override classes
845 ColorDelegator = ModifiedColorDelegator
846 UndoDelegator = ModifiedUndoDelegator
847
848 # Override menus
849 menu_specs = [
850 ("file", "_File"),
851 ("edit", "_Edit"),
852 ("debug", "_Debug"),
853 ("options", "_Options"),
854 ("window", "_Window"),
855 ("help", "_Help"),
856 ]
857
858 # Extend right-click context menu
859 rmenu_specs = OutputWindow.rmenu_specs + [
860 ("Squeeze", "<<squeeze-current-text>>"),
861 ]
862 _idx = 1 + len(list(itertools.takewhile(
863 lambda rmenu_item: rmenu_item[0] != "Copy", rmenu_specs)
864 ))
865 rmenu_specs.insert(_idx, ("Copy with prompts",
866 "<<copy-with-prompts>>",
867 "rmenu_check_copy"))
868 del _idx
869
870 allow_line_numbers = False
871 user_input_insert_tags = "stdin"
872
873 # New classes
874 from idlelib.history import History
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'

Callers 1

open_shellMethod · 0.85

Calls 3

listClass · 0.85
insertMethod · 0.45
compileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…