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: Fixed E722 in frame.py #4440

Merged
merged 7 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
12 changes: 6 additions & 6 deletions gui/wxpython/lmgr/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def show_menu_errors(messages):
y = client_disp[1]
self.SetPosition((x, y))
self.SetSize((w, h))
except:
except (ValueError, IndexError):
pass
else:
# does center (of screen) make sense for lmgr?
Expand Down Expand Up @@ -885,7 +885,7 @@ def OnCBPageChanged(self, event):
try:
self.GetMapDisplay().SetFocus()
self.GetMapDisplay().Raise()
except:
except AttributeError:
pass

event.Skip()
Expand Down Expand Up @@ -1125,7 +1125,7 @@ def GetMenuCmd(self, event):

try:
cmdlist = cmd.split(" ")
except: # already list?
except AttributeError: # already list?
cmdlist = cmd

# check list of dummy commands for GUI modules that do not have GRASS
Expand All @@ -1137,7 +1137,7 @@ def GetMenuCmd(self, event):
layer = self.GetLayerTree().layer_selected
name = self.GetLayerTree().GetLayerInfo(layer, key="maplayer").name
type = self.GetLayerTree().GetLayerInfo(layer, key="type")
except:
except AttributeError:
layer = None

if layer and len(cmdlist) == 1: # only if no parameters given
Expand Down Expand Up @@ -1185,7 +1185,7 @@ def OnVDigit(self, event):
# available only for vector map layers
try:
mapLayer = tree.GetLayerInfo(layer, key="maplayer")
except:
except AttributeError:
mapLayer = None

if not mapLayer or mapLayer.GetType() != "vector":
Expand Down Expand Up @@ -1862,7 +1862,7 @@ def OnShowAttributeTable(self, event, selection=None):
# available only for vector map layers
try:
maptype = tree.GetLayerInfo(layer, key="maplayer").type
except:
except (AttributeError, KeyError):
arohanajit marked this conversation as resolved.
Show resolved Hide resolved
maptype = None

if not maptype or maptype != "vector":
Expand Down
10 changes: 5 additions & 5 deletions gui/wxpython/lmgr/layertree.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ def OnLayerContextMenu(self, event):
# self.popupMenu.Enable(self.popupID['bgmap'], False)
self.popupMenu.Enable(self.popupID["topo"], False)
# else:
### self.popupMenu.Enable(self.popupID['bgmap'], True)
# self.popupMenu.Enable(self.popupID['bgmap'], True)

item = wx.MenuItem(
self.popupMenu, id=self.popupID["meta"], text=_("Metadata")
Expand Down Expand Up @@ -1742,7 +1742,7 @@ def OnDeleteLayer(self, event):

try:
item.properties.Close(True)
except:
except Exception:
arohanajit marked this conversation as resolved.
Show resolved Hide resolved
pass

if item != self.root:
Expand All @@ -1758,7 +1758,7 @@ def OnDeleteLayer(self, event):
try:
if self.GetLayerInfo(item, key="type") != "group":
self.Map.DeleteLayer(self.GetLayerInfo(item, key="maplayer"))
except:
except (AttributeError, KeyError):
arohanajit marked this conversation as resolved.
Show resolved Hide resolved
pass

# redraw map if auto-rendering is enabled
Expand Down Expand Up @@ -1999,7 +1999,7 @@ def OnDrop(self, dropTarget, dragItem):
# save everything associated with item to drag
try:
old = dragItem # make sure this member exists
except:
except Exception:
arohanajit marked this conversation as resolved.
Show resolved Hide resolved
return

Debug.msg(4, "LayerTree.OnDrop(): layer=%s" % (self.GetItemText(dragItem)))
Expand Down Expand Up @@ -2046,7 +2046,7 @@ def RecreateItem(self, dragItem, dropTarget, parent=None):
newctrl.SetValue(
self.GetLayerInfo(dragItem, key="maplayer").GetCmd(string=True)
)
except:
except Exception:
pass
newctrl.Bind(wx.EVT_TEXT_ENTER, self.OnCmdChanged)
data = self.GetPyData(dragItem)
Expand Down
Loading