From d8fb9352c8fb50ee035b3d1d77e494bcb069c3c2 Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Mon, 30 Sep 2024 08:50:51 -0400 Subject: [PATCH 1/5] fixed e722 in ii2t_manager --- gui/wxpython/image2target/ii2t_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/wxpython/image2target/ii2t_manager.py b/gui/wxpython/image2target/ii2t_manager.py index 1c9958c9ce..b8c20b721d 100644 --- a/gui/wxpython/image2target/ii2t_manager.py +++ b/gui/wxpython/image2target/ii2t_manager.py @@ -895,7 +895,7 @@ def OnSrcSelection(self, event): if p.returncode == 0: print("returncode = ", str(p.returncode)) self.parent.Map.region = self.parent.Map.GetRegion() - except: + except Exception: pass def OnTgtRastSelection(self, event): From 1e73cd940d266257a8f47491620a126d4e632493 Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Mon, 30 Sep 2024 08:52:40 -0400 Subject: [PATCH 2/5] revert --- gui/wxpython/image2target/ii2t_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/wxpython/image2target/ii2t_manager.py b/gui/wxpython/image2target/ii2t_manager.py index b8c20b721d..1c9958c9ce 100644 --- a/gui/wxpython/image2target/ii2t_manager.py +++ b/gui/wxpython/image2target/ii2t_manager.py @@ -895,7 +895,7 @@ def OnSrcSelection(self, event): if p.returncode == 0: print("returncode = ", str(p.returncode)) self.parent.Map.region = self.parent.Map.GetRegion() - except Exception: + except: pass def OnTgtRastSelection(self, event): From 56359e64466a9e6135bcb6d48f375513c35e5ff2 Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Mon, 30 Sep 2024 09:03:11 -0400 Subject: [PATCH 3/5] fixed F841 in iit2t_manager.py --- gui/wxpython/image2target/ii2t_manager.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/gui/wxpython/image2target/ii2t_manager.py b/gui/wxpython/image2target/ii2t_manager.py index 1c9958c9ce..a960c3b521 100644 --- a/gui/wxpython/image2target/ii2t_manager.py +++ b/gui/wxpython/image2target/ii2t_manager.py @@ -1781,7 +1781,7 @@ def OnGeorect(self, event): else: flags = "a" - busy = wx.BusyInfo(_("Rectifying images, please wait..."), parent=self) + wx.BusyInfo(_("Rectifying images, please wait..."), parent=self) wx.GetApp().Yield() ret, msg = RunCommand( @@ -1828,7 +1828,7 @@ def OnGeorect(self, event): ) ret = msg = "" - busy = wx.BusyInfo( + wx.BusyInfo( _("Rectifying vector map <%s>, please wait...") % vect, parent=self ) wx.GetApp().Yield() @@ -1971,7 +1971,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")) @@ -2270,7 +2269,6 @@ def OnZoomToTarget(self, event): def OnZoomMenuGCP(self, event): """Popup Zoom menu""" - point = wx.GetMousePosition() zoommenu = Menu() # Add items to the menu @@ -3376,7 +3374,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() @@ -3414,7 +3411,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"] From 1b9b50ac250c4a454c32b27f23bfe02c4db4406c Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Mon, 30 Sep 2024 13:34:50 -0400 Subject: [PATCH 4/5] removed point from ii2t_mapdisplay --- gui/wxpython/image2target/ii2t_mapdisplay.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/gui/wxpython/image2target/ii2t_mapdisplay.py b/gui/wxpython/image2target/ii2t_mapdisplay.py index c148eb314d..9ee3b77d11 100644 --- a/gui/wxpython/image2target/ii2t_mapdisplay.py +++ b/gui/wxpython/image2target/ii2t_mapdisplay.py @@ -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")) @@ -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 From 08dcbeb2d45a19e759411f4fc3c4f57c0dd29a60 Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Mon, 30 Sep 2024 16:59:42 -0400 Subject: [PATCH 5/5] 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: