How to use the paperwork.frontend.util.canvas.animations.SpinnerAnimation function in paperwork

To help you get started, we’ve selected a few paperwork examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openpaperwork / paperwork / paperwork-gtk / src / paperwork / frontend / multiscan / scan.py View on Github external
def __on_scan_done(self, img):
        size = fit(img.size, self.size)
        img = img.resize(size)
        self.scan_animation = None
        self.drawers = [
            RectangleDrawer(self.position, self.size,
                            inside_color=ScanAnimation.BACKGROUND_COLOR),
            PillowImageDrawer(self.position, img),
            SpinnerAnimation(((self.position[0] + (self.size[0] / 2) -
                               SpinnerAnimation.ICON_SIZE / 2),
                              (self.position[1] + (self.size[1] / 2) -
                               SpinnerAnimation.ICON_SIZE / 2))),
        ]
        self.set_canvas(self.canvas)  # reset canvas on all new drawers
        self.canvas.redraw()
github openpaperwork / paperwork / paperwork-gtk / src / paperwork / frontend / multiscan / scan.py View on Github external
def __on_scan_done(self, img):
        size = fit(img.size, self.size)
        img = img.resize(size)
        self.scan_animation = None
        self.drawers = [
            RectangleDrawer(self.position, self.size,
                            inside_color=ScanAnimation.BACKGROUND_COLOR),
            PillowImageDrawer(self.position, img),
            SpinnerAnimation(((self.position[0] + (self.size[0] / 2) -
                               SpinnerAnimation.ICON_SIZE / 2),
                              (self.position[1] + (self.size[1] / 2) -
                               SpinnerAnimation.ICON_SIZE / 2))),
        ]
        self.set_canvas(self.canvas)  # reset canvas on all new drawers
        self.canvas.redraw()
github openpaperwork / paperwork / src / paperwork / frontend / mainwindow / __init__.py View on Github external
def on_export_preview_start(self):
        visible = self.img['canvas'].visible_size
        spinner = SpinnerAnimation(
            ((visible[0] - SpinnerAnimation.ICON_SIZE) / 2,
             (visible[1] - SpinnerAnimation.ICON_SIZE) / 2)
        )

        self.img['canvas'].add_drawer(spinner)
        self.export['estimated_size'].set_text(_("Computing ..."))
github openpaperwork / paperwork / paperwork-gtk / src / paperwork / frontend / mainwindow / scan.py View on Github external
def __on_ocr_rotation_anim_done_cb(self):
        self.rotation_done = True
        for angle in list(self.ocr_drawers.keys())[:]:
            if self.__used_angles and angle not in self.__used_angles:
                self._disable_angle(angle)
            else:
                img_drawer = self.ocr_drawers[angle][0]
                spinner_bg = RectangleDrawer(
                    img_drawer.position, img_drawer.size,
                    inside_color=(0.0, 0.0, 0.0, 0.1),
                    angle=angle,
                )
                spinner_bg.set_canvas(self.canvas)
                spinner_bg.redraw()
                spinner = SpinnerAnimation(
                    (
                        (img_drawer.position[0] + (img_drawer.size[0] / 2)) -
                        (SpinnerAnimation.ICON_SIZE / 2),
                        (img_drawer.position[1] + (img_drawer.size[1] / 2)) -
                        (SpinnerAnimation.ICON_SIZE / 2)
                    )
                )
                spinner.set_canvas(self.canvas)
                self.ocr_drawers[angle] = [img_drawer, spinner_bg, spinner]
                self.animators.append(spinner)
        # TODO(Jflesch): There are artefacts visible after the rotation
        # -> this is just the lazy way of getting rid of them.
        # there shouldn't be artefact in a first place
        self.canvas.redraw()
github openpaperwork / paperwork / paperwork-gtk / src / paperwork / frontend / mainwindow / pages.py View on Github external
'selection_start': None,
            'selection_end': None,
            'mouse_over': None,
        }
        self.mouse_over = False
        self.show_border = show_border
        self.show_all_boxes = show_all_boxes
        self.show_boxes = show_boxes
        self.search_sentence = search_sentence
        self.factories = job_factories
        self.schedulers = job_schedulers
        self.loading = False
        self._size = max_size
        self.previous_page_drawer = previous_page_drawer
        self._position = (0, 0)
        self.spinner = SpinnerAnimation((0, 0))
        self.upd_spinner_position()
        self.load_boxes()
github openpaperwork / paperwork / paperwork-gtk / src / paperwork / frontend / mainwindow / scan.py View on Github external
for angle in list(self.ocr_drawers.keys())[:]:
            if self.__used_angles and angle not in self.__used_angles:
                self._disable_angle(angle)
            else:
                img_drawer = self.ocr_drawers[angle][0]
                spinner_bg = RectangleDrawer(
                    img_drawer.position, img_drawer.size,
                    inside_color=(0.0, 0.0, 0.0, 0.1),
                    angle=angle,
                )
                spinner_bg.set_canvas(self.canvas)
                spinner_bg.redraw()
                spinner = SpinnerAnimation(
                    (
                        (img_drawer.position[0] + (img_drawer.size[0] / 2)) -
                        (SpinnerAnimation.ICON_SIZE / 2),
                        (img_drawer.position[1] + (img_drawer.size[1] / 2)) -
                        (SpinnerAnimation.ICON_SIZE / 2)
                    )
                )
                spinner.set_canvas(self.canvas)
                self.ocr_drawers[angle] = [img_drawer, spinner_bg, spinner]
                self.animators.append(spinner)
        # TODO(Jflesch): There are artefacts visible after the rotation
        # -> this is just the lazy way of getting rid of them.
        # there shouldn't be artefact in a first place
        self.canvas.redraw()
github openpaperwork / paperwork / paperwork-gtk / src / paperwork / frontend / mainwindow / pages.py View on Github external
def upd_spinner_position(self):
        self.spinner.position = (
            (self.position[0] + (self.size[0] / 2) -
             (SpinnerAnimation.ICON_SIZE / 2)),
            (self.position[1] + (self.size[1] / 2) -
             (SpinnerAnimation.ICON_SIZE / 2)),
        )