@@ -2029,53 +2029,37 @@ def cmdline_results_scroll(w, size, key):
2029
2029
2030
2030
# {{{ sidebar sizing
2031
2031
2032
- def max_sidebar ( w , size , key ) :
2032
+ def _set_sidebar_weight ( weight : float ) -> None :
2033
2033
from pudb .settings import save_config
2034
2034
2035
- weight = 5
2036
2035
CONFIG ["sidebar_width" ] = weight
2037
2036
save_config (CONFIG )
2038
2037
2039
2038
self .columns .contents [1 ] = (
2040
2039
self .columns .contents [1 ][0 ],
2041
- (urwid .WEIGHT , weight ))
2042
- self .columns ._invalidate ()
2043
-
2044
- def min_sidebar (w , size , key ):
2045
- from pudb .settings import save_config
2040
+ self .columns .options ("weight" , weight ))
2046
2041
2047
- weight = 1 / 5
2048
- CONFIG ["sidebar_width" ] = weight
2049
- save_config (CONFIG )
2042
+ def max_sidebar (w , size , key ):
2043
+ _set_sidebar_weight (5 )
2050
2044
2051
- self .columns .contents [1 ] = (
2052
- self .columns .contents [1 ][0 ],
2053
- (urwid .WEIGHT , weight ))
2054
- self .columns ._invalidate ()
2045
+ def min_sidebar (w , size , key ):
2046
+ _set_sidebar_weight (1 / 5 )
2055
2047
2056
2048
def grow_sidebar (w , size , key ):
2057
- from pudb .settings import save_config
2058
-
2059
- weight = self .columns .column_types [1 ][1 ]
2049
+ _widget , (_weight_literal , weight , _flag ) = self .columns .contents [1 ]
2050
+ assert weight is not None
2060
2051
2061
2052
if weight < 5 :
2062
2053
weight *= 1.25
2063
- CONFIG ["sidebar_width" ] = weight
2064
- save_config (CONFIG )
2065
- self .columns .column_types [1 ] = urwid .WEIGHT , weight
2066
- self .columns ._invalidate ()
2054
+ _set_sidebar_weight (weight )
2067
2055
2068
2056
def shrink_sidebar (w , size , key ):
2069
- from pudb .settings import save_config
2070
-
2071
- weight = self .columns .column_types [1 ][1 ]
2057
+ _widget , (_weight_literal , weight , _flag ) = self .columns .contents [1 ]
2058
+ assert weight is not None
2072
2059
2073
2060
if weight > 1 / 5 :
2074
2061
weight /= 1.25
2075
- CONFIG ["sidebar_width" ] = weight
2076
- save_config (CONFIG )
2077
- self .columns .column_types [1 ] = urwid .WEIGHT , weight
2078
- self .columns ._invalidate ()
2062
+ _set_sidebar_weight (weight )
2079
2063
2080
2064
self .rhs_col_sigwrap .listen ("=" , max_sidebar )
2081
2065
self .rhs_col_sigwrap .listen ("+" , grow_sidebar )
0 commit comments