/[gzz]/gzz/metacode/umltool.py
ViewVC logotype

Diff of /gzz/metacode/umltool.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by humppake, Thu Dec 19 16:13:18 2002 UTC revision 1.8 by humppake, Thu Dec 19 22:24:42 2002 UTC
# Line 108  class namedEl: Line 108  class namedEl:
108          return self.name          return self.name
109      def jlinkstr(self, box):      def jlinkstr(self, box):
110          if self.jlink != None:          if self.jlink != None:
111              return 'showjlink("'+self.jlink+'", ('+box+'));'              """ If focus is set and matches, focus jlink. """
112                #trimming jlink to comparable
113                name = self.jlink
114                if name.rfind("#") != -1:
115                    name = name[0:name.rfind("#")]
116                if name.endswith(".html"): name = name[0:len(name)-5]
117                if name.endswith(".gen"): name = name[0:len(name)-4]
118                #comparing
119                if settings.has_key('focus') and (\
120                      settings['focus'].find("_"+self.name.replace(".", "_")+".") != -1 or \
121                      settings['focus'].find("_"+self.name.replace(".", "_")+"_package") != -1):
122                    return 'showfocus("'+self.jlink+'", ('+box+'));'
123                return 'showjlink("'+self.jlink+'", ('+box+'));'
124          return ""          return ""
125      def repl(self, s):      def repl(self, s):
126          s = s.replace("%%", self.var)          s = s.replace("%%", self.var)
# Line 662  class jlink: Line 674  class jlink:
674              mapper(self.corners[2], self.corners[3])              mapper(self.corners[2], self.corners[3])
675          )]          )]
676          print "Mapped: ", self.corners          print "Mapped: ", self.corners
677      def getTarget(self):      def target(self):
678          """Returns jlink's target with "full path",          """Returns target file of the jlink with
679          but without .foo postfix."""             path from the current directory."""
         ts = self.name.split(".")  
         target = (settings['javadoc']+"/"+"/".join(ts))  
         return (target)  
     def imgmapanchor(self, zoom=100):  
680          ts = self.name.split(".")          ts = self.name.split(".")
681          if re.search("html", ts[-1]):          if re.search("html", ts[-1]):
682              target = self.name              if (settings.has_key('to_context')):
683                    if settings['to_context'].endswith("/"):
684                        target = settings['to_context']+self.name
685                    else:
686                        target = settings['to_context']+"/"+self.name
687                    while target.startswith("/"):
688                        target = target[1:len(target)]
689                else: target = self.name
690          elif re.match("^[a-z]", ts[-1]):          elif re.match("^[a-z]", ts[-1]):
691              target = (settings['to_javadoc']+"/"\              target = (settings['to_javadoc']+"/"\
692                        +"/".join(ts)                        +"/".join(ts)
# Line 680  class jlink: Line 695  class jlink:
695              target = (settings['to_javadoc']+"/"\              target = (settings['to_javadoc']+"/"\
696                        +"/".join(ts)                        +"/".join(ts)
697                        + ".html")                        + ".html")
698          return """<area href="%s" shape="rect" coords="%s" target="_top" title="%s" alt="%s" />\n""" % (          return (target)
699              target, ",".join(["%s"%(int(c*(zoom*0.01))) for c in self.corners]), self.name, self.name)      def imgmapanchor(self, scale=1.0):
700            return """<area href="%s" shape="rect" coords="%s" target="_top" title="%s" alt="%s" />\n""" \
701                   % (self.target(),
702                      ",".join(["%s"%(int(c*1.0)) for c in self.corners]),
703                      self.name,
704                      self.name)
705                    
   
706  def roundDown(x):  def roundDown(x):
707      return int(float(x) - 5)      return int(float(x) - 5)
708  def roundUp(x):  def roundUp(x):
# Line 706  class psbbox: Line 725  class psbbox:
725                  "-xsize", self.w * scale, "-ysize", self.h * scale,                  "-xsize", self.w * scale, "-ysize", self.h * scale,
726                  "-xborder", 0, "-yborder", 0]]                  "-xborder", 0, "-yborder", 0]]
727    
728  def run(prefix_in, prefix_out="", zoom=100):  def run(prefix_in, prefix_out="", scale=1.0):
729      if prefix_out == "": prefix_out = prefix_in      if prefix_out == "": prefix_out = prefix_in
730      if not prefix_out.endswith(".gen"): prefix_out = prefix_out + ".gen"      if not prefix_out.endswith(".gen"): prefix_out = prefix_out + ".gen"
731    
732        settings['focus'] = prefix_out;
733    
734      if settings.has_key('tmpdir'):      if settings.has_key('tmpdir'):
735          path = settings['tmpdir'] + "/"          path = settings['tmpdir'] + "/"
736      else: path = '';      else: path = '';
# Line 788  def run(prefix_in, prefix_out="", zoom=1 Line 809  def run(prefix_in, prefix_out="", zoom=1
809          </HTML>          </HTML>
810          """ % { "prefix_in": prefix_in,          """ % { "prefix_in": prefix_in,
811                  "filename": prefix_out+".png",                  "filename": prefix_out+".png",
812                  "links": " ".join([l.imgmapanchor(zoom) for l in links]) }                  "links": " ".join([l.imgmapanchor(scale) for l in links]) }
813      html = open(path+prefix_out+".html", "w")      html = open(path+prefix_out+".html", "w")
814      html.write(htmlcode)      html.write(htmlcode)
815      html.close()      html.close()
816    
817      targets = []      targets = []
818      for l in links:      for l in links:
819          targets.append(l.getTarget())          targets.append(l.target())
820      return targets      return targets

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26