Esempio n. 1
0
    def __init__(
        self,
        parent,
        fake,
        device,
        misclick_threshold,
        dualclick_threshold,
        finger_delta,
        timeout,
        fast_start,
        npoints,
        auto_close,
    ):
        WebContainerController.__init__(self)
        instance = CalibratorControllerActions(controller=self)
        self.parent = parent
        self.add_processor("calibrator", instance)

        self.calibrator = Calibrator(npoints, misclick_threshold, dualclick_threshold, finger_delta, device, fake)

        self.timeout = timeout
        self.fast_start = fast_start
        self.auto_close = auto_close
        self.state = None
        self.nerror = 0
Esempio n. 2
0
    def __init__(self, parent, fake, device, misclick_threshold,
                 dualclick_threshold, finger_delta, timeout, fast_start,
                 npoints, auto_close):
        WebContainerController.__init__(self)
        instance = CalibratorControllerActions(controller=self)
        self.parent = parent
        self.add_processor("calibrator", instance)

        self.calibrator = Calibrator(npoints, misclick_threshold,
                                     dualclick_threshold, finger_delta, device,
                                     fake)

        self.timeout = timeout
        self.fast_start = fast_start
        self.auto_close = auto_close
        self.state = None
        self.nerror = 0
Esempio n. 3
0
class CalibratorController(WebContainerController):
    def __init__(
        self,
        parent,
        fake,
        device,
        misclick_threshold,
        dualclick_threshold,
        finger_delta,
        timeout,
        fast_start,
        npoints,
        auto_close,
    ):
        WebContainerController.__init__(self)
        instance = CalibratorControllerActions(controller=self)
        self.parent = parent
        self.add_processor("calibrator", instance)

        self.calibrator = Calibrator(npoints, misclick_threshold, dualclick_threshold, finger_delta, device, fake)

        self.timeout = timeout
        self.fast_start = fast_start
        self.auto_close = auto_close
        self.state = None
        self.nerror = 0

    def initiate(self, data):
        width = data[0]
        height = data[1]
        self.calibrator.set_screen_prop(width, height)
        print "Screen resolution: ", width, "x", height

        data = {}
        next = None
        self.state = "init"
        if self.fast_start:
            self.state = "calibrating"
            next = self.calibrator.get_next_point()

        self._calc_verification_point(width, height)

        data["mostrar_cursor"] = (MOSTRAR_CURSOR,)
        data["timeout"] = self.timeout
        data["fast_start"] = self.fast_start
        data["auto_close"] = self.auto_close
        data["state"] = self.state
        data["next"] = next
        data["locale"] = get_base_data(self.timeout)
        data["verification_point"] = self.verification_point

        self.send_command("ready", data)

    def finish(self):
        self.state = "end"
        self.send_command("end")
        self.calibrator.calc_new_axis()
        self.calibrator.finish()

    def reset(self):
        self.state = "calibrating"
        self.nerror = 0
        self.calibrator.reset()

        width = self.calibrator.width
        height = self.calibrator.height
        self._calc_verification_point(width, height)
        self.send_command("reset", self.verification_point)

        next = self.calibrator.get_next_point()
        self.send_command("move_pointer", next)

    def _check_last_click(self, (x, y)):
        """
        Este metodo comprueba si el último click coincide con el centro de la
        pantalla, en el caso de que no coincida, reinicia el proceso de
        calibración ya que considera de que la pantalla no está correctamemte
        calibrada
        """
        recalibrate = False
        misclick_threshold = 16
        if (
            abs(self.verification_point[0] - x) > misclick_threshold
            or abs(self.verification_point[1] - y) > misclick_threshold
        ):
            recalibrate = True

        return recalibrate
Esempio n. 4
0
class CalibratorController(WebContainerController):
    def __init__(self, parent, fake, device, misclick_threshold,
                 dualclick_threshold, finger_delta, timeout, fast_start,
                 npoints, auto_close):
        WebContainerController.__init__(self)
        instance = CalibratorControllerActions(controller=self)
        self.parent = parent
        self.add_processor("calibrator", instance)

        self.calibrator = Calibrator(npoints, misclick_threshold,
                                     dualclick_threshold, finger_delta, device,
                                     fake)

        self.timeout = timeout
        self.fast_start = fast_start
        self.auto_close = auto_close
        self.state = None
        self.nerror = 0

    def initiate(self, data):
        width = data[0]
        height = data[1]
        self.calibrator.set_screen_prop(width, height)
        print "Screen resolution: ", width, 'x', height

        data = {}
        next = None
        self.state = 'init'
        if self.fast_start:
            self.state = 'calibrating'
            next = self.calibrator.get_next_point()

        self._calc_verification_point(width, height)

        data['mostrar_cursor'] = MOSTRAR_CURSOR,
        data['timeout'] = self.timeout
        data['fast_start'] = self.fast_start
        data['auto_close'] = self.auto_close
        data['state'] = self.state
        data['next'] = next
        data['locale'] = get_base_data(self.timeout)
        data['verification_point'] = self.verification_point

        self.send_command('ready', data)

    def finish(self):
        self.state = 'end'
        self.send_command('end')
        self.calibrator.calc_new_axis()
        self.calibrator.finish()

    def reset(self):
        self.state = 'calibrating'
        self.nerror = 0
        self.calibrator.reset()

        width = self.calibrator.width
        height = self.calibrator.height
        self._calc_verification_point(width, height)
        self.send_command('reset', self.verification_point)

        next = self.calibrator.get_next_point()
        self.send_command('move_pointer', next)

    def _check_last_click(self, (x, y)):
        """
        Este metodo comprueba si el último click coincide con el centro de la
        pantalla, en el caso de que no coincida, reinicia el proceso de
        calibración ya que considera de que la pantalla no está correctamemte
        calibrada
        """
        recalibrate = False
        misclick_threshold = 16
        if abs(self.verification_point[0] - x) > misclick_threshold or \
                abs(self.verification_point[1] - y) > misclick_threshold:
            recalibrate = True

        return recalibrate