diff -r 7a45415956b9 Lib/idlelib/ZoomInOut.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Lib/idlelib/ZoomInOut.py Tue Apr 30 03:41:03 2013 +0200 @@ -0,0 +1,39 @@ +# ZoomInOut extension +# Press to zoom in and to zoom out + + +def zoom_decorator(func): + """ + Decotaror to avoid code duplication in + zoom_in_event and zoom_out_event + """ + def f(self, event): + font = self.text.configure('font')[-1] + if isinstance(font, str): + font = self.text.tk.split(font) + fontname, fontsize, fontwidth = font + fontsize = func(self, int(fontsize)) + self.text.configure(font=(fontname, fontsize, fontwidth)) + return f + + +class ZoomInOut: + + menudefs = [ + ('windows', [ + ('Zoom In', '<>'), + ('Zoom Out', '<>') + ]) + ] + + def __init__(self, editwin): + self.text = editwin.text + + @zoom_decorator + def zoom_in_event(self, fontsize): + return fontsize + 1 if fontsize < 22 else fontsize + + @zoom_decorator + def zoom_out_event(self, fontsize): + return fontsize - 1 if fontsize > 7 else fontsize + diff -r 7a45415956b9 Lib/idlelib/config-extensions.def --- a/Lib/idlelib/config-extensions.def Sun Apr 28 17:07:16 2013 -0400 +++ b/Lib/idlelib/config-extensions.def Tue Apr 30 03:41:03 2013 +0200 @@ -44,6 +44,12 @@ [ZoomHeight_cfgBindings] zoom-height= +[ZoomInOut] +enable=1 +[ZoomInOut_cfgBindings] +zoom-in= +zoom-out= + [ScriptBinding] enable=1 enable_shell=0