Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wxGUI: Fixed E722 in ii2t_gis_set.py #4417

Merged
merged 6 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
arohanajit marked this conversation as resolved.
Show resolved Hide resolved
pass

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