From 7c2b4bbd94bb3b1b8d74f4410e03a899735b4e35 Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Wed, 25 Sep 2024 06:04:09 +0000 Subject: [PATCH] refactored dialogs.py v2 --- gui/wxpython/dbmgr/dialogs.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gui/wxpython/dbmgr/dialogs.py b/gui/wxpython/dbmgr/dialogs.py index 26e6d876371..8749ef338a4 100644 --- a/gui/wxpython/dbmgr/dialogs.py +++ b/gui/wxpython/dbmgr/dialogs.py @@ -222,10 +222,13 @@ def GetSQLString(self, updateValues=False): ctype = columns[name]["ctype"] value = columns[name]["values"][idx] id = columns[name]["ids"][idx] - try: - newvalue = self.FindWindowById(id).GetValue() - except: - newvalue = self.FindWindowById(id).GetLabel() + widget = self.FindWindowById(id) + if hasattr(widget, "GetValue"): + newvalue = widget.GetValue() + elif hasattr(widget, "GetLabel"): + newvalue = widget.GetLabel() + else: + raise AttributeError(f"AttributeError in {widget}") if newvalue: try: