Exemplo n.º 1
0
    def remove_rest(self, line):
        try:
            if line.strip() != "":
                parts = line.split(",")
                measure = int(parts[0].strip())
                start = parts[1].split("/")
                if len(start) == 1:
                    start = float(start[0].strip())
                elif len(start) == 2:
                    start = float(
                        int(start[0].strip()) / int(start[1].strip()))
                else:
                    raise CorruptedCompositionFileError("Huono alkamishetki.")

                for rest in self.comp.rests:
                    if rest.start == start and rest.measure == measure:
                        Composition.remove_rest(self.comp, measure, start)
                        return True
        except:
            print("Huono tauko.")
Exemplo n.º 2
0
    def find_items(self, comp):
        ''' Finds items that are on this column. '''

        for note in comp.notes:
            if note.measure == self.measure and note.start == self.start:
                self.notes.append(note)

        for rest in comp.rests:
            if rest.measure == self.measure and rest.start == self.start:
                self.rests.append(rest)

        for note in self.notes:
            for rest in self.rests:
                if note.start == rest.start:
                    Composition.remove_rest(comp, rest.measure, rest.start)
                    print("Nuotti ja tauko paallekain. Tauko poistettu.")

        for beam in comp.beams:
            if beam.measure == self.measure:
                self.beams.append(beam)

        for lyric in comp.lyrics:
            if lyric.measure == self.measure and lyric.start == self.start:
                self.lyrics.append(lyric)