Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../lib64/python2..../idlelib
File: ZoomHeight.py
# Sample extension: zoom a window to maximum height
[0] Fix | Delete
[1] Fix | Delete
import re
[2] Fix | Delete
import sys
[3] Fix | Delete
[4] Fix | Delete
from idlelib import macosxSupport
[5] Fix | Delete
[6] Fix | Delete
class ZoomHeight:
[7] Fix | Delete
[8] Fix | Delete
menudefs = [
[9] Fix | Delete
('windows', [
[10] Fix | Delete
('_Zoom Height', '<<zoom-height>>'),
[11] Fix | Delete
])
[12] Fix | Delete
]
[13] Fix | Delete
[14] Fix | Delete
def __init__(self, editwin):
[15] Fix | Delete
self.editwin = editwin
[16] Fix | Delete
[17] Fix | Delete
def zoom_height_event(self, event):
[18] Fix | Delete
top = self.editwin.top
[19] Fix | Delete
zoom_height(top)
[20] Fix | Delete
[21] Fix | Delete
def zoom_height(top):
[22] Fix | Delete
geom = top.wm_geometry()
[23] Fix | Delete
m = re.match(r"(\d+)x(\d+)\+(-?\d+)\+(-?\d+)", geom)
[24] Fix | Delete
if not m:
[25] Fix | Delete
top.bell()
[26] Fix | Delete
return
[27] Fix | Delete
width, height, x, y = map(int, m.groups())
[28] Fix | Delete
newheight = top.winfo_screenheight()
[29] Fix | Delete
if sys.platform == 'win32':
[30] Fix | Delete
newy = 0
[31] Fix | Delete
newheight = newheight - 72
[32] Fix | Delete
[33] Fix | Delete
elif macosxSupport.isAquaTk():
[34] Fix | Delete
# The '88' below is a magic number that avoids placing the bottom
[35] Fix | Delete
# of the window below the panel on my machine. I don't know how
[36] Fix | Delete
# to calculate the correct value for this with tkinter.
[37] Fix | Delete
newy = 22
[38] Fix | Delete
newheight = newheight - newy - 88
[39] Fix | Delete
[40] Fix | Delete
else:
[41] Fix | Delete
#newy = 24
[42] Fix | Delete
newy = 0
[43] Fix | Delete
#newheight = newheight - 96
[44] Fix | Delete
newheight = newheight - 88
[45] Fix | Delete
if height >= newheight:
[46] Fix | Delete
newgeom = ""
[47] Fix | Delete
else:
[48] Fix | Delete
newgeom = "%dx%d+%d+%d" % (width, newheight, x, newy)
[49] Fix | Delete
top.wm_geometry(newgeom)
[50] Fix | Delete
[51] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function