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 PEP8 errors in wxplot/ #4699

Merged
merged 2 commits into from
Nov 20, 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 @@ -31,9 +31,6 @@ per-file-ignores =
gui/wxpython/iclass/frame.py: F405, F403
gui/wxpython/iclass/g.gui.iclass.py: E501
gui/wxpython/iclass/statistics.py: F841, F405, F403
gui/wxpython/wxplot/histogram.py: E722
gui/wxpython/wxplot/profile.py: F841, E722
gui/wxpython/wxplot/base.py: F841, E722
gui/wxpython/location_wizard/dialogs.py: F841
gui/wxpython/location_wizard/wizard.py: E722
gui/wxpython/mapdisp/main.py: E722
Expand Down
7 changes: 3 additions & 4 deletions gui/wxpython/wxplot/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from gui_core.wrap import Menu

import grass.script as gs
from grass.exceptions import CalledModuleError

PlotIcons = {
"draw": MetaIcon(img="show", label=_("Draw/re-draw plot")),
Expand Down Expand Up @@ -204,7 +205,7 @@ def InitRasterOpts(self, rasterList, plottype):

try:
ret = gs.raster_info(r)
except:
except CalledModuleError:
continue
# if r.info cannot parse map, skip it

Expand Down Expand Up @@ -270,7 +271,7 @@ def InitRasterPairs(self, rasterList, plottype):
ret0 = gs.raster_info(rpair[0])
ret1 = gs.raster_info(rpair[1])

except:
except (IndexError, CalledModuleError):
continue
# if r.info cannot parse map, skip it

Expand Down Expand Up @@ -510,7 +511,6 @@ def OnMotion(self, event):

def PlotOptionsMenu(self, event):
"""Popup menu for plot and text options"""
point = wx.GetMousePosition()
popt = Menu()
# Add items to the menu
settext = wx.MenuItem(popt, wx.ID_ANY, _("Text settings"))
Expand Down Expand Up @@ -608,7 +608,6 @@ def PlotOptions(self, event):

def PrintMenu(self, event):
"""Print options and output menu"""
point = wx.GetMousePosition()
printmenu = Menu()
for title, handler in (
(_("Page setup"), self.OnPageSetup),
Expand Down
5 changes: 1 addition & 4 deletions gui/wxpython/wxplot/histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,7 @@ def OnCreateHist(self, event):
create a list of cell value and count/percent/area pairs. This is passed to
plot to create a line graph of the histogram.
"""
try:
self.SetCursor(StockCursor(wx.CURSOR_ARROW))
except:
pass
self.SetCursor(StockCursor(wx.CURSOR_ARROW))

self.SetGraphStyle()
wx.BeginBusyCursor()
Expand Down
5 changes: 2 additions & 3 deletions gui/wxpython/wxplot/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def SetupProfile(self):
# delete extra first segment point
try:
self.seglist.pop(0)
except:
except IndexError:
pass

#
Expand Down Expand Up @@ -291,7 +291,6 @@ def CreateDatalist(self, raster, coords):
# freezing with large, high resolution maps
region = gs.region()
curr_res = min(float(region["nsres"]), float(region["ewres"]))
transect_rec = 0
if self.transect_length / curr_res > 500:
transect_res = self.transect_length / 500
else:
Expand Down Expand Up @@ -486,7 +485,7 @@ def OnStats(self, event):
statstr += "median: %f\n" % np.median(a)
statstr += "distance along transect: %f\n\n" % self.transect_length
message.append(statstr)
except:
except (ValueError, TypeError, KeyError, IndexError):
pass

stats = PlotStatsFrame(self, id=wx.ID_ANY, message=message, title=title)
Expand Down
Loading