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

Class PyShell

tools/python-3.11.9-amd64/Lib/idlelib/pyshell.py:845–1453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

open_shellMethod · 0.85

Calls 4

python_versionFunction · 0.90
listFunction · 0.85
insertMethod · 0.45
compileMethod · 0.45

Tested by

no test coverage detected