--- Impressive-0.10.3/impressive.py 2011-11-28 14:08:14.000000000 +0100
+++ Impressive-0.10.4-WIP/impressive.py 2011-11-28 14:03:46.000000000 +0100
@@ -511,7 +511,7 @@
try:
return func(*args, **kwargs)
except:
- print >>sys.stderr, "----- Exception in user function ----"
+ print >>sys.stderr, "----- Unhandled Exception ----"
traceback.print_exc(file=sys.stderr)
print >>sys.stderr, "----- End of traceback -----"
@@ -1296,7 +1296,7 @@
return self.parse_tokens(filter(None, data.split()))
def getobj(self, obj, force_type=None):
- if obj.__class__ == PDFref:
+ if isinstance(obj, PDFref):
obj = obj.ref
if type(obj) != types.IntType:
raise PDFError, "object is not a valid reference"
@@ -1432,11 +1432,14 @@
if 'Dest' in node:
dest = self.dest2page(node['Dest'])
elif 'A' in node:
- action = node['A']['S']
+ a = node['A']
+ if isinstance(a, PDFref):
+ a = self.getobj(a)
+ action = a['S']
if action == 'URI':
- dest = node['A'].get('URI', None)
+ dest = a.get('URI', None)
elif action == 'GoTo':
- dest = self.dest2page(node['A'].get('D', None))
+ dest = self.dest2page(a.get('D', None))
if dest:
return tuple(node['Rect'] + [dest])
except PDFError:
@@ -2013,13 +2018,13 @@
for pdf in FileProps:
if not pdf.lower().endswith(".pdf"): continue
if RTrestart: break
- ParsePDF(pdf)
+ SafeCall(ParsePDF, [pdf])
if RTrestart: continue
for page in xrange(1, PageCount + 1):
if RTrestart: break
if (page != p1) and (page != p2) \
and (page >= PageRangeStart) and (page <= PageRangeEnd):
- PageImage(page)
+ SafeCall(PageImage, [page])
RTrunning = False
if CacheMode >= FileCache:
print >>sys.stderr, "Background rendering finished, used %.1f MiB of disk space." %\
@@ -3821,7 +3826,7 @@
if not CacheMode:
for pdf in FileProps:
if pdf.lower().endswith(".pdf"):
- ParsePDF(pdf)
+ SafeCall(ParsePDF, [pdf])
# start output and enter main loop
StartTime = pygame.time.get_ticks()