[GRASS-SVN] r68973 - in grass/branches/releasebranch_7_2: display/d.northarrow display/d.northarrow/thumbnails gui/wxpython/gui_core lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jul 14 16:30:00 PDT 2016


Author: neteler
Date: 2016-07-14 16:30:00 -0700 (Thu, 14 Jul 2016)
New Revision: 68973

Added:
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/1a.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/1b.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/2.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/3.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/4.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/5.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/6.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/7a.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/7b.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/8a.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/8b.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/9.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/arrow1.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/arrow2.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/arrow3.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/basic_compass.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/fancy_compass.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/star.png
Removed:
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/n_arrow_1a.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/n_arrow_1b.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/n_arrow_2.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/n_arrow_3.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/n_arrow_4.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/n_arrow_5.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/n_arrow_6.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/n_arrow_7a.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/n_arrow_7b.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/n_arrow_8a.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/n_arrow_8b.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/n_arrow_9.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/n_arrow_basic_compass.png
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/n_arrow_fancy_compass.png
Modified:
   grass/branches/releasebranch_7_2/display/d.northarrow/Makefile
   grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/README
   grass/branches/releasebranch_7_2/gui/wxpython/gui_core/widgets.py
   grass/branches/releasebranch_7_2/lib/gis/parser_html.c
