def exit(self):
     if (self.mode == "speech"):
         self.grammar.unload()
         toggle_speechrec()
     self.mode = "regular"
     turn_on_sound()
     toggle_eyetracker()
Exemple #2
0
    def handle_input(self, dataDicts):
        if (loud_detection(dataDicts, "bell")):
            self.modeSwitcher.turnOnModeSwitch()

        if (self.mode == "regular"):
            if (percentage_detection(dataDicts, "whistle", 75)):
                self.mode = "speech"
                toggle_speechrec()
            else:
                if (single_tap_detection(dataDicts, "cluck", 35, 1000)):
                    click()
                elif (single_tap_detection(dataDicts, "fingersnap", 50, 1000)):
                    click(button='right')
                elif (loud_detection(dataDicts, "sound_f")):
                    scroll(150)
                elif (loud_detection(dataDicts, "sound_s")):
                    scroll(-150)

                if (percentage_detection(dataDicts, "sound_thr", 75)):
                    quadrant = detect_mouse_quadrant(3, 3)
                    if (quadrant > 3):
                        self.modeSwitcher.switchMode('browse')

        elif (self.mode == "speech"):
            self.speech_mode()
            if (percentage_detection(dataDicts, "sound_thr", 75)):
                self.mode = "regular"
                toggle_speechrec()
Exemple #3
0
 def reset_mode(self):
     if (self.mode == "speech"):
         self.grammar.unload()
         toggle_speechrec()
     self.inputManager.press("esc")
     self.detector.add_tick_action("Esc")
     self.mode = "regular"
Exemple #4
0
 def start(self):
     self.grammar.load()
     self.mode = "speech"
     toggle_speechrec()
     self.centerXPos, self.centerYPos = pyautogui.position()
     toggle_eyetracker()
     mute_sound()
     self.open_file()
Exemple #5
0
 def toggle_speech( self ):
     if( self.mode != "speech" ):
         self.mode = "speech"
         self.grammar.load()
         print( "--- TOGGLING SPEECH RECOGNITION ON" )
     else:
         self.mode = "regular"
         self.grammar.unload()
         print( "--- TOGGLING SPEECH RECOGNITION OFF" )
     toggle_speechrec()
Exemple #6
0
    def toggle_speech(self, with_enter=True):
        self.release_hold_keys()

        if (self.mode != "speech"):
            self.mode = "speech"
            self.grammar.load()
            if (with_enter):
                self.inputManager.press('enter')
        else:
            self.mode = "regular"
            self.grammar.unload()
        toggle_speechrec()
 def exit_speech_mode(self):
     self.grammar.unload()
     toggle_speechrec()
     self.mode = "regular"
    def handle_input(self, dataDicts):
        self.detector.tick(dataDicts)

        if (self.mode != "speech"):
            if (self.detector.detect("click")):
                if (self.hold_key == ""):
                    self.follow_mouse(False)

                    minimap = self.minimaps[self.current_map]
                    if (self.detector.detect_inside_minimap(
                            minimap[0], minimap[1], minimap[2], minimap[3])
                            and self.detector.detect("minimap-click")):
                        click()
                    else:
                        click(button='right')
                elif (self.hold_key == "click"):
                    click()
                else:
                    self.press_ability(self.hold_key)

                self.hold_key = ""
            elif (self.detector.detect("q") or self.detector.detect("q2")):
                self.press_ability('q')
            elif (self.detector.detect("w")):
                self.press_ability('w')
            elif (self.detector.detect("e")):
                self.press_ability('e')
            elif (self.detector.detect("heroic")):
                self.press_ability('r')
            elif (self.detector.detect("special")):
                quadrant = self.detector.detect_mouse_quadrant(3, 3)
                self.set_hold_key(quadrant)
            elif (self.detector.detect("movement")):
                quadrant = self.detector.detect_mouse_quadrant(3, 3)
                self.character_movement(quadrant)

            edges = self.detector.detect_mouse_screen_edge(10)
            if (len(edges) > 0 or self.detector.detect("camera")):
                self.mode = "cameramovement"
                print("Camera movement!")
                self.camera_movement(edges, detect_mouse_quadrant(4, 3))
            elif (self.mode == "cameramovement"):
                self.camera_movement([], -1)
                print("Regular mode!")
                self.mode = "regular"

            if (self.detector.detect("rightclick")):
                print("LMB")
                click()
        elif (self.mode == "speech"):
            pythoncom.PumpWaitingMessages()
            time.sleep(.1)

        if (SPEECHREC_ENABLED == True and self.detector.detect("speech")):
            self.mode = "speech"
            print("SELECTING HERO MODE")
            self.selectHeroRule.set_callback(self.select_hero)
            self.grammar.load()
            toggle_speechrec()
        elif (self.detector.detect("exit")):
            quadrant = self.detector.detect_mouse_quadrant(3, 3)

            if (quadrant == 9):
                self.mode = "speech"
                print(self.select_hero)
                self.selectHeroRule.set_callback(self.select_hero)
                self.grammar.load()
                toggle_speechrec()
            else:
                self.modeSwitcher.switchMode('browse')

        return self.detector.tickActions
Exemple #9
0
 def exit(self):
     self.grammar.unload()
     toggle_speechrec()
     turn_on_sound()
Exemple #10
0
 def start(self):
     self.grammar.load()
     mute_sound()
     toggle_speechrec()
Exemple #11
0
 def reset_mode(self):
     if (self.mode == "speech"):
         self.grammar.unload()
         toggle_speechrec()
     self.inputManager.press("esc")
     self.mode = "regular"
Exemple #12
0
 def exit(self):
     self.grammar.unload()
     toggle_speechrec()