1 |
from __future__ import nested_scopes |
from __future__ import nested_scopes |
2 |
|
from gzz.index import XuLink |
3 |
# Now, this is the start of the REAL demo, the one |
# Now, this is the start of the REAL demo, the one |
4 |
# with Xanadu links between PDF and text. |
# with Xanadu links between PDF and text. |
5 |
|
|
12 |
|
|
13 |
space = gzz.impl.ModularSpace(*tools.spaceArgList()) |
space = gzz.impl.ModularSpace(*tools.spaceArgList()) |
14 |
xuindexer = gzz.index.impl.TransientXuIndexer() |
xuindexer = gzz.index.impl.TransientXuIndexer() |
15 |
|
enfoverlap = gzz.index.IndexManager.getEnfiladeOverlap(space) |
16 |
|
|
17 |
enfMaker = gzz.media.impl.Enfilade1DImpl.Enfilade1DImplMaker() |
enfMaker = gzz.media.impl.Enfilade1DImpl.Enfilade1DImplMaker() |
18 |
|
|
19 |
# A PDF file |
# A PDF file |
34 |
c1 = home.N(d1) |
c1 = home.N(d1) |
35 |
c2 = c1.N(d1) |
c2 = c1.N(d1) |
36 |
|
|
37 |
space.cellTexter.setEnfilade(c1, enfMaker.makeEnfilade(pagescroll1.getCurrent())) |
pages1span = pagescroll1.getCurrent() |
38 |
space.cellTexter.setEnfilade(c2, enfMaker.makeEnfilade(pagescroll2.getCurrent())) |
pages2span = pagescroll2.getCurrent() |
39 |
|
pages1 = enfMaker.makeEnfilade(pages1span) |
40 |
|
pages2 = enfMaker.makeEnfilade(pages2span) |
41 |
|
|
42 |
|
xuindexer.add(XuLink( |
43 |
|
enfMaker.makeEnfilade(pages1span.subSpan(1,2).subArea(100,100,300,100)), |
44 |
|
enfMaker.makeEnfilade(pages2span.subSpan(2,3).subArea(200,100,200,200)) |
45 |
|
)) |
46 |
|
|
47 |
|
space.cellTexter.setEnfilade(c1, pages1) |
48 |
|
space.cellTexter.setEnfilade(c2, pages2) |
49 |
|
|
50 |
globalcursor = None |
globalcursor = None |
51 |
|
|
62 |
if 1: # PDF |
if 1: # PDF |
63 |
list = content.getList() |
list = content.getList() |
64 |
print list |
print list |
65 |
content = list[0] |
contentspan = list[0] |
66 |
prect = [ |
prect = [ |
67 |
GLSpans.getRect(content.subSpan(i,i+1)) |
GLSpans.getRect(contentspan.subSpan(i,i+1)) |
68 |
for i in range(0,content.length())] |
for i in range(0,content.length())] |
69 |
globalpap = [ |
globalpap = [ |
70 |
pdfpaper(p) for p in prect |
pdfpaper(p) for p in prect |
71 |
] |
] |
72 |
|
|
73 |
|
forw = xuindexer.getForwardIndex().getMatches(content) |
74 |
|
back = xuindexer.getBackwardIndex().getMatches(content) |
75 |
|
|
76 |
|
print "Xu: ",forw,back |
77 |
|
|
78 |
java.lang.System.gc() |
java.lang.System.gc() |
79 |
AbstractUpdateManager.chg() |
AbstractUpdateManager.chg() |
80 |
|
|