Skip to content

Commit

Permalink
Fix signature removal
Browse files Browse the repository at this point in the history
  • Loading branch information
srwi committed Jan 28, 2024
1 parent 00064ce commit fd75469
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# MockSign

Simulate the look of hand signed and scanned documents. MockSign is inspired
by [FalsiSign](https://gitlab.com/edouardklein/falsisign) by Edouard Klein.
![Build](https://github.com/srwi/MockSign/actions/workflows/github-actions.yml/badge.svg)
[![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/srwi/MockSign/blob/master/LICENSE)

Simulate the look of hand signed and scanned documents. MockSign draws inspiration from
[FalsiSign](https://gitlab.com/edouardklein/falsisign), developed by Edouard Klein.

![MockSign Screenshot](https://github.com/srwi/FalsiSignPy/assets/17520641/2ec12a25-ec97-4dca-a551-27a4d44c2602)

Expand Down
2 changes: 2 additions & 0 deletions src/mocksign/mocksign.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ def _redraw_page_signatures(self) -> None:
return

page_signatures = self._pdf.get_page_signatures(self._current_page)
for id_ in self._pdf.get_page_signature_ids(self._current_page):
self._graph.delete_figure(id_)
self._pdf.clear_page_signatures(self._current_page)
for signature in page_signatures:
scaled_signature = signature.get_scaled_signature()
Expand Down
1 change: 1 addition & 0 deletions src/mocksign/pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def place_signature(self, page_number: int, signature: Signature, identifier: in
raise RuntimeError(f"Signature with identifier {identifier} already exists on page {i}.")

self._signatures[page_number][identifier] = signature
print(self._signatures)

def delete_signature(self, identifier: int) -> None:
for i, page_signatures in enumerate(self._signatures):
Expand Down
3 changes: 1 addition & 2 deletions test/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from typing import Tuple

import pytest
from mocksign import utils
from PIL import Image

from src.mocksign import utils


@pytest.mark.parametrize(
"image_size,target_size,expected_padded_image_coords",
Expand Down

0 comments on commit fd75469

Please sign in to comment.