SpecCommandLineDrawing/DraftAssDir

From Inkscape Wiki
Revision as of 01:33, 21 January 2009 by Inductiveload (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The association directory is a module that contains global information for the command line editing module. This includes:

  1. A dictionary linking the command header (eg circle) with the relevant module containing the parameters and SVG drawing function (i.e. cl_circle.py)
  2. A dictionary containing style attributes that apply to all objects, so these don't need to be specified for each object. (For example, fill colour, stroke width, etc).

Draft Code


#!/usr/bin/env python 
'''

######DESCRIPTION######

This script contains a dictionary for matching command headers to the modules
containing the relevant command dictionaries and drawing routines.

If a module is added to the directory, it should be added here along with the
command headers it responds to. In this way, it is easy to add or remove modules
without having to modify the core script.

directory = {   'circle'        :'cl_circle',
                'rect'          :'cl_rect',
                'poly'          :'cl_poly',
                'line'          :'cl_line',
                'star'          :'cl_star' 
            }

std_style = { #style commands that are applicable to "standard" objects
                't': {'t':'scalar', 'xml':'stroke-width',    'd':1},            #line thickness
                'f': {'t':'colour', 'xml':'fill',            'd':'none'},       #fill colour
                'fo':{'t':'scalar', 'xml':'fill-opacity',    'd':'1'}           #stroke opacity
                's': {'t':'colour', 'xml':'stroke',          'd':'#000000'},    #stroke colour
                'so':{'t':'scalar', 'xml':'stroke-opacity',  'd':'1'}           #stroke opacity
            }