Changeset 3574

Show
Ignore:
Timestamp:
04/29/08 13:07:09 (7 months ago)
Author:
robert_martin
Message:

Uses the image library to update the width of the image if it's changed.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • diavisviewplugin/0.11/DiaVisView/DiaVisView.py

    r3573 r3574  
     1#!/usr/bin/python 
    12# -*- coding: utf-8 -*- 
    23# This software is licensed as described in the file COPYING, which 
     
    1415import re 
    1516import gzip 
     17import Image 
     18 
    1619 
    1720from genshi.builder import tag 
     
    116119        except Exception: 
    117120            png_mtime = 0 
     121        else: 
     122            try: 
     123                im = Image.open(png_path) 
     124            except Exception, e: 
     125                self.env.log.info('Error checking original png file width for Dia = %s',e) 
     126                raise Exception('Error checking original png file width for Dia.') 
     127            existing_width = im.size[0] 
     128 
    118129 
    119130        self.env.log.info('Comparing dia and png file modification times : %s, %s',dia_mtime,dia_mtime) 
    120131 
    121         if dia_mtime > png_mtime: 
     132 
     133 
     134        if (dia_mtime > png_mtime) or (existing_width != width): 
    122135            try: 
    123136                # The file maybe compressed.  The name has to be prepended to keep the extension.