Example #1
0
 def backspace(self):
     if len(self.m_data) > 0:
         if self.g_face:
             self.g_box.get_children()[-2].destroy()
             self.g_face.destroy()
             self.g_face = None
         self.g_box.get_children()[len(self.m_data)-1].destroy()
         self.g_box.pack_start(gu.create_png_image('holder'), False, False, 0)
         del self.m_data[-1]
Example #2
0
 def backspace(self):
     if len(self.m_data) > 0:
         if self.g_face:
             self.g_box.get_children()[-2].destroy()
             self.g_face.destroy()
             self.g_face = None
         self.g_box.get_children()[len(self.m_data) - 1].destroy()
         self.g_box.pack_start(gu.create_png_image('holder'), False)
         del self.m_data[-1]
Example #3
0
 def create_holders(self):
     """
     create those |__| that represents one beat
     """
     if self.__timeout:
         gobject.source_remove(self.__timeout)
     self.clear()
     for x in range(self.m_num_beats):
         self.g_box.pack_start(gu.create_png_image('holder'), False)
     self.m_data = []
Example #4
0
 def create_holders(self):
     """
     create those |__| that represents one beat
     """
     if self.__timeout:
         GObject.source_remove(self.__timeout)
     self.clear()
     for x in range(self.m_num_notes):
         self.g_box.pack_start(gu.create_png_image('holder'), False, False, 0)
     self.m_data = []
Example #5
0
 def add_rhythm_element(self, i):
     assert len(self.m_data) <= self.m_num_beats
     if len(self.g_box.get_children()) >= self.m_num_beats:
         self.g_box.get_children()[self.m_num_beats - 1].destroy()
     vbox = Gtk.VBox(False, 0)
     vbox.show()
     im = gu.create_rhythm_image(const.RHYTHMS[i])
     vbox.pack_start(im, True, True, 0)
     vbox.pack_start(gu.create_png_image('rhythm-wrong'), False, False, 0)
     vbox.get_children()[-1].hide()
     self.g_box.pack_start(vbox, False, False, 0)
     self.g_box.reorder_child(vbox, len(self.m_data))
     self.m_data.append(i)
Example #6
0
 def add_rhythm_element(self, i):
     assert len(self.m_data) <= self.m_num_beats
     if len(self.g_box.get_children()) >= self.m_num_beats:
         self.g_box.get_children()[self.m_num_beats-1].destroy()
     vbox = gtk.VBox()
     vbox.show()
     im = gu.create_rhythm_image(const.RHYTHMS[i])
     vbox.pack_start(im)
     vbox.pack_start(gu.create_png_image('rhythm-wrong'), False, False)
     vbox.get_children()[-1].hide()
     self.g_box.pack_start(vbox, False)
     self.g_box.reorder_child(vbox, len(self.m_data))
     self.m_data.append(i)
Example #7
0
    def add_rhythm_element(self, i):
        assert len(self.m_data) <= self.m_num_notes
        if len(self.g_box.get_children()) >= self.m_num_notes:
            self.g_box.get_children()[self.m_num_notes-1].destroy()
        vbox = Gtk.VBox()
        vbox.show()
#        im = gu.create_rhythm_image(const.RHYTHMS[i])
        im = self.g_parent.solbutton(i, False)
        vbox.pack_start(im, True, True, 0)
        vbox.pack_start(gu.create_png_image('rhythm-wrong'), False, False, 0)
        vbox.get_children()[-1].hide()
        self.g_box.pack_start(vbox, False, False, 0)
        self.g_box.reorder_child(vbox, len(self.m_data))
        self.m_data.append(i)
Example #8
0
    def add_rhythm_element(self, i):
        assert len(self.m_data) <= self.m_num_notes
        if len(self.g_box.get_children()) >= self.m_num_notes:
            self.g_box.get_children()[self.m_num_notes-1].destroy()
        vbox = gtk.VBox()
        vbox.show()
#        im = gu.create_rhythm_image(const.RHYTHMS[i])
        im = self.g_parent.solbutton(i, False)
        vbox.pack_start(im)
        vbox.pack_start(gu.create_png_image('rhythm-wrong'), False, False)
        vbox.get_children()[-1].hide()
        self.g_box.pack_start(vbox, False)
        self.g_box.reorder_child(vbox, len(self.m_data))
        self.m_data.append(i)
Example #9
0
 def clear_wrong_part(self):
     """When the user have answered the question, this method is used
     to clear all but the first correct elements."""
     # this assert is always true because if there is no rhythm element,
     # then there is a rhythm holder ( |__| )
     assert self.m_num_beats == len(self.g_parent.m_t.m_question)
     self.g_face.destroy()
     self.g_face = None
     for n in range(self.m_num_beats):
         if self.m_data[n] != self.g_parent.m_t.m_question[n]:
             break
     for x in range(n, len(self.g_box.get_children())):
         self.g_box.get_children()[n].destroy()
     self.m_data = self.m_data[:n]
     for x in range(n, self.m_num_beats):
         self.g_box.pack_start(gu.create_png_image('holder'), False)
Example #10
0
 def clear_wrong_part(self):
     """When the user have answered the question, this method is used
     to clear all but the first correct elements."""
     # this assert is always true because if there is no rhythm element,
     # then there is a rhythm holder ( |__| )
     assert self.m_num_notes == len(self.g_parent.m_t.m_question)
     self.g_face.destroy()
     self.g_face = None
     for n in range(self.m_num_notes):
         if self.m_data[n] != self.g_parent.m_t.m_question[n]:
             break
     for x in range(n, len(self.g_box.get_children())):
         self.g_box.get_children()[n].destroy()
     self.m_data = self.m_data[:n]
     for x in range(n, self.m_num_notes):
         self.g_box.pack_start(gu.create_png_image('holder'), False, False, 0)