Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/staff.py
diff options
context:
space:
mode:
Diffstat (limited to 'staff.py')
-rw-r--r--staff.py27
1 files changed, 22 insertions, 5 deletions
diff --git a/staff.py b/staff.py
index 15ba0fc..0f210cc 100644
--- a/staff.py
+++ b/staff.py
@@ -18,6 +18,13 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
+import logging
+logger = logging.getLogger('staff')
+
+
+class Beat:
+ clef = None
+
class Staff:
y = 0
@@ -25,10 +32,11 @@ class Staff:
rmarg = 0
spacing = 0
ymax = 0
- clef = None
- def __init__(self):
- pass
+ def __init__(self, beat):
+ self.beats = []
+ self.beats.append(beat)
+ logger.debug(self.beats)
def draw(self, window, width):
context = window.cairo_create()
@@ -42,5 +50,14 @@ class Staff:
line_y += self.spacing
self.ymax = line_y + self.spacing * 2
context.stroke()
- self.clef.draw(window.cairo_create(), self.lmarg * 1.1, self.y,
- self.spacing * 3, self.ymax - self.y - self.spacing)
+ context.clip()
+ self.draw_beats(window)
+
+ def draw_beats(self, window):
+ for beat in self.beats:
+ if beat.clef != None:
+ beat.clef.draw(window.cairo_create(),
+ self.lmarg * 1.1,
+ self.y,
+ self.spacing * 3,
+ self.ymax - self.y - self.spacing)