def render_Preload(self, request, template='test.pde'): appid = request.path.split('/')[1] # pde only needs values for now # if Processing-js team gets their act together this might change fonts = vx.getFontPreload(appid) if len(fonts) == 0: return "/* nothing to see here */" font_str = ','.join([x[1] for x in fonts]) # Get html that will be served templateFile = open(template) template = templateFile.read() templateFile.close() # Inject correct handler into html html = template % {'fonts': font_str} request.setHeader("content-type", _mime_types['pde']) # Write html # request.write(html) # request.finish() # Why this works, I'm not sure... Something fishy to be investigated later. return str(html) #server.NOT_DONE_YET
def render_Preload(self, request, template='test.pde'): appid = request.path.split('/')[1] # pde only needs values for now # if Processing-js team gets their act together this might change fonts = vx.getFontPreload(appid) if len(fonts) == 0: return "/* nothing to see here */" font_str = ','.join([x[1] for x in fonts]) # Get html that will be served templateFile = open(template) template = templateFile.read() templateFile.close() # Inject correct handler into html html = template % {'fonts':font_str} request.setHeader("content-type", _mime_types['pde']) # Write html # request.write(html) # request.finish() # Why this works, I'm not sure... Something fishy to be investigated later. return str(html) #server.NOT_DONE_YET
def render_customCSS(self, request): ''' Generates a custom CSS file to create proper @font-face directives ''' appid = request.path.split('/')[1] pre = ""; fonts = vx.getFontPreload(appid) for pair in fonts: pre = pre + '@font-face{\n\tfont-family:"'+str(pair[0])+'";\n\tsrc: url(' + str(pair[1]) + ');\n}\n' self.send_page(request, pre, 'css')
def render_customCSS(self, request): ''' Generates a custom CSS file to create proper @font-face directives ''' appid = request.path.split('/')[1] pre = ""; fonts = vx.getFontPreload(appid) for pair in fonts: pre = pre + '@font-face{\n\tfont-family:"'+str(pair[0])+'";\n\tsrc: url(' + str(pair[1]) + ');\n}\n' request.setHeader("content-type", _mime_types['css']) return pre
def render_customCSS(self, request): ''' Generates a custom CSS file to create proper @font-face directives ''' appid = request.path.split('/')[1] pre = "" fonts = vx.getFontPreload(appid) for pair in fonts: pre = pre + '@font-face{\n\tfont-family:"' + str( pair[0]) + '";\n\tsrc: url(' + str(pair[1]) + ');\n}\n' request.setHeader("content-type", _mime_types['css']) return pre
def render_Preload(self, request, template='test.pde'): appid = request.path.split('/')[1] # pde only needs values for now # if Processing-js team gets their act together this might change fonts = vx.getFontPreload(appid) if len(fonts) == 0: return "/* nothing to see here */" font_str = ','.join([x[1] for x in fonts]) # Get html that will be served templateFile = open(template) template = templateFile.read() templateFile.close() # Inject correct handler into html html = template % {'fonts':font_str} self.send_page(request, html, 'pde')