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,10 @@ 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
18201826 frame_help: LabelFrame
18211827 frame_helplist: Frame
18221828 frame_helplist_buttons: Frame
@@ -1842,6 +1848,9 @@ def create_page_general(self):
18421848 self .paren_bell = tracers .add (
18431849 BooleanVar (self ), ('extensions' , 'ParenMatch' , 'bell' ))
18441850
1851+ self .auto_squeeze_min_lines = tracers .add (
1852+ StringVar (self ), ('main' , 'PyShell' , 'auto-squeeze-min-lines' ))
1853+
18451854 self .autosave = tracers .add (
18461855 IntVar (self ), ('main' , 'General' , 'autosave' ))
18471856 self .format_width = tracers .add (
@@ -1855,8 +1864,10 @@ def create_page_general(self):
18551864 text = ' Window Preferences' )
18561865 frame_editor = LabelFrame (self , borderwidth = 2 , relief = GROOVE ,
18571866 text = ' Editor Preferences' )
1867+ frame_shell = LabelFrame (self , borderwidth = 2 , relief = GROOVE ,
1868+ text = ' Shell Preferences' )
18581869 frame_help = LabelFrame (self , borderwidth = 2 , relief = GROOVE ,
1859- text = ' Additional Help Sources ' )
1870+ text = ' Additional Help Sources ' )
18601871 # Frame_window.
18611872 frame_run = Frame (frame_window , borderwidth = 0 )
18621873 startup_title = Label (frame_run , text = 'At Startup' )
@@ -1918,6 +1929,13 @@ def create_page_general(self):
19181929 self .context_int = Entry (
19191930 frame_context , textvariable = self .context_lines , width = 3 )
19201931
1932+ # Frame_shell.
1933+ frame_auto_squeeze_min_lines = Frame (frame_shell , borderwidth = 0 )
1934+ auto_squeeze_min_lines_title = Label (frame_auto_squeeze_min_lines ,
1935+ text = 'Auto-Squeeze Min. Lines:' )
1936+ self .auto_squeeze_min_lines_int = Entry (
1937+ frame_auto_squeeze_min_lines , width = 4 ,
1938+ textvariable = self .auto_squeeze_min_lines )
19211939
19221940 # frame_help.
19231941 frame_helplist = Frame (frame_help )
@@ -1943,6 +1961,7 @@ def create_page_general(self):
19431961 # Body.
19441962 frame_window .pack (side = TOP , padx = 5 , pady = 5 , expand = TRUE , fill = BOTH )
19451963 frame_editor .pack (side = TOP , padx = 5 , pady = 5 , expand = TRUE , fill = BOTH )
1964+ frame_shell .pack (side = TOP , padx = 5 , pady = 5 , expand = TRUE , fill = BOTH )
19461965 frame_help .pack (side = TOP , padx = 5 , pady = 5 , expand = TRUE , fill = BOTH )
19471966 # frame_run.
19481967 frame_run .pack (side = TOP , padx = 5 , pady = 0 , fill = X )
@@ -1983,6 +2002,11 @@ def create_page_general(self):
19832002 context_title .pack (side = LEFT , anchor = W , padx = 5 , pady = 5 )
19842003 self .context_int .pack (side = TOP , padx = 5 , pady = 5 )
19852004
2005+ # frame_auto_squeeze_min_lines
2006+ frame_auto_squeeze_min_lines .pack (side = TOP , padx = 5 , pady = 0 , fill = X )
2007+ auto_squeeze_min_lines_title .pack (side = LEFT , anchor = W , padx = 5 , pady = 5 )
2008+ self .auto_squeeze_min_lines_int .pack (side = TOP , padx = 5 , pady = 5 )
2009+
19862010 # frame_help.
19872011 frame_helplist_buttons .pack (side = RIGHT , padx = 5 , pady = 5 , fill = Y )
19882012 frame_helplist .pack (side = TOP , padx = 5 , pady = 5 , expand = TRUE , fill = BOTH )
@@ -2018,6 +2042,10 @@ def load_general_cfg(self):
20182042 self .context_lines .set (idleConf .GetOption (
20192043 'extensions' , 'CodeContext' , 'maxlines' , type = 'int' ))
20202044
2045+ # Set variables for shell windows.
2046+ self .auto_squeeze_min_lines .set (idleConf .GetOption (
2047+ 'main' , 'PyShell' , 'auto-squeeze-min-lines' , type = 'int' ))
2048+
20212049 # Set additional help sources.
20222050 self .user_helplist = idleConf .GetAllExtraHelpSourcesList ()
20232051 self .helplist .delete (0 , 'end' )
@@ -2211,6 +2239,9 @@ def detach(self):
22112239
22122240CodeContext: Maxlines is the maximum number of code context lines to
22132241display when Code Context is turned on for an editor window.
2242+
2243+ Shell Preferences: Auto-Squeeze Min. Lines is the minimum number of lines
2244+ of output to automatically "squeeze".
22142245'''
22152246}
22162247
0 commit comments