# HG changeset patch # User Atul Varma # Date 1219255805 25200 # Node ID c41c4896c97e86d9b5338a4ac3d555d9431f0d72 # Parent 56d44190362e51d54cd57ac108d53b1e64fe0758 upload image cmd now accepts more image types in clipboard, changed cmd_monospace to use tt instead of pre. diff -r 56d44190362e -r c41c4896c97e my-enso-commands.py --- a/my-enso-commands.py Sat Jun 07 16:53:59 2008 -0700 +++ b/my-enso-commands.py Wed Aug 20 11:10:05 2008 -0700 @@ -58,12 +58,16 @@ import AppKit pb = AppKit.NSPasteboard.generalPasteboard() + tiffbytes = None if pb.availableTypeFromArray_([AppKit.NSTIFFPboardType]): - bytes = pb.dataForType_(AppKit.NSTIFFPboardType).bytes() - datafile = StringIO(str(bytes)) - return datafile - else: - return None + tiffbytes = pb.dataForType_(AppKit.NSTIFFPboardType).bytes() + elif pb.availableTypeFromArray_([AppKit.NSPICTPboardType]): + img = AppKit.NSImage.alloc().initWithPasteboard_(pb) + tiffbytes = img.TIFFRepresentation().bytes() + + if tiffbytes: + return StringIO(str(tiffbytes)) + return None def image_command(func): def wrapper(ensoapi): @@ -201,7 +205,7 @@ @htmlifier def cmd_monospace(ensoapi, text): - return "
%s
" % text + return "%s" % text def cmd_normalize(ensoapi): normal_template = "%s"