Skip to content

Commit

Permalink
updated BusyInfo to use context manager
Browse files Browse the repository at this point in the history
  • Loading branch information
Arohan Ajit committed Sep 30, 2024
1 parent d9424c8 commit 08dcbeb
Showing 1 changed file with 27 additions and 31 deletions.
58 changes: 27 additions & 31 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"

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 = ""

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

0 comments on commit 08dcbeb

Please sign in to comment.