Changeset 4562

Show
Ignore:
Timestamp:
10/24/08 06:18:46 (3 months ago)
Author:
lei
Message:

Fixed Python 2.4 issue (ticket #3631).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • pagetodocintegration/0.11/pagetodoc/pagetodoc.py

    r4197 r4562  
    2828    img_max_x = '0' 
    2929    img_max_y = '0' 
     30    dpi = '96' 
     31    cm2inch = 2.54 
    3032     
    3133    verbose = False 
     
    4143        self.img_max_x = self.env.config.get('pagetodoc', 'img_max_x', self.img_max_x) 
    4244        self.img_max_y = self.env.config.get('pagetodoc', 'img_max_y', self.img_max_y) 
     45        self.img_max_y = self.env.config.get('pagetodoc', 'dpi', self.dpi) 
    4346         
    4447        # XSL-Transformation         
     
    9699        self.perform_workarounds(htmlfilepath, 'html') 
    97100     
    98         cmd = 'xsltproc %s -o %s %s %s' % (('-v' if self.verbose else ''),  wordfilepath, xsltfilepath, htmlfilepath) 
     101        if self.verbose: 
     102            verb = '-v' 
     103        else: 
     104            verb = '' 
     105        cmd = 'xsltproc %s -o %s %s %s' % (verb, wordfilepath, xsltfilepath, htmlfilepath) 
    99106        self.execute_external_program(cmd) 
    100107         
     
    200207         
    201208        # resize images, if wanted, using ImageMagick 
    202         if int(self.img_max_x) > 0 and int(self.img_max_y) > 0: 
    203             args = "-resize '%sx%s>'" % (self.img_max_x, self.img_max_y) 
     209        if int(self.img_max_x)/self.cm2inch*int(self.dpi) > 0 and int(self.img_max_y)/self.cm2inch*int(self.dpi) > 0: 
     210            #args = "-density %sd -resize '%sx%s>'" % (self.dpi, self.img_max_x, self.img_max_y) 
     211            args = "-resize '%sx%s>' -resample %s" % (self.img_max_x, self.img_max_y, self.dpi) 
     212             
    204213            cmd = 'convert %s %s %s' % (fn, args, fn) 
    205214            self.execute_external_program(cmd)