Log:
d.northarrow: thumbnails added (trac #3032, trunk r68945, r68946, r68948)

Modified: grass/branches/releasebranch_7_2/display/d.northarrow/Makefile
===================================================================
--- grass/branches/releasebranch_7_2/display/d.northarrow/Makefile	2016-07-14 21:58:48 UTC (rev 68972)
+++ grass/branches/releasebranch_7_2/display/d.northarrow/Makefile	2016-07-14 23:30:00 UTC (rev 68973)
@@ -7,4 +7,14 @@
 
 include $(MODULE_TOPDIR)/include/Make/Module.make
 
-default: cmd
+# thumbnail previews
+IMGSRC := $(wildcard thumbnails/*.png)
+IMGDST := $(patsubst thumbnails/%,$(HTMLDIR)/northarrows/%,$(IMGSRC))
+
+default: cmd $(IMGDST)
+
+$(HTMLDIR)/northarrows/%.png: thumbnails/%.png | $(HTMLDIR)/northarrows
+	$(INSTALL_DATA) $< $@
+
+$(HTMLDIR)/northarrows: $(HTMLDIR)
+	$(MKDIR) $@

Copied: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/1a.png (from rev 68946, grass/trunk/display/d.northarrow/thumbnails/1a.png)
===================================================================
(Binary files differ)

Copied: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/1b.png (from rev 68946, grass/trunk/display/d.northarrow/thumbnails/1b.png)
===================================================================
(Binary files differ)

Copied: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/2.png (from rev 68946, grass/trunk/display/d.northarrow/thumbnails/2.png)
===================================================================
(Binary files differ)

Copied: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/3.png (from rev 68946, grass/trunk/display/d.northarrow/thumbnails/3.png)
===================================================================
(Binary files differ)

Copied: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/4.png (from rev 68946, grass/trunk/display/d.northarrow/thumbnails/4.png)
===================================================================
(Binary files differ)

Copied: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/5.png (from rev 68946, grass/trunk/display/d.northarrow/thumbnails/5.png)
===================================================================
(Binary files differ)

Copied: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/6.png (from rev 68946, grass/trunk/display/d.northarrow/thumbnails/6.png)
===================================================================
(Binary files differ)

Copied: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/7a.png (from rev 68946, grass/trunk/display/d.northarrow/thumbnails/7a.png)
===================================================================
(Binary files differ)

Copied: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/7b.png (from rev 68946, grass/trunk/display/d.northarrow/thumbnails/7b.png)
===================================================================
(Binary files differ)

Copied: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/8a.png (from rev 68946, grass/trunk/display/d.northarrow/thumbnails/8a.png)
===================================================================
(Binary files differ)

Copied: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/8b.png (from rev 68946, grass/trunk/display/d.northarrow/thumbnails/8b.png)
===================================================================
(Binary files differ)

Copied: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/9.png (from rev 68946, grass/trunk/display/d.northarrow/thumbnails/9.png)
===================================================================
(Binary files differ)

Modified: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/README
===================================================================
--- grass/trunk/display/d.northarrow/thumbnails/README	2016-07-11 20:48:47 UTC (rev 68945)
+++ grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/README	2016-07-14 23:30:00 UTC (rev 68973)
@@ -9,15 +9,17 @@
 export GRASS_RENDER_HEIGHT=300
 g.region raster=elevation
 
-for STYLE in 1a 1b 2 3 4 5 6 7a 7b 8a 8b 9 fancy_compass basic_compass
+#PREFIX=n_arrow_
+PREFIX=""
+
+for STYLE in 1a 1b 2 3 4 5 6 7a 7b 8a 8b 9 fancy_compass basic_compass arrow1 arrow2 arrow3 star
 do
 	echo ${STYLE}
-	export GRASS_RENDER_FILE=n_arrow_${STYLE}.png
-	d.northarrow style=${STYLE} at=20,20
-	mogrify -trim n_arrow_${STYLE}.png
-	identify -format "%[fx:w]x%[fx:h]" n_arrow_${STYLE}.png
-#	convert n_arrow_${STYLE}.png -gravity center -background white -extent 170x24 n_arrow_${STYLE}.png
-	convert n_arrow_${STYLE}.png -gravity center -background white n_arrow_${STYLE}.png
-	optipng -o5 n_arrow_${STYLE}.png n_arrow_${STYLE}.png --quiet
+	export GRASS_RENDER_FILE=${PREFIX}${STYLE}.png
+	d.northarrow -t style=${STYLE} at=20,20
+	mogrify -trim ${PREFIX}${STYLE}.png
+	identify -format "%[fx:w]x%[fx:h]" ${PREFIX}${STYLE}.png
+	# first resize it to max size and then place it into a bigger rectangle
+	mogrify -resize 24x24 -background white -gravity Center -extent 24x24 ${PREFIX}${STYLE}.png
+	optipng -o5 ${PREFIX}${STYLE}.png ${PREFIX}${STYLE}.png --quiet
 done
-

Copied: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/arrow1.png (from rev 68946, grass/trunk/display/d.northarrow/thumbnails/arrow1.png)
===================================================================
(Binary files differ)

Copied: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/arrow2.png (from rev 68946, grass/trunk/display/d.northarrow/thumbnails/arrow2.png)
===================================================================
(Binary files differ)

Copied: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/arrow3.png (from rev 68946, grass/trunk/display/d.northarrow/thumbnails/arrow3.png)
===================================================================
(Binary files differ)

Copied: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/basic_compass.png (from rev 68946, grass/trunk/display/d.northarrow/thumbnails/basic_compass.png)
===================================================================
(Binary files differ)

Copied: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/fancy_compass.png (from rev 68946, grass/trunk/display/d.northarrow/thumbnails/fancy_compass.png)
===================================================================
(Binary files differ)

Deleted: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/n_arrow_1a.png
===================================================================
(Binary files differ)

Deleted: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/n_arrow_1b.png
===================================================================
(Binary files differ)

Deleted: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/n_arrow_2.png
===================================================================
(Binary files differ)

Deleted: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/n_arrow_3.png
===================================================================
(Binary files differ)

Deleted: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/n_arrow_4.png
===================================================================
(Binary files differ)

Deleted: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/n_arrow_5.png
===================================================================
(Binary files differ)

Deleted: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/n_arrow_6.png
===================================================================
(Binary files differ)

Deleted: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/n_arrow_7a.png
===================================================================
(Binary files differ)

Deleted: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/n_arrow_7b.png
===================================================================
(Binary files differ)

Deleted: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/n_arrow_8a.png
===================================================================
(Binary files differ)

Deleted: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/n_arrow_8b.png
===================================================================
(Binary files differ)

Deleted: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/n_arrow_9.png
===================================================================
(Binary files differ)

Deleted: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/n_arrow_basic_compass.png
===================================================================
(Binary files differ)

Deleted: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/n_arrow_fancy_compass.png
===================================================================
(Binary files differ)

Copied: grass/branches/releasebranch_7_2/display/d.northarrow/thumbnails/star.png (from rev 68946, grass/trunk/display/d.northarrow/thumbnails/star.png)
===================================================================
(Binary files differ)

Modified: grass/branches/releasebranch_7_2/gui/wxpython/gui_core/widgets.py
===================================================================
--- grass/branches/releasebranch_7_2/gui/wxpython/gui_core/widgets.py	2016-07-14 21:58:48 UTC (rev 68972)
+++ grass/branches/releasebranch_7_2/gui/wxpython/gui_core/widgets.py	2016-07-14 23:30:00 UTC (rev 68973)
@@ -1594,18 +1594,11 @@
     """ComboBox with north arrows for d.barscale."""
 
     def _getPath(self, name):
-        path = os.path.join(os.getenv("GISBASE"), "gui", "images",
-                            'symbols', 'n_arrows')
-        try:
-            int(name[0])
-            return os.path.join(path, 'n_arrow{name}.png'.format(name=name))
-        except ValueError:
-            return os.path.join(path, '{name}.png'.format(name=name))
+        return os.path.join(
+            os.getenv("GISBASE"),
+            "docs", "html", "northarrows", "%s.png" % name)
 
-    def OnMeasureItem(self, item):
-        return 32
 
-
 class LayersList(GListCtrl, listmix.TextEditMixin):
     """List of layers to be imported (dxf, shp...)"""
 

Modified: grass/branches/releasebranch_7_2/lib/gis/parser_html.c
===================================================================
--- grass/branches/releasebranch_7_2/lib/gis/parser_html.c	2016-07-14 21:58:48 UTC (rev 68972)
+++ grass/branches/releasebranch_7_2/lib/gis/parser_html.c	2016-07-14 23:30:00 UTC (rev 68973)
@@ -256,9 +256,13 @@
                             else if (strcmp(opt->gisprompt,
                                             "old,barscale,barscale") == 0)
                                 thumbnails = "barscales";
-                            
+                            else if (strcmp(opt->gisprompt,
+                                            "old,northarrow,northarrow") == 0)
+                                thumbnails = "northarrows";
+
                             if (thumbnails)
-                                fprintf(stdout, "<img width=\"80\" height=\"12\" "
+                                fprintf(stdout, "<img height=\"12\" "
+                                        "style=\"max-width: 80;\""
                                         "src=\"%s/%s.png\" alt=\"%s\"> ",
                                         thumbnails, opt->opts[i], opt->opts[i]);
                         }



More information about the grass-commit mailing list