diff --git a/.flake8 b/.flake8 index ffa7d162eda..14224a97843 100644 --- a/.flake8 +++ b/.flake8 @@ -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 diff --git a/gui/wxpython/photo2image/g.gui.photo2image.py b/gui/wxpython/photo2image/g.gui.photo2image.py index 65b4141873e..fe153b236cc 100755 --- a/gui/wxpython/photo2image/g.gui.photo2image.py +++ b/gui/wxpython/photo2image/g.gui.photo2image.py @@ -121,7 +121,7 @@ def main(): app = wx.App() - wizard = GCPWizard( + GCPWizard( parent=None, giface=StandaloneGrassInterface(), group=group, diff --git a/gui/wxpython/photo2image/ip2i_manager.py b/gui/wxpython/photo2image/ip2i_manager.py index 5a2a1f14f21..711ec4191af 100644 --- a/gui/wxpython/photo2image/ip2i_manager.py +++ b/gui/wxpython/photo2image/ip2i_manager.py @@ -1107,22 +1107,20 @@ 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: @@ -1130,21 +1128,19 @@ def OnGeorect(self, event): 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) @@ -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")) @@ -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 @@ -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() @@ -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"] != "": diff --git a/gui/wxpython/photo2image/ip2i_mapdisplay.py b/gui/wxpython/photo2image/ip2i_mapdisplay.py index aa085f2b43a..732716a1a0c 100644 --- a/gui/wxpython/photo2image/ip2i_mapdisplay.py +++ b/gui/wxpython/photo2image/ip2i_mapdisplay.py @@ -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")) @@ -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