Пример #1
0
 def prepare(
     cls, touchet_manager
 ):  # Need to pass touchet manager as argument to avoid cyclic dependencies
     shapepicker().pick(
         cls.instantiate,
         "Pick a shape that should become a rotation touchet.",
         touchet_manager)
Пример #2
0
 def prepare2(cls, slider_shape, touchet_manager):
     shapepicker().pick(
         cls.prepare3,
         "Pick another shape that should become the referential.",
         slider_shape,
         touchet_manager
     )
Пример #3
0
 def prepare(
     cls, touchet_manager
 ):  # Need to pass touchet manager as argument to avoid cyclic dependencies
     shapepicker().pick(
         cls.prepare2,
         "Pick a shape that should become the unbounded slider.",
         touchet_manager)
Пример #4
0
 def prepare(
     cls, touchet_manager
 ):  # Need to pass touchet manager as argument to avoid cyclic dependencies
     shapepicker().pick(
         cls.instantiate,
         "Pick a shape that you want to become a hold button.",
         touchet_manager)
Пример #5
0
 def prepare3(cls, loref_shape, slider_shape, touchet_manager):
     if loref_shape == slider_shape:
         print("Error: You picked twice the same shape.")
         return
     shapepicker().pick(
         cls.instantiate,
         "Pick another shape to become the upper referential.", loref_shape,
         slider_shape, touchet_manager)
Пример #6
0
 def prepare3(cls, v_loref_shape, slider_shape, touchet_manager):
     if v_loref_shape == slider_shape:
         print("Error: You picked twice the same shape.")
         return
     shapepicker().pick(
         cls.prepare4,
         "Pick another shape to become the vertical upper ref.",
         [v_loref_shape, slider_shape], touchet_manager)
Пример #7
0
 def prepare5(cls, h_loref_shape, other_shapes, touchet_manager):
     other_shapes = [h_loref_shape] + other_shapes
     if len(set(other_shapes)) < len(other_shapes):
         print("Error: You picked twice the same shape.")
         return
     shapepicker().pick(
         cls.instantiate,
         "Pick another shape to become the horizontal upper ref.",
         other_shapes, touchet_manager)
Пример #8
0
 def prepare4(cls, v_hiref_shape, other_shapes, touchet_manager):
     other_shapes = [v_hiref_shape] + other_shapes
     if len(set(other_shapes)) < len(other_shapes):
         print("Error: You picked twice the same shape.")
         return
     shapepicker().pick(
         cls.prepare5,
         "Pick another shape to become the horizontal lower ref.",
         other_shapes, touchet_manager)
Пример #9
0
    def __stats(self):
        self.nth_frame += 1
        elapsed = time.time() - self.start_time
        if elapsed > .1:
            self.fps = int(self.nth_frame / elapsed)
            self.nth_frame = 0
            self.start_time = time.time()

        self.__print("Tracking {:2d} shapes".format(len(shapetracker().shapes)), 2, self.text_l)
        self.__print("{:2d} FPS".format(self.fps), 2, self.text_r - 86)

        if not handdetector().hand_valid:
            self.__print("HAND ERROR! Too many or too long hands.", 1, self.text_l, color=(0, 0, 255))
        elif ui().menu_armed:
            self.__print("Hold the blue square to enter the menu.", 1, self.text_l, color=(255, 50, 50))
        elif ui().menu_active:
            self.__print("Pick an option from the menu.", 1, self.text_l, color=(255, 50, 50))
        elif ui().action_menu_armed:
            self.__print("Hold the blue square to enter the menu.", 1, self.text_l, color=(50, 255, 50))
        elif ui().action_menu_active:
            self.__print("Pick an option from the menu.", 1, self.text_l, color=(50, 255, 50))
        elif shapepicker().active:
            if shapepicker().must_lift_finger:
                self.__print("Please lift your finger.", 0, self.text_l, color=(0, 255, 255))
            else:
                self.__print(shapepicker().hint, 0, self.text_l, color=(0, 255, 0))
                self.__print("Press and hold the shape you want to pick ({}%)".format(int(100 * shapepicker().progress())), 1, self.text_l, color=(0, 255, 0))
        elif shaperegionpicker().active:
            if shaperegionpicker().must_lift_finger:
                self.__print("Please lift your finger (keep hand under camera).", 0, self.text_l, color=(0, 255, 255))
            else:
                self.__print("Press and hold {} in the shape ({}%)".format(shaperegionpicker().current_region_description(), int(100 * shaperegionpicker().progress())), 0, self.text_l, color=(0, 255, 0))
                self.__print("When all regions are selected, remove your hand.", 1, self.text_l, color=(0, 255, 0))
        elif shapepositionpicker().active:
            self.__print(shapepositionpicker().hint, 0, self.text_l, color=(0, 255, 0))
            self.__print("When the position has been reached, remove hand.", 1, self.text_l, color=(0, 255, 0))
Пример #10
0
    def __init__(self, logger=None):
        super().__init__()
        if conf()['compile_pyx_on_startup']:
            os.system("python setup.py build_ext --inplace")

        self.frame = 0
        self.logger = logger

        # Initialize all needed modules
        shapedetector()
        shapetracker()
        touchedshapetracker()
        handdetector()
        handtracker()
        visualizer()
        ui()
        shapepicker()
        shaperegionpicker()

        # Put the wires together
        handtracker().subscribe('hand_exit', shapetracker().clear_lost_shapes)
        handtracker().subscribe('finger_up',
                                touchedshapetracker().on_finger_up)
        handtracker().subscribe('finger_pressing', ui().on_finger_pressing)
        handtracker().subscribe('finger_up', ui().on_finger_up)
        handtracker().subscribe('finger_down', ui().on_finger_down)
        handtracker().subscribe('finger_pressing',
                                shapepicker().on_finger_pressing)
        handtracker().subscribe('finger_up', shapepicker().on_finger_up)
        handtracker().subscribe('hand_exit', handdetector().on_hand_exit)
        handtracker().subscribe('finger_pressing',
                                shaperegionpicker().on_finger_pressing)
        handtracker().subscribe('finger_up', shaperegionpicker().on_finger_up)
        handtracker().subscribe('hand_exit', shaperegionpicker().on_hand_exit)
        handtracker().subscribe('hand_exit',
                                shapepositionpicker().on_hand_exit)
Пример #11
0
 def prepare(cls, touchet_manager):
     shapepicker().pick(cls.prepare2,
                        "Pick a shape that becomes the new swipe button.",
                        touchet_manager)
Пример #12
0
 def __set_shape_action(self, action):
     self.__action_menu_close()
     shapepicker().pick(self.__set_shape_action_callback,
                        "Pick the shape to set to {}".format(action),
                        action)
Пример #13
0
 def prepare(cls, touchet_manager):
     shapepicker().pick(
         cls.prepare2,
         "Pick a shape that should be your new pos. button.",
         touchet_manager
     )
Пример #14
0
 def prepare(cls, touchet_manager):
     shapepicker().pick(
         cls.prepare2,
         "Pick a shape to become a your new pos. hold button.",
         touchet_manager
     )
Пример #15
0
 def prepare(cls, touchet_manager):
     shapepicker().pick(cls.prepare2,
                        "Pick a shape that becomes the new finger slider.",
                        touchet_manager)
Пример #16
0
 def prepare2(cls, slider_shape, touchet_manager):
     shapepicker().pick(
         cls.prepare3,
         "Pick another shape to become the vertical lower ref.",
         slider_shape, touchet_manager)