26
26
from optparse import OptionParser
27
27
import os
28
28
import re
29
+ import shutil
29
30
import sys
30
31
from unicodedata import normalize
31
32
@@ -125,6 +126,7 @@ def run(self):
125
126
if self ._with_viewer :
126
127
for name in self ._slide .associated_images :
127
128
self ._run_image (name )
129
+ self ._write_static ()
128
130
self ._shutdown ()
129
131
130
132
def _run_image (self , associated = None ):
@@ -142,6 +144,22 @@ def _run_image(self, associated=None):
142
144
DeepZoomImageTiler (dz , basename , self ._format , associated ,
143
145
self ._queue ).run ()
144
146
147
+ def _write_static (self ):
148
+ basesrc = os .path .join (os .path .dirname (os .path .abspath (__file__ )),
149
+ 'static' )
150
+ basedst = os .path .join (self ._basename , 'static' )
151
+ self ._copydir (basesrc , basedst )
152
+ self ._copydir (os .path .join (basesrc , 'images' ),
153
+ os .path .join (basedst , 'images' ))
154
+
155
+ def _copydir (self , src , dest ):
156
+ if not os .path .exists (dest ):
157
+ os .makedirs (dest )
158
+ for name in os .listdir (src ):
159
+ srcpath = os .path .join (src , name )
160
+ if os .path .isfile (srcpath ):
161
+ shutil .copy (srcpath , os .path .join (dest , name ))
162
+
145
163
_punct_re = re .compile (r'[\t !"#$%&\'()*\-/<=>?@\[\\\]^_`{|},.]+' )
146
164
@classmethod
147
165
def _slugify (cls , text ):
0 commit comments