From 05039ea001c0fc62e914102b440610807f676f2e Mon Sep 17 00:00:00 2001 From: Klemek Date: Fri, 27 Aug 2021 10:20:46 +0200 Subject: [PATCH] small fixes --- watchy-image-editor/app.py | 2 +- watchy-image-editor/explorer.py | 2 +- watchy-image-editor/file.py | 6 ++++++ watchy-image-editor/image.py | 1 - 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/watchy-image-editor/app.py b/watchy-image-editor/app.py index d75f3e3..33a6619 100644 --- a/watchy-image-editor/app.py +++ b/watchy-image-editor/app.py @@ -219,7 +219,7 @@ class App(ttk.Frame): self.open_file(path) def _file_save(self) -> None: - self.save_file() + self.save_file(self.current_file.path) def _file_save_as(self) -> None: path = filedialog.asksaveasfilename( diff --git a/watchy-image-editor/explorer.py b/watchy-image-editor/explorer.py index e3cc6a3..a0db1e6 100644 --- a/watchy-image-editor/explorer.py +++ b/watchy-image-editor/explorer.py @@ -77,7 +77,7 @@ class Explorer(ttk.Frame): text=f"{image.name}{'*' if image.modified else ''}", values=[f"{image.width}x{image.height}"], ) - if self.size > 0 and (focus_id != self.current_id or force): + if self.size > 0 and focus_id != self.current_id: self.focus(focus_id) def explorer_item_click(self, event) -> None: diff --git a/watchy-image-editor/file.py b/watchy-image-editor/file.py index 1615b64..5937186 100644 --- a/watchy-image-editor/file.py +++ b/watchy-image-editor/file.py @@ -62,3 +62,9 @@ class File: with open(path, mode="w") as f: for image in self.images: f.write(image.export_cpp()) + + def __eq__(self, other: object) -> bool: + if isinstance(other, self.__class__): + return self.path == other.path + else: + return False diff --git a/watchy-image-editor/image.py b/watchy-image-editor/image.py index 7434732..7a35a28 100644 --- a/watchy-image-editor/image.py +++ b/watchy-image-editor/image.py @@ -41,7 +41,6 @@ class Image: def set_pixel(self, x: int, y: int, v: bool) -> None: position = self.__get_position(x, y) chunk_id = position // 8 - # TODO fix, invalid chunk id when drawing if v != self.get_pixel(x, y): if v: self.data[chunk_id] |= 1 << (7 - position % 8)