3030from idlelib .codecontext import CodeContext
3131from idlelib .parenmatch import ParenMatch
3232from idlelib .paragraph import FormatParagraph
33+ from idlelib .squeezer import Squeezer
3334
3435changes = ConfigChanges ()
3536# Reload changed options in the following classes.
36- reloadables = (AutoComplete , CodeContext , ParenMatch , FormatParagraph )
37+ reloadables = (AutoComplete , CodeContext , ParenMatch , FormatParagraph ,
38+ Squeezer )
3739
3840
3941class ConfigDialog (Toplevel ):
@@ -1748,9 +1750,9 @@ def delete_custom_keys(self):
17481750 self .customlist .SetMenu (item_list , item_list [0 ])
17491751 # Revert to default key set.
17501752 self .keyset_source .set (idleConf .defaultCfg ['main' ]
1751- .Get ('Keys' , 'default' ))
1753+ .Get ('Keys' , 'default' ))
17521754 self .builtin_name .set (idleConf .defaultCfg ['main' ].Get ('Keys' , 'name' )
1753- or idleConf .default_keys ())
1755+ or idleConf .default_keys ())
17541756 # User can't back out of these changes, they must be applied now.
17551757 changes .save_all ()
17561758 self .cd .save_all_changed_extensions ()
@@ -1817,6 +1819,16 @@ def create_page_general(self):
18171819 frame_context: Frame
18181820 context_title: Label
18191821 (*)context_int: Entry - context_lines
1822+ frame_shell: LabelFrame
1823+ frame_auto_squeeze_min_lines: Frame
1824+ auto_squeeze_min_lines_title: Label
1825+ (*)auto_squeeze_min_lines_int: Entry - auto_squeeze_min_lines
1826+ frame_show_squeezed_tooltips: Frame
1827+ show_squeezed_tooltips_title: Label
1828+ (*)show_squeezed_tooltips_bool: Entry - show_squeezed_tooltips
1829+ frame_squeezed_tooltips_delay: Frame
1830+ squeezed_tooltips_delay_title: Label
1831+ (*)squeezed_tooltips_delay_int: Entry - squeezed_tooltips_delay
18201832 frame_help: LabelFrame
18211833 frame_helplist: Frame
18221834 frame_helplist_buttons: Frame
@@ -1842,6 +1854,13 @@ def create_page_general(self):
18421854 self .paren_bell = tracers .add (
18431855 BooleanVar (self ), ('extensions' , 'ParenMatch' , 'bell' ))
18441856
1857+ self .auto_squeeze_min_lines = tracers .add (
1858+ StringVar (self ), ('main' , 'PyShell' , 'auto-squeeze-min-lines' ))
1859+ self .show_squeezed_tooltips = tracers .add (
1860+ StringVar (self ), ('main' , 'PyShell' , 'show-squeezed-tooltips' ))
1861+ self .squeezed_tooltips_delay = tracers .add (
1862+ StringVar (self ), ('main' , 'PyShell' , 'squeezed-tooltips-delay' ))
1863+
18451864 self .autosave = tracers .add (
18461865 IntVar (self ), ('main' , 'General' , 'autosave' ))
18471866 self .format_width = tracers .add (
@@ -1855,8 +1874,10 @@ def create_page_general(self):
18551874 text = ' Window Preferences' )
18561875 frame_editor = LabelFrame (self , borderwidth = 2 , relief = GROOVE ,
18571876 text = ' Editor Preferences' )
1877+ frame_shell = LabelFrame (self , borderwidth = 2 , relief = GROOVE ,
1878+ text = ' Shell Preferences' )
18581879 frame_help = LabelFrame (self , borderwidth = 2 , relief = GROOVE ,
1859- text = ' Additional Help Sources ' )
1880+ text = ' Additional Help Sources ' )
18601881 # Frame_window.
18611882 frame_run = Frame (frame_window , borderwidth = 0 )
18621883 startup_title = Label (frame_run , text = 'At Startup' )
@@ -1918,6 +1939,25 @@ def create_page_general(self):
19181939 self .context_int = Entry (
19191940 frame_context , textvariable = self .context_lines , width = 3 )
19201941
1942+ # Frame_shell.
1943+ frame_auto_squeeze_min_lines = Frame (frame_shell , borderwidth = 0 )
1944+ auto_squeeze_min_lines_title = Label (frame_auto_squeeze_min_lines ,
1945+ text = 'Auto-Squeeze Min. Lines:' )
1946+ self .auto_squeeze_min_lines_int = Entry (
1947+ frame_auto_squeeze_min_lines , width = 4 ,
1948+ textvariable = self .auto_squeeze_min_lines )
1949+ frame_show_squeezed_tooltips = Frame (frame_shell , borderwidth = 0 )
1950+ show_squeezed_tooltips_title = Label (frame_show_squeezed_tooltips ,
1951+ text = 'Show Squeezed Tooltips:' )
1952+ self .show_squeezed_tooltips_on = Checkbutton (
1953+ frame_show_squeezed_tooltips ,
1954+ variable = self .show_squeezed_tooltips )
1955+ frame_squeezed_tooltips_delay = Frame (frame_shell , borderwidth = 0 )
1956+ squeezed_tooltips_delay_title = Label (frame_squeezed_tooltips_delay ,
1957+ text = 'Squeezed Tooltip Delay:' )
1958+ self .squeezed_tooltips_delay_int = Entry (
1959+ frame_squeezed_tooltips_delay , width = 4 ,
1960+ textvariable = self .squeezed_tooltips_delay )
19211961
19221962 # frame_help.
19231963 frame_helplist = Frame (frame_help )
@@ -1943,6 +1983,7 @@ def create_page_general(self):
19431983 # Body.
19441984 frame_window .pack (side = TOP , padx = 5 , pady = 5 , expand = TRUE , fill = BOTH )
19451985 frame_editor .pack (side = TOP , padx = 5 , pady = 5 , expand = TRUE , fill = BOTH )
1986+ frame_shell .pack (side = TOP , padx = 5 , pady = 5 , expand = TRUE , fill = BOTH )
19461987 frame_help .pack (side = TOP , padx = 5 , pady = 5 , expand = TRUE , fill = BOTH )
19471988 # frame_run.
19481989 frame_run .pack (side = TOP , padx = 5 , pady = 0 , fill = X )
@@ -1983,6 +2024,19 @@ def create_page_general(self):
19832024 context_title .pack (side = LEFT , anchor = W , padx = 5 , pady = 5 )
19842025 self .context_int .pack (side = TOP , padx = 5 , pady = 5 )
19852026
2027+ # frame_auto_squeeze_min_lines
2028+ frame_auto_squeeze_min_lines .pack (side = TOP , padx = 5 , pady = 0 , fill = X )
2029+ auto_squeeze_min_lines_title .pack (side = LEFT , anchor = W , padx = 5 , pady = 5 )
2030+ self .auto_squeeze_min_lines_int .pack (side = TOP , padx = 5 , pady = 5 )
2031+
2032+ frame_show_squeezed_tooltips .pack (side = TOP , padx = 5 , pady = 0 , fill = X )
2033+ show_squeezed_tooltips_title .pack (side = LEFT , anchor = W , padx = 5 , pady = 5 )
2034+ self .show_squeezed_tooltips_on .pack (side = TOP , padx = 5 , pady = 5 )
2035+
2036+ frame_squeezed_tooltips_delay .pack (side = TOP , padx = 5 , pady = 0 , fill = X )
2037+ squeezed_tooltips_delay_title .pack (side = LEFT , anchor = W , padx = 5 , pady = 5 )
2038+ self .squeezed_tooltips_delay_int .pack (side = TOP , padx = 5 , pady = 5 )
2039+
19862040 # frame_help.
19872041 frame_helplist_buttons .pack (side = RIGHT , padx = 5 , pady = 5 , fill = Y )
19882042 frame_helplist .pack (side = TOP , padx = 5 , pady = 5 , expand = TRUE , fill = BOTH )
@@ -2018,6 +2072,14 @@ def load_general_cfg(self):
20182072 self .context_lines .set (idleConf .GetOption (
20192073 'extensions' , 'CodeContext' , 'maxlines' , type = 'int' ))
20202074
2075+ # Set variables for shell windows.
2076+ self .auto_squeeze_min_lines .set (idleConf .GetOption (
2077+ 'main' , 'PyShell' , 'auto-squeeze-min-lines' , type = 'int' ))
2078+ self .show_squeezed_tooltips .set (idleConf .GetOption (
2079+ 'main' , 'PyShell' , 'show-squeezed-tooltips' , type = 'bool' ))
2080+ self .squeezed_tooltips_delay .set (idleConf .GetOption (
2081+ 'main' , 'PyShell' , 'squeezed-tooltips-delay' , type = 'int' ))
2082+
20212083 # Set additional help sources.
20222084 self .user_helplist = idleConf .GetAllExtraHelpSourcesList ()
20232085 self .helplist .delete (0 , 'end' )
@@ -2211,6 +2273,14 @@ def detach(self):
22112273
22122274CodeContext: Maxlines is the maximum number of code context lines to
22132275display when Code Context is turned on for an editor window.
2276+
2277+ Shell Preferences:
2278+ * Auto-Squeeze Min. Lines is the minimum number of lines of output to
2279+ automatically "squeeze".
2280+ * Show Squeezed Tooltips toggles whether tooltips are shown for squeezed
2281+ outputs.
2282+ * Squeezed Tooltips Delay sets the mouse hover delay over a squeezed output
2283+ before its tooltip is shown, in milliseconds.
22142284'''
22152285}
22162286
0 commit comments