From b16bcc5a57d7d3414efdc988a715b61f758e5c94 Mon Sep 17 00:00:00 2001 From: David Hozic Date: Thu, 1 Feb 2024 23:10:51 +0100 Subject: [PATCH] Bug fix --- docs/source/changelog.rst | 7 +++++++ tkclasswiz/__init__.py | 2 +- tkclasswiz/object_frame/frame_base.py | 9 ++++++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index 7a67679..1d07ff6 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -24,6 +24,13 @@ Glossary Releases --------------------- +v1.4.7 +=================== +- Fixed incorrect item being removed (at incorrect index) when editing an object. +- Fixed :class:`tkclasswiz.storage.ListBoxObjects` still selecting the old value when a new value + was inserted. Now only the added value is selected. + + v1.4.6 ================ - Fixed some parameter name lengths not being accommodated for. diff --git a/tkclasswiz/__init__.py b/tkclasswiz/__init__.py index e76c898..1dc36c3 100644 --- a/tkclasswiz/__init__.py +++ b/tkclasswiz/__init__.py @@ -27,7 +27,7 @@ SOFTWARE. """ -__version__ = "1.4.6" +__version__ = "1.4.7" from .object_frame import * diff --git a/tkclasswiz/object_frame/frame_base.py b/tkclasswiz/object_frame/frame_base.py index 961fb92..24a589d 100644 --- a/tkclasswiz/object_frame/frame_base.py +++ b/tkclasswiz/object_frame/frame_base.py @@ -80,9 +80,11 @@ def __init__( "If editing, the value being edited" # If return_widget is None, it's a floating display with no return value - editing_index = return_widget.current() if return_widget is not None else -1 - if editing_index == -1: - editing_index = None + editing_index = None + if old_data is not None and return_widget is not None: + current = return_widget.current() + if current != -1: + editing_index = current self.editing_index = editing_index "The index of object being edited" @@ -293,4 +295,5 @@ def _update_ret_widget(self, new: Any): if isinstance(self.return_widget, ComboBoxObjects): self.return_widget.current(ind) else: + self.return_widget.select_clear("0", tk.END) self.return_widget.selection_set(ind)