From 08dcbeb2d45a19e759411f4fc3c4f57c0dd29a60 Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Mon, 30 Sep 2024 16:59:42 -0400 Subject: [PATCH] updated BusyInfo to use context manager --- gui/wxpython/image2target/ii2t_manager.py | 58 +++++++++++------------ 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/gui/wxpython/image2target/ii2t_manager.py b/gui/wxpython/image2target/ii2t_manager.py index a960c3b521..f5587d1d27 100644 --- a/gui/wxpython/image2target/ii2t_manager.py +++ b/gui/wxpython/image2target/ii2t_manager.py @@ -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: @@ -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: