21 |
|
|
22 |
# $Id$ |
# $Id$ |
23 |
|
|
24 |
__docformat__ = 'reStructuredText' |
# |
25 |
|
# Written by Asko Soukka |
26 |
|
# |
27 |
|
|
28 |
dbg = None |
__docformat__ = 'reStructuredText' |
29 |
|
|
30 |
import os, navidoc.util.debug |
""" |
31 |
|
Navidoc configuration module. |
32 |
|
""" |
33 |
|
|
34 |
#Environmental variable MPINPUTS should be relative to tmpdir, |
dbg = None |
|
#or be an absolute path. |
|
|
os.putenv("MPINPUTS", "../../navidoc/navidoc/mp/") |
|
35 |
|
|
36 |
# base_url |
import os, ConfigParser |
|
base_rul = 'http://fenfire.org/' |
|
37 |
|
|
38 |
# midfix for generated files |
import navidoc.util.debug |
|
# don't change this, if you don't know what you are doing :) |
|
|
midfix = ".gen" |
|
39 |
|
|
40 |
# global settings needed all around |
# General debug filter |
41 |
mp_directory = '../ffdoc/diagrams' |
dbg = navidoc.util.debug.DebugFilter() |
|
mp_generate = 1 |
|
|
mp_eps_only = 0 |
|
|
mp_context_menu = 1 |
|
42 |
|
|
43 |
# initializing dynamic settings |
# System calls |
44 |
# should be kept up-to-date in code |
metapost = 'mpost' |
45 |
# always when compiling ReST or diagrams |
pnmscale = 'pnmscale' |
46 |
|
pstopnm = 'pstopnm' |
47 |
|
pnmtopng = 'pnmtopng' |
48 |
|
stderr = '/dev/null' |
49 |
|
|
50 |
|
# Initializing dynamic settings |
51 |
|
# These should be kept up-to-date in code |
52 |
|
# 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 |
# settings for linking javadoc |
# Set the default docutils.conf |
59 |
# the search order is ascending, sudden death |
docutils_conf = './docutils.conf' |
|
linkpackages = {} # holder of packagenames, will members will be cleaned after every diagram |
|
|
javadoc_directories = ['../ffdoc/libvob/javadoc', |
|
|
'../ffdoc/storm/javadoc', |
|
|
'../ffdoc/alph/javadoc', |
|
|
'../ffdoc/fenfire/javadoc', |
|
|
'../ffdoc/loom/javadoc', |
|
|
'../ffdoc/navidoc/javadoc' |
|
|
] |
|
|
link_redirection = {'navidoc': '../ffdoc/navidoc', |
|
|
'libvob': '../ffdoc/libvob', |
|
|
'storm': '../ffdoc/storm', |
|
|
'alph': '../ffdoc/alph', |
|
|
'fenfire': '../ffdoc/fenfire', |
|
|
'loom': '../ffdoc/loom', |
|
|
} |
|
|
docxx_directories = ['../ffdoc/libvob/docxx', |
|
|
'../ffdoc/storm/docxx', |
|
|
'../ffdoc/alph/docxx', |
|
|
'../ffdoc/fenfire/docxx', |
|
|
'../ffdoc/loom/docxx', |
|
|
'../ffdoc/navidoc/docxx', |
|
|
] |
|
60 |
|
|
61 |
# general debug filter |
# Set the default navidoc.conf |
62 |
dbg = navidoc.util.debug.DebugFilter() |
navidoc_conf = './navidoc.conf' |
63 |
|
read_navidoc_conf = '' |
64 |
|
|
65 |
|
# Holder of packagenames when linking diagrams |
66 |
|
# will be cleaned after every diagram |
67 |
|
linkpackages = {} |
68 |
|
|
69 |
|
# Should linked parts of the diagram be emphasized |
70 |
|
# using colors and rough edge |
71 |
|
link_emphasize = 0 |
72 |
|
|
73 |
|
# Should diagrams be generated at all |
74 |
|
# this is altered to halt image generation |
75 |
|
# temporarily |
76 |
|
mp_generate = 1 |
77 |
|
|
78 |
# set the default docutils.conf |
# Generate only eps -versions of diagrams |
79 |
docutils = "./docutils.conf" |
# Usable, when compiling reSTs into LaTeX |
80 |
|
mp_eps_only = 0 |
81 |
|
|
82 |
# pegs will be sorted after their priority |
# Should context menu be added into diagrams |
83 |
pegboard_priorities = {'Current': 1, |
# this is modifiable later as UML direvtive option |
84 |
'Revising': 2, |
mp_context_menu = 0 |
85 |
'Incomplete': 3, |
|
86 |
'Undefined': 4, |
def read_config(module, filepath): |
87 |
'Accepted': 5, |
""" |
88 |
'Implemented': 6, |
read_config(module, filepath) |
89 |
'Rejected': 7, |
|
90 |
'Irrelevant': 8, |
Reads a config file and updates |
91 |
} |
attributes in module. |
92 |
|
""" |
93 |
# authors and stakeholders to replace with nicknames |
cp = ConfigParser.ConfigParser() |
94 |
pegboard_authors = {'Tuomas Lukka': 'tjl', |
cp.read(filepath) |
95 |
'Tuomas J. Lukka': 'tjl', |
for section in cp.sections(): |
96 |
'Benja Fallenstein': 'benja', |
for option in cp.options(section): |
97 |
'Benja': 'benja', |
setattr(module, option, eval(cp.get(section, option))) |
98 |
'Asko Soukka': 'humppake', |
|
99 |
'Matti Katila': 'mudyc', |
def imgmapanchor(self, scale=1.0, diagram='', context=''): |
100 |
'Anton Feldmann': 'anton', |
from navidoc.util.path import slashify, relative_path |
101 |
'Tero Mäyränen': 'deetsay', |
# Adding javascript thingy, when target not defined |
102 |
'Marc Schiereck': 'dreevich', |
if context.endswith('_implicit'): |
103 |
'Hermanni Hyytiälä': 'hemppah', |
id_postfix = '' |
104 |
'Antti_Juhani Kaijanaho': 'ibid', |
context = context[:len(context)-len('_implicit')] |
105 |
'Janne V. Kujala': 'jvk', |
else: |
106 |
'Janne Kujala': 'jvk', |
id_postfix = '_implicit' |
107 |
'Tuukka Hastrup': 'tuukkah', |
context = context + '_implicit' |
108 |
'Vesa Kaihlavirta': 'vegai', |
|
109 |
} |
if self.target == '' and diagram and context: |
110 |
|
self.target = "javascript:setImg('"+diagram+"_img', '"+slashify(relative_path(working_directory, mp_directory))+diagram+context+midfix+".png', '#"+diagram+id_postfix+"_map')" |
111 |
|
|
112 |
|
if not self.target.startswith('javascript'): |
113 |
|
diagram = '#'+diagram |
114 |
|
self.target = self.target.replace('.html', '.uml.html') |
115 |
|
else: diagram = '' |
116 |
|
|
117 |
|
return """<area href="%s%s" shape="rect" coords="%s" target="%s" title="%s" alt="%s" />""" \ |
118 |
|
% (self.target, diagram, |
119 |
|
",".join(["%s"%(int(c*scale)) for c in self.corners]), '_top', |
120 |
|
self.title, self.title) |
121 |
|
|
122 |
# status for pegs without rst or with failing rst |
import navidoc.mp |
123 |
pegboard_undefined = 'Undefined' |
navidoc.mp.MPLink.imgmapanchor = imgmapanchor |