Skip to content

Commit

Permalink
wxGUI: Fixed F841 in ii2t_manager.py (#4418)
Browse files Browse the repository at this point in the history
* fixed e722 in ii2t_manager

* revert

* fixed F841 in iit2t_manager.py

* removed point from ii2t_mapdisplay

* updated BusyInfo to use context manager
  • Loading branch information
arohanajit authored Oct 1, 2024
1 parent e427da0 commit 3e53e34
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 37 deletions.
62 changes: 27 additions & 35 deletions gui/wxpython/image2target/ii2t_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1781,22 +1781,20 @@ def OnGeorect(self, event):
else:
flags = "a"

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

ret, msg = RunCommand(
"i.ortho.rectify",
parent=self,
getErrorMsg=True,
quiet=True,
group=self.xygroup,
extension=self.extension,
method=self.gr_method,
angle=self.grwiz.cam_angle,
flags=flags,
)
with wx.BusyInfo(_("Rectifying images, please wait..."), parent=self):
wx.GetApp().Yield()

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

# provide feedback on failure
if ret != 0:
Expand Down Expand Up @@ -1828,23 +1826,21 @@ def OnGeorect(self, event):
)
ret = msg = ""

busy = wx.BusyInfo(
with wx.BusyInfo(
_("Rectifying vector map <%s>, please wait...") % vect, parent=self
)
wx.GetApp().Yield()

ret, msg = RunCommand(
"v.rectify",
parent=self,
getErrorMsg=True,
quiet=True,
input=vect,
output=self.outname,
group=self.xygroup,
order=self.gr_order,
)

del busy
):
wx.GetApp().Yield()

ret, msg = RunCommand(
"v.rectify",
parent=self,
getErrorMsg=True,
quiet=True,
input=vect,
output=self.outname,
group=self.xygroup,
order=self.gr_order,
)

# provide feedback on failure
if ret != 0:
Expand Down Expand Up @@ -1971,7 +1967,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 @@ -2270,7 +2265,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 @@ -3376,7 +3370,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 @@ -3414,7 +3407,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/image2target/ii2t_mapdisplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,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 @@ -518,7 +517,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 3e53e34

Please sign in to comment.