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-18 22:45:45 (GMT)
committer Daniel Francis <francis@sugarlabs.org>2012-07-18 22:45:45 (GMT)
commitc00157adf5090bc827513f01f59c19750dab3583 (patch)
tree5646d9d07add6a5f8fa440c2f439a7e371f2445c /instruments
parent949f113073784fa17cac0a0b59a2e08d09522d69 (diff)
Score for piano, two staves.
Diffstat (limited to 'instruments')
-rw-r--r--instruments/__init__.py20
-rw-r--r--instruments/instrument.py38
-rw-r--r--instruments/piano.py32
3 files changed, 90 insertions, 0 deletions
diff --git a/instruments/__init__.py b/instruments/__init__.py
new file mode 100644
index 0000000..eba97a9
--- /dev/null
+++ b/instruments/__init__.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2012 S. Daniel Francis <francis@sugarlabs.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
diff --git a/instruments/instrument.py b/instruments/instrument.py
new file mode 100644
index 0000000..8a54b03
--- /dev/null
+++ b/instruments/instrument.py
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2012 S. Daniel Francis <francis@sugarlabs.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+
+class Instrument:
+ staves = []
+ name = ''
+ ymin = 0
+ ymax = 0
+
+ def __init__(self):
+ pass
+
+ def draw(self, context, width, lmarg, rmarg, linespacing):
+ for staff in self.staves:
+ staff.lmarg = lmarg
+ staff.rmarg = rmarg
+ staff.spacing = linespacing
+ staff.y = self.ymax
+ staff.draw(context, width)
+ self.ymax = staff.ymax
diff --git a/instruments/piano.py b/instruments/piano.py
new file mode 100644
index 0000000..66f68e4
--- /dev/null
+++ b/instruments/piano.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2012 S. Daniel Francis <francis@sugarlabs.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+from gettext import gettext as _
+
+from staff import Staff
+from instrument import Instrument
+
+
+class Piano(Instrument):
+ name = _('Piano')
+
+ def __init__(self):
+ self.staves.append(Staff())
+ self.staves.append(Staff())