Exemplo n.º 1
0
 def new_exercise(self, videoPath, exercisePath, translationPath, langId):
     self.exercise = Exercise()
     self.exercise.set_media_change_callback(self.media_change_call_back)
     self.exercise.new()
     self.exercise.set_language_id(langId)
     self._set_paths(videoPath, exercisePath,
                     translationPath)  # This initialize the exercise
     self._reload(True)
     self._activate_sequence()
     self.gui_controller.set_title("", True)
Exemplo n.º 2
0
 def add_random_guitar(self):
     random_number = random.randint(1, 100)
     if random_number >= 1 and random_number < 60:
         random_guitar = self._GUITAR_M
     elif random_number >= 60 and random_number < 90:
         random_guitar = self._GUITAR_D
     else:
         random_guitar = self._GUITAR_A
     guitar_step = ExerciseStep(random_guitar)
     guitar_exercise = Exercise("Guitar", "Pick the following guitar",
                                [guitar_step])
     self._exercises.insert(0, guitar_exercise)
Exemplo n.º 3
0
    def get_exercise(self, quantity: int, guitar: dict) -> Exercise:
        """ Returns random chord exercises """
        if guitar["kind"] != "instrument":
            return None

        random_steps = []
        note = Note()
        chord = Chord()

        for pos in range(0, quantity):  # pylint: disable=W0612
            pentatonic_key = note.get_random_note()
            target_chord = chord.get_random_chord()
            step = ExerciseStep(f"{pentatonic_key} Pentatonic", target_chord)
            random_steps.append(step)

        output = Exercise(self._TITLE,
                          self._SUBTITLE,
                          random_steps,
                          practice_category=self.category)

        return output
    def get_exercise(self, quantity: int, guitar: dict) -> Exercise:
        """ Returns exercise """
        if guitar["kind"] != "instrument":
            return None
        random_steps = []

        random_chords = Chord().get_random_chords(quantity)
        key_signature = KeySignature()

        for chord in random_chords:
            try:
                note = key_signature.get_random_relative_note(chord)
            except Exception:
                continue

            random_step = ExerciseStep(f"{note} -> {chord}")
            random_steps.append(random_step)

        output = Exercise(self._TITLE,
                          self._SUBTITLE,
                          random_steps,
                          practice_category=self.category)

        return output
 def add_guitar(self, guitar: dict):
     """ Adds a new instrument """
     guitar_step = ExerciseStep(guitar["type"])
     guitar_exercise = Exercise("Guitar", "Pick the following guitar",
                                [guitar_step])
     self._exercises.insert(0, guitar_exercise)