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 all 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
3 changes: 0 additions & 3 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ per-file-ignores =
gui/scripts/d.wms.py: E501
gui/wxpython/image2target/*: F841, E722
gui/wxpython/image2target/g.gui.image2target.py: E501, F841
gui/wxpython/lmgr/frame.py: E722
# layertree still includes some formatting issues (it is ignored by Black)
gui/wxpython/lmgr/layertree.py: E722
gui/wxpython/modules/*: F841, E722
gui/wxpython/nviz/*: F841, E266, E722, F403, F405
gui/wxpython/photo2image/*: F841, E722, E265
Expand Down
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 @@ -884,7 +884,7 @@ def OnCBPageChanged(self, event):
try:
self.GetMapDisplay().SetFocus()
self.GetMapDisplay().Raise()
except:
except AttributeError:
pass

event.Skip()
Expand Down Expand Up @@ -1123,7 +1123,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 @@ -1135,7 +1135,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 @@ -1183,7 +1183,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 @@ -1860,7 +1860,7 @@ def OnShowAttributeTable(self, event, selection=None):
# available only for vector map layers
try:
maptype = tree.GetLayerInfo(layer, key="maplayer").type
except:
except AttributeError:
maptype = None

if not maptype or maptype != "vector":
Expand Down
11 changes: 4 additions & 7 deletions gui/wxpython/lmgr/layertree.py
Original file line number Diff line number Diff line change
Expand Up @@ -1742,7 +1742,7 @@ def OnDeleteLayer(self, event):

try:
item.properties.Close(True)
except:
except AttributeError:
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:
pass

# redraw map if auto-rendering is enabled
Expand Down Expand Up @@ -1997,10 +1997,7 @@ def OnEndDrag(self, event):

def OnDrop(self, dropTarget, dragItem):
# save everything associated with item to drag
try:
old = dragItem # make sure this member exists
except:
return
old = dragItem # make sure this member exists

Debug.msg(4, "LayerTree.OnDrop(): layer=%s" % (self.GetItemText(dragItem)))

Expand Down Expand Up @@ -2046,7 +2043,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