示例#1
0
 def test_select_clef(self):
     self.assertEqual(mpd.select_clef("c' e'"), "violin")
     self.assertEqual(mpd.select_clef("as e'"), "violin")
     self.assertEqual(mpd.select_clef("a d'"), "bass")
     self.assertEqual(mpd.select_clef("c e'"), "bass")
     self.assertEqual(mpd.select_clef("f e''"), "violin")
     self.assertEqual(mpd.select_clef("g' a"), "violin")
     self.assertEqual(mpd.select_clef("b d'"), "violin")
     self.assertEqual(mpd.select_clef("bes d'"), "violin")
     self.assertEqual(mpd.select_clef("bes des'"), "bass")
     self.assertEqual(mpd.select_clef("ces' cisis'"), "violin")
示例#2
0
 def test_select_clef(self):
     self.assertEqual(mpd.select_clef("c' e'"), "violin")
     self.assertEqual(mpd.select_clef("as e'"), "violin")
     self.assertEqual(mpd.select_clef("a d'"), "bass")
     self.assertEqual(mpd.select_clef("c e'"), "bass")
     self.assertEqual(mpd.select_clef("f e''"), "violin")
     self.assertEqual(mpd.select_clef("g' a"), "violin")
     self.assertEqual(mpd.select_clef("b d'"), "violin")
     self.assertEqual(mpd.select_clef("bes d'"), "violin")
     self.assertEqual(mpd.select_clef("bes des'"), "bass")
     self.assertEqual(mpd.select_clef("ces' cisis'"), "violin")
示例#3
0
 def show_answer(self):
     """
     Show the answer in the music displayer. All callers must check
     for exceptions.
     """
     fontsize = self.get_int('config/feta_font_size=20')
     if isinstance(self.m_t.m_P.get_question().music, lessonfile.Chord):
         clef = mpd.select_clef(self.m_t.m_P.get_music_as_notename_string('music'))
         self.g_music_displayer.display(r"\staff{\clef %s <%s>}" % (clef, self.m_t.m_P.get_music_as_notename_string('music')), fontsize)
     else:
         self.g_music_displayer.display(self.m_t.m_P.get_music(), fontsize)
示例#4
0
 def show_answer(self):
     """
     Show the answer in the music displayer. All callers must check
     for exceptions.
     """
     fontsize = self.get_int('config/feta_font_size=20')
     if isinstance(self.m_t.m_P.get_question().music, lessonfile.Chord):
         clef = mpd.select_clef(self.m_t.m_P.get_music_as_notename_string('music'))
         # Here we don't check for exceptions since the music is always
         # tested by the code that plays the question. Maybe we should,
         # just in case this changes?
         self.g_music_displayer.display(r"\staff{\clef %s <%s>}" % (clef, self.m_t.m_P.get_music_as_notename_string('music')), fontsize)
     else:
         # Same as the comment above applies here too.
         self.g_music_displayer.display(self.m_t.m_P.get_music(), fontsize)
示例#5
0
 def show_answer(self):
     """
     Show the answer in the music displayer. All callers must check
     for exceptions.
     """
     fontsize = self.get_int('config/feta_font_size=20')
     if isinstance(self.m_t.m_P.get_question().music, lessonfile.Chord):
         clef = mpd.select_clef(
             self.m_t.m_P.get_music_as_notename_string('music'))
         self.g_music_displayer.display(
             r"\staff{\clef %s <%s>}" %
             (clef, self.m_t.m_P.get_music_as_notename_string('music')),
             fontsize)
     else:
         self.g_music_displayer.display(self.m_t.m_P.get_music(), fontsize)
