예제 #1
0
    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
예제 #2
0
파일: http.py 프로젝트: anrl/W12x
	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
예제 #3
0
파일: http.py 프로젝트: debashish1711/Vx12
	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')
예제 #4
0
파일: http.py 프로젝트: anrl/W12x
	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
예제 #5
0
    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
예제 #6
0
파일: http.py 프로젝트: debashish1711/Vx12
	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')