Skip to content

Commit

Permalink
wxGUI: Add specific exception handling in vdigit/mapwindow.py (#4952)
Browse files Browse the repository at this point in the history
  • Loading branch information
arohanajit authored Jan 16, 2025
1 parent f958f45 commit 05b087f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions gui/wxpython/vdigit/mapwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def OnLeftDownAddLine(self, event):
"""Left mouse button pressed - add new feature"""
try:
mapLayer = self.toolbar.GetLayer().GetName()
except:
except AttributeError:
return

if self.toolbar.GetAction("type") in {"point", "centroid"}:
Expand Down Expand Up @@ -482,7 +482,7 @@ def OnLeftDownDisplayCA(self, event):
"""
try:
mapLayer = self.toolbar.GetLayer().GetName()
except:
except AttributeError:
return

coords = self.Pixel2Cell(self.mouse["begin"])
Expand Down Expand Up @@ -624,8 +624,7 @@ def OnLeftDownUndo(self, event):
removed,
],
)
# self.mouse['begin'] = self.Cell2Pixel(self.polycoords[-1])
except:
except IndexError:
pass

if action == "editLine":
Expand Down Expand Up @@ -691,7 +690,7 @@ def _onLeftDown(self, event):
"""Left mouse button donw - vector digitizer various actions"""
try:
self.toolbar.GetLayer().GetName()
except:
except AttributeError:
GMessage(parent=self, message=_("No vector map selected for editing."))
event.Skip()
return
Expand Down Expand Up @@ -1095,7 +1094,7 @@ def _onRightUp(self, event):
# -> add new line / boundary
try:
mapName = self.toolbar.GetLayer().GetName()
except:
except AttributeError:
mapName = None
GError(parent=self, message=_("No vector map selected for editing."))

Expand Down

0 comments on commit 05b087f

Please sign in to comment.