[GRASS-SVN] r64407 - grass/trunk/gui/wxpython

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Feb 2 18:08:29 PST 2015


Author: wenzeslaus
Date: 2015-02-02 18:08:29 -0800 (Mon, 02 Feb 2015)
New Revision: 64407

Modified:
   grass/trunk/gui/wxpython/gis_set.py
Log:
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 r57549, r64345 and r64405
 * 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)


Modified: grass/trunk/gui/wxpython/gis_set.py
===================================================================
--- grass/trunk/gui/wxpython/gis_set.py	2015-02-02 18:30:09 UTC (rev 64406)
+++ grass/trunk/gui/wxpython/gis_set.py	2015-02-03 02:08:29 UTC (rev 64407)
@@ -104,14 +104,14 @@
             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 @@
 
         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 @@
                                  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 @@
 
         # 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 @@
         return grassrc
 
     def _showWarning(self, text):
-        """Displays a warning message to the user.
+        """Displays a warning, hint or info message to the user.
 
-        There is no cleaning procedure. You should call _hideMessage when
-        you know that there is everything correct now.
+        This function can be used for all kinds of messages except for
+        error messages.
+
+        .. 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 @@
             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 @@
             # 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
 



More information about the grass-commit mailing list