import tempfile import os import string from grailutil import getenv, which from Tkinter import * from formatter import AS_IS _FILTERCMD = 'djpeg' _FILTERARG = '-gif' _FILTERPATH = which(_FILTERCMD, string.splitfields(getenv('PATH'), ':')) if hasattr(os, 'popen') and _FILTERPATH: _FILTER = _FILTERPATH + ' ' + _FILTERARG class parse_image_jpeg: """Parser for image/jpeg files. Collect all the data on a temp file and then create an in-line image from it. """ def __init__(self, viewer, reload=0): self.broken = None self.tf = self.tfname = None self.viewer = viewer self.viewer.new_font((AS_IS, AS_IS, AS_IS, 1)) self.tfname = tempfile.mktemp() self.tf = os.popen(_FILTER + '>' + self.tfname, 'wb') self.label = Label(self.viewer.text, text=self.tfname, highlightthickness=0,
import tempfile import os import string from grailutil import getenv, which from Tkinter import * from formatter import AS_IS _FILTERCMD = 'djpeg' _FILTERARG = '-gif' _FILTERPATH = which(_FILTERCMD, string.splitfields(getenv('PATH'), ':')) if hasattr(os, 'popen') and _FILTERPATH: _FILTER = _FILTERPATH + ' ' + _FILTERARG class parse_image_jpeg: """Parser for image/jpeg files. Collect all the data on a temp file and then create an in-line image from it. """ def __init__(self, viewer, reload=0): self.broken = None self.tf = self.tfname = None self.viewer = viewer self.viewer.new_font((AS_IS, AS_IS, AS_IS, 1)) self.tfname = tempfile.mktemp() self.tf = os.popen(_FILTER + '>' + self.tfname, 'wb') self.label = Label(self.viewer.text, text=self.tfname,
import tempfile import os import string from grailutil import getenv, which from Tkinter import * from formatter import AS_IS from PIL import Image, ImageTk SVG_WIDTH_PX = 600 _FILTERCMD = 'inkscape' _FILTERARG = '-z -w %u -e %s.png %s' _FILTERPATH = which("inkscape", string.splitfields(getenv('PATH'), ':')) if hasattr(os, 'popen') and _FILTERPATH: _FILTER = _FILTERPATH + ' ' + _FILTERARG class parse_image_svgxml: """Parser for image/svg+xml files. Collect all the data on a temp file and then create an in-line image from it. """ def __init__(self, viewer, reload=0): self.broken = None self.tf = self.tfname = None self.viewer = viewer self.viewer.new_font((AS_IS, AS_IS, AS_IS, 1)) self.tfname = tempfile.mktemp() self.tf = os.popen('cat >' + self.tfname, 'wb')
import tempfile import os import string from grailutil import getenv, which from Tkinter import * from formatter import AS_IS from PIL import Image, ImageTk SVG_WIDTH_PX = 600 _FILTERCMD = 'inkscape' _FILTERARG = '-z -w %u -e %s.png %s' _FILTERPATH = which("inkscape", string.splitfields(getenv('PATH'), ':')) if hasattr(os, 'popen') and _FILTERPATH: _FILTER = _FILTERPATH + ' ' + _FILTERARG class parse_image_svgxml: """Parser for image/svg+xml files. Collect all the data on a temp file and then create an in-line image from it. """ def __init__(self, viewer, reload=0): self.broken = None self.tf = self.tfname = None self.viewer = viewer self.viewer.new_font((AS_IS, AS_IS, AS_IS, 1))