Browse Source

g.version, wxGUI: backport of citation flag and menu entry (trunk https://trac.osgeo.org/grass/changeset/68657, https://trac.osgeo.org/grass/changeset/68658, https://trac.osgeo.org/grass/changeset/68659, https://trac.osgeo.org/grass/changeset/68662)

git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@68664 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 9 years ago
parent
commit
8740c4d6e7
7 changed files with 79 additions and 5 deletions
  1. 28 0
      CITING
  2. 1 1
      Makefile
  3. 1 1
      general/g.version/Makefile
  4. 15 1
      general/g.version/main.c
  5. 27 0
      gui/wxpython/gui_core/ghelp.py
  6. 4 1
      include/Makefile
  7. 3 1
      lib/init/grass.py

+ 28 - 0
CITING

@@ -0,0 +1,28 @@
+The GRASS Development Team, the addon authors, further contributors and the user community have invested enormous efforts in making GRASS GIS available to you. Please give credit where credit is due and cite GRASS GIS and its addons when you use them for data analysis.
+
+For citation choices see below; for citing a particular GRASS GIS module, you may cite the main author(s) along with the GRASS Development Team.
+
+
+Choices for citing the main GRASS GIS software (update YEAR and version number accordingly):
+* GRASS Development Team, YEAR. Geographic Resources Analysis Support System (GRASS) Software, Version 7.0. Open Source Geospatial Foundation. http://grass.osgeo.org
+* GRASS Development Team, YEAR. Geographic Resources Analysis Support System (GRASS) Programmer's Manual. Open Source Geospatial Foundation. Electronic document: http://grass.osgeo.org/programming7
+
+
+Citing a GRASS GIS Addon (update AUTHOR(S), YEAR, Addon-NAME, and version number accordingly):
+* AUTHOR(S), and GRASS Development Team, YEAR Addon-NAME. Geographic Resources Analysis Support System (GRASS) Software, Version 7.0. Open Source Geospatial Foundation. https://grass.osgeo.org/grass70/manuals/addons/Addon-NAME.html
+
+
+For other (scientific) references, see
+* https://grasswiki.osgeo.org/wiki/GRASS_Citation_Repository
+
+
+A BibTeX entry for LaTeX users is:
+
+@Manual{GRASS_GIS_software,
+  title = {Geographic Resources Analysis Support System (GRASS) Software},
+  author = {{GRASS Development Team}},
+  organization = {Open Source Geospatial Foundation},
+  address = {USA},
+  year = {YEAR},
+  url = {http://grass.osgeo.org},
+}

+ 1 - 1
Makefile

@@ -50,7 +50,7 @@ DIRS = \
 
 
 SUBDIRS = $(DIRS)
 SUBDIRS = $(DIRS)
 
 
-FILES = AUTHORS COPYING CHANGES REQUIREMENTS.html GPL.TXT contributors.csv contributors_extra.csv translators.csv
+FILES = AUTHORS CITING COPYING CHANGES REQUIREMENTS.html GPL.TXT contributors.csv contributors_extra.csv translators.csv
 FILES_DST = $(patsubst %,$(ARCH_DISTDIR)/%,$(FILES))
 FILES_DST = $(patsubst %,$(ARCH_DISTDIR)/%,$(FILES))
 
 
 default:
 default:

+ 1 - 1
general/g.version/Makefile

@@ -3,7 +3,7 @@ MODULE_TOPDIR = ../..
 PGM=g.version
 PGM=g.version
 
 
 # cat the COPYING file, add a c line-break \n at each line end
 # cat the COPYING file, add a c line-break \n at each line end
-# and remove the unix newline. 
+# and remove the unix newline (see: include/Makefile)
 
 
 EXTRA_CFLAGS = $(PROJINC) $(GEOSCFLAGS) \
 EXTRA_CFLAGS = $(PROJINC) $(GEOSCFLAGS) \
 	-DGRASS_VERSION_NUMBER=\"'$(GRASS_VERSION_NUMBER)'\" \
 	-DGRASS_VERSION_NUMBER=\"'$(GRASS_VERSION_NUMBER)'\" \

+ 15 - 1
general/g.version/main.c

@@ -46,6 +46,10 @@ static const char COPYING[] =
 #include <grass/copying.h>
 #include <grass/copying.h>
 ;
 ;
 
 
+static const char CITING[] =
+#include <grass/citing.h>
+;
+
 static const char GRASS_CONFIGURE_PARAMS[] =
 static const char GRASS_CONFIGURE_PARAMS[] =
 #include <grass/confparms.h>
 #include <grass/confparms.h>
 ;
 ;
@@ -53,7 +57,7 @@ static const char GRASS_CONFIGURE_PARAMS[] =
 int main(int argc, char *argv[])
 int main(int argc, char *argv[])
 {
 {
     struct GModule *module;
     struct GModule *module;
-    struct Flag *copyright, *build, *gish_rev, *shell, *extended;
+    struct Flag *copyright, *build, *gish_rev, *cite_flag, *shell, *extended;
 
 
     G_gisinit(argv[0]);
     G_gisinit(argv[0]);
 
 
@@ -72,6 +76,11 @@ int main(int argc, char *argv[])
     copyright->description = _("Print also the copyright message");
     copyright->description = _("Print also the copyright message");
     copyright->guisection = _("Additional info");
     copyright->guisection = _("Additional info");
 
 
+    cite_flag = G_define_flag();
+    cite_flag->key = 'x';
+    cite_flag->description = _("Print also the citation options");
+    cite_flag->guisection = _("Additional info");
+
     build = G_define_flag();
     build = G_define_flag();
     build->key = 'b';
     build->key = 'b';
     build->description = _("Print also the build information");
     build->description = _("Print also the build information");
@@ -114,6 +123,11 @@ int main(int argc, char *argv[])
 	fputs(COPYING, stdout);
 	fputs(COPYING, stdout);
     }
     }
 
 
+    if (cite_flag->answer) {
+	fprintf(stdout, "\n");
+	fputs(CITING, stdout);
+    }
+
     if (build->answer) {
     if (build->answer) {
 	fprintf(stdout, "\n");
 	fprintf(stdout, "\n");
 	fputs(GRASS_CONFIGURE_PARAMS, stdout);
 	fputs(GRASS_CONFIGURE_PARAMS, stdout);

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

@@ -58,6 +58,7 @@ class AboutWindow(wx.Frame):
         for title, win in ((_("Info"), self._pageInfo()),
         for title, win in ((_("Info"), self._pageInfo()),
                            (_("Copyright"), self._pageCopyright()),
                            (_("Copyright"), self._pageCopyright()),
                            (_("License"), self._pageLicense()),
                            (_("License"), self._pageLicense()),
+                           (_("Citation"), self._pageCitation()),
                            (_("Authors"), self._pageCredit()),
                            (_("Authors"), self._pageCredit()),
                            (_("Contributors"), self._pageContributors()),
                            (_("Contributors"), self._pageContributors()),
                            (_("Extra contributors"), self._pageContributors(extra = True)),
                            (_("Extra contributors"), self._pageContributors(extra = True)),
@@ -269,6 +270,32 @@ class AboutWindow(wx.Frame):
         
         
         return licensewin
         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):
     def _pageCredit(self):
         """Credit about"""
         """Credit about"""
                 # credits
                 # credits

+ 4 - 1
include/Makefile

@@ -5,7 +5,7 @@ include $(MODULE_TOPDIR)/include/Make/Rules.make
 
 
 SRCH := $(wildcard ../include/*.h ../include/defs/*.h ../include/vect/*.h ../include/iostream/*.h)
 SRCH := $(wildcard ../include/*.h ../include/defs/*.h ../include/vect/*.h ../include/iostream/*.h)
 DSTH := $(patsubst ../include/%.h,$(ARCH_INCDIR)/%.h,$(SRCH))
 DSTH := $(patsubst ../include/%.h,$(ARCH_INCDIR)/%.h,$(SRCH))
-DSTH_EXTRA = $(ARCH_INCDIR)/copying.h $(ARCH_INCDIR)/confparms.h
+DSTH_EXTRA = $(ARCH_INCDIR)/copying.h $(ARCH_INCDIR)/citing.h $(ARCH_INCDIR)/confparms.h
 
 
 SRCMAKE := $(wildcard ../include/Make/*.make)
 SRCMAKE := $(wildcard ../include/Make/*.make)
 DSTMAKE := $(patsubst ../include/Make/%.make,$(ARCH_DISTDIR)/include/Make/%.make,$(SRCMAKE))
 DSTMAKE := $(patsubst ../include/Make/%.make,$(ARCH_DISTDIR)/include/Make/%.make,$(SRCMAKE))
@@ -45,5 +45,8 @@ $(ARCH_DISTDIR)/include/Make:
 $(ARCH_INCDIR)/copying.h: $(MODULE_TOPDIR)/COPYING | $(ARCH_INCDIR)
 $(ARCH_INCDIR)/copying.h: $(MODULE_TOPDIR)/COPYING | $(ARCH_INCDIR)
 	sed -e 's/^\(.*\)$$/"\1\\n"/' $< > $@
 	sed -e 's/^\(.*\)$$/"\1\\n"/' $< > $@
 
 
+$(ARCH_INCDIR)/citing.h: $(MODULE_TOPDIR)/CITING | $(ARCH_INCDIR)
+	sed -e 's/^\(.*\)$$/"\1\\n"/' $< > $@
+
 $(ARCH_INCDIR)/confparms.h: $(MODULE_TOPDIR)/config.status | $(ARCH_INCDIR)
 $(ARCH_INCDIR)/confparms.h: $(MODULE_TOPDIR)/config.status | $(ARCH_INCDIR)
 	sed -n '7s/^#\(.*\)$$/"\1"/p' $< > $@
 	sed -n '7s/^#\(.*\)$$/"\1"/p' $< > $@

+ 3 - 1
lib/init/grass.py

@@ -1055,12 +1055,14 @@ r"""
 %-41s%s (%s)
 %-41s%s (%s)
 %-41sg.manual -i
 %-41sg.manual -i
 %-41sg.version -c
 %-41sg.version -c
+%-41sg.version -x
 """ % (_("GRASS GIS homepage:"),
 """ % (_("GRASS GIS homepage:"),
         # GTC Running through: SHELL NAME
         # GTC Running through: SHELL NAME
        _("This version running through:"),
        _("This version running through:"),
        shellname, os.getenv('SHELL'),
        shellname, os.getenv('SHELL'),
        _("Help is available with the command:"),
        _("Help is available with the command:"),
-       _("See the licence terms with:")))
+       _("See the licence terms with:"),
+       _("See citation options with:")))
     
     
     if grass_gui == 'wxpython':
     if grass_gui == 'wxpython':
         message("%-41sg.gui wxpython" % _("If required, restart the GUI with:"))
         message("%-41sg.gui wxpython" % _("If required, restart the GUI with:"))