Skip to content

Commit

Permalink
wxGUI gcp: fix checking vector map existence in the group (#680)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmszi committed Jul 25, 2020
1 parent 27c352f commit 61e3e5f
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions gui/wxpython/gcp/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -893,22 +893,25 @@ def OnEnterPage(self, event=None):
self.parent.grouppage.xygroup,
'VREF')

f = open(vgrpfile)
error_message = _(
'No maps in selected group <%s>.\n'
'Please edit group or select another group.') % \
self.parent.grouppage.xygroup

try:
for vect in f.readlines():
vect = vect.strip('\n')
if len(vect) < 1:
continue
self.parent.src_maps.append(vect)
finally:
f.close()
with open(vgrpfile) as f:
for vect in f.readlines():
vect = vect.strip('\n')
if len(vect) < 1:
continue
self.parent.src_maps.append(vect)
except FileNotFoundError:
GError(parent=self, message=error_message,
showTraceback=False)
return

if len(self.parent.src_maps) < 1:
GError(
parent=self, message=_(
'No maps in selected group <%s>.\n'
'Please edit group or select another group.') %
self.parent.grouppage.xygroup)
GError(parent=self, message=error_message)
return

# filter out all maps not in group
Expand Down

0 comments on commit 61e3e5f

Please sign in to comment.