Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
-->

# Version History
- 0.2.195 - Cancel CapsuleButton ``_animate_id`` callbacks during tab detachment to
avoid repeated button images and ``invalid command name`` errors when
closing roots.
- Extend ``cancel_after_events`` to handle identifiers suffixed with
``_animate_id`` or ``_after_id``.
- Add regression test covering cleanup when ``after info`` for a
widget is unavailable.
- 0.2.194 - Clone widgets using keyword configuration to respect CapsuleButton's
signature and preserve options like cursor.
- Add regression test ensuring cursor configuration copies correctly.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 0.2.194
version: 0.2.195
Author: Miguel Marina <karel.capek.robotics@gmail.com> - [LinkedIn](https://www.linkedin.com/in/progman32/)
# AutoML

Expand Down
4 changes: 3 additions & 1 deletion gui/utils/closable_notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ def _cancel_ident(ident: str) -> None:

try:
for name in dir(widget):
if name.endswith(("_anim", "_after", "_timer", "_animate")):
if name.endswith(
("_anim", "_after", "_timer", "_animate", "_animate_id", "_after_id")
):
ident = getattr(widget, name, None)
if isinstance(ident, str) and ident not in cancelled:
_cancel_ident(ident)
Expand Down
2 changes: 1 addition & 1 deletion mainappsrc/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@

"""Project version information."""

VERSION = "0.2.194"
VERSION = "0.2.195"

__all__ = ["VERSION"]
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,26 @@ def test_close_clears_animate(self, monkeypatch):
root.update()
assert "_animate" not in str(root.tk.call("after", "info"))
root.destroy()

def test_detach_clears_animate_without_after_info(self, monkeypatch):
root = tk.Tk(); root.withdraw()
nb = ClosableNotebook(root)
btn = self.AnimatedButton(nb)
nb.add(btn, text="Tab")
nb.update_idletasks()

orig_call = btn.tk.call

def fake_call(*args):
if args[:3] == ("after", "info", str(btn)):
raise tk.TclError("unsupported")
return orig_call(*args)

monkeypatch.setattr(btn.tk, "call", fake_call)

self._detach(nb, monkeypatch)
root.update()
assert "_animate" not in str(root.tk.call("after", "info"))
win = nb._floating_windows[0]
win.destroy()
root.destroy()