Kaynağa Gözat

wxGUI/startup: make warnings, hints and infos show the same; number boxes

 * number boxes to lead user through dialog
 * use GRASS (GIS) database (directory) to emphasize that it is something special (and it is the term used inside GRASS anyway)
 * make Location and Mapset list vertically smaller (the window is just little bit higher and wider now then the 64 one), however it is hard to say what actually drives the height
 * do not use Warning to prefix a message which is informative and might be as well as hint or info
 * improve i18n by using format to combine user visible strings
 * add info what to do to the no Location found message
 * use Location and Mapset in changed messages
 * see also https://trac.osgeo.org/grass/changeset/57549, https://trac.osgeo.org/grass/changeset/64345 and https://trac.osgeo.org/grass/changeset/64405
 * see also GRASS-dev 'Making start of GRASS GIS easier for newcomers' (http://lists.osgeo.org/pipermail/grass-dev/2015-January/073286.html, http://lists.osgeo.org/pipermail/grass-dev/2015-February/073655.html)


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@64407 15284696-431f-4ddb-bdfa-cd5b030d7da7
Vaclav Petras 10 yıl önce
ebeveyn
işleme
8fa3766272
1 değiştirilmiş dosya ile 34 ekleme ve 21 silme
  1. 34 21
      gui/wxpython/gis_set.py

+ 34 - 21
gui/wxpython/gis_set.py

@@ -104,14 +104,14 @@ class GRASSStartup(wx.Frame):
             grassRevisionStr = ''
         
         self.gisdbase_box = wx.StaticBox(parent=self.panel, id=wx.ID_ANY,
-                                         label=" %s " % _("Select GRASS GIS data directory"))
-        
+                                         label=" %s " % _("1. Select GRASS GIS database directory"))
         self.location_box = wx.StaticBox(parent=self.panel, id=wx.ID_ANY,
-                                         label=" %s " % _("Select GRASS Location"))
+                                         label=" %s " % _("2. Select GRASS Location"))
         self.mapset_box = wx.StaticBox(parent=self.panel, id=wx.ID_ANY,
-                                         label=" %s " % _("Select GRASS Mapset"))
+                                         label=" %s " % _("3. Select GRASS Mapset"))
 
-        # no message at the beginning
+        # no message at the beginning but a dummy text is needed to do
+        # the layout right (the lenght should be similar to maximal message)
         self.lmessage = StaticWrapText(
             parent=self.panel, id=wx.ID_ANY,
             label=("This is a placeholer text to workaround layout issues."
@@ -137,7 +137,7 @@ class GRASSStartup(wx.Frame):
 
         self.ldbase = wx.StaticText(
             parent=self.gisdbase_panel, id=wx.ID_ANY,
-            label=_("GRASS GIS data directory contains Locations."))
+            label=_("GRASS GIS database directory contains Locations."))
 
         self.llocation = StaticWrapText(
             parent=self.location_panel, id=wx.ID_ANY,
@@ -173,6 +173,8 @@ class GRASSStartup(wx.Frame):
                                  label = _("&Browse"))
         self.bmapset = wx.Button(parent = self.mapset_panel, id = wx.ID_ANY,
                                  label = _("&New"))
+        self.bmapset.SetToolTipString(
+            _("Create a new Mapset in selected Location"))
         self.bwizard = wx.Button(parent = self.location_panel, id = wx.ID_ANY,
                                  label = _("N&ew"))
         self.bwizard.SetToolTipString(_("Create a new location using location wizard."
@@ -197,14 +199,14 @@ class GRASSStartup(wx.Frame):
 
         # Locations
         self.lblocations = GListBox(parent = self.location_panel,
-                                    id = wx.ID_ANY, size = (180, 200),
+                                    id=wx.ID_ANY, size=(180, 120),
                                     choices = self.listOfLocations)
         self.lblocations.SetColumnWidth(0, 180)
 
         # TODO: sort; but keep PERMANENT on top of list
         # Mapsets
         self.lbmapsets = GListBox(parent = self.mapset_panel,
-                                  id = wx.ID_ANY, size = (180, 200),
+                                  id=wx.ID_ANY, size=(180, 120),
                                   choices = self.listOfMapsets)
         self.lbmapsets.SetColumnWidth(0, 180)
 
@@ -460,21 +462,29 @@ class GRASSStartup(wx.Frame):
         return grassrc
 
     def _showWarning(self, text):
-        """Displays a warning message to the user.
+        """Displays a warning, hint or info message to the user.
+
+        This function can be used for all kinds of messages except for
+        error messages.
 
-        There is no cleaning procedure. You should call _hideMessage when
-        you know that there is everything correct now.
+        .. note::
+            There is no cleaning procedure. You should call _hideMessage when
+            you know that there is everything correct now.
         """
-        self.lmessage.SetLabel(_("Warning: ") + text)
+        self.lmessage.SetLabel(text)
         self.sizer.Layout()
 
     def _showError(self, text):
         """Displays a error message to the user.
 
-        There is no cleaning procedure. You should call _hideMessage when
-        you know that there is everything correct now.
+        This function should be used only when something serious and unexpected
+        happens, otherwise _showWarning should be used.
+
+        .. note::
+            There is no cleaning procedure. You should call _hideMessage when
+            you know that there is everything correct now.
         """
-        self.lmessage.SetLabel(_("Error: ") + text)
+        self.lmessage.SetLabel(_("Error: {text}").format(text=text))
         self.sizer.Layout()
 
     def _hideMessage(self):
@@ -744,7 +754,9 @@ class GRASSStartup(wx.Frame):
             self.lblocations.SetSelection(0)
         else:
             self.lblocations.SetSelection(wx.NOT_FOUND)
-            self._showWarning(_("No GRASS location found in '%s'.")
+            self._showWarning(_("No GRASS Location found in '%s'."
+                                " Create a new Location or choose different"
+                                " GRASS database directory.")
                               % self.gisdbase)
 
         return self.listOfLocations
@@ -1094,11 +1106,12 @@ class StartUp(wx.App):
             # where other checks are performed or it should use some public
             # API. There is no reason for not exposing it.
             # TODO: another question is what should be warning, hint or message
-            StartUp._showWarning(_('GRASS needs a directory in which to store its data. '
-                                    'Create one now if you have not already done so. '
-                                    'A popular choice is "grassdata", located in '
-                                    'your home directory. '
-                                    'Press Browse button to select the directory.'))
+            StartUp._showWarning(_('GRASS needs a directory (GRASS database) '
+                                   'in which to store its data. '
+                                   'Create one now if you have not already done so. '
+                                   'A popular choice is "grassdata", located in '
+                                   'your home directory. '
+                                   'Press Browse button to select the directory.'))
 
         return 1