示例#6
0
 def show_music(self):
     self.clear_stacking_frame()
     md = mpd.MusicDisplayer()
     self.g_source.pack_start(md, True, True, 0)
     md.show()
     md.display(r"\staff{ \clef %s < %s >}" % (
             mpd.select_clef(self.m_t.m_P.get_music_as_notename_string('music')),
             self.m_t.m_P.get_music_as_notename_string('music')), 20)
     # display the notenames on the buttons with octave info
     v = self.m_t.m_P.get_music_as_notename_list('music')
     v.sort(mpd.compare_notenames)
     for n in v:
         b = Gtk.Button(mpd.MusicalPitch.new_from_notename(n).get_user_octave_notename())
         b.get_children()[0].set_use_markup(1)
         b.show()
         self.g_answer.pack_end(b, False, False, 0)
示例#7
0
 def show_music(self):
     self.clear_stacking_frame()
     md = mpd.MusicDisplayer()
     self.g_source.pack_start(md, True, True, 0)
     md.show()
     md.display(r"\staff{ \clef %s < %s >}" % (
             mpd.select_clef(self.m_t.m_P.get_music_as_notename_string('music')),
             self.m_t.m_P.get_music_as_notename_string('music')), 20)
     # display the notenames on the buttons with octave info
     v = self.m_t.m_P.get_music_as_notename_list('music')
     v.sort(key=lambda n: mpd.notename_to_int(n))
     for n in v:
         b = Gtk.Button(mpd.MusicalPitch.new_from_notename(n).get_user_octave_notename())
         b.get_children()[0].set_use_markup(1)
         b.show()
         self.g_answer.pack_end(b, False, False, 0)
示例#8
0
 def show_intervals(self, widget=None):
     tv = [self.get_string('first_interval_type'),
             self.get_string('last_interval_type')]
     clefs = {}
     music = {}
     for x in range(2):
         music[x] = self.m_t.m_tonikas[x].get_octave_notename() + " " \
             + (self.m_t.m_tonikas[x] + mpd.Interval().set_from_int(self.m_t.m_intervals[x])).get_octave_notename()
         clefs[x] = mpd.select_clef(music[x])
         if tv[x] == 'harmonic':
             music[x] = "< %s >" % music[x]
     m = r"\staff{ \clef %s %s |" % (clefs[0], music[0])
     if clefs[0] != clefs[1]:
         m = m + r"\clef %s " % clefs[1]
     m = m + music[1]
     self.g_music_displayer.display(m,
           self.get_int('config/feta_font_size=20'))
示例#9
0
 def show_answer(self):
     """
     Show the answer in the music displayer. All callers must check
     for exceptions.
     """
     fontsize = self.get_int('config/feta_font_size=20')
     if isinstance(self.m_t.m_P.get_question().music, lessonfile.Chord):
         clef = mpd.select_clef(
             self.m_t.m_P.get_music_as_notename_string('music'))
         # Here we don't check for exceptions since the music is always
         # tested by the code that plays the question. Maybe we should,
         # just in case this changes?
         self.g_music_displayer.display(
             r"\staff{\clef %s <%s>}" %
             (clef, self.m_t.m_P.get_music_as_notename_string('music')),
             fontsize)
     else:
         # Same as the comment above applies here too.
         self.g_music_displayer.display(self.m_t.m_P.get_music(), fontsize)
示例#10
0
 def show_intervals(self, widget=None):
     tv = [
         self.get_string('first_interval_type'),
         self.get_string('last_interval_type')
     ]
     clefs = {}
     music = {}
     for x in range(2):
         music[x] = self.m_t.m_tonikas[x].get_octave_notename() + " " \
             + (self.m_t.m_tonikas[x] + mpd.Interval().set_from_int(self.m_t.m_intervals[x])).get_octave_notename()
         clefs[x] = mpd.select_clef(music[x])
         if tv[x] == 'harmonic':
             music[x] = "< %s >" % music[x]
     m = r"\staff{ \clef %s %s |" % (clefs[0], music[0])
     if clefs[0] != clefs[1]:
         m = m + r"\clef %s " % clefs[1]
     m = m + music[1]
     self.g_music_displayer.display(
         m, self.get_int('config/feta_font_size=20'))