Browse Source

wxGUI/location wizard: fix proj parsing

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@40979 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 15 years ago
parent
commit
d3c000cbfa
1 changed files with 15 additions and 11 deletions
  1. 15 11
      gui/wxpython/gui_modules/location_wizard.py

+ 15 - 11
gui/wxpython/gui_modules/location_wizard.py

@@ -1539,35 +1539,39 @@ class CustomPage(TitledPage):
     def OnPageChanging(self, event):
     def OnPageChanging(self, event):
         if event.GetDirection() and not self.customstring:
         if event.GetDirection() and not self.customstring:
             event.Veto()
             event.Veto()
-        else:
-            # check for datum tranforms            
+        elif not event.GetDirection() and not self.customstring:
+            return
+        else: # check for datum tranforms            
             ret, out, err = gcmd.RunCommand('g.proj',
             ret, out, err = gcmd.RunCommand('g.proj',
-                                  read = True, getErrorMsg = True,
-                                  proj4 = self.customstring, 
-                                  datumtrans = '-1')
+                                            read = True, getErrorMsg = True,
+                                            proj4 = self.customstring, 
+                                            datumtrans = '-1')
             if ret != 0:
             if ret != 0:
-                wx.MessageBox(err, 'g.proj error: check PROJ4 parameter string')
+                wx.MessageBox(parent = self,
+                              message = err,
+                              caption = _("Error"),
+                              style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
                 event.Veto()
                 event.Veto()
                 return
                 return
             
             
-            if out != '':
+            if out:
                 dtrans = ''
                 dtrans = ''
                 # open a dialog to select datum transform number
                 # open a dialog to select datum transform number
                 dlg = SelectTransformDialog(self.parent.parent, transforms=out)
                 dlg = SelectTransformDialog(self.parent.parent, transforms=out)
                 
                 
                 if dlg.ShowModal() == wx.ID_OK:
                 if dlg.ShowModal() == wx.ID_OK:
                     dtrans = dlg.GetTransform()
                     dtrans = dlg.GetTransform()
-                    if dtrans == '':
+                    if len(dtrans) == 0:
                         dlg.Destroy()
                         dlg.Destroy()
                         event.Veto()
                         event.Veto()
-                        return 'Datum transform is required.'
+                        return _('Datum transform is required.')
                 else:
                 else:
                     dlg.Destroy()
                     dlg.Destroy()
                     event.Veto()
                     event.Veto()
-                    return 'Datum transform is required.'
+                    return _('Datum transform is required.')
                 
                 
                 self.parent.datumtrans = dtrans
                 self.parent.datumtrans = dtrans
-                
+        
         self.GetNext().SetPrev(self)
         self.GetNext().SetPrev(self)
             
             
     def GetProjstring(self, event):
     def GetProjstring(self, event):