def Refresh(self):
stateMask = commctrl.LVIS_SELECTED | commctrl.LVIS_DROPHILITED
state = 0
self.children = []
# Enumerate and store the child PIDLs
for cid in self.folder.EnumObjects(self.hwnd, 0):
self.children.append(cid)
for row_index, data in enumerate(self.children):
assert len(data)==1, "expecting just a child PIDL"
typ, path = data[0].split('\0')
desc = os.path.exists(path) and "Yes" or "No"
prop_vals = (path, desc)
# first col
data, extras = win32gui_struct.PackLVITEM(
item=row_index,
subItem=0,
text=prop_vals[0],
state=state,
stateMask=stateMask)
win32gui.SendMessage(self.hwnd_child,
commctrl.LVM_INSERTITEM,
row_index, data)
# rest of the cols.
col_index = 1
for prop_val in prop_vals[1:]:
data, extras = win32gui_struct.PackLVITEM(
item=row_index,
subItem=col_index,
text=prop_val)
win32gui.SendMessage(self.hwnd_child,
commctrl.LVM_SETITEM,
0, data)
col_index += 1
评论列表
文章目录