Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/instruments
diff options
context:
space:
mode:
authorDaniel Francis <francis@sugarlabs.org>2012-07-20 01:23:22 (GMT)
committer Daniel Francis <francis@sugarlabs.org>2012-07-20 01:23:22 (GMT)
commit26aa4b4f4cd640620e8db2a60912000f63c6c5b8 (patch)
tree0d38a1eb5d325ece5f693b2f23a2b112b66db36c /instruments
parente87aaf3691454d9445066386fee2f14a6dd68689 (diff)
Show G cleff
Diffstat (limited to 'instruments')
-rw-r--r--instruments/instrument.py9
-rw-r--r--instruments/piano.py9
2 files changed, 12 insertions, 6 deletions
diff --git a/instruments/instrument.py b/instruments/instrument.py
index d6871b4..3d3f3fc 100644
--- a/instruments/instrument.py
+++ b/instruments/instrument.py
@@ -39,7 +39,8 @@ class Instrument:
self.svg = rsvg.Handle(file=os.path.join(
os.environ['SUGAR_BUNDLE_PATH'], 'symbols/accolade.svg'))
- def draw(self, context, width, lmarg, rmarg, linespacing, bracket_cr):
+ def draw(self, window, width, lmarg, rmarg, linespacing):
+ accolade_cr = window.cairo_create()
xx = lmarg * 0.20 / self.svg.props.width
x0 = lmarg
@@ -50,15 +51,15 @@ class Instrument:
staff.rmarg = rmarg
staff.spacing = linespacing
staff.y = self.ymax
- staff.draw(context, width)
+ staff.draw(window, width)
self.ymax = staff.ymax
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)
+ accolade_cr.transform(matrix)
+ self.svg.render_cairo(accolade_cr)
def guess_height(self, linespace):
return len(self.staves) * linespace * 9
diff --git a/instruments/piano.py b/instruments/piano.py
index 127a06c..b3cd48d 100644
--- a/instruments/piano.py
+++ b/instruments/piano.py
@@ -22,6 +22,7 @@ from gettext import gettext as _
from staff import Staff
from instrument import Instrument
+import clef
class Piano(Instrument):
@@ -29,5 +30,9 @@ class Piano(Instrument):
def __init__(self):
Instrument.__init__(self)
- self.staves.append(Staff())
- self.staves.append(Staff())
+ top_staff = Staff()
+ top_staff.clef = clef.Clef()
+ bottom_staff = Staff()
+ bottom_staff.clef = clef.Clef()
+ self.staves.append(top_staff)
+ self.staves.append(bottom_staff)