| 1 |
#!/usr/bin/env python |
|---|
| 2 |
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 3 |
##~ License |
|---|
| 4 |
##~ |
|---|
| 5 |
##- The RuneBlade Foundation library is intended to ease some |
|---|
| 6 |
##- aspects of writing intricate Jabber, XML, and User Interface (wxPython, etc.) |
|---|
| 7 |
##- applications, while providing the flexibility to modularly change the |
|---|
| 8 |
##- architecture. Enjoy. |
|---|
| 9 |
##~ |
|---|
| 10 |
##~ Copyright (C) 2002 TechGame Networks, LLC. |
|---|
| 11 |
##~ |
|---|
| 12 |
##~ This library is free software; you can redistribute it and/or |
|---|
| 13 |
##~ modify it under the terms of the BSD style License as found in the |
|---|
| 14 |
##~ LICENSE file included with this distribution. |
|---|
| 15 |
##~ |
|---|
| 16 |
##~ TechGame Networks, LLC can be reached at: |
|---|
| 17 |
##~ 3578 E. Hartsel Drive #211 |
|---|
| 18 |
##~ Colorado Springs, Colorado, USA, 80920 |
|---|
| 19 |
##~ |
|---|
| 20 |
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 21 |
|
|---|
| 22 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 23 |
#~ Imports |
|---|
| 24 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 25 |
|
|---|
| 26 |
from DOTSkinObject import DOTSkinObject |
|---|
| 27 |
|
|---|
| 28 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 29 |
#~ Class Initialization |
|---|
| 30 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 31 |
|
|---|
| 32 |
class graph_settings(DOTSkinObject): |
|---|
| 33 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 34 |
#~ Constants / Variables / Etc. |
|---|
| 35 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 36 |
|
|---|
| 37 |
default_settings = DOTSkinObject.default_settings.copy() |
|---|
| 38 |
default_settings.update({ |
|---|
| 39 |
# bgcolor background color for drawing, plus initial fill color |
|---|
| 40 |
# center false center drawing on page |
|---|
| 41 |
# clusterrank local may be global or none |
|---|
| 42 |
# color black for clusters, outline color, and fill color if fillcolor not defined |
|---|
| 43 |
# comment any string (format-dependent) |
|---|
| 44 |
# compound false allow edges between clusters |
|---|
| 45 |
# concentrate false enables edge concentrators |
|---|
| 46 |
# fillcolor black cluster fill color |
|---|
| 47 |
# fontcolor black type face color |
|---|
| 48 |
# fontname Times-Roman font family |
|---|
| 49 |
# fontpath list of directories to such for fonts |
|---|
| 50 |
# fontsize 14 point size of label |
|---|
| 51 |
# label any string |
|---|
| 52 |
# labeljust left-justified r for right-justified cluster labels |
|---|
| 53 |
# labelloc top r for right-justified cluster labels |
|---|
| 54 |
# layers id:id:id... |
|---|
| 55 |
# margin .5 margin included in page, inches |
|---|
| 56 |
# mclimit 1.0 scale factor for mincross iterations |
|---|
| 57 |
# nodesep .25 separation between nodes, in inches. |
|---|
| 58 |
# nslimit if set to f, bounds network simplex iterations by (f)(number of nodes) when setting x-coordinates |
|---|
| 59 |
# nslimit1 if set to f, bounds network simplex iterations by (f)(number of nodes) when ranking nodes |
|---|
| 60 |
# ordering if `out` out edge order is preserved |
|---|
| 61 |
# orientation portrait if rotate is not used and the value is landscape, use landscape orientation |
|---|
| 62 |
# page unit of pagination, e.g. "8.5,11" |
|---|
| 63 |
# pagedir BL traversal order of pages |
|---|
| 64 |
# quantum if quantum ¿ 0.0, node label dimensions will be rounded to integral multiples of quantum |
|---|
| 65 |
# rank same, min, max, source or sink |
|---|
| 66 |
# rankdir TB LR (left to right) or TB (top to bottom) |
|---|
| 67 |
# ranksep .75 separation between ranks, in inches. |
|---|
| 68 |
# ratio approximate aspect ratio desired, fill or auto |
|---|
| 69 |
# remincross if true and there are multiple clusters, re-run crossing minimization |
|---|
| 70 |
# rotate If 90, set orientation to landscape |
|---|
| 71 |
# samplepoints 8 number of points used to represent ellipses and circles on output (cf. Appendix C |
|---|
| 72 |
# searchsize 30 maximum edges with negative cut values to check when looking for a minimum one during network simplex |
|---|
| 73 |
# size maximum drawing size, in inches |
|---|
| 74 |
# style graphics options, e.g. filled for clusters |
|---|
| 75 |
# URL URL associated with graph (format-dependent) |
|---|
| 76 |
}) |
|---|
| 77 |
|
|---|
| 78 |
_DOTRelatedAttributes = { |
|---|
| 79 |
'bgcolor':1, 'center':1, 'clusterrank':1, 'color':1, 'comment':1, 'compound':1, 'concentrate':1, 'fillcolor':1, 'fontcolor':1, 'fontname':1, |
|---|
| 80 |
'fontpath':1, 'fontsize':1, 'label':1, 'labeljust':1, 'labelloc':1, 'layers':1, 'margin':1, 'mclimit':1, 'nodesep':1, 'nslimit':1, 'nslimit1':1, |
|---|
| 81 |
'ordering':1, 'orientation':1, 'page':1, 'pagedir':1, 'quantum':1, 'rank':1, 'rankdir':1, 'ranksep':1, 'ratio':1, 'remincross':1, 'rotate':1, |
|---|
| 82 |
'samplepoints':1, 'searchsize':1, 'size':1, 'style':1, 'URL':1} |
|---|
| 83 |
|
|---|
| 84 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 85 |
#~ Public |
|---|
| 86 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 87 |
|
|---|
| 88 |
def _toDOT(self, joinstr='\n', close=1): |
|---|
| 89 |
return 'graph [%s]%s' % (self._OutputDOTSettings(), close and ';' or '') |
|---|
| 90 |
|
|---|