Mercurial > my-enso-commands
changeset 6:c41c4896c97e
upload image cmd now accepts more image types in clipboard, changed cmd_monospace to use tt instead of pre.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Wed, 20 Aug 2008 11:10:05 -0700 |
parents | 56d44190362e |
children | 41bc59775872 |
files | my-enso-commands.py |
diffstat | 1 files changed, 10 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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 "<pre>%s</pre>" % text + return "<tt>%s</tt>" % text def cmd_normalize(ensoapi): normal_template = "<span style=\"font-weight: normal;\">%s</span>"