Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wxGUI: Refactored try-except block to be more robust in dialogs.py #4383

Merged
merged 3 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 0 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ per-file-ignores =
doc/gui/wxpython/example/dialogs.py: F401
gui/scripts/d.wms.py: E501
gui/wxpython/dbmgr/base.py: E722
gui/wxpython/dbmgr/dialogs.py: E722
gui/wxpython/dbmgr/sqlbuilder.py: E722
gui/wxpython/dbmgr/manager.py: E722
gui/wxpython/docs/wxgui_sphinx/conf.py: E402, W291
Expand Down
11 changes: 7 additions & 4 deletions gui/wxpython/dbmgr/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
arohanajit marked this conversation as resolved.
Show resolved Hide resolved

if newvalue:
try:
Expand Down
Loading