/[papo]/papo/ruff/ruff.py
ViewVC logotype

Diff of /papo/ruff/ruff.py

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

revision 1.8 by jlenton, Mon Nov 24 23:39:00 2003 UTC revision 1.9 by jlenton, Wed Nov 26 19:38:02 2003 UTC
# Line 26  import codecs Line 26  import codecs
26    
27  import pathetic  import pathetic
28  import compute  import compute
29    import caps
30    
31  from errors import *  from errors import *
32    
# Line 53  def init_dentry_from_xml(dentry, dom): Line 54  def init_dentry_from_xml(dentry, dom):
54          for i in ('vfill', 'raw', 'wrap'):          for i in ('vfill', 'raw', 'wrap'):
55              kw[i] = box.getAttribute(i) == 'true'              kw[i] = box.getAttribute(i) == 'true'
56          kw['align'] = {"right": 1, "center": 0}.setdefault(box.getAttribute('align'), -1)          kw['align'] = {"right": 1, "center": 0}.setdefault(box.getAttribute('align'), -1)
57            kw['style'] = box.getAttribute('style') or dentry.style
58          dentry.add_box(*p, **kw)          dentry.add_box(*p, **kw)
59    
60  def init_detail_from_xml(detail, dom):  def init_detail_from_xml(detail, dom):
61      for den in xpath.Evaluate('detail_entry', dom):      for den in xpath.Evaluate('detail_entry', dom):
62          d = detail.add_dentry(den.getAttribute('name'))          d = detail.add_dentry(den.getAttribute('name'))
63            d.style = den.getAttribute('style') or detail.style
64          init_dentry_from_xml(d, den)          init_dentry_from_xml(d, den)
65      for det in xpath.Evaluate('detail', dom):      for det in xpath.Evaluate('detail', dom):
66          d = detail.add_detail(det.getAttribute('name'))          d = detail.add_detail(det.getAttribute('name'))
67            d.style = det.getAttribute('style') or detail.style
68          init_detail_from_xml(d, det)          init_detail_from_xml(d, det)
69      for i in ('header', 'footer'):      for i in ('header', 'footer'):
70          for j in ('', 'page_', 'partial_'):          for j in ('', 'page_', 'partial_'):
# Line 75  def init_detail_from_xml(detail, dom): Line 79  def init_detail_from_xml(detail, dom):
79                            "%s/%s should have an explicit, numeric, height attribute" \                            "%s/%s should have an explicit, numeric, height attribute" \
80                            % (detail.fqdn, n)                            % (detail.fqdn, n)
81                  x=pathetic.Shelf(detail, n, h)                  x=pathetic.Shelf(detail, n, h)
82                    x.style = d.getAttribute('style') or detail.style
83                  setattr(detail, n, x)                  setattr(detail, n, x)
84                  init_dentry_from_xml(x, d)                  init_dentry_from_xml(x, d)
85              else:              else:
# Line 191  class Page: Line 196  class Page:
196                  i = i.render()                  i = i.render()
197              else:              else:
198                  i = [' '*len(r[-1])]                  i = [' '*len(r[-1])]
             print i, maxrlen - len(r) - 1  
199              r.extend(i*(maxrlen - len(r) - 1))              r.extend(i*(maxrlen - len(r) - 1))
200          for i in post:          for i in post:
201              if isinstance(i, pathetic.Pathetic):              if isinstance(i, pathetic.Pathetic):
# Line 213  class Report: Line 217  class Report:
217                                       max_height=max_height,                                       max_height=max_height,
218                                       height=height,                                       height=height,
219                                       encoder=encoder)                                       encoder=encoder)
220            template.style = dom.getAttribute('style') or '12cpi'
221            template.caps = caps.Caps('../ruff/caps/'+(dom.getAttribute('printer') or 'escp'))
222          init_detail_from_xml(template, dom)          init_detail_from_xml(template, dom)
223          self.template = template          self.template = template
224          self.init_stack()          self.init_stack()

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

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