Try to manage CSS path
This commit is contained in:
16
display.py
16
display.py
@@ -140,10 +140,11 @@ class DisplayHTMLBlockTable(DisplayHTMLBlock):
|
||||
|
||||
class DisplayHTMLPage(object):
|
||||
|
||||
def __init__(self, title, filename):
|
||||
def __init__(self, title, filename, css_path):
|
||||
self.title = title
|
||||
self.filename = filename
|
||||
self.blocks = []
|
||||
self.css_path = css_path
|
||||
|
||||
def getFilename(self):
|
||||
return self.filename;
|
||||
@@ -169,7 +170,8 @@ class DisplayHTMLPage(object):
|
||||
f.write('<html>')
|
||||
f.write('<head>')
|
||||
f.write('<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />')
|
||||
f.write('<link rel="stylesheet" href="iwla.css"/>')
|
||||
for css in self.css_path:
|
||||
f.write('<link rel="stylesheet" href="%s"/>' % (css))
|
||||
if self.title:
|
||||
f.write('<title>%s</title>' % (self.title))
|
||||
f.write('</head>')
|
||||
@@ -180,8 +182,9 @@ class DisplayHTMLPage(object):
|
||||
|
||||
class DisplayHTMLBuild(object):
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, iwla):
|
||||
self.pages = []
|
||||
self.iwla = iwla
|
||||
|
||||
def getPage(self, filename):
|
||||
for page in self.pages:
|
||||
@@ -193,6 +196,13 @@ class DisplayHTMLBuild(object):
|
||||
self.pages.append(page)
|
||||
|
||||
def build(self, root):
|
||||
display_root = self.iwla.getConfValue('DISPLAY_ROOT', '')
|
||||
for res_path in self.iwla.getResourcesPath():
|
||||
target = os.path.abspath(res_path)
|
||||
link_name = os.path.join(display_root, res_path)
|
||||
if not os.path.exists(link_name):
|
||||
os.symlink(target, link_name)
|
||||
|
||||
for page in self.pages:
|
||||
page.build(root)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user