21 |
|
|
22 |
# $Id$ |
# $Id$ |
23 |
|
|
24 |
|
# |
25 |
|
# Written by Asko Soukka |
26 |
|
# |
27 |
|
|
28 |
__docformat__ = 'reStructuredText' |
__docformat__ = 'reStructuredText' |
29 |
|
|
30 |
|
""" |
31 |
|
Navidoc configuration module. |
32 |
|
""" |
33 |
|
|
34 |
dbg = None |
dbg = None |
35 |
|
|
36 |
import os, navidoc.util.debug, ConfigParser |
import os, ConfigParser |
37 |
|
|
38 |
|
import navidoc.util.debug |
39 |
|
|
40 |
# general debug filter |
# General debug filter |
41 |
dbg = navidoc.util.debug.DebugFilter() |
dbg = navidoc.util.debug.DebugFilter() |
42 |
|
|
43 |
# system calls |
# System calls |
44 |
metapost = 'mpost' |
metapost = 'mpost' |
45 |
pnmscale = 'pnmscale' |
pnmscale = 'pnmscale' |
46 |
pstopnm = 'pstopnm' |
pstopnm = 'pstopnm' |
47 |
pnmtopng = 'pnmtopng' |
pnmtopng = 'pnmtopng' |
48 |
stderr = '/dev/null' |
stderr = '/dev/null' |
49 |
|
|
50 |
# initializing dynamic settings |
# Initializing dynamic settings |
51 |
# should be kept up-to-date in code |
# These should be kept up-to-date in code |
52 |
# always when compiling reST or diagrams |
# always when compiling reST or diagrams |
53 |
working_directory = '.' |
working_directory = '.' |
54 |
input_filename = '' |
input_filename = '' |
55 |
output_filename = '' |
output_filename = '' |
56 |
link_base_directory = None # if different than working_directory |
link_base_directory = None # if different than working_directory |
57 |
|
|
58 |
# set the default docutils.conf |
# Set the default docutils.conf |
59 |
docutils_conf = './docutils.conf' |
docutils_conf = './docutils.conf' |
60 |
|
|
61 |
# set the default navidoc.conf |
# Set the default navidoc.conf |
62 |
navidoc_conf = './navidoc.conf' |
navidoc_conf = './navidoc.conf' |
63 |
read_navidoc_conf = '' |
read_navidoc_conf = '' |
64 |
|
|
65 |
# holder of packagenames when linking diagrams |
# Holder of packagenames when linking diagrams |
66 |
# will be cleaned after every diagram |
# will be cleaned after every diagram |
67 |
linkpackages = {} |
linkpackages = {} |
68 |
|
|
69 |
# should linked parts of the diagram be emphasized |
# Should linked parts of the diagram be emphasized |
70 |
# using colors and rough edge |
# using colors and rough edge |
71 |
link_emphasize = 0 |
link_emphasize = 0 |
72 |
|
|
73 |
# should diagrams be generated at all |
# Should diagrams be generated at all |
74 |
# this is altered to halt image generation |
# this is altered to halt image generation |
75 |
# temporarily |
# temporarily |
76 |
mp_generate = 1 |
mp_generate = 1 |
77 |
|
|
78 |
# generate only eps-versions of diagrams |
# Generate only eps -versions of diagrams |
79 |
# usable, when compiling reSTs into LaTeX |
# Usable, when compiling reSTs into LaTeX |
80 |
mp_eps_only = 0 |
mp_eps_only = 0 |
81 |
|
|
82 |
# should context menu be added into diagrams |
# Should context menu be added into diagrams |
83 |
# this is latered as UML diagram option |
# this is modifiable later as UML direvtive option |
84 |
mp_context_menu = 0 |
mp_context_menu = 0 |
85 |
|
|
86 |
def read_config(module, filepath): |
def read_config(module, filepath): |
87 |
|
""" |
88 |
|
read_config(module, filepath) |
89 |
|
|
90 |
|
Reads a config file and updates |
91 |
|
attributes in module. |
92 |
|
""" |
93 |
cp = ConfigParser.ConfigParser() |
cp = ConfigParser.ConfigParser() |
94 |
cp.read(filepath) |
cp.read(filepath) |
95 |
for section in cp.sections(): |
for section in cp.sections(): |