diff --git a/wrp.py b/wrp.py
index c984dc6..7cba619 100755
--- a/wrp.py
+++ b/wrp.py
@@ -210,18 +210,45 @@ if sys.platform == "linux" or sys.platform == "linux2":
httpout = WebkitRenderer.httpout
+ frame = self._view.page().currentFrame()
+ web_url = frame.url().toString()
+
# Write URL map
httpout.write("\n"
- "\n
\n"
- "
\n"
- "\n")
+
+ httpout.write("\n\n")
+
+ if ISMAP == "true":
+ RENDERS[WebkitRenderer.req_map] = mapfile
return image
@@ -355,10 +382,10 @@ if sys.platform == "linux" or sys.platform == "linux2":
while True:
req = REQ.get()
WebkitRenderer.httpout = req[0]
- rurl = req[1]
+ WebkitRenderer.req_url = req[1]
WebkitRenderer.req_jpg = req[2]
WebkitRenderer.req_map = req[3]
- if rurl == "http://wrp.stop/":
+ if WebkitRenderer.req_url == "http://wrp.stop/":
print ">>> Terminate Request Received"
QApplication.exit(0)
break
@@ -372,7 +399,7 @@ if sys.platform == "linux" or sys.platform == "linux2":
renderer.wait = WAIT
renderer.grabWholeWindow = False
- image = renderer.render(rurl)
+ image = renderer.render(WebkitRenderer.req_url)
qBuffer = QBuffer()
image.save(qBuffer, 'jpg', QUALITY)
@@ -606,16 +633,19 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
default_url = re.match(r"\S+\s+(\S+)", line).group(1)
elif re.match(r"(\S+)", line).group(1) == "rect":
- rect = re.match(r"(\S+)\s+(\S+)\s+(\d+),(\d+)\s+(\d+),(\d+)", line)
- min_x = int(rect.group(3))
- min_y = int(rect.group(4))
- max_x = int(rect.group(5))
- max_y = int(rect.group(6))
- if (req_x >= min_x) and \
- (req_x <= max_x) and \
- (req_y >= min_y) and \
- (req_y <= max_y):
- goto_url = rect.group(2)
+ try:
+ rect = re.match(r"(\S+)\s+(\S+)\s+(\d+),(\d+)\s+(\d+),(\d+)", line)
+ min_x = int(rect.group(3))
+ min_y = int(rect.group(4))
+ max_x = int(rect.group(5))
+ max_y = int(rect.group(6))
+ if (req_x >= min_x) and \
+ (req_x <= max_x) and \
+ (req_y >= min_y) and \
+ (req_y <= max_y):
+ goto_url = rect.group(2)
+ except AttributeError:
+ pass
if goto_url == "none":
goto_url = default_url