def getBindingsForCommand(self, commandName): c, k = self.c, self.c.k data = [] n1, n2 = 4, 20 d = k.bindingsDict for stroke in sorted(d): assert g.isStroke(stroke), repr(stroke) aList = d.get(stroke, []) for si in aList: assert g.isShortcutInfo(si), si if si.commandName == commandName: pane = '' if si.pane == 'all' else ' %s:' % (si.pane) s1 = pane s2 = k.prettyPrintKey(stroke) s3 = si.commandName n1 = max(n1, len(s1)) n2 = max(n2, len(s2)) data.append((s1, s2, s3), ) data.sort(key=lambda x: x[1]) return ','.join(['%s %s' % (s1, s2) for s1, s2, s3 in data]).strip()
def getBindingsForCommand(self, commandName): c, k = self.c, self.c.k data = [] n1, n2 = 4, 20 d = k.bindingsDict for stroke in sorted(d): assert g.isStroke(stroke), repr(stroke) aList = d.get(stroke, []) for si in aList: assert g.isShortcutInfo(si), si if si.commandName == commandName: pane = '' if si.pane == 'all' else ' %s:' % (si.pane) s1 = pane s2 = k.prettyPrintKey(stroke) s3 = si.commandName n1 = max(n1, len(s1)) n2 = max(n2, len(s2)) data.append((s1, s2, s3),) data.sort(key=lambda x: x[1]) return ','.join(['%s %s' % (s1, s2) for s1, s2, s3 in data]).strip()