Skip to content

Commit

Permalink
fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Nokse22 committed Jul 8, 2024
1 parent 581f003 commit 4731eb0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
3 changes: 3 additions & 0 deletions src/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,9 @@ def vertical_line(self, x, start_y, length, char, draw):
def set_char_at(self, x, y, char, draw):
_layer = self.drawing if draw else self.preview

if char == "":
char = " "

if y >= len(_layer) or x >= len(_layer[0]) or x < 0 or y < 0:
return
if draw:
Expand Down
11 changes: 2 additions & 9 deletions src/tools/line.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def __init__(self, *args, **kwargs):
builder = Gtk.Builder.new_from_resource("/io/github/nokse22/asciidraw/ui/line_sidebar.ui")
self._sidebar = builder.get_object("line_stack_page")
self.line_type_combo = builder.get_object("line_type_combo")
self.arrow_switch = builder.get_object("line_arrow_switch")

self.start_x = 0
self.start_y = 0
Expand All @@ -61,15 +62,7 @@ def __init__(self, *args, **kwargs):
self.prev_pos = [0,0]

self.line_type_combo.bind_property("selected", self, "line_type")

@GObject.Property(type=bool, default=False)
def active(self):
return self._active

@active.setter
def active(self, value):
self._active = value
self.notify('active')
self.arrow_switch.bind_property("active", self, "arrow")

@GObject.Property(type=bool, default=False)
def arrow(self):
Expand Down
3 changes: 3 additions & 0 deletions src/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,11 @@ def make_new_canvas(self):
self.file_path = ""
self.title_widget.set_subtitle("")
self.canvas.undo_changes = []
self.canvas.redo_changes = []
self.undo_button.set_sensitive(False)
self.undo_button.set_tooltip_text("")
self.redo_button.set_sensitive(False)
self.redo_button.set_tooltip_text("")
self.canvas.is_saved = True
toast = Adw.Toast(title=_("New Canvas"), timeout=2)
self.toast_overlay.add_toast(toast)
Expand Down

0 comments on commit 4731eb0

Please sign in to comment.