[GRASS-dev] new script for calling colorrules.py

Michael Barton michael.barton at asu.edu
Mon Aug 18 01:42:02 EDT 2008


Here is a new script for quickly calling the colorrules interactive  
color setting module from the command line. You can initialize it for  
raster or vector maps:

color_table.py raster
color_table.py vector

=========== color_table.py ============

#!/usr/bin/env python
############################################################################
#
# MODULE:    color_table.py
# AUTHOR(S): GRASS Development Team
#            Michael Barton (michael.barton at asu.edu) and
#            Glynn Clements (glynn at gclements.plus.com)
#
# PURPOSE:   Calls wx.Python module colorrules.py for interactive  
management
#               of raster and vector color tables
# COPYRIGHT: (C) 2008 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
#   for details.
#
#############################################################################
#%Module
#%  description: g.parser test script
#%  keywords: keyword1, keyword2
#%End
#%option
#%  key: maptype
#%  type: string
#%  options: raster,vector
#%  answer: raster
#%  description: Type of map (raster or vector)
#%  required : yes
#%end


import sys
import os
import grass

sys.path.append(os.path.join(os.getenv("GISBASE"), 'etc', 'wxpython',  
'gui_modules'))

import colorrules
import wx

def main():
     if options['maptype'] == 'vector':
         maptype = 'vcolors'
     else:
         maptype = 'r.colors'
     app = wx.PySimpleApp()
     ctable = colorrules.ColorTable(parent = None, cmd=maptype)
     ctable.Show()
     app.MainLoop()

if __name__ == "__main__":
     options, flags = grass.parser()
     main()

===================================



Michael



More information about the grass-dev mailing list