/[alph]/alph/alph/util/dscutil.py
ViewVC logotype

Diff of /alph/alph/util/dscutil.py

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

revision 1.3 by benja, Tue Apr 22 14:52:45 2003 UTC revision 1.4 by tjl, Fri Jun 6 20:04:39 2003 UTC
# Line 3  import jarray Line 3  import jarray
3  import alph  import alph
4  from copy import deepcopy  from copy import deepcopy
5    
6    dbg = 0
7    
8  def reliablePS2DSC(infile, outfile):  def reliablePS2DSC(infile, outfile):
9      """Convert a postscript file to a .dsc file reliably.      """Convert a postscript file to a .dsc file reliably.
10      Because several files have broken dsc comments, we      Because several files have broken dsc comments, we
# Line 16  def reliablePS2DSC(infile, outfile): Line 18  def reliablePS2DSC(infile, outfile):
18    
19      cmdline = cmdline % locals()      cmdline = cmdline % locals()
20    
21      print 'cmdline -- ', cmdline      if dbg:
22            print 'cmdline -- ', cmdline
23      result = os.system(cmdline)      result = os.system(cmdline)
24      print 'result -- ', result      if dbg:
25            print 'result -- ', result
26      if result: return 0      if result: return 0
27    
28      return 1      return 1
# Line 28  def reliablePDF2DSC(infile, outfile): Line 32  def reliablePDF2DSC(infile, outfile):
32      """      """
33      cmdline = "pdf2dsc %(infile)s %(outfile)s" % locals()      cmdline = "pdf2dsc %(infile)s %(outfile)s" % locals()
34    
35      print "CMD:",cmdline      if dbg:
36            print "CMD:",cmdline
37      result = os.system(cmdline)      result = os.system(cmdline)
38      print "PDFDSC:",result      if dbg:
39            print "PDFDSC:",result
40      if result: return 0      if result: return 0
41    
42      return 1      return 1
# Line 57  def _dsctokens(string): Line 63  def _dsctokens(string):
63              lastspace = 0              lastspace = 0
64      if not lastspace:      if not lastspace:
65          tokens.append(string[last:])          tokens.append(string[last:])
66      print "Tok: '"+string+"' ",tokens      if dbg:
67            print "Tok: '"+string+"' ",tokens
68      return tokens      return tokens
69    
70  class SinglePageInfo:  class SinglePageInfo:
# Line 85  def dsc2pageinfo(infile): Line 92  def dsc2pageinfo(infile):
92      mtypes = {}      mtypes = {}
93      for i in range(0, len(media)/6):      for i in range(0, len(media)/6):
94          (name, w, h, weight, color, type) = media[i*6:(i+1)*6]          (name, w, h, weight, color, type) = media[i*6:(i+1)*6]
95          print "Docmedia '%(name)s' %(w)s %(h)s %(weight)s %(color)s %(type)s" \          if dbg:
96                print "Docmedia '%(name)s' %(w)s %(h)s %(weight)s %(color)s %(type)s" \
97                      % locals()                      % locals()
98          mtypes[name] = (float(w),float(h))          mtypes[name] = (float(w),float(h))
99    

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

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