Skip to content

Commit

Permalink
wxGUI: Fixed E722 in ii2t_gis_set.py (#4417)
Browse files Browse the repository at this point in the history
* fix 722 in iit2t_gis_set

* added ii2t-manager

* Update ii2t_gis_set.py

* Update ii2t_manager.py

* Update ii2t_gis_set.py
  • Loading branch information
arohanajit authored Oct 1, 2024
1 parent e9768eb commit 3f61cd7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
12 changes: 6 additions & 6 deletions gui/wxpython/image2target/ii2t_gis_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def __init__(self, parent=None, id=wx.ID_ANY, style=wx.DEFAULT_FRAME_STYLE):
self.hbitmap = wx.StaticBitmap(
self.panel, wx.ID_ANY, wx.Bitmap(name=name, type=wx.BITMAP_TYPE_PNG)
)
except:
except Exception:
self.hbitmap = wx.StaticBitmap(
self.panel, wx.ID_ANY, BitmapFromImage(wx.EmptyImage(530, 150))
)
Expand Down Expand Up @@ -824,8 +824,8 @@ def DeleteMapset(self, event):
shutil.rmtree(os.path.join(self.gisdbase, location, mapset))
self.OnSelectLocation(None)
self.lbmapsets.SetSelection(0)
except:
wx.MessageBox(message=_("Unable to delete mapset"))
except OSError as e:
wx.MessageBox(message=_("Unable to delete mapset: %s") % str(e))

dlg.Destroy()

Expand Down Expand Up @@ -856,8 +856,8 @@ def DeleteLocation(self, event):
self.lblocations.SetSelection(0)
self.OnSelectLocation(None)
self.lbmapsets.SetSelection(0)
except:
wx.MessageBox(message=_("Unable to delete location"))
except OSError as e:
wx.MessageBox(message=_("Unable to delete location: %s") % str(e))

dlg.Destroy()

Expand Down Expand Up @@ -1163,7 +1163,7 @@ def _getDefaultMapsetName(self):
defaultName = getpass.getuser()
# raise error if not ascii (not valid mapset name)
defaultName.encode("ascii")
except: # whatever might go wrong
except Exception: # whatever might go wrong
defaultName = "user"

return defaultName
Expand Down
14 changes: 0 additions & 14 deletions gui/wxpython/image2target/ii2t_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -884,20 +884,6 @@ def OnSrcSelection(self, event):
else:
wx.FindWindowById(wx.ID_FORWARD).Enable(True)

try:
# set computational region to match selected map and zoom display
# to region
if maptype == "raster":
p = RunCommand("g.region", "raster=src_map")
elif maptype == "vector":
p = RunCommand("g.region", "vector=src_map")

if p.returncode == 0:
print("returncode = ", str(p.returncode))
self.parent.Map.region = self.parent.Map.GetRegion()
except:
pass

def OnTgtRastSelection(self, event):
"""Source map to display selected"""
global tgt_map
Expand Down

0 comments on commit 3f61cd7

Please sign in to comment.