[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz doc/uml/.cvsignore doc/gzz.css metacode/mpu...
From: |
Asko Soukka |
Subject: |
[Gzz-commits] gzz doc/uml/.cvsignore doc/gzz.css metacode/mpu... |
Date: |
Thu, 06 Feb 2003 16:57:42 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Asko Soukka <address@hidden> 03/02/06 16:57:42
Modified files:
doc/uml : .cvsignore
doc : gzz.css
metacode : mputils.py umldoc.py umlhelper.mp umlrst.py
umltool.py
Log message:
umltool upgrade
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/doc/uml/.cvsignore.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/doc/gzz.css.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/metacode/mputils.py.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/metacode/umldoc.py.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/metacode/umlhelper.mp.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/metacode/umlrst.py.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/metacode/umltool.py.diff?tr1=1.24&tr2=1.25&r1=text&r2=text
Patches:
Index: gzz/doc/gzz.css
diff -u gzz/doc/gzz.css:1.13 gzz/doc/gzz.css:1.14
--- gzz/doc/gzz.css:1.13 Mon Jan 13 08:39:39 2003
+++ gzz/doc/gzz.css Thu Feb 6 16:57:42 2003
@@ -192,8 +192,6 @@
border-left: solid thin black ;
padding-left: 0.5ex }
-
-
.docinfo-name {
font-weight: bold;
text-align: left;
Index: gzz/doc/uml/.cvsignore
diff -u gzz/doc/uml/.cvsignore:1.3 gzz/doc/uml/.cvsignore:1.4
--- gzz/doc/uml/.cvsignore:1.3 Mon Jan 13 08:39:39 2003
+++ gzz/doc/uml/.cvsignore Thu Feb 6 16:57:42 2003
@@ -1,10 +1,2 @@
-*.gen.1
-*.gen.2
-*.gen.3
+*.gen.*
*.log
-*.gen.html
-*.gen.uml
-*.gen.mp
-*.gen.png
-*.gen.log
-*.gen.refers
Index: gzz/metacode/mputils.py
diff -u gzz/metacode/mputils.py:1.7 gzz/metacode/mputils.py:1.8
--- gzz/metacode/mputils.py:1.7 Mon Feb 3 05:30:00 2003
+++ gzz/metacode/mputils.py Thu Feb 6 16:57:42 2003
@@ -19,7 +19,7 @@
Metapost -> PNG related stuff.
"""
import os, sys, re
-#import docutils.parsers.rst.directives, docutils.nodes, docutils.core
+import docutils.parsers.rst.directives, docutils.nodes, docutils.core
import docutils
import uml
Index: gzz/metacode/umldoc.py
diff -u gzz/metacode/umldoc.py:1.19 gzz/metacode/umldoc.py:1.20
--- gzz/metacode/umldoc.py:1.19 Mon Feb 3 11:11:25 2003
+++ gzz/metacode/umldoc.py Thu Feb 6 16:57:42 2003
@@ -49,7 +49,7 @@
import sys, os.path
import umltool, umlrst, mputils
-import docutils.core
+import docutils.core, docutils.parsers.rst
# must be run in the main directory of gzz module
settings = mputils.Settings()
Index: gzz/metacode/umlhelper.mp
diff -u gzz/metacode/umlhelper.mp:1.20 gzz/metacode/umlhelper.mp:1.21
--- gzz/metacode/umlhelper.mp:1.20 Fri Jan 24 04:06:46 2003
+++ gzz/metacode/umlhelper.mp Thu Feb 6 16:57:42 2003
@@ -390,7 +390,7 @@
showjlinksize(name, p);
enddef;
vardef showlinkerror(expr name, p) =
- fill p withcolor (0, 1, 1);
+ fill p withcolor (1, 0.6, 0.6);
showjlinksize(name, p);
enddef;
vardef showfocus(expr name, p) =
Index: gzz/metacode/umlrst.py
diff -u gzz/metacode/umlrst.py:1.22 gzz/metacode/umlrst.py:1.23
--- gzz/metacode/umlrst.py:1.22 Mon Feb 3 05:30:00 2003
+++ gzz/metacode/umlrst.py Thu Feb 6 16:57:42 2003
@@ -126,17 +126,19 @@
def embed_diagrams(path):
umltool.set_transition_paths(path)
+ settings['path'] = path
#the second pass - adds uml into html
if path.endswith(".rst"): path = path[0:len(path)-4]
if os.path.isfile(path+".gen.html"):
- html = open(path+".gen.html").read()
- out = open(path+".gen.html", "w")
+ htmlfile = open(path+".gen.html")
+ html = htmlfile.read()
+ htmlfile.close()
insert = html.find("<!-- UML:")
while insert > -1:
- out.write(html[0:insert]);
name = html[insert+9:html.find(" ", insert+9)]
-
+ settings['name'] = name
+
#This should work also with non-generated UML-diagrams. Checks
first
#for generated and then if non-generated diagram exists.
if (os.path.isfile(mputils._slashify(settings['tmpdir'])\
@@ -148,37 +150,31 @@
context_name = name+"_"+path.replace("/","_")
if context_name.endswith(".gen"):
context_name = context_name[0:len(context_name)-4]
+
implicit_targets = create_diagram(prefix, context_name, 1.0)
for target in implicit_targets:
embed_implicit(path, name, target)
+ out = open(path+".gen.html", "w")
+ out.write(html[0:insert]);
#Cut&Pastes imagemap into html
imgmap =
open(settings['tmpdir']+"/"+context_name+".gen.html").read()
- out.write("<map id=\""+name+"\" name=\""+name+"\">\n")
+ out.write("<a id=\""+name+"\"></a>")
+ out.write("<map id=\""+name+"_map\" name=\""+name+"_map\">\n")
out.write(imgmap[imgmap.find('>',imgmap.find('<map'))+1:\
imgmap.find('</map>')])
out.write("</map>\n")
- out.write("<div class=\"uml-explicit\">\n")
- if (os.path.isfile(mputils._slashify(settings['tmpdir'])\
- +name+".gen.refers")):
- refers = open(mputils._slashify(settings['tmpdir'])\
- +name+".gen.refers").readlines()
- out.write("<strong>"+name+"</strong>: \n")
- for refer in refers:
- out.write("[<a href=\""\
- +mputils.transition_path(path,
refer.replace(".rst", ".gen.html")).replace("\n","")\
-
+"#"+name+"\">"+refer.split("/")[-1].split(".")[0]+"</a>]\n")
- out.write("<br/>\n")
- out.write("<a id=\""+name+"\"></a>\n")
out.write("<img src=\""+mputils._slashify(settings['to_tmpdir'])\
+context_name+".gen.png"\
- +"\" usemap=\"#"+name+"\" alt=\""+name+"\" />\n")
- out.write("</div>\n")
+ +"\" usemap=\"#"+name+"_map\" alt=\""+name+"\" />\n")
html = html[html.find("-->", insert)+3:len(html)]
+ out.write(html)
+ out.close()
+ htmlfile = open(path+".gen.html")
+ html = htmlfile.read()
+ htmlfile.close()
insert = html.find("<!-- UML:")
- out.write(html)
- out.close()
else:
print "!umlrst: strange: no file for",path+".gen.html -- ignoring"
@@ -195,6 +191,7 @@
path = (oldpath[0:slash+1] + path).replace("//", "/")
settings2 = settings.copy()
+ settings['path'] = path
umltool.set_transition_paths(path)
slash = oldpath.rfind("/")
@@ -206,14 +203,14 @@
if path.endswith(".rst"): path = path[0:len(path)-4]
if path.endswith(".html"): path = path[0:len(path)-5]
if os.path.isfile(path+".html"):
- html = open(path+".html").read()
+ htmlfile = open(path+".html")
+ html = htmlfile.read()
+ htmlfile.close()
insert = html.upper().find("</H1>")
if insert == -1: insert = html.upper().find("</H2>")
#the same diagram is written only once
- if html.find("id=\""+name+"\"") == -1 and insert != -1:
- out = open(path+".html", "w")
- out.write(html[0:insert+5]);
+ if html.find("id=\""+name+"_small\"") == -1 and insert != -1:
#This should work also with non-generated UML-diagrams. Checks
first
#for generated and then if non-generated diagram exists.
@@ -224,37 +221,26 @@
print "umlrst: embedding %s into %s" % (name, path)
- context_name = name+"_"+path.replace("/","_")
+ context_name = name+"_small_"+path.replace("/","_")
if context_name.endswith(".gen"):
context_name = context_name[0:len(context_name)-4]
create_diagram(old_prefix, context_name, 0.5)
+ out = open(path+".html", "w")
+ out.write(html[0:insert+5]);
#Cut&Pastes imagemap into html
imgmap = open(mputils._slashify(settings['tmpdir'])\
+context_name+".gen.html").read()
- out.write("<map id=\""+name+"\" name=\""+name+"\">\n")
+ out.write("<div class=\"embedded\">")
+ out.write("<map id=\""+name+"_small\" name=\""+name+"_small\">\n")
out.write(imgmap[imgmap.find('>',imgmap.find('<map'))+1:\
imgmap.find('</map>')])
out.write("</map>\n")
- out.write("<div class=\"uml-implicit\">\n")
- if (os.path.isfile(mputils._slashify(settings['tmpdir'])\
- +name+".gen.refers")):
- refers = open(mputils._slashify(settings['tmpdir'])\
- +name+".gen.refers").readlines()
- out.write("<small><strong>"+name+"</strong>: \n")
- for refer in refers:
- out.write("[<a href=\""\
- +mputils.transition_path(path,
refer.replace(".rst", ".gen.html")).replace("\n","")\
-
+"#"+name+"\">"+refer.split("/")[-1].split(".")[0]+"</a>]\n")
- out.write("</small><br/>\n")
-
- out.write("<a id=\""+name+"\"></a>\n")
out.write("<img "\
+"src=\""+mputils._slashify(settings['to_tmpdir'])\
+context_name+".gen.png"\
- +"\" usemap=\"#"+name+"\" alt=\""+name+"\" />\n")
- out.write("</div>\n")
-
+ +"\" usemap=\"#"+name+"_small\" alt=\""+name+"_small\"
/>\n")
+ out.write("</div>")
html = html[insert+5:len(html)]
out.write(html)
out.close()
Index: gzz/metacode/umltool.py
diff -u gzz/metacode/umltool.py:1.24 gzz/metacode/umltool.py:1.25
--- gzz/metacode/umltool.py:1.24 Thu Feb 6 04:23:35 2003
+++ gzz/metacode/umltool.py Thu Feb 6 16:57:42 2003
@@ -77,6 +77,60 @@
stack.append(new)
return stack[0][1]
+def jlinkstr(jlink, box, RoughEdge=1):
+ if jlink != None:
+ if settings.has_key('path'):
+ slash = settings['path'].rfind("/")
+ if slash != -1:
+ path = (settings['path'][0:slash+1] +
target(jlink)).replace("//", "/")
+ else:
+ path = target(jlink).replace("//", "/")
+ if path.rfind("#") != -1:
+ path = path[0:path.rfind("#")]
+ if not os.path.isfile(path):
+# print path
+ return 'showlinkerror("'+jlink+'", ('+box+'));'
+
+ """ If focus is set and 'focus' matches, focus jlink. """
+ #trimming jlink to comparable
+ name = jlink
+ if name.rfind("#") != -1:
+ name = name[0:name.rfind("#")]
+ if name.endswith(".html"): name = name[0:len(name)-5]
+ if name.endswith(".gen"): name = name[0:len(name)-4]
+ #comparing
+ if settings.has_key('focus') and (\
+ settings['focus'].find("_"+name.replace(".", "_")+".") != -1 or \
+ settings['focus'].find("_"+name.replace(".", "_")+"_package") !=
-1):
+ if RoughEdge: return 'showfocus("'+jlink+'",
('+box+'));'+"\n"+'drawRoughEdge(('+box+'));'
+ else: return 'showfocus("'+jlink+'", ('+box+'));'
+ return 'showjlink("'+jlink+'", ('+box+'));'
+ return ""
+
+def target(jlink):
+ """Returns target file of the jlink with
+ path from the current directory."""
+ ts = jlink.split(".")
+ if re.search("html", ts[-1]):
+ if settings.has_key('to_context') and not \
+ jlink.startswith(settings['to_context']):
+ if settings['to_context'].endswith("/"):
+ target = settings['to_context']+jlink
+ else:
+ target = settings['to_context']+"/"+jlink
+ while target.startswith("/"):
+ target = target[1:len(target)]
+ else: target = jlink
+ elif re.match("^[a-z]", ts[-1]):
+ target = (settings['to_javadoc']+"/"\
+ +"/".join(ts)
+ + "/package-summary.html#package_description")
+ else:
+ target = (settings['to_javadoc']+"/"\
+ +"/".join(ts)
+ + ".html")
+ return target
+
class umlException(Exception):
def __init__(self, value):
self.value = value
@@ -101,23 +155,6 @@
curList.addContainedElement(self.name, el)
def defaultjlink(self):
return self.name
- def jlinkstr(self, box):
- if self.jlink != None:
- """ If focus is set and 'focus' matches, focus jlink. """
- #trimming jlink to comparable
- name = self.jlink
- if name.rfind("#") != -1:
- name = name[0:name.rfind("#")]
- if name.endswith(".html"): name = name[0:len(name)-5]
- if name.endswith(".gen"): name = name[0:len(name)-4]
- #comparing
- if settings.has_key('focus') and (\
- settings['focus'].find("_"+name.replace(".", "_")+".") != -1
or \
- settings['focus'].find("_"+name.replace(".",
"_")+"_package") != -1):
-
- return 'showfocus("'+self.jlink+'",
('+box+'));'+"\n"+'drawRoughEdge(('+box+'));'
- return 'showjlink("'+self.jlink+'", ('+box+'));'
- return ""
def repl(self, s):
s = s.replace("%%", self.var)
s = s.replace("%name%", self.name)
@@ -322,7 +359,7 @@
"%%.stereo = nullpicture;")
return self.repl(s)
def drawCode(self):
- s = self.jlinkstr("bboxmeasuredpic(%%)") + """
+ s = jlinkstr(self.jlink, "bboxmeasuredpic(%%)") + """
drawmeasuredpic(%%);
draw bboxmeasuredpic(%%);
"""
@@ -342,13 +379,32 @@
"""
return self.repl(s)
def drawCode(self):
- s = self.jlinkstr("bboxmeasuredpic(%%)") + """
+ s = jlinkstr(self.jlink, "bboxmeasuredpic(%%)") + """
drawmeasuredpic(%%);
draw bboxmeasuredpic(%%);
draw (((0,0)--(15,0)--(15,5)--(0,5)--cycle) shifted %%.nw);
"""
return self.repl(s)
+class mptitle(namedEl):
+ def __init__(self, var, s, l = []):
+ #print "mp:",s,l
+ self.var = var or s
+ self.name = s
+ self.docontents(l)
+ def setupCode(self):
+ s = """
+ picture %%.pict;
+ %%.pict = classTitle("%name%");
+ picmeasurements(%%);
+ """
+ return self.repl(s)
+ def drawCode(self):
+ s = jlinkstr(self.jlink, "bboxmeasuredpic(%%)", 0) + """
+ drawmeasuredpic(%%);
+ draw bboxmeasuredpic(%%);
+ """
+ return self.repl(s)
class simpleEl(namedEl):
def __init__(self, var, s, l):
@@ -449,7 +505,7 @@
fixmeasuredpic(%%);
draw bboxmeasuredpic(%%);
"""+\
- self.jlinkstr("bboxmeasuredpic(%%.titl)")+"""
+ jlinkstr(self.jlink, "bboxmeasuredpic(%%.titl)")+"""
fixmeasuredpic(%%.titl);
drawmeasuredpic(%%.titl);"""
return self.repl(s)
@@ -704,6 +760,7 @@
elif key == "under": type = under
elif key == "left-of": type = leftOf
elif key == "right-of": type = rightOf
+ elif key == "title": type = mptitle
else:
raise umlException("Unknown key! "+key)
return type
@@ -713,9 +770,6 @@
def drawCode(self):
"The code to draw the objects after the user code"
code = "\n".join([e.drawCode() for e in self.list]) + "\n"
- code += """
- showjlinksize("bbox", (bbox currentpicture));
- """
return code
class jlink:
@@ -730,31 +784,10 @@
mapper(self.corners[2], self.corners[3])
)]
#print "Mapped: ", self.corners
- def target(self):
- """Returns target file of the jlink with
- path from the current directory."""
- ts = self.name.split(".")
- if re.search("html", ts[-1]):
- if (settings.has_key('to_context')):
- if settings['to_context'].endswith("/"):
- target = settings['to_context']+self.name
- else:
- target = settings['to_context']+"/"+self.name
- while target.startswith("/"):
- target = target[1:len(target)]
- else: target = self.name
- elif re.match("^[a-z]", ts[-1]):
- target = (settings['to_javadoc']+"/"\
- +"/".join(ts)
- + "/package-summary.html#package_description")
- else:
- target = (settings['to_javadoc']+"/"\
- +"/".join(ts)
- + ".html")
return (target)
def imgmapanchor(self, scale=1.0):
return """<area href="%s" shape="rect" coords="%s" target="_top"
title="%s" alt="%s" />\n""" \
- % (self.target(),
+ % (target(self.name),
",".join(["%s"%(int(c*scale)) for c in self.corners]),
self.name,
self.name)
@@ -763,7 +796,7 @@
if prefix_out == "": prefix_out = prefix_in
if not prefix_out.endswith(".gen"): prefix_out = prefix_out + ".gen"
- settings['focus'] = prefix_out;
+ settings['focus'] = prefix_out
if settings.has_key('tmpdir'):
path = mputils._slashify(settings['tmpdir'])
@@ -772,12 +805,57 @@
s = open(path+prefix_in+".uml").read()
l = parseIndented(s)
m = mplist(l)
-
+
+ refer_draw = ""
+
+ """ Creates the "menu" above the diagram. """
+ """ Some variables are needed :/ """
+ if settings.has_key('name') and settings.has_key('path'):
+ """Refers must exist"""
+ if (os.path.isfile(path+settings['name']+".gen.refers")):
+ refer_file = open(path+settings['name']\
+ +".gen.refers", "r")
+ refers = refer_file.readlines()
+ refer_file.close()
+ """List through in descending order."""
+ refer_names = {}
+ for id_inv in range(len(refers)):
+ id = len(refers)-(id_inv+1)
+ refer_file = open(refers[id].replace(".rst",
".gen.html").replace("\n",""))
+ refer_title = re.compile('<title>([^<]*)</title>')
+ refer_title = refer_title.findall(refer_file.read())
+ refer_file.close()
+ if len(refer_title) > 0: refer_title = refer_title[0]
+ else: refer_title = refers[id].split("/")[-1].split(".")[0]
+
+ slash = settings['path'].rfind("/")
+ if slash != -1:
+ refer_path = settings['path'][0:slash+1].replace("//", "/")
+ refer_jlink = mputils.transition_path(refer_path,
+ refers[id].replace(".rst",
".gen.html").replace("\n",""))
+ else: refer_jlink = refers[id].replace(".rst",
".gen.html").replace("\n","")
+# print "refer:", refers[id], "jlink:",refer_jlink, "path:",
settings['path']
+# refer_name = refers[id].split("/")[-1].split(".")[0]
+ refer_name = randomVar()
+ refer_names[id] = refer_name
+ refer_obj = mptitle(refer_name, refer_title)
+ refer_obj.jlink = refer_jlink+"#"+settings['name']
+ refer_draw += refer_obj.setupCode()
+ if id == len(refers)-1:
+ refer_draw += "\t"+refer_name+".sw =
ulcorner(bbox(currentpicture));\n"
+ else:
+ refer_draw += "\t"+refer_name+".sw = "\
+ +refer_names[id+1]\
+ +".nw;\n"
+ refer_draw += refer_obj.drawCode()
+
gen1 = open(path+prefix_out+".1", "w")
- gen1.write(m.setupCode())
+ gen1.write(m.setupCode()+"\n")
gen1.close()
gen2 = open(path+prefix_out+".2", "w")
- gen2.write(m.drawCode())
+ gen2.write(m.drawCode()+"\n")
+ gen2.write(refer_draw+"\n")
+ gen2.write("showjlinksize(\"bbox\", (bbox currentpicture));\n")
gen2.close()
gen3 = open(path+prefix_out+".3", "w")
gen3.write("""
@@ -838,5 +916,5 @@
targets = []
for l in links:
- targets.append(l.target())
+ targets.append(target(l.name))
return targets
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz doc/uml/.cvsignore doc/gzz.css metacode/mpu...,
Asko Soukka <=