Skip to content

Commit

Permalink
Merge pull request #8 from TimNekk/develop (v1.2.0)
Browse files Browse the repository at this point in the history
Add auto delete from history and fixed tests
  • Loading branch information
TimNekk authored Mar 28, 2023
2 parents 67f7fa1 + 93dd89d commit 11d4432
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ app = Gigapixel(exe_path, output_suffix)

# Process image.
image = Path('path/to/image.jpg')
output_path = app.process(image, scale=Scale.X2, mode=Mode.STANDARD)
output_path = app.process(image, scale=Scale.X2, mode=Mode.STANDARD, delete_from_history=True)

# Print output path.
print(output_path)
Expand Down
8 changes: 7 additions & 1 deletion gigapixel/gigapixel.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ def save_photo(self) -> None:
self._main_window.child_window(title="Cancel Processing", control_type="Button").wait_not('visible',
timeout=60)

@log("Deleting photo from history", "Photo deleted", level=Level.DEBUG)
def delete_photo(self) -> None:
self._main_window.Pane.Button2.click_input()

@log("Setting processing options", "Processing options set", level=Level.DEBUG)
def set_processing_options(self, scale: Optional[Scale] = None, mode: Optional[Mode] = None) -> None:
if scale:
Expand Down Expand Up @@ -129,11 +133,13 @@ def _get_save_path(self, path: Path) -> Path:

@log(start="Starting processing: {}", format=(1,))
@log(end="Finished processing: {}", format=(1,), level=Level.SUCCESS)
def process(self, photo_path: Path, scale: Scale = Scale.X2, mode: Mode = Mode.STANDARD) -> Path:
def process(self, photo_path: Path, scale: Scale = Scale.X2, mode: Mode = Mode.STANDARD, delete_from_history: bool = True) -> Path:
self._check_path(photo_path)

self._app.open_photo(photo_path)
self._app.set_processing_options(scale, mode)
self._app.save_photo()
if delete_from_history:
self._app.delete_photo()

return self._get_save_path(photo_path)
2 changes: 0 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ setenv =
PYTHONPATH = {toxinidir}
deps =
-r{toxinidir}/requirements_dev.txt
commands =
pytest

[testenv:flake8]
basepython = python3.10
Expand Down

0 comments on commit 11d4432

Please sign in to comment.