small fixes
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user