Skip to content

Commit

Permalink
wxGUI: Fixed F841 in photo2image/ (#4573)
Browse files Browse the repository at this point in the history
* fixed 841

* fixed busyInfo
  • Loading branch information
arohanajit authored Oct 23, 2024
1 parent c5c42cf commit 2575783
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 37 deletions.
4 changes: 2 additions & 2 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ per-file-ignores =
gui/scripts/d.wms.py: E501
gui/wxpython/image2target/g.gui.image2target.py: E501
gui/wxpython/nviz/*: E722
gui/wxpython/photo2image/*: F841, E722, E265
gui/wxpython/photo2image/g.gui.photo2image.py: E501, F841
gui/wxpython/photo2image/*: E722
gui/wxpython/photo2image/g.gui.photo2image.py: E501
gui/wxpython/psmap/*: F841, E266, E722
gui/wxpython/vdigit/*: F841, E722, F405, F403
gui/wxpython/animation/g.gui.animation.py: E501
Expand Down
2 changes: 1 addition & 1 deletion gui/wxpython/photo2image/g.gui.photo2image.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def main():

app = wx.App()

wizard = GCPWizard(
GCPWizard(
parent=None,
giface=StandaloneGrassInterface(),
group=group,
Expand Down
56 changes: 24 additions & 32 deletions gui/wxpython/photo2image/ip2i_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1107,44 +1107,40 @@ def OnGeorect(self, event):
else:
flags = "a"

busy = wx.BusyInfo(_("Rectifying images, please wait..."), parent=self)
wx.GetApp().Yield()
with wx.BusyInfo(_("Rectifying images, please wait..."), parent=self):
wx.GetApp().Yield()

ret, msg = RunCommand(
"i.rectify",
parent=self,
getErrorMsg=True,
quiet=True,
group=self.xygroup,
extension=self.extension,
order=self.gr_order,
method=self.gr_method,
flags=flags,
)

del busy
ret, msg = RunCommand(
"i.rectify",
parent=self,
getErrorMsg=True,
quiet=True,
group=self.xygroup,
extension=self.extension,
order=self.gr_order,
method=self.gr_method,
flags=flags,
)

# provide feedback on failure
if ret != 0:
print("ip2i: Error in i.rectify", file=sys.stderr)
print(self.grwiz.src_map, file=sys.stderr)
print(msg, file=sys.stderr)

busy = wx.BusyInfo(
with wx.BusyInfo(
_("Writing output image to group, please wait..."), parent=self
)
wx.GetApp().Yield()

ret1, msg1 = RunCommand(
"i.group",
parent=self,
getErrorMsg=True,
quiet=False,
group=self.xygroup,
input="".join([self.grwiz.src_map.split("@")[0], self.extension]),
)
):
wx.GetApp().Yield()

del busy
ret1, msg1 = RunCommand(
"i.group",
parent=self,
getErrorMsg=True,
quiet=False,
group=self.xygroup,
input="".join([self.grwiz.src_map.split("@")[0], self.extension]),
)

if ret1 != 0:
print("ip2i: Error in i.group", file=sys.stderr)
Expand Down Expand Up @@ -1253,7 +1249,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 @@ -1556,7 +1551,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 @@ -2467,7 +2461,6 @@ def UpdateSettings(self):

srcrender = False
tgtrender = False
reload_target = False
if self.new_src_map != src_map:
# remove old layer
layers = self.parent.grwiz.SrcMap.GetListOfLayers()
Expand Down Expand Up @@ -2499,7 +2492,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"]

if tgt_map["raster"] != "":
Expand Down
2 changes: 0 additions & 2 deletions gui/wxpython/photo2image/ip2i_mapdisplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,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 @@ -510,7 +509,6 @@ def SaveDisplayRegion(self, event):

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

Expand Down

0 comments on commit 2575783

Please sign in to comment.