diff --git a/wrp.py b/wrp.py
index 2e28b61..29bdab5 100755
--- a/wrp.py
+++ b/wrp.py
@@ -5,7 +5,7 @@
# with an imagemap of clickable links. This is an adaptation of previous works by
# picidae.net and Paul Hammond.
-__version__ = "1.3"
+__version__ = "1.4"
#
# This program is based on the software picidae.py from picidae.net
@@ -59,11 +59,14 @@ import threading
import Queue
import sys
import logging
+import StringIO
# Request queue (URLs go in here)
REQ = Queue.Queue()
# Response queue (dummy response objects)
RESP = Queue.Queue()
+# Renders dictionary
+RENDERS = {}
#######################
### Linux CODEPATH ###
@@ -373,13 +376,12 @@ if sys.platform == "linux" or sys.platform == "linux2":
qBuffer = QBuffer()
image.save(qBuffer, 'jpg', QUALITY)
- output = open(WebkitRenderer.req_jpg, 'w')
+ output = StringIO.StringIO()
output.write(qBuffer.buffer().data())
- output.close()
+ RENDERS[req[2]] = output
del renderer
- print ">>> done: %s [%d kb]..." % (WebkitRenderer.req_jpg,
- os.path.getsize(WebkitRenderer.req_jpg)/1024)
+ print ">>> done: %s [%d kb]..." % (WebkitRenderer.req_jpg, output.len/1024)
RESP.put('')
@@ -470,10 +472,10 @@ elif sys.platform == "darwin":
if frame == webview.mainFrame():
view = frame.frameView().documentView()
- bitmapdata = self.captureView(view)
- bitmapdata.representationUsingType_properties_(
- AppKit.NSGIFFileType, None).writeToFile_atomically_(
- WebkitLoad.req_gif, objc.YES)
+ output = StringIO.StringIO()
+ output.write(self.captureView(view).representationUsingType_properties_(
+ AppKit.NSGIFFileType, None))
+ RENDERS[WebkitLoad.req_gif] = output
# url of the rendered page
web_url = frame.dataSource().initialRequest().URL().absoluteString()
@@ -490,7 +492,7 @@ elif sys.platform == "darwin":
httpout.write(""
"\n"
"\n" % (WebkitLoad.req_map, WebkitLoad.req_gif))
- mapfile = open(WebkitLoad.req_map, "w+")
+ mapfile = StringIO.StringIO()
mapfile.write("default %s\n" % (web_url))
else:
httpout.write("\n"
@@ -525,7 +527,7 @@ elif sys.platform == "darwin":
httpout.write("