def text(x, y, s): clr = g.highlight(s) if clr: painter.setPen(clr) else: painter.setPen(QtCore.Qt.black) painter.drawText(x, y, unicode(g.pretty(s)))
def __str__(self): self.neck.allup() pedline = [' '] * 10 for p in self.pedals: self.neck.toggle(p) for i in range(10): if self.neck.copedent[p][i] != 0 and pedline[i] != None: pedline[i] = "%-2s" % p g.tonic[0] = self.neck[self.tonicstring][0] sr = '' printy = [] for j, s in enumerate(self.strings): if s == 0: printy += ['. '] else: printy += ["%-2s" % g.pretty(self.neck[j][0])] sr += ' '.join(pedline) + '\n' sr += ' '.join([x.encode('UTF-8') for x in printy]) return sr
# pprint(grips) # pprint(reversed) # l = [(score,pedals,grip) for (grip,(pedals,score)) in reversed.items()] # l.sort(cmp=lambda x,y: x[0]-y[0]) print '-'*40 for score, pedals, grip, tonicstring in candidates: print pedline = [''] * 10 for p in pedals: for i in range(10): if neck.copedent[p][i] != 0 and pedline[i] != None: pedline[i] = "%-3s" % p for i in range(10): if pedline[i] == '': pedline[i] = '...' g.tonic[0] = grip[tonicstring] print "tonic %s, on string %d" % (g.letter(g.tonic[0]), tonicstring) printy = ["%-3s" % g.pretty(x) if x != None else '...' for x in grip] printy = ['...'] * (10-len(printy)) + printy print "tonicstring=", tonicstring print ' '.join(pedline), " ", score print ' '.join([x.encode('UTF-8') for x in printy]) # print score, pedals, grip
def __str__(self): self.normalize() return g.pretty(self)
def test_unicode_display(): p = g.pretty(As) print p.encode('UTF-8') print As print As