Example #1
0
    def __on_scan_info_cb(self, x, y):
        size = fit((x, y), self.canvas.visible_size)
        position = (
            int(self.position[0] + (self.canvas.visible_size[0] / 2) -
                (size[0] / 2)),
            int(self.position[1]),
        )

        scan_drawer = ScanAnimation(position, (x, y), self.canvas.visible_size)
        scan_drawer.set_canvas(self.canvas)
        ratio = scan_drawer.ratio

        self.scan_drawers = [scan_drawer]

        calibration = self.scan_workflow.calibration
        if calibration:
            calibration_drawer = TargetAreaDrawer(
                position,
                size,
                (
                    int(position[0] + (ratio * calibration[0][0])),
                    int(position[1] + (ratio * calibration[0][1])),
                ),
                (
                    int(ratio * (calibration[1][0] - calibration[0][0])),
                    int(ratio * (calibration[1][1] - calibration[0][1])),
                ),
            )
            calibration_drawer.set_canvas(self.canvas)

            self.scan_drawers.append(calibration_drawer)

        self.redraw()
Example #2
0
 def __on_scan_info(self, size):
     self.scan_animation = ScanAnimation(self.position, size, self.size)
     self.drawers = [
         RectangleDrawer(self.position, self.size,
                         inside_color=ScanAnimation.BACKGROUND_COLOR),
         self.scan_animation,
     ]
     assert(self.canvas)
     self.set_canvas(self.canvas)  # reset canvas on all new drawers
     for drawer in self.drawers:
         drawer.redraw()
Example #3
0
 def on_scan_info(self, size):
     self.calibration['scan_drawer'] = ScanAnimation(
         (0, 0),
         size, self.calibration['image_gui'].visible_size)
     self.calibration['image_gui'].add_drawer(
         self.calibration['scan_drawer'])