Replace g[idx] by variable name

This commit is contained in:
Arthur Milchior 2020-02-19 02:16:02 -08:00
parent a0bd232cfd
commit bdcd111d72

View File

@ -1157,16 +1157,19 @@ by clicking on one on the left."""
def fillGroups(root, grps, head=""): def fillGroups(root, grps, head=""):
for g in grps: for g in grps:
baseName = g[0]
did = g[1]
children = g[5]
item = SidebarItem( item = SidebarItem(
g[0], baseName,
":/icons/deck.svg", ":/icons/deck.svg",
lambda g=g: self.setFilter("deck", head + g[0]), lambda baseName=baseName: self.setFilter("deck", head + baseName),
lambda expanded, g=g: self.mw.col.decks.collapseBrowser(g[1]), lambda expanded, did=did: self.mw.col.decks.collapseBrowser(did),
not self.mw.col.decks.get(g[1]).get("browserCollapsed", False), not self.mw.col.decks.get(g[1]).get("browserCollapsed", False),
) )
root.addChild(item) root.addChild(item)
newhead = head + g[0] + "::" newhead = head + baseName + "::"
fillGroups(item, g[5], newhead) fillGroups(item, children, newhead)
fillGroups(root, grps) fillGroups(root, grps)