diff options
author | Daniel Francis <francis@sugarlabs.org> | 2012-07-19 17:18:45 (GMT) |
---|---|---|
committer | Daniel Francis <francis@sugarlabs.org> | 2012-07-19 17:18:45 (GMT) |
commit | e87aaf3691454d9445066386fee2f14a6dd68689 (patch) | |
tree | cba1ff6b26f5363fb34f4acecf8f69a6c48302d5 /instruments | |
parent | d570bd3684165608e47ee0f74556e31a5611e388 (diff) |
More decent Accolade (I found the correct musical name for the bracket in english). Show instrument name.
Diffstat (limited to 'instruments')
-rw-r--r-- | instruments/instrument.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/instruments/instrument.py b/instruments/instrument.py index 65ebdbc..d6871b4 100644 --- a/instruments/instrument.py +++ b/instruments/instrument.py @@ -33,27 +33,32 @@ class Instrument: ymin = 0 ymax = 0 show_bracket = False + staffx = 0 def __init__(self): self.svg = rsvg.Handle(file=os.path.join( - os.environ['SUGAR_BUNDLE_PATH'], 'symbols/bracket.svg')) + os.environ['SUGAR_BUNDLE_PATH'], 'symbols/accolade.svg')) def draw(self, context, width, lmarg, rmarg, linespacing, bracket_cr): + + xx = lmarg * 0.20 / self.svg.props.width + x0 = lmarg + y0 = linespacing * 3.5 + self.staffx = lmarg + lmarg * 0.20 for staff in self.staves: - staff.lmarg = lmarg + staff.lmarg = self.staffx staff.rmarg = rmarg staff.spacing = linespacing staff.y = self.ymax staff.draw(context, width) self.ymax = staff.ymax - xx = lmarg * 0.60 / self.svg.props.width - yy = (self.ymax - self.ymin - linespacing * 3) / self.svg.props.height - x0 = lmarg * 0.40 - y0 = linespacing * 3 - logger.debug('xx=%f yy=%f x0=%f y0=%f' % (xx, yy, x0, y0)) + yy = (self.ymax - self.ymin - linespacing * 4) / self.svg.props.height matrix = cairo.Matrix(xx=xx, yy=yy, x0=x0, y0=y0) bracket_cr.transform(matrix) self.svg.render_cairo(bracket_cr) + + def guess_height(self, linespace): + return len(self.staves) * linespace * 9 |