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

checks: Flake8 F841 fixes in the wxpython directory part 3 #4261

Merged
merged 12 commits into from
Sep 18, 2024
Merged
17 changes: 7 additions & 10 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,14 @@ per-file-ignores =
gui/wxpython/dbmgr/manager.py: E722
gui/wxpython/dbmgr/vinfo.py: F841
gui/wxpython/docs/wxgui_sphinx/conf.py: E402, W291
gui/wxpython/gcp/g.gui.gcp.py: F841
gui/wxpython/gcp/manager.py: F841, E722
gui/wxpython/gcp/mapdisplay.py: F841
gui/wxpython/gui_core/*: F841, E266, E722
gui/wxpython/gui_core/dialogs.py: E722, F841
gui/wxpython/gui_core/forms.py: E722, F841
gui/wxpython/gcp/manager.py: E722
gui/wxpython/gui_core/*: E266, E722
gui/wxpython/gui_core/dialogs.py: E722
gui/wxpython/gui_core/forms.py: E722
gui/wxpython/gui_core/ghelp.py: E722
gui/wxpython/gui_core/gselect.py: F841, E266, E722
gui/wxpython/gui_core/preferences.py: E266, F841
gui/wxpython/gui_core/treeview.py: F841
gui/wxpython/gui_core/widgets.py: F841, E722, E266
gui/wxpython/gui_core/gselect.py: E266, E722
gui/wxpython/gui_core/preferences.py: E266
gui/wxpython/gui_core/widgets.py: E722, E266
gui/wxpython/image2target/*: F841, E722, E265
gui/wxpython/image2target/g.gui.image2target.py: E501, E265, F841
gui/wxpython/iscatt/*: F841, E722, F405, F403
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/gcp/g.gui.gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def main():

app = wx.App()

wizard = GCPWizard(parent=None, giface=StandaloneGrassInterface())
GCPWizard(parent=None, giface=StandaloneGrassInterface())

app.MainLoop()

Expand Down
8 changes: 2 additions & 6 deletions gui/wxpython/gcp/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1826,7 +1826,7 @@ def OnGeorect(self, event):
else:
flags = "a"

busy = wx.BusyInfo(_("Rectifying images, please wait..."), parent=self)
petrasovaa marked this conversation as resolved.
Show resolved Hide resolved
wx.BusyInfo(_("Rectifying images, please wait..."), parent=self)
wx.GetApp().Yield()

ret, msg = RunCommand(
Expand Down Expand Up @@ -1886,7 +1886,7 @@ def OnGeorect(self, event):
)
ret = msg = ""

busy = wx.BusyInfo(
wx.BusyInfo(
_("Rectifying vector map <%s>, please wait...") % vect, parent=self
petrasovaa marked this conversation as resolved.
Show resolved Hide resolved
)
wx.GetApp().Yield()
Expand Down Expand Up @@ -2028,7 +2028,6 @@ def OnGROrder(self, event):

elif self.gr_order == 2:
minNumOfItems = 6
diff = 6 - numOfItems
# self.SetStatusText(
# _('Insufficient points, 6+ points needed for 2nd order'))

Expand Down Expand Up @@ -2331,7 +2330,6 @@ def OnZoomToTarget(self, event):

def OnZoomMenuGCP(self, event):
"""Popup Zoom menu"""
point = wx.GetMousePosition()
zoommenu = Menu()
# Add items to the menu

Expand Down Expand Up @@ -3433,7 +3431,6 @@ def UpdateSettings(self):
srcrenderVector = False
tgtrender = False
tgtrenderVector = False
reload_target = False
if self.new_src_map != src_map:
# remove old layer
layers = self.parent.grwiz.SrcMap.GetListOfLayers()
Expand Down Expand Up @@ -3471,7 +3468,6 @@ def UpdateSettings(self):
del layers[0]
layers = self.parent.grwiz.TgtMap.GetListOfLayers()
# self.parent.grwiz.TgtMap.DeleteAllLayers()
reload_target = True
tgt_map["raster"] = self.new_tgt_map["raster"]
tgt_map["vector"] = self.new_tgt_map["vector"]

Expand Down
2 changes: 0 additions & 2 deletions gui/wxpython/gcp/mapdisplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,6 @@ def PrintMenu(self, event):
"""
Print options and output menu for map display
"""
point = wx.GetMousePosition()
printmenu = Menu()
# Add items to the menu
setup = wx.MenuItem(printmenu, wx.ID_ANY, _("Page setup"))
Expand Down Expand Up @@ -528,7 +527,6 @@ def SaveDisplayRegion(self, event):

def OnZoomMenu(self, event):
"""Popup Zoom menu"""
point = wx.GetMousePosition()
zoommenu = Menu()
# Add items to the menu

Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/gui_core/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def OnLocation(self, event):
dbase = grass.gisenv()["GISDBASE"]
self.element2.UpdateItems(dbase=dbase, location=location)
self.element2.SetSelection(0)
mapset = self.element2.GetStringSelection()
petrasovaa marked this conversation as resolved.
Show resolved Hide resolved
self.element2.GetStringSelection()

def GetValues(self):
"""Get location, mapset"""
Expand Down
3 changes: 0 additions & 3 deletions gui/wxpython/gui_core/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,6 @@ def run(self):
pTable = self.task.get_param(
"dbtable", element="element", raiseError=False
)
if pTable:
table = pTable.get("value", "")

if name == "LayerSelect":
# determine format
Expand Down Expand Up @@ -1546,7 +1544,6 @@ def __init__(self, parent, giface, task, id=wx.ID_ANY, frame=None, *args, **kwar
if value:
selection.SetValue(value)

formatSelector = True
# A gselect.Select is a combobox with two children: a textctl
# and a popupwindow; we target the textctl here
textWin = selection.GetTextCtrl()
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/gui_core/goutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ def AddStyledMessage(self, message, style=None):
self.linePos -= 1
else:
if c == "\r":
pos = self.GetCurLine()[1]
petrasovaa marked this conversation as resolved.
Show resolved Hide resolved
self.GetCurLine()[1]
# self.SetCurrentPos(pos)
else:
self.SetCurrentPos(self.linePos)
Expand Down
6 changes: 0 additions & 6 deletions gui/wxpython/gui_core/gselect.py
Original file line number Diff line number Diff line change
Expand Up @@ -1373,12 +1373,6 @@ def Insert(self, group):
"""Insert subgroups for defined group"""
if not group:
return
gisenv = gs.gisenv()
try:
name, mapset = group.split("@", 1)
except ValueError:
name = group
mapset = gisenv["MAPSET"]

mlist = RunCommand("i.group", group=group, read=True, flags="sg").splitlines()
try:
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/gui_core/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def OnMenuHighlight(self, event):
id = event.GetMenuId()
item = self.FindItemById(id)
if item:
help = item.GetHelp()
petrasovaa marked this conversation as resolved.
Show resolved Hide resolved
item.GetHelp()

# but in this case just call Skip so the default is done
event.Skip()
Expand Down
2 changes: 0 additions & 2 deletions gui/wxpython/gui_core/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -2021,8 +2021,6 @@ def OnCheckColorTable(self, event):

def OnLoadEpsgCodes(self, event):
"""Load EPSG codes from the file"""
win = self.FindWindowById(self.winId["projection:statusbar:projFile"])
path = win.GetValue()
epsgCombo = self.FindWindowById(self.winId["projection:statusbar:epsg"])
wx.BeginBusyCursor()
try:
Expand Down
4 changes: 2 additions & 2 deletions gui/wxpython/gui_core/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ def OnChar(self, event):
# complete command after pressing '.'
if event.GetKeyCode() == 46:
self.autoCompList = []
entry = self.GetTextLeft()
petrasovaa marked this conversation as resolved.
Show resolved Hide resolved
self.GetTextLeft()
self.InsertText(pos, ".")
self.CharRight()
self.toComplete = self.EntityToComplete()
Expand All @@ -538,7 +538,7 @@ def OnChar(self, event):
or event.GetKeyCode() == wx.WXK_SUBTRACT
):
self.autoCompList = []
entry = self.GetTextLeft()
self.GetTextLeft()
petrasovaa marked this conversation as resolved.
Show resolved Hide resolved
self.InsertText(pos, "-")
self.CharRight()
self.toComplete = self.EntityToComplete()
Expand Down
1 change: 0 additions & 1 deletion gui/wxpython/gui_core/pystc.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ def __init__(self, parent, id=wx.ID_ANY, statusbar=None):
9, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL
)
face = font.GetFaceName()
size = font.GetPointSize()

# setting the monospace here to not mess with the rest of the code
# TODO: review the whole styling
Expand Down
14 changes: 5 additions & 9 deletions gui/wxpython/gui_core/treeview.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,17 +303,13 @@ def main():
root = tree.root
n1 = tree.AppendNode(parent=root, data={"label": "node1"})
n2 = tree.AppendNode(parent=root, data={"label": "node2"})
n3 = tree.AppendNode(parent=root, data={"label": "node3"}) # pylint: disable=W0612
n3 = tree.AppendNode(parent=root, data={"label": "node3"}) # noqa: F841
n11 = tree.AppendNode(parent=n1, data={"label": "node11", "xxx": "A"})
n12 = tree.AppendNode(
parent=n1, data={"label": "node12", "xxx": "B"}
) # pylint: disable=W0612
n21 = tree.AppendNode(
parent=n2, data={"label": "node21", "xxx": "A"}
) # pylint: disable=W0612
n111 = tree.AppendNode(
n12 = tree.AppendNode(parent=n1, data={"label": "node12", "xxx": "B"}) # noqa: F841
n21 = tree.AppendNode(parent=n2, data={"label": "node21", "xxx": "A"}) # noqa: F841
n111 = tree.AppendNode( # noqa: F841
parent=n11, data={"label": "node111", "xxx": "A"}
) # pylint: disable=W0612
)

app = wx.App()
frame = TreeFrame(model=tree)
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/gui_core/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def InsertPage(self, *args, **kwargs):
self.classObject.InsertPage(self.widget, *args, **kwargs)
except (
TypeError
) as e: # documentation says 'index', but certain versions of wx require 'n'
): # documentation says 'index', but certain versions of wx require 'n'
kwargs["n"] = kwargs["index"]
del kwargs["index"]
self.classObject.InsertPage(self.widget, *args, **kwargs)
Expand Down
Loading