Browse Source

wxGUI: add g.version citation info to About dialog (see https://trac.osgeo.org/grass/ticket/947, https://trac.osgeo.org/grass/changeset/68657, https://trac.osgeo.org/grass/changeset/68658)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@68659 15284696-431f-4ddb-bdfa-cd5b030d7da7
Vaclav Petras 9 years ago
parent
commit
22247a328e
1 changed files with 27 additions and 0 deletions
  1. 27 0
      gui/wxpython/gui_core/ghelp.py

+ 27 - 0
gui/wxpython/gui_core/ghelp.py

@@ -70,6 +70,7 @@ class AboutWindow(wx.Frame):
         for title, win in ((_("Info"), self._pageInfo()),
                            (_("Copyright"), self._pageCopyright()),
                            (_("License"), self._pageLicense()),
+                           (_("Citation"), self._pageCitation()),
                            (_("Authors"), self._pageCredit()),
                            (_("Contributors"), self._pageContributors()),
                            (_("Extra contributors"), self._pageContributors(extra=True)),
@@ -284,6 +285,32 @@ class AboutWindow(wx.Frame):
 
         return licensewin
 
+    def _pageCitation(self):
+        """Citation information"""
+        try:
+            # import only when needed
+            import grass.script as gscript
+            text = gscript.read_command('g.version', flags='x')
+        except CalledModuleError as error:
+            text = _("Unable to provide citation suggestion,"
+                     " see GRASS GIS website instead."
+                     " The error was: {}").format(error)
+
+        # put text into a scrolling panel
+        window = ScrolledPanel(self.aboutNotebook)
+        window.SetBackgroundColour('WHITE')
+        stat_text = wx.StaticText(
+            window, id=wx.ID_ANY, label=text)
+        window.SetAutoLayout(True)
+        window.sizer = wx.BoxSizer(wx.VERTICAL)
+        window.sizer.Add(item=stat_text, proportion=1,
+                         flag=wx.EXPAND | wx.ALL, border=3)
+        window.SetSizer(window.sizer)
+        window.Layout()
+        window.SetupScrolling()
+
+        return window
+
     def _pageCredit(self):
         """Credit about"""
         # credits