| 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 edge_settings(DOTSkinObject): |
|---|
| 33 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 34 |
#~ Constants / Variables / Etc. |
|---|
| 35 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 36 |
|
|---|
| 37 |
default_settings = DOTSkinObject.default_settings.copy() |
|---|
| 38 |
default_settings.update({ |
|---|
| 39 |
# arrowhead normal style of arrowhead at head end |
|---|
| 40 |
# arrowsize 1.0 scaling factor for arrowheads |
|---|
| 41 |
# arrowtail normal style of arrowhead at tail end |
|---|
| 42 |
# color black edge stroke color |
|---|
| 43 |
# comment any string (format-dependent) |
|---|
| 44 |
# constraint true use edge to affect node ranking |
|---|
| 45 |
# decorate if set, draws a line connecting labels with their edges |
|---|
| 46 |
# dir forward forward, back, both, or none |
|---|
| 47 |
# fontcolor black type face color |
|---|
| 48 |
# fontname Times-Roman font family |
|---|
| 49 |
# fontsize 14 point size of label |
|---|
| 50 |
# headlabel label placed near head of edge |
|---|
| 51 |
# headport n,ne,e,se,s,sw,w,nw |
|---|
| 52 |
# headURL URL attached to head label if output format is ismap |
|---|
| 53 |
# label edge label |
|---|
| 54 |
# labelangle -25.0 angle in degrees which head or tail label is rotated off edge |
|---|
| 55 |
# labeldistance 1.0 scaling factor for distance of head or tail label from node |
|---|
| 56 |
# labelfloat false lessen constraints on edge label placement |
|---|
| 57 |
# labelfontcolor black type face color for head and tail labels |
|---|
| 58 |
# labelfontname Times-Roman font family for head and tail labels |
|---|
| 59 |
# labelfontsize 14 point size for head and tail labels |
|---|
| 60 |
# layer overlay range all, id or id:id |
|---|
| 61 |
# lhead name of cluster to use as head of edge |
|---|
| 62 |
# ltail name of cluster to use as tail of edge |
|---|
| 63 |
# minlen 1 minimum rank distance between head and tail |
|---|
| 64 |
# samehead tag for head node; edge heads with the same tag are merged onto the same port |
|---|
| 65 |
# sametail tag for tail node; edge tails with the same tag are merged onto the same port |
|---|
| 66 |
# style graphics options, e.g. bold, dotted, filled; cf. Section 2.3 |
|---|
| 67 |
# taillabel label placed near tail of edge |
|---|
| 68 |
# tailport n,ne,e,se,s,sw,w,nw |
|---|
| 69 |
# tailURL URL attached to tail label if output format is ismap |
|---|
| 70 |
# weight 1 integer cost of stretching an edge |
|---|
| 71 |
}) |
|---|
| 72 |
|
|---|
| 73 |
_DOTRelatedAttributes = { |
|---|
| 74 |
'arrowhead':1, 'arrowsize':1, 'arrowtail':1, 'color':1, 'comment':1, 'constraint':1, 'decorate':1, 'dir':1, 'fontcolor':1, |
|---|
| 75 |
'fontname':1, 'fontsize':1, 'headlabel':1, 'headport':1, 'headURL':1, 'label':1, 'labelangle':1, 'labeldistance':1, 'labelfloat':1, |
|---|
| 76 |
'labelfontcolor':1, 'labelfontname':1, 'labelfontsize':1, 'layer':1, 'lhead':1, 'ltail':1, 'minlen':1, 'samehead':1, 'sametail':1, |
|---|
| 77 |
'style':1, 'taillabel':1, 'tailport':1, 'tailURL':1, 'weight':1,} |
|---|
| 78 |
|
|---|
| 79 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 80 |
#~ Public |
|---|
| 81 |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 82 |
|
|---|
| 83 |
def _toDOT(self, joinstr='\n', close=1): |
|---|
| 84 |
return 'edge [%s]%s' % (self._OutputDOTSettings(), close and ';' or '') |
|---|
| 85 |
|
|---|