This commit is contained in:
Kovid Goyal 2011-03-20 10:53:11 -06:00
parent 73d13c3f6a
commit 3de3f3d4fb
3 changed files with 5 additions and 3 deletions

View File

@ -18,6 +18,6 @@ def recipe_title_callback(raw):
return eval(raw.decode('utf-8')) return eval(raw.decode('utf-8'))
vipy.session.add_content_browser('.r', ',r', 'Recipe', vipy.session.add_content_browser('.r', ',r', 'Recipe',
vipy.session.glob_based_iterator(os.path.join(project_dir, 'resources', 'recipes', '*.recipe')), vipy.session.glob_based_iterator(os.path.join(project_dir, 'recipes', '*.recipe')),
vipy.session.regexp_based_matcher(r'title\s*=\s*(?P<title>.+)', 'title', recipe_title_callback)) vipy.session.regexp_based_matcher(r'title\s*=\s*(?P<title>.+)', 'title', recipe_title_callback))
EOFPY EOFPY

View File

@ -22,6 +22,7 @@ border_style_map = {
'dot-dot-dash': 'dotted', 'dot-dot-dash': 'dotted',
'outset': 'outset', 'outset': 'outset',
'tripple': 'double', 'tripple': 'double',
'triple': 'double',
'thick-thin-small': 'solid', 'thick-thin-small': 'solid',
'thin-thick-small': 'solid', 'thin-thick-small': 'solid',
'thin-thick-thin-small': 'solid', 'thin-thick-thin-small': 'solid',

View File

@ -251,12 +251,12 @@ class WMF(object):
img.load(bmp) img.load(bmp)
return img.export('png') return img.export('png')
def wmf_unwrap(wmf_data): def wmf_unwrap(wmf_data, verbose=0):
''' '''
Return the largest embedded raster image in the WMF. Return the largest embedded raster image in the WMF.
The returned data is in PNG format. The returned data is in PNG format.
''' '''
w = WMF() w = WMF(verbose=verbose)
w(wmf_data) w(wmf_data)
if not w.has_raster_image: if not w.has_raster_image:
raise ValueError('No raster image found in the WMF') raise ValueError('No raster image found in the WMF')
@ -266,4 +266,5 @@ if __name__ == '__main__':
wmf = WMF(verbose=4) wmf = WMF(verbose=4)
wmf(open(sys.argv[-1], 'rb')) wmf(open(sys.argv[-1], 'rb'))
open('/t/test.bmp', 'wb').write(wmf.bitmaps[0]) open('/t/test.bmp', 'wb').write(wmf.bitmaps[0])
open('/t/test.png', 'wb').write(wmf.to_png())