30 |
identityManager = DummyIdentityManager() |
identityManager = DummyIdentityManager() |
31 |
slicer = SingleSlicer("foo") |
slicer = SingleSlicer("foo") |
32 |
|
|
33 |
|
usingNormalBindings = 0 |
34 |
|
|
35 |
from java.io import * |
PPDIR=os.getcwd()+'/gzz/modules/pp/example/' |
36 |
from java.util.zip import * |
def clean_data(args=''): |
37 |
|
os.system('rm '+PPDIR+'b_*') |
38 |
# new zipfile initialazion |
os.system('rm '+PPDIR+'d*') |
39 |
if 1: |
os.system('rm '+PPDIR+'ps_F*') |
40 |
o = ZipOutputStream(FileOutputStream('/tmp/pp/a.zip')); |
|
41 |
o.putNextEntry(ZipEntry("ps_foo")); |
if args=='full': |
42 |
o.write(0x02); |
os.system('rm '+PPDIR+'ps_*') |
43 |
o.closeEntry(); |
os.system('rm '+PPDIR+'pp.gz') |
44 |
o.close(); |
|
45 |
|
def return_data(): |
46 |
|
clean_data() |
47 |
|
os.system('tar -xzvf ' +PPDIR+ 'pp.gz -C '+PPDIR) |
48 |
|
|
49 |
|
|
50 |
class PPView2Scene: |
class PPView2Scene: |
51 |
def __init__(self): |
def __init__(self): |
52 |
w.setLocation(0,0,1024,768) |
w.setLocation(0,0,1024,768) |
53 |
|
return_data() |
|
#os.rename(os.getcwd()+'/gzz/modules/pp/example/ps_FOO', |
|
|
# os.getcwd()+'/gzz/modules/pp/example/ps_foo') |
|
|
|
|
|
|
|
54 |
|
|
55 |
# Next, the mediaserver we'll save to. |
# Next, the mediaserver we'll save to. |
|
#self.ms = gzz.mediaserver.SimpleMediaserver( |
|
|
# gzz.mediaserver.storage.DirStorer(File(os.getcwd()+'/gzz/modules/pp/example/'))) |
|
56 |
self.ms = gzz.mediaserver.SimpleMediaserver( |
self.ms = gzz.mediaserver.SimpleMediaserver( |
57 |
gzz.mediaserver.storage.ZipStorer( |
gzz.mediaserver.storage.DirStorer(File(os.getcwd()+'/gzz/modules/pp/example/'))) |
|
ZipFile('/tmp/pp/a.zip') )) |
|
|
|
|
|
|
|
58 |
|
|
59 |
# We need to get a "filer" for storing versions of our space. |
# We need to get a "filer" for storing versions of our space. |
60 |
# Accept this part as 'magic' for now... |
# Accept this part as 'magic' for now... |
65 |
self.filer = self.filers.getFiler("foo") |
self.filer = self.filers.getFiler("foo") |
66 |
self.avc = gzz.view.AbstractViewContext() |
self.avc = gzz.view.AbstractViewContext() |
67 |
|
|
68 |
if 0: |
if 1: |
69 |
#load space from disk |
#load space from disk |
70 |
self.space = gzz.impl.ModularSpace(self.filer.load(), *tools.spaceArgList()) |
self.space = gzz.impl.ModularSpace(self.filer.load(), *tools.spaceArgList()) |
71 |
self.ppactions = gzz.modules.pp.PPActionsImpl(self.space) |
self.ppactions = gzz.modules.pp.PPActionsImpl(self.space) |
103 |
self.poly = ["FILL", "LINE"] |
self.poly = ["FILL", "LINE"] |
104 |
self.map = None |
self.map = None |
105 |
self.mode = 0 |
self.mode = 0 |
106 |
|
clean_data() |
|
usingNormalBindings = 0 |
|
107 |
|
|
108 |
|
|
109 |
def key(self, key): |
def key(self, key): |
110 |
if key == "Ctrl-R": |
if key == "Ctrl-R": |
|
print 'Reload' |
|
111 |
loadScenes() |
loadScenes() |
112 |
|
if key == "Alt-X": |
113 |
|
print 'Full save!' |
114 |
|
clean_data('full') |
115 |
|
self.key('Ctrl-X') |
116 |
|
|
117 |
if key == "Ctrl-I": |
if key == "Ctrl-I": |
118 |
print "INTERPLIST" |
print "INTERPLIST" |
119 |
self.vs.dump() |
self.vs.dump() |
120 |
print self.vs.matcher.interpList(self.vs.matcher) |
print self.vs.matcher.interpList(self.vs.matcher) |
121 |
if key == "Ctrl-X": |
if key == "Ctrl-X": |
122 |
print 'Save...' |
print 'Save...' |
123 |
|
return_data() |
124 |
|
|
125 |
# Now, saving the space is a one-liner: |
# Now, saving the space is a one-liner: |
126 |
self.filers.saveAll(self.ppv.space.getSlicer().exportAll()) |
self.filers.saveAll(self.ppv.space.getSlicer().exportAll()) |
127 |
|
os.system('mv '+ PPDIR +'ps_FOO '+ PPDIR+'ps_foo') |
128 |
|
os.system('cd '+PPDIR+' && tar -czvf pp.gz b_* d*') |
129 |
|
clean_data() |
130 |
|
|
131 |
# Loading |
# Loading |
132 |
if key == "Ctrl-Z": |
if key == "Ctrl-Z": |
133 |
print 'Loading scene' |
print 'Loading scene' |
134 |
|
print 'DOES NOT WORK' |
135 |
|
loadScenes() |
136 |
|
|
137 |
self.space = gzz.impl.ModularSpace(self.filer.load(), *tools.spaceArgList()) |
self.space = gzz.impl.ModularSpace(self.filer.load(), *tools.spaceArgList()) |
138 |
|
|
139 |
# set space to *everywhere* ! |
# set space to *everywhere* ! |