Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../lib64/python2..../idlelib
File: TreeWidget.py
# XXX TO DO:
[0] Fix | Delete
# - popup menu
[1] Fix | Delete
# - support partial or total redisplay
[2] Fix | Delete
# - key bindings (instead of quick-n-dirty bindings on Canvas):
[3] Fix | Delete
# - up/down arrow keys to move focus around
[4] Fix | Delete
# - ditto for page up/down, home/end
[5] Fix | Delete
# - left/right arrows to expand/collapse & move out/in
[6] Fix | Delete
# - more doc strings
[7] Fix | Delete
# - add icons for "file", "module", "class", "method"; better "python" icon
[8] Fix | Delete
# - callback for selection???
[9] Fix | Delete
# - multiple-item selection
[10] Fix | Delete
# - tooltips
[11] Fix | Delete
# - redo geometry without magic numbers
[12] Fix | Delete
# - keep track of object ids to allow more careful cleaning
[13] Fix | Delete
# - optimize tree redraw after expand of subnode
[14] Fix | Delete
[15] Fix | Delete
import os
[16] Fix | Delete
from Tkinter import *
[17] Fix | Delete
import imp
[18] Fix | Delete
[19] Fix | Delete
from idlelib import ZoomHeight
[20] Fix | Delete
from idlelib.configHandler import idleConf
[21] Fix | Delete
[22] Fix | Delete
ICONDIR = "Icons"
[23] Fix | Delete
[24] Fix | Delete
# Look for Icons subdirectory in the same directory as this module
[25] Fix | Delete
try:
[26] Fix | Delete
_icondir = os.path.join(os.path.dirname(__file__), ICONDIR)
[27] Fix | Delete
except NameError:
[28] Fix | Delete
_icondir = ICONDIR
[29] Fix | Delete
if os.path.isdir(_icondir):
[30] Fix | Delete
ICONDIR = _icondir
[31] Fix | Delete
elif not os.path.isdir(ICONDIR):
[32] Fix | Delete
raise RuntimeError, "can't find icon directory (%r)" % (ICONDIR,)
[33] Fix | Delete
[34] Fix | Delete
def listicons(icondir=ICONDIR):
[35] Fix | Delete
"""Utility to display the available icons."""
[36] Fix | Delete
root = Tk()
[37] Fix | Delete
import glob
[38] Fix | Delete
list = glob.glob(os.path.join(icondir, "*.gif"))
[39] Fix | Delete
list.sort()
[40] Fix | Delete
images = []
[41] Fix | Delete
row = column = 0
[42] Fix | Delete
for file in list:
[43] Fix | Delete
name = os.path.splitext(os.path.basename(file))[0]
[44] Fix | Delete
image = PhotoImage(file=file, master=root)
[45] Fix | Delete
images.append(image)
[46] Fix | Delete
label = Label(root, image=image, bd=1, relief="raised")
[47] Fix | Delete
label.grid(row=row, column=column)
[48] Fix | Delete
label = Label(root, text=name)
[49] Fix | Delete
label.grid(row=row+1, column=column)
[50] Fix | Delete
column = column + 1
[51] Fix | Delete
if column >= 10:
[52] Fix | Delete
row = row+2
[53] Fix | Delete
column = 0
[54] Fix | Delete
root.images = images
[55] Fix | Delete
[56] Fix | Delete
[57] Fix | Delete
class TreeNode:
[58] Fix | Delete
[59] Fix | Delete
def __init__(self, canvas, parent, item):
[60] Fix | Delete
self.canvas = canvas
[61] Fix | Delete
self.parent = parent
[62] Fix | Delete
self.item = item
[63] Fix | Delete
self.state = 'collapsed'
[64] Fix | Delete
self.selected = False
[65] Fix | Delete
self.children = []
[66] Fix | Delete
self.x = self.y = None
[67] Fix | Delete
self.iconimages = {} # cache of PhotoImage instances for icons
[68] Fix | Delete
[69] Fix | Delete
def destroy(self):
[70] Fix | Delete
for c in self.children[:]:
[71] Fix | Delete
self.children.remove(c)
[72] Fix | Delete
c.destroy()
[73] Fix | Delete
self.parent = None
[74] Fix | Delete
[75] Fix | Delete
def geticonimage(self, name):
[76] Fix | Delete
try:
[77] Fix | Delete
return self.iconimages[name]
[78] Fix | Delete
except KeyError:
[79] Fix | Delete
pass
[80] Fix | Delete
file, ext = os.path.splitext(name)
[81] Fix | Delete
ext = ext or ".gif"
[82] Fix | Delete
fullname = os.path.join(ICONDIR, file + ext)
[83] Fix | Delete
image = PhotoImage(master=self.canvas, file=fullname)
[84] Fix | Delete
self.iconimages[name] = image
[85] Fix | Delete
return image
[86] Fix | Delete
[87] Fix | Delete
def select(self, event=None):
[88] Fix | Delete
if self.selected:
[89] Fix | Delete
return
[90] Fix | Delete
self.deselectall()
[91] Fix | Delete
self.selected = True
[92] Fix | Delete
self.canvas.delete(self.image_id)
[93] Fix | Delete
self.drawicon()
[94] Fix | Delete
self.drawtext()
[95] Fix | Delete
[96] Fix | Delete
def deselect(self, event=None):
[97] Fix | Delete
if not self.selected:
[98] Fix | Delete
return
[99] Fix | Delete
self.selected = False
[100] Fix | Delete
self.canvas.delete(self.image_id)
[101] Fix | Delete
self.drawicon()
[102] Fix | Delete
self.drawtext()
[103] Fix | Delete
[104] Fix | Delete
def deselectall(self):
[105] Fix | Delete
if self.parent:
[106] Fix | Delete
self.parent.deselectall()
[107] Fix | Delete
else:
[108] Fix | Delete
self.deselecttree()
[109] Fix | Delete
[110] Fix | Delete
def deselecttree(self):
[111] Fix | Delete
if self.selected:
[112] Fix | Delete
self.deselect()
[113] Fix | Delete
for child in self.children:
[114] Fix | Delete
child.deselecttree()
[115] Fix | Delete
[116] Fix | Delete
def flip(self, event=None):
[117] Fix | Delete
if self.state == 'expanded':
[118] Fix | Delete
self.collapse()
[119] Fix | Delete
else:
[120] Fix | Delete
self.expand()
[121] Fix | Delete
self.item.OnDoubleClick()
[122] Fix | Delete
return "break"
[123] Fix | Delete
[124] Fix | Delete
def expand(self, event=None):
[125] Fix | Delete
if not self.item._IsExpandable():
[126] Fix | Delete
return
[127] Fix | Delete
if self.state != 'expanded':
[128] Fix | Delete
self.state = 'expanded'
[129] Fix | Delete
self.update()
[130] Fix | Delete
self.view()
[131] Fix | Delete
[132] Fix | Delete
def collapse(self, event=None):
[133] Fix | Delete
if self.state != 'collapsed':
[134] Fix | Delete
self.state = 'collapsed'
[135] Fix | Delete
self.update()
[136] Fix | Delete
[137] Fix | Delete
def view(self):
[138] Fix | Delete
top = self.y - 2
[139] Fix | Delete
bottom = self.lastvisiblechild().y + 17
[140] Fix | Delete
height = bottom - top
[141] Fix | Delete
visible_top = self.canvas.canvasy(0)
[142] Fix | Delete
visible_height = self.canvas.winfo_height()
[143] Fix | Delete
visible_bottom = self.canvas.canvasy(visible_height)
[144] Fix | Delete
if visible_top <= top and bottom <= visible_bottom:
[145] Fix | Delete
return
[146] Fix | Delete
x0, y0, x1, y1 = self.canvas._getints(self.canvas['scrollregion'])
[147] Fix | Delete
if top >= visible_top and height <= visible_height:
[148] Fix | Delete
fraction = top + height - visible_height
[149] Fix | Delete
else:
[150] Fix | Delete
fraction = top
[151] Fix | Delete
fraction = float(fraction) / y1
[152] Fix | Delete
self.canvas.yview_moveto(fraction)
[153] Fix | Delete
[154] Fix | Delete
def lastvisiblechild(self):
[155] Fix | Delete
if self.children and self.state == 'expanded':
[156] Fix | Delete
return self.children[-1].lastvisiblechild()
[157] Fix | Delete
else:
[158] Fix | Delete
return self
[159] Fix | Delete
[160] Fix | Delete
def update(self):
[161] Fix | Delete
if self.parent:
[162] Fix | Delete
self.parent.update()
[163] Fix | Delete
else:
[164] Fix | Delete
oldcursor = self.canvas['cursor']
[165] Fix | Delete
self.canvas['cursor'] = "watch"
[166] Fix | Delete
self.canvas.update()
[167] Fix | Delete
self.canvas.delete(ALL) # XXX could be more subtle
[168] Fix | Delete
self.draw(7, 2)
[169] Fix | Delete
x0, y0, x1, y1 = self.canvas.bbox(ALL)
[170] Fix | Delete
self.canvas.configure(scrollregion=(0, 0, x1, y1))
[171] Fix | Delete
self.canvas['cursor'] = oldcursor
[172] Fix | Delete
[173] Fix | Delete
def draw(self, x, y):
[174] Fix | Delete
# XXX This hard-codes too many geometry constants!
[175] Fix | Delete
dy = 20
[176] Fix | Delete
self.x, self.y = x, y
[177] Fix | Delete
self.drawicon()
[178] Fix | Delete
self.drawtext()
[179] Fix | Delete
if self.state != 'expanded':
[180] Fix | Delete
return y + dy
[181] Fix | Delete
# draw children
[182] Fix | Delete
if not self.children:
[183] Fix | Delete
sublist = self.item._GetSubList()
[184] Fix | Delete
if not sublist:
[185] Fix | Delete
# _IsExpandable() was mistaken; that's allowed
[186] Fix | Delete
return y+17
[187] Fix | Delete
for item in sublist:
[188] Fix | Delete
child = self.__class__(self.canvas, self, item)
[189] Fix | Delete
self.children.append(child)
[190] Fix | Delete
cx = x+20
[191] Fix | Delete
cy = y + dy
[192] Fix | Delete
cylast = 0
[193] Fix | Delete
for child in self.children:
[194] Fix | Delete
cylast = cy
[195] Fix | Delete
self.canvas.create_line(x+9, cy+7, cx, cy+7, fill="gray50")
[196] Fix | Delete
cy = child.draw(cx, cy)
[197] Fix | Delete
if child.item._IsExpandable():
[198] Fix | Delete
if child.state == 'expanded':
[199] Fix | Delete
iconname = "minusnode"
[200] Fix | Delete
callback = child.collapse
[201] Fix | Delete
else:
[202] Fix | Delete
iconname = "plusnode"
[203] Fix | Delete
callback = child.expand
[204] Fix | Delete
image = self.geticonimage(iconname)
[205] Fix | Delete
id = self.canvas.create_image(x+9, cylast+7, image=image)
[206] Fix | Delete
# XXX This leaks bindings until canvas is deleted:
[207] Fix | Delete
self.canvas.tag_bind(id, "<1>", callback)
[208] Fix | Delete
self.canvas.tag_bind(id, "<Double-1>", lambda x: None)
[209] Fix | Delete
id = self.canvas.create_line(x+9, y+10, x+9, cylast+7,
[210] Fix | Delete
##stipple="gray50", # XXX Seems broken in Tk 8.0.x
[211] Fix | Delete
fill="gray50")
[212] Fix | Delete
self.canvas.tag_lower(id) # XXX .lower(id) before Python 1.5.2
[213] Fix | Delete
return cy
[214] Fix | Delete
[215] Fix | Delete
def drawicon(self):
[216] Fix | Delete
if self.selected:
[217] Fix | Delete
imagename = (self.item.GetSelectedIconName() or
[218] Fix | Delete
self.item.GetIconName() or
[219] Fix | Delete
"openfolder")
[220] Fix | Delete
else:
[221] Fix | Delete
imagename = self.item.GetIconName() or "folder"
[222] Fix | Delete
image = self.geticonimage(imagename)
[223] Fix | Delete
id = self.canvas.create_image(self.x, self.y, anchor="nw", image=image)
[224] Fix | Delete
self.image_id = id
[225] Fix | Delete
self.canvas.tag_bind(id, "<1>", self.select)
[226] Fix | Delete
self.canvas.tag_bind(id, "<Double-1>", self.flip)
[227] Fix | Delete
[228] Fix | Delete
def drawtext(self):
[229] Fix | Delete
textx = self.x+20-1
[230] Fix | Delete
texty = self.y-4
[231] Fix | Delete
labeltext = self.item.GetLabelText()
[232] Fix | Delete
if labeltext:
[233] Fix | Delete
id = self.canvas.create_text(textx, texty, anchor="nw",
[234] Fix | Delete
text=labeltext)
[235] Fix | Delete
self.canvas.tag_bind(id, "<1>", self.select)
[236] Fix | Delete
self.canvas.tag_bind(id, "<Double-1>", self.flip)
[237] Fix | Delete
x0, y0, x1, y1 = self.canvas.bbox(id)
[238] Fix | Delete
textx = max(x1, 200) + 10
[239] Fix | Delete
text = self.item.GetText() or "<no text>"
[240] Fix | Delete
try:
[241] Fix | Delete
self.entry
[242] Fix | Delete
except AttributeError:
[243] Fix | Delete
pass
[244] Fix | Delete
else:
[245] Fix | Delete
self.edit_finish()
[246] Fix | Delete
try:
[247] Fix | Delete
self.label
[248] Fix | Delete
except AttributeError:
[249] Fix | Delete
# padding carefully selected (on Windows) to match Entry widget:
[250] Fix | Delete
self.label = Label(self.canvas, text=text, bd=0, padx=2, pady=2)
[251] Fix | Delete
theme = idleConf.CurrentTheme()
[252] Fix | Delete
if self.selected:
[253] Fix | Delete
self.label.configure(idleConf.GetHighlight(theme, 'hilite'))
[254] Fix | Delete
else:
[255] Fix | Delete
self.label.configure(idleConf.GetHighlight(theme, 'normal'))
[256] Fix | Delete
id = self.canvas.create_window(textx, texty,
[257] Fix | Delete
anchor="nw", window=self.label)
[258] Fix | Delete
self.label.bind("<1>", self.select_or_edit)
[259] Fix | Delete
self.label.bind("<Double-1>", self.flip)
[260] Fix | Delete
self.text_id = id
[261] Fix | Delete
[262] Fix | Delete
def select_or_edit(self, event=None):
[263] Fix | Delete
if self.selected and self.item.IsEditable():
[264] Fix | Delete
self.edit(event)
[265] Fix | Delete
else:
[266] Fix | Delete
self.select(event)
[267] Fix | Delete
[268] Fix | Delete
def edit(self, event=None):
[269] Fix | Delete
self.entry = Entry(self.label, bd=0, highlightthickness=1, width=0)
[270] Fix | Delete
self.entry.insert(0, self.label['text'])
[271] Fix | Delete
self.entry.selection_range(0, END)
[272] Fix | Delete
self.entry.pack(ipadx=5)
[273] Fix | Delete
self.entry.focus_set()
[274] Fix | Delete
self.entry.bind("<Return>", self.edit_finish)
[275] Fix | Delete
self.entry.bind("<Escape>", self.edit_cancel)
[276] Fix | Delete
[277] Fix | Delete
def edit_finish(self, event=None):
[278] Fix | Delete
try:
[279] Fix | Delete
entry = self.entry
[280] Fix | Delete
del self.entry
[281] Fix | Delete
except AttributeError:
[282] Fix | Delete
return
[283] Fix | Delete
text = entry.get()
[284] Fix | Delete
entry.destroy()
[285] Fix | Delete
if text and text != self.item.GetText():
[286] Fix | Delete
self.item.SetText(text)
[287] Fix | Delete
text = self.item.GetText()
[288] Fix | Delete
self.label['text'] = text
[289] Fix | Delete
self.drawtext()
[290] Fix | Delete
self.canvas.focus_set()
[291] Fix | Delete
[292] Fix | Delete
def edit_cancel(self, event=None):
[293] Fix | Delete
try:
[294] Fix | Delete
entry = self.entry
[295] Fix | Delete
del self.entry
[296] Fix | Delete
except AttributeError:
[297] Fix | Delete
return
[298] Fix | Delete
entry.destroy()
[299] Fix | Delete
self.drawtext()
[300] Fix | Delete
self.canvas.focus_set()
[301] Fix | Delete
[302] Fix | Delete
[303] Fix | Delete
class TreeItem:
[304] Fix | Delete
[305] Fix | Delete
"""Abstract class representing tree items.
[306] Fix | Delete
[307] Fix | Delete
Methods should typically be overridden, otherwise a default action
[308] Fix | Delete
is used.
[309] Fix | Delete
[310] Fix | Delete
"""
[311] Fix | Delete
[312] Fix | Delete
def __init__(self):
[313] Fix | Delete
"""Constructor. Do whatever you need to do."""
[314] Fix | Delete
[315] Fix | Delete
def GetText(self):
[316] Fix | Delete
"""Return text string to display."""
[317] Fix | Delete
[318] Fix | Delete
def GetLabelText(self):
[319] Fix | Delete
"""Return label text string to display in front of text (if any)."""
[320] Fix | Delete
[321] Fix | Delete
expandable = None
[322] Fix | Delete
[323] Fix | Delete
def _IsExpandable(self):
[324] Fix | Delete
"""Do not override! Called by TreeNode."""
[325] Fix | Delete
if self.expandable is None:
[326] Fix | Delete
self.expandable = self.IsExpandable()
[327] Fix | Delete
return self.expandable
[328] Fix | Delete
[329] Fix | Delete
def IsExpandable(self):
[330] Fix | Delete
"""Return whether there are subitems."""
[331] Fix | Delete
return 1
[332] Fix | Delete
[333] Fix | Delete
def _GetSubList(self):
[334] Fix | Delete
"""Do not override! Called by TreeNode."""
[335] Fix | Delete
if not self.IsExpandable():
[336] Fix | Delete
return []
[337] Fix | Delete
sublist = self.GetSubList()
[338] Fix | Delete
if not sublist:
[339] Fix | Delete
self.expandable = 0
[340] Fix | Delete
return sublist
[341] Fix | Delete
[342] Fix | Delete
def IsEditable(self):
[343] Fix | Delete
"""Return whether the item's text may be edited."""
[344] Fix | Delete
[345] Fix | Delete
def SetText(self, text):
[346] Fix | Delete
"""Change the item's text (if it is editable)."""
[347] Fix | Delete
[348] Fix | Delete
def GetIconName(self):
[349] Fix | Delete
"""Return name of icon to be displayed normally."""
[350] Fix | Delete
[351] Fix | Delete
def GetSelectedIconName(self):
[352] Fix | Delete
"""Return name of icon to be displayed when selected."""
[353] Fix | Delete
[354] Fix | Delete
def GetSubList(self):
[355] Fix | Delete
"""Return list of items forming sublist."""
[356] Fix | Delete
[357] Fix | Delete
def OnDoubleClick(self):
[358] Fix | Delete
"""Called on a double-click on the item."""
[359] Fix | Delete
[360] Fix | Delete
[361] Fix | Delete
# Example application
[362] Fix | Delete
[363] Fix | Delete
class FileTreeItem(TreeItem):
[364] Fix | Delete
[365] Fix | Delete
"""Example TreeItem subclass -- browse the file system."""
[366] Fix | Delete
[367] Fix | Delete
def __init__(self, path):
[368] Fix | Delete
self.path = path
[369] Fix | Delete
[370] Fix | Delete
def GetText(self):
[371] Fix | Delete
return os.path.basename(self.path) or self.path
[372] Fix | Delete
[373] Fix | Delete
def IsEditable(self):
[374] Fix | Delete
return os.path.basename(self.path) != ""
[375] Fix | Delete
[376] Fix | Delete
def SetText(self, text):
[377] Fix | Delete
newpath = os.path.dirname(self.path)
[378] Fix | Delete
newpath = os.path.join(newpath, text)
[379] Fix | Delete
if os.path.dirname(newpath) != os.path.dirname(self.path):
[380] Fix | Delete
return
[381] Fix | Delete
try:
[382] Fix | Delete
os.rename(self.path, newpath)
[383] Fix | Delete
self.path = newpath
[384] Fix | Delete
except os.error:
[385] Fix | Delete
pass
[386] Fix | Delete
[387] Fix | Delete
def GetIconName(self):
[388] Fix | Delete
if not self.IsExpandable():
[389] Fix | Delete
return "python" # XXX wish there was a "file" icon
[390] Fix | Delete
[391] Fix | Delete
def IsExpandable(self):
[392] Fix | Delete
return os.path.isdir(self.path)
[393] Fix | Delete
[394] Fix | Delete
def GetSubList(self):
[395] Fix | Delete
try:
[396] Fix | Delete
names = os.listdir(self.path)
[397] Fix | Delete
except os.error:
[398] Fix | Delete
return []
[399] Fix | Delete
names.sort(key = os.path.normcase)
[400] Fix | Delete
sublist = []
[401] Fix | Delete
for name in names:
[402] Fix | Delete
item = FileTreeItem(os.path.join(self.path, name))
[403] Fix | Delete
sublist.append(item)
[404] Fix | Delete
return sublist
[405] Fix | Delete
[406] Fix | Delete
[407] Fix | Delete
# A canvas widget with scroll bars and some useful bindings
[408] Fix | Delete
[409] Fix | Delete
class ScrolledCanvas:
[410] Fix | Delete
def __init__(self, master, **opts):
[411] Fix | Delete
if 'yscrollincrement' not in opts:
[412] Fix | Delete
opts['yscrollincrement'] = 17
[413] Fix | Delete
self.master = master
[414] Fix | Delete
self.frame = Frame(master)
[415] Fix | Delete
self.frame.rowconfigure(0, weight=1)
[416] Fix | Delete
self.frame.columnconfigure(0, weight=1)
[417] Fix | Delete
self.canvas = Canvas(self.frame, **opts)
[418] Fix | Delete
self.canvas.grid(row=0, column=0, sticky="nsew")
[419] Fix | Delete
self.vbar = Scrollbar(self.frame, name="vbar")
[420] Fix | Delete
self.vbar.grid(row=0, column=1, sticky="nse")
[421] Fix | Delete
self.hbar = Scrollbar(self.frame, name="hbar", orient="horizontal")
[422] Fix | Delete
self.hbar.grid(row=1, column=0, sticky="ews")
[423] Fix | Delete
self.canvas['yscrollcommand'] = self.vbar.set
[424] Fix | Delete
self.vbar['command'] = self.canvas.yview
[425] Fix | Delete
self.canvas['xscrollcommand'] = self.hbar.set
[426] Fix | Delete
self.hbar['command'] = self.canvas.xview
[427] Fix | Delete
self.canvas.bind("<Key-Prior>", self.page_up)
[428] Fix | Delete
self.canvas.bind("<Key-Next>", self.page_down)
[429] Fix | Delete
self.canvas.bind("<Key-Up>", self.unit_up)
[430] Fix | Delete
self.canvas.bind("<Key-Down>", self.unit_down)
[431] Fix | Delete
#if isinstance(master, Toplevel) or isinstance(master, Tk):
[432] Fix | Delete
self.canvas.bind("<Alt-Key-2>", self.zoom_height)
[433] Fix | Delete
self.canvas.focus_set()
[434] Fix | Delete
def page_up(self, event):
[435] Fix | Delete
self.canvas.yview_scroll(-1, "page")
[436] Fix | Delete
return "break"
[437] Fix | Delete
def page_down(self, event):
[438] Fix | Delete
self.canvas.yview_scroll(1, "page")
[439] Fix | Delete
return "break"
[440] Fix | Delete
def unit_up(self, event):
[441] Fix | Delete
self.canvas.yview_scroll(-1, "unit")
[442] Fix | Delete
return "break"
[443] Fix | Delete
def unit_down(self, event):
[444] Fix | Delete
self.canvas.yview_scroll(1, "unit")
[445] Fix | Delete
return "break"
[446] Fix | Delete
def zoom_height(self, event):
[447] Fix | Delete
ZoomHeight.zoom_height(self.master)
[448] Fix | Delete
return "break"
[449] Fix | Delete
[450] Fix | Delete
[451] Fix | Delete
def _tree_widget(parent):
[452] Fix | Delete
root = Tk()
[453] Fix | Delete
root.title("Test TreeWidget")
[454] Fix | Delete
width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
[455] Fix | Delete
root.geometry("+%d+%d"%(x, y + 150))
[456] Fix | Delete
sc = ScrolledCanvas(root, bg="white", highlightthickness=0, takefocus=1)
[457] Fix | Delete
sc.frame.pack(expand=1, fill="both", side=LEFT)
[458] Fix | Delete
item = FileTreeItem(os.getcwd())
[459] Fix | Delete
node = TreeNode(sc.canvas, None, item)
[460] Fix | Delete
node.expand()
[461] Fix | Delete
root.mainloop()
[462] Fix | Delete
[463] Fix | Delete
if __name__ == '__main__':
[464] Fix | Delete
from idlelib.idle_test.htest import run
[465] Fix | Delete
run(_tree_widget)
[466] Fix | Delete
[467] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function