[GRASS-SVN] r42371 - grass/trunk/raster/r.colors

svn_grass at osgeo.org svn_grass at osgeo.org
Sat May 29 07:18:23 EDT 2010


Author: martinl
Date: 2010-05-29 07:18:21 -0400 (Sat, 29 May 2010)
New Revision: 42371

Modified:
   grass/trunk/raster/r.colors/main.c
   grass/trunk/raster/r.colors/thumbnails.py
Log:
r.colors: guisection cosmetics, be quiet when generating thumbnails


Modified: grass/trunk/raster/r.colors/main.c
===================================================================
--- grass/trunk/raster/r.colors/main.c	2010-05-29 10:02:57 UTC (rev 42370)
+++ grass/trunk/raster/r.colors/main.c	2010-05-29 11:18:21 UTC (rev 42371)
@@ -8,7 +8,7 @@
  * PURPOSE:      Allows creation and/or modification of the color table
  *               for a raster map layer.
  *
- * COPYRIGHT:    (C) 2006-2008 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2006-2008, 2010 by the GRASS Development Team
  *
  *               This program is free software under the GNU General Public
  *               License (>=v2). Read the file COPYING that comes with GRASS
@@ -16,12 +16,6 @@
  *
  ***************************************************************************/
 
-/* main.c
- *
- * specify and print options added by DBA Systems, Inc.
- * update 10/99 for GRASS 5
- */
-
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
@@ -164,26 +158,12 @@
     G_add_keyword(_("raster"));
     G_add_keyword(_("color table"));
     module->description =
-	_("Creates/modifies the color table associated with a raster map layer.");
-
+	_("Creates/modifies the color table associated with a raster map.");
+    
     opt.map = G_define_standard_option(G_OPT_R_MAP);
     opt.map->required = NO;
     opt.map->guisection = _("Required");
 
-    opt.rast = G_define_option();
-    opt.rast->key = "raster";
-    opt.rast->type = TYPE_STRING;
-    opt.rast->required = NO;
-    opt.rast->gisprompt = "old,cell,raster";
-    opt.rast->description =
-	_("Raster map name from which to copy color table");
-
-    opt.rules = G_define_standard_option(G_OPT_F_INPUT);
-    opt.rules->key = "rules";
-    opt.rules->required = NO;
-    opt.rules->description = _("Path to rules file (\"-\" to read rules from stdin)");
-    opt.rules->guisection = _("Colors");
-
     scan_rules();
 
     opt.colr = G_define_option();
@@ -194,12 +174,29 @@
     opt.colr->options = rules_list();
     opt.colr->description = _("Type of color table");
     opt.colr->descriptions = rules_descriptions();
-    opt.colr->guisection = _("Colors");
+    opt.colr->guisection = _("Define");
 
+    opt.rast = G_define_option();
+    opt.rast->key = "raster";
+    opt.rast->type = TYPE_STRING;
+    opt.rast->required = NO;
+    opt.rast->gisprompt = "old,cell,raster";
+    opt.rast->description =
+	_("Raster map from which to copy color table");
+    opt.rast->guisection = _("Define");
+
+    opt.rules = G_define_standard_option(G_OPT_F_INPUT);
+    opt.rules->key = "rules";
+    opt.rules->required = NO;
+    opt.rules->label = _("Path to rules file");
+    opt.rules->description = _("\"-\" to read rules from stdin");
+    opt.rules->guisection = _("Define");
+
     flag.r = G_define_flag();
     flag.r->key = 'r';
     flag.r->description = _("Remove existing color table");
-
+    flag.r->guisection = _("Remove");
+    
     flag.w = G_define_flag();
     flag.w->key = 'w';
     flag.w->description =
@@ -212,22 +209,22 @@
     flag.n = G_define_flag();
     flag.n->key = 'n';
     flag.n->description = _("Invert colors");
-    flag.n->guisection = _("Colors");
+    flag.n->guisection = _("Define");
 
     flag.g = G_define_flag();
     flag.g->key = 'g';
     flag.g->description = _("Logarithmic scaling");
-    flag.g->guisection = _("Colors");
+    flag.g->guisection = _("Define");
 
     flag.a = G_define_flag();
     flag.a->key = 'a';
     flag.a->description = _("Logarithmic-absolute scaling");
-    flag.a->guisection = _("Colors");
+    flag.a->guisection = _("Define");
 
     flag.e = G_define_flag();
     flag.e->key = 'e';
     flag.e->description = _("Histogram equalization");
-    flag.e->guisection = _("Colors");
+    flag.e->guisection = _("Define");
 
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);

Modified: grass/trunk/raster/r.colors/thumbnails.py
===================================================================
--- grass/trunk/raster/r.colors/thumbnails.py	2010-05-29 10:02:57 UTC (rev 42370)
+++ grass/trunk/raster/r.colors/thumbnails.py	2010-05-29 11:18:21 UTC (rev 42371)
@@ -72,7 +72,7 @@
 
 def ppmtopng(dst, src):
     if grass.find_program("g.ppmtopng", ["help"]):
-	grass.run_command('g.ppmtopng', input = src, output = dst)
+	grass.run_command('g.ppmtopng', input = src, output = dst, quiet = True)
     elif grass.find_program("pnmtopng"):
 	fh = open(dst, 'wb')
 	grass.call(["pnmtopng", src], stdout = fh)
@@ -171,13 +171,13 @@
     grass.use_temp_region()
     grass.run_command('g.region', rows = 100, cols = 100)
 
-    grass.mapcalc("$grad = row()/1.0", grad = tmp_grad_rel)
-
+    grass.mapcalc("$grad = row()/1.0", grad = tmp_grad_rel, quiet = True)
+    
     for table in os.listdir(color_dir):
 	path = os.path.join(color_dir, table)
 	grad = make_gradient(path)
 	make_image(output_dir, table, grad)
-
+    
     grass.mapcalc("$grad = row()", grad = tmp_grad_abs, quiet = True)
     for table in ['grey.eq', 'grey.log', 'random']:
 	make_image(output_dir, table, tmp_grad_abs, True)



More information about the grass-commit mailing list