Exemple #1
0
def GenPageHTML(head={}, topbar="", content={}):

    # Sanitize inputs
    if not ("title" in head):
        head["title"] = "Class2Go"

    if not ("scripts" in head):
        head["scripts"] = []

    if not ("css" in head):
        head["css"] = []

    if not ("meta" in head):
        head["meta"] = {}

    # CSS and JS paths to URLs
    for i, path in enumerate(head["css"]):
        head["css"][i] = STATIC_URL + "css/" + path

    temp_dict = {}
    for src, type in head["scripts"].iteritems():
        temp_dict[STATIC_URL + "js/" + src] = type
    head["scripts"] = temp_dict

    # Start of page generation
    page = markup.page()

    ## Head
    page.init(title=head["title"], css=head["css"], script=head["scripts"], metainfo=head["meta"])

    ## Body (composed inside-out)

    # Topbar
    layout_div = markup.page()
    layout_div.add(topbar)
    content_div = markup.page()

    # Left column
    if "l" in content["layout"]:
        content_div.div(
            content["l"]["content"], class_="layout_left_column", style="width:%s;" % (content["l"]["width"])
        )

        # Main column
        content_div.div(
            content["l"]["content"], class_="layout_main_column", style="width:%s;" % (content["l"]["width"])
        )

    # Right column
    if "r" in content["layout"]:
        content_div.div(
            content["r"]["content"], class_="layout_right_column", style="width:%s;" % (content["r"]["width"])
        )

    layout_div.add(content_div.__str__())
    page.add(layout_div.__str__())

    return page.__str__()
Exemple #2
0
def GenPageHTML(head = {}, topbar = '', content = {}):
	
	# Sanitize inputs
	if not('title' in head):
		head['title'] = 'Class2Go'
	
	if not('scripts' in head):
		head['scripts'] = []
		
	if not('css' in head):
		head['css'] = []
		
	if not('meta' in head):
		head['meta'] = {}
	
	# CSS and JS paths to URLs
	for i, path in enumerate(head['css']):
		head['css'][i] = STATIC_URL + 'css/' + path
	
	temp_dict = {}
	for src,type in head['scripts'].iteritems():
		temp_dict[STATIC_URL + 'js/' + src] = type
	head['scripts'] = temp_dict
	
	# Start of page generation
	page = markup.page()

	## Head
	page.init(title = head['title'], css = head['css'], script = head['scripts'], metainfo = head['meta'])
	
	## Body (composed inside-out)
	
	
	# Topbar
	layout_div = markup.page()
	layout_div.add(topbar)
	content_div = markup.page()
	
	
	# Left column
	if ('l' in content['layout']):
		content_div.div(content['l']['content'], class_='layout_left_column', style='width:%s;'%(content['l']['width']))
		
	# Main column
		content_div.div(content['l']['content'], class_='layout_main_column', style='width:%s;'%(content['l']['width']))
	
	# Right column
	if ('r' in content['layout']):
		content_div.div(content['r']['content'], class_='layout_right_column', style='width:%s;'%(content['r']['width']))
		
	layout_div.add(content_div.__str__())
	page.add(layout_div.__str__())
	
	return page.__str__()
Exemple #3
0
def create_html(directory,files):

    items = tuple(files)
    paras = ( "Quick and dirty output from oban program" )
    images = tuple(files)
    
    page = markup.page( )
    page.init( title="My title", 
    css=( 'one.css', 'two.css' ), 
    header="Objective Analysis of dBZ and Vr from each sweep file") 

# hack in an embedded tag for images - markup.py probably has a way to do this better...

    img_src = []
    for item in files:
        img_src.append("<img src='%s',  width='%s', height='%s'>" % (item,"300","600"))
    
    page.p( paras )
    page.a( tuple(img_src), href=images, title=images)
    
    html_file = open(str(directory)+".html", "w")
    html_file.write(page())
    html_file.close()
    html_file = open(str(directory)+"/"+str(directory)+".html", "w")
    html_file.write(page())
    html_file.close()
    return
Exemple #4
0
def html_report(report, result_loc):
	global html_report
	html_report = page()
	html_report.init(title="Test Report")
	suite_stats.reset()
	
	for class_name in report:
		html_report.p(nest.strong("CLASS: {0}".format(class_name)),style="font-size:24px; margin:0px")
		class_stats.reset()
		
		for test_name in report[class_name]:
			test_stats.reset()
			
			test = report[class_name][test_name]
			halt,results = test.halt,test.results
			
			html_report.p(nest.strong("TEST: {0}".format(test_name)),style="font-size:20px; margin:0px")
			if halt:
				html_halting_test(results[0])
			else:
				html_continue_test(results)
			html_report.br()
	
	result_file = open(result_loc,'w')
	result_file.write(str(html_report))
	result_file.close()

	print
	print "HTML resport generated at {0}.".format(result_loc)
 def encode_html_rows(rows):
     """ Encode rows into html """
     page = markup.page()
     page.h2("Job Table")
     page.init("Job Table")
     JobTable.make_table(page, rows, header= JobTable.columns)
     return page.__str__()
    def __str__(self):
        page = markup.page( )
        page.init(
            title=self.title, 
            css=self.css, 
            header=self.header, 
            footer=self.footer
            )
        
        page.h1(self.title)
        
        if len(self.subdirs):
            links = []
            for s in sorted(self.subdirs, key=operator.attrgetter('path')):
                print s.path
                base = os.path.basename(s.path)
                link = e.a(base,
                           href='/'.join([base, 'index.html']))
                links.append(link)
            page.h2('Subdirectories:')
            page.ul( class_='mylist' )
            page.li( links, class_='myitem' )
            page.ul.close()

        size = 100/self.nimagesperrow - 1
        if len(self.images):
            for rimgs in split(sorted(self.images), self.nimagesperrow):
                page.img( src=rimgs, width='{size}%'.format(size=size),
                          alt=rimgs)
                page.br()
        return str(page)
    def generate_html_report(self):
        """
        Generate the html report out of the png files created from csv.
        """
        csv_files = self._fetch_csv_files_from_source_dir()

        page = markup.page()
        page.init(title="Jenkins")
        page.h1("API Performance report", style=self.h1_style)
        page.hr()
        index = 0
        ordered_reports_list = [
            'NovaAPIService', 'NovaSchedulerService', 'NovaComputeService',
            'NovaNetworkService', 'ServiceLevelReport'
        ]
        report_idx = 0
        while report_idx < len(ordered_reports_list):
            for csv_file in csv_files:
                report_name = self._fetch_report_name(csv_file)
                if report_name == ordered_reports_list[report_idx]:
                    self._generate_report_from_csv(csv_file, report_name, page)
                    page.br()
            report_idx += 1

        #write the performance report html file.
        fpath = path.join(self.reports_dir, 'log_analysis_report.html')
        html = open(fpath, 'w')
        html.write(str(page))
        html.close()
        print _("Generated performance report : %s") % fpath
def build_page():
    with open('web_files/results.json') as json_data:
        array = json.load(json_data)

    with open('web_files/tweets.txt', encoding='utf8') as tweet_data:
        all_tweets = tweet_data.read()
        array_tweets = all_tweets.split('\n\n')

    page = markup.page()
    page.init(header="Trump's great CNN and Twitter feed",
              title="Trump's great CNN and Twitter feed")

    page.ul(class_='cnn_list')
    for dictionary in array:
        page.li(
            page.a(dictionary['title'], href='web_files/' + dictionary['url']))
    page.ul.close()

    page.ul(class_='tweet_list')
    for tweet in array_tweets:
        page.li(tweet)
    page.ul.close()

    with open('trump.html', 'wb') as f:
        f.write(str(page).encode())
def indexPage(form):
    tl = twolocus.TwoLocus('/csbiodata/public/www.csbio.unc.edu/htdocs/sgreens/pairwise_origins/')
    panel = markup.page()
    helper.link_css_and_js(panel)
    panel.div(style="padding:20px 20px;")
    user, permissionLevel, date, time, elapsed = cgAdmin.getCompgenCookie(form)
    editFlag = (form.getvalue("edit") == "True")
    if permissionLevel >= 80:
        panel.add(WikiApp.editTag("%s" % this_file, not editFlag))
    panel.add(WikiApp.getWikiContent("%s" % this_file, editInPlace=(permissionLevel >= 80) and editFlag,
                                     returnPage="./?run=%s" % this_file))
    panel.br()
    panel.form(_class="form-horizontal", action="", method="POST", enctype="multipart/form-data")
    panel.div(_class="control-group")
    panel.h3('Background Samples')
    has_bg_strains = helper.strain_set_selector(panel, tl, 'background')
    panel.h3('Foreground Samples')
    has_fg_strains = helper.strain_set_selector(panel, tl, 'foreground')
    panel.script("""$(".chosen").chosen()""", type="text/javascript")
    panel.script('''$("form").submit(function () {return %s() && %s();});''' % (has_bg_strains, has_fg_strains),
                 type="text/javascript")
    helper.select_all_buttons(panel)
    panel.br()
    panel.input(type="hidden", name="target", value="%s.visualization" % this_file)
    panel.input(type="submit", name="submit", value="Submit")
    panel.div.close()  # control group
    panel.form.close()
    panel.div.close()
    return panel
Exemple #10
0
 def generate_html_report(self):
     """
     Generate the html report out of the png files created from jtl.
     """
     page = markup.page()
     page.init(title="Jenkins")
     page.h1("Performance report", style=self.h1_style)
     page.hr()
     index = 0
     for plugin, jtl in plugin_class_file_map.items():
         index += 1
         page.h2(plugin, style=self.h2_style)
         if plugin != 'AggregateReport':
             # Aggregate Report will only have tabular report link.
             #png_path = path.join(self.reports_dir, plugin + ".png")
             png_path = plugin + ".png"
             page.img(src=png_path, alt=plugin)
         page.br()
         #generate tabular report.
         report_path = self.generate_tabular_html_report_for_plugin(plugin)
         if report_path:
             csv_fname = plugin + ".csv"
             page.a("Download csv report",
                    href=csv_fname,
                    style=self.a_style)
             page.a("View csv report", href=report_path, style=self.a_style)
         page.a("Top", href="#top", style=self.a_style)
         page.br()
     #write the performance report html file.
     fpath = path.join(self.reports_dir, 'performance_report.html')
     html = open(fpath, 'w')
     html.write(str(page))
     html.close()
     print "Generated Performance Report : %s" % fpath
Exemple #11
0
def genCodePerTransHTML(interviews, outputdir, code):
    """ For each interview, output a page for each code with all the quotes coded as such """

    for interview in interviews:
        with open(
                outputdir + '/' + urlSafe(code) + '_' + interview.name +
                '.html', 'w') as outFile:
            header = "All references to '" + code + "' in interview '" + interview.name + "'"
            #footer = "This is the end."
            styles = ('../layout.css')

            page = markup.page()
            page.init(title=header,
                      header=header,
                      css=styles,
                      charset='utf-8',
                      script=['../format.js', '../jquery-3.3.1.slim.min.js'])
            page.br()
            page.a("Index", color="blue", href="index.html")
            page.br()
            page.br()
            page.br()
            page.br()

            page.table(style="width: 100%")

            for quote in interview.quotes:
                if (code in quote.codes):
                    quote.printHTML(page)

            page.table.close()

            outFile.write(str(page))
Exemple #12
0
def gen_html(entries):

    page = markup.page()
    page.init(title="Ambulant media support")
    gen_form(page)
    gen_table(page, entries)
    return page
Exemple #13
0
def genCodeHTML(interviews, outputdir, code):
    """ Searches through all interviews and extracts all references to each code, writes to an HTML output """

    with open(outputdir + '/' + urlSafe(code) + '.html', 'w') as outFile:
        header = "All references to " + code
        #footer = "This is the end."
        styles = ('../layout.css')

        page = markup.page()
        page.init(title=header,
                  header=header,
                  css=styles,
                  charset='utf-8',
                  script=['../format.js', '../jquery-3.3.1.slim.min.js'])
        page.br()
        page.a("Index", color="blue", href="index.html")
        page.br()
        page.br()
        page.br()
        page.br()

        page.table(style="width: 100%")

        for interview in interviews:
            for quote in interview.quotes:
                if (code in quote.codes):
                    quote.printHTML(page)

        page.table.close()

        outFile.write(str(page))
Exemple #14
0
 def startPage(self):
     self.page = markup.page()
     self.page.init(title=self.title, css="./fret.css")
     self.page.small()
     self.page.a('Home', href='./index.cgi')
     self.page.small.close()
     self.page.h1(self.title)
Exemple #15
0
    def toHTML(self):
        """ Prints HTML for this interview to a file in output directory """

        with open(self.outFileDir + '/' + self.outFileBase + '.html',
                  'w') as outFile:  # Should be of form, e.g.,  Johnson.html
            header = "Interview with " + self.name
            #footer = "This is the end."
            styles = ('../layout.css')

            page = markup.page()
            page.init(title=header,
                      header=header,
                      css=styles,
                      charset='utf-8',
                      script=['../jquery-3.3.1.slim.min.js', '../format.js'])
            page.br()
            page.a("Index", color="blue", href="index.html")
            page.br()
            page.br()
            page.br()
            page.br()

            page.table(style="width: 100%")
            for quote in self.quotes:
                quote.printHTML(page, 'this_interview')

            page.table.close()

            #outFile.write( unicode(page, encoding='utf-8') )
            outFile.write(str(page))
 def generate_html_report(self):
     """
     Generate the html report out of the png files created from jtl.
     """
     page = markup.page()
     page.init(title="Jenkins")
     page.h1("Performance report", style=self.h1_style)
     page.hr()
     index = 0
     for plugin,jtl in plugin_class_file_map.items():
         index += 1
         page.h2(plugin, style=self.h2_style)
         if plugin != 'AggregateReport':
             # Aggregate Report will only have tabular report link.                
             #png_path = path.join(self.reports_dir, plugin + ".png")
             png_path = plugin + ".png"
             page.img(src=png_path, alt=plugin)
         page.br()
         #generate tabular report.
         report_path = self.generate_tabular_html_report_for_plugin(plugin)
         if report_path:
             csv_fname = plugin + ".csv"
             page.a("Download csv report", href=csv_fname,
                    style=self.a_style)
             page.a("View csv report", href=report_path, style=self.a_style)
         page.a("Top", href="#top", style=self.a_style)
         page.br()
     #write the performance report html file.
     fpath = path.join(self.reports_dir, 'performance_report.html')
     html = open(fpath, 'w')
     html.write(str(page))
     html.close()
     print "Generated Performance Report : %s" % fpath
Exemple #17
0
def indexPage(form):
	""" Main query page """
	panel = markup.page()
	panel.div(style="padding:50px 50px;")
	'''
	for bwtDir in glob.glob('/csbiodata/CEGS3x3BWT/*'):
		panel.h3(bwtDir)
		msbwt = MultiStringBWT.loadBWT(bwtDir)
		break
	'''
	panel.h3("Select Dataset:")
	available = sorted(glob.glob("%s/*/*msbwt.npy" % MSBWTdir))
	panel.div(style="padding:0px 0px 40px 120px;")
	panel.form(action="", method="POST", enctype="multipart/form-data")
	for i, dataset in enumerate(available):
		end = dataset.rfind('/')
		start = dataset.rfind('/', 0, end-1) + 1
		shorten = dataset[start:end]
		panel.input(type="checkbox", name="dataset", value=shorten)
		panel.add(shorten)
		panel.br()
	panel.div.close()

	panel.label("Search Pattern:")
	panel.input(type="text", name="pattern", size="100")
	panel.input(type="hidden", name="target", value="msAllele.Search")
	panel.input(type="submit", name="submit", value="Submit")
	panel.form.close()
	panel.div.close()
	return panel
Exemple #18
0
def write_single(target, non_target, diag, singles, panel, curr_page, run_path, fig_path, id):
    for s in [single for single in singles]:
        single_html = os.path.join(target, s.fig + id + '.html')

        # Create the actual single plot
        curr_page = markup.page(mode='strict_html')
        curr_page.init(css='htmlify.css')
        curr_page.img(src=os.path.join("..", fig_path, diag, s.fig), style='float: left;')

        # Produce links to other single plots
        link_to_single(curr_page, singles, panel)
        curr_page.br()

        for link in non_target:
            rewrite_linked_filename = globals()[target + "_" + link]()
            link_single = rewrite_linked_filename.switch(target, link, s.fig)
            link_panel = rewrite_linked_filename.switch(target, link, panel.fig)
            curr_page.a("Link to " + link + " version",
                        href=os.path.join("..", link, link_single + link_panel + ".html"),
                        class_='link')
            curr_page.br()
        curr_page.a("Back to overview",
                    href='index.html#' + id, class_='link')
        f = open(single_html, "w")
        for line in curr_page.content:
            f.write("%s\n" % line)
        f.close()
    def toHTML(self):
        """ Prints HTML for this thread to a file in output directory """
        filename = "{}/html/{}.html".format(self.outFileDir, self.outFileBase)
        print('writing interview: ', filename)
        with open(filename,
                  'w') as outFile:  # Should be of form, e.g., Johnson.html
            header = self.outFileBase
            page = markup.page()
            page = genHeaderMenu(page, header)

            page.div(class_="num_posts")
            page.add("quotes={}".format(len(self.posts)))
            page.div.close()

            page.table(style="width: 100%")

            page.tr(class_="table-header")
            page.th('speaker')
            page.th('quote')
            page.th('codes')
            page.tr.close()

            for post in self.posts:
                post.printHTML(page, 'this_interview')

            page.table.close()

            #outFile.write( unicode(page, encoding='utf-8') )
            outFile.write(str(page))
Exemple #20
0
def create_html(directory, files):

    items = tuple(files)
    paras = ("Quick and dirty output from oban program")
    images = tuple(files)

    page = markup.page()
    page.init(title="My title",
              css=('one.css', 'two.css'),
              header="Objective Analysis of dBZ and Vr from each sweep file")

    # hack in an embedded tag for images - markup.py probably has a way to do this better...

    img_src = []
    for item in files:
        img_src.append("<img src='%s',  width='%s', height='%s'>" %
                       (item, "300", "600"))

    page.p(paras)
    page.a(tuple(img_src), href=images, title=images)

    html_file = open(str(directory) + ".html", "w")
    html_file.write(page())
    html_file.close()
    html_file = open(str(directory) + "/" + str(directory) + ".html", "w")
    html_file.write(page())
    html_file.close()
    return
Exemple #21
0
def make_html(component_dict, sorted_names=None, title='Simulation'):
    '''Returns a markup.page instance suitable for writing to an html file.
    '''
    import markup
    if sorted_names == None:
        sorted_names = sorted(component_dict.keys())
    page = markup.page()
    page.h1('The components of {0}'.format(title))
    page.ul()
    for name in sorted_names:
        page.li(component_dict[name].html(name))
    page.ul.close()
    page.br( )
    
    page.h1('Provenance of components')
    page.dl()
    for name in sorted_names:
        c = component_dict[name]
        page.add(c.provenance.html(name))
    page.dl.close()
    page.br( )
    
    page.h1('Extended displays of component values')
    page.dl()
    for name in sorted_names:
        c = component_dict[name]
        if c.display == False:
            continue
        key = 'value of {0}'.format(name)
        page.add(markup.oneliner.dt(key,id=key)+'\n'+
                 markup.oneliner.dd(c.display())
                 )
    page.dl.close()
    return page
Exemple #22
0
    def displayExtFiles(self, DB):
        """Display blobs in DB as web page links"""
        files = DB.getExtFilenames()
        print files
        if len(files) == 0:
            return
        items=[]
        for f in files:
            print f, files[f]
            items.append('<a href=%s>%s</a>' %(files[f],f)
                         )
        import markup
        page = markup.page( )
        page.init( title="PEATDB Files Preview",
                   css=( 'one.css' ),
                   header="Preview for project",
                   footer="PEATDB" )
        page.ul( class_='mylist' )
        page.li( items, class_='myitem' )
        page.ul.close()

        filename = '/tmp/prevtemp.html'
        hf = open(filename,'w')
        for c in page.content:
            hf.write(c)
        hf.close()
        import webbrowser
        webbrowser.open(filename, autoraise=1)
        return
def genCodePostsHTMLReddit(threads, outputdir, code, project_title):
    """ Generates the posts tab of a code page """

    with open("{}/html/{}.html".format(outputdir, urlSafe(code)),
              mode="w") as outFile:
        header = "All posts in {} tagged with {}".format(project_title, code)
        page = markup.page()
        page = genHeaderMenu(page, header)

        page.div(class_="submenu")
        page.a("quotes", color="blue", href="{}.html".format(urlSafe(code)))
        page.add("&nbsp;&nbsp;-&nbsp;&nbsp;")
        page.a("interviews",
               color="blue",
               href="{}_interviews.html".format(urlSafe(code)))
        page.div.close()

        page.table(style="width: 100%; table-layout: fixed; max-width: 90vw")

        page.tr(class_="table-header")
        page.th('speaker', width="15%")
        page.th('text', width="50%")
        page.th('codes', width="20%")
        page.tr.close()

        for thread in threads:
            for post in thread.posts:
                if (code in post.codes):
                    post.printHTML(page)

        page.table.close()

        outFile.write(str(page))
    def generate_html_report(self):
        """
        Generate the html report out of the png files created from csv.
        """
        csv_files = self._fetch_csv_files_from_source_dir()

        page = markup.page()
        page.init(title="Jenkins")
        page.h1("API Performance report", style=self.h1_style)
        page.hr()
        index = 0
        ordered_reports_list = ['NovaAPIService', 'NovaSchedulerService',
                                'NovaComputeService', 'NovaNetworkService',
                                'ServiceLevelReport']
        report_idx = 0
        while report_idx < len(ordered_reports_list):
            for csv_file in csv_files:
                report_name = self._fetch_report_name(csv_file)
                if report_name == ordered_reports_list[report_idx]:
                    self._generate_report_from_csv(csv_file, report_name, page)
                    page.br()
            report_idx += 1

        #write the performance report html file.
        fpath = path.join(self.reports_dir, 'log_analysis_report.html')
        html = open(fpath, 'w')
        html.write(str(page))
        html.close()
        print _("Generated performance report : %s") % fpath
def genPosterPostsHTML(poster, outputdir):
    """ For a given poster, generate their posts page """
    username = urlSafe(poster.name)
    with open("{}/html/{}_quotes.html".format(outputdir, username),
              mode="w+") as outfile:
        header = "All coded activity for poster {}".format(username)
        page = markup.page()
        page = genHeaderMenu(page, header)

        page.div(class_="submenu")
        page.a("codes", color="blue", href="{}.html".format(username))
        page.add("&nbsp;&nbsp;-&nbsp;&nbsp;")
        page.a("interviews",
               color="blue",
               href="{}_interviews.html".format(username))
        page.add("&nbsp;&nbsp;-&nbsp;&nbsp;")
        page.a("quotes", color="blue", href="{}_quotes.html".format(username))
        page.div.close()

        page.table(style="width: 100%; table-layout: fixed")

        # First write a block for all the codes the poster engages with, and how often they posted something with that code

        page.tr(class_="table-header")
        page.add("<h1>quotes (n={})</h1>".format(len(poster.threads)))
        page.tr.close()

        for post in poster.posts:
            post.printHTML(page, codeLinkTo="this_interview")

        page.table.close()
        outfile.write(str(page))
    outfile.close()
Exemple #26
0
 def generateHTMLTable(columnNames,table_type,countTD=1):
     snippet = markup.page()
     titles = columnNames['labels']
     inputids = columnNames['columns']
     snippet.table(width="100%")
     if countTD == 1:
         for i in range(len(titles)):
             snippet.tr()
             snippet.td(oneliner.p(titles[i]),align='center')
             snippet.td(oneliner.input(id=(inputids[i]+table_type)),align='center')
             snippet.tr.close()
         snippet.tr()
         snippet.td(style='padding-top: 10px;',align="center")
         snippet.td(oneliner.input(id="Cancel"+table_type,type="button",value="取消"),align='center')
         snippet.td(oneliner.input(id="Save"+table_type,type="button",value="保存"),align='center')
         snippet.tr.close()
     elif countTD == 3:
         i=0
         while (i < len(titles)):
             snippet.tr()
             snippet.td(oneliner.p(titles[i]),align='left')
             snippet.td(oneliner.input(id=(inputids[i]+table_type)),align='left')
             i=i+1
             if i < len(titles):
                 snippet.td(oneliner.p(titles[i]),align='left')
                 snippet.td(oneliner.input(id=(inputids[i]+table_type)),align='left')
             i=i+1
             if i < len(titles):
                 snippet.td(oneliner.p(titles[i]),align='left')
                 snippet.td(oneliner.input(id=(inputids[i]+table_type)),align='left')
             snippet.tr.close()
             i=i+1
     snippet.table.close()
     return str(snippet)
    def __str__(self):
        page = markup.page()
        page.init(title=self.title,
                  css=self.css,
                  header=self.header,
                  footer=self.footer)

        page.h1(self.title)

        if len(self.subdirs):
            links = []
            for s in sorted(self.subdirs, key=operator.attrgetter('path')):
                print s.path
                base = os.path.basename(s.path)
                link = e.a(base, href='/'.join([base, 'index.html']))
                links.append(link)
            page.h2('Subdirectories:')
            page.ul(class_='mylist')
            page.li(links, class_='myitem')
            page.ul.close()

        size = 100 / self.nimagesperrow - 1
        if len(self.images):
            for rimgs in split(sorted(self.images), self.nimagesperrow):
                page.img(src=rimgs,
                         width='{size}%'.format(size=size),
                         alt=rimgs)
                page.br()
        return str(page)
Exemple #28
0
def loadIndex():
		page = markup.page( )
		page.init( css="( 'layout.css', 'alt.css', 'images.css' )" )
		page.div( class_='header' )
		page.h1("Soap Explorer")
		page.div.close( )
		page.div( class_='content' )
		page.h2("Service parameters")
		page.form(name_="input",method_="post",action_="servicelist")
		page.add("server:")
		page.input(id="server",type="text",name="server")
		page.br()
		page.add("poolalias:")
		page.input(id="poolalias",type="text",name="poolalias")
		page.br()	
		page.add("user:"******"user",type="text",name="user")
		page.br()	
		page.add("pass:"******"pass",type="text",name="pass")
		page.br()
		page.input(type_="submit",value_="load",class_="load")
		page.form.close()
		page.div.close( )
		page.div( class_='footer' )
		page.p("footer")
		page.div.close( )
		return page
Exemple #29
0
    def displayExtFiles(self, DB):
        """Display blobs in DB as web page links"""
        files = DB.getExtFilenames()
        print files
        if len(files) == 0:
            return
        items = []
        for f in files:
            print f, files[f]
            items.append('<a href=%s>%s</a>' % (files[f], f))
        import markup
        page = markup.page()
        page.init(title="PEATDB Files Preview",
                  css=('one.css'),
                  header="Preview for project",
                  footer="PEATDB")
        page.ul(class_='mylist')
        page.li(items, class_='myitem')
        page.ul.close()

        filename = '/tmp/prevtemp.html'
        hf = open(filename, 'w')
        for c in page.content:
            hf.write(c)
        hf.close()
        import webbrowser
        webbrowser.open(filename, autoraise=1)
        return
Exemple #30
0
def MakeTable(TableDict):
    class RowData:
        def opentag(self):
            self.Table.tr.open()
            self.Table.td.open()
        def closetag(self):
            self.Table.td.close()
            self.Table.tr.close()

    RD = RowData()
    Table = markup.page(case='upper')
    Table.table.open(width='50%', border='2')
    RD.opentag
    Table.b('Manufacturer')
    Table.td.close()
    Table.td.open()
    Table.b(TableDict['manuf'])
    RD.closetag
    RD.opentag
    Table.b("Model:")
    Table.td.close()
    Table.td.open()
    Table.b(TableDict['model'])
    RD.closetag
    RD.opentag
    Table.b("Serialnumber:")
    Table.td.close()
    Table.td.open()
    Table.b(TableDict['sn'])
    RD.closetag
    Table.table.close()
    return Table
Exemple #31
0
def initializePage(t, h, sort_list="[[9,1]]"):
    currentTime = time.localtime()
    dateTime = str(currentTime[1]) + '/' + str(currentTime[2]) + '/' + str(
        currentTime[0]) + " "
    dateTime += str(currentTime[3]) + ":" + str(currentTime[4]) + ":" + str(
        currentTime[5])

    csses = "style.css"

    tsStr = '\n$(document).ready(function()\n'
    tsStr += '  {\n'
    tsStr += '      $("table").tablesorter({\n'
    tsStr += '      // sort on the tenth column , order desc \n'
    tsStr += '          sortList: ' + sort_list + ' \n'
    tsStr += '              }); \n'
    tsStr += '  }\n'
    tsStr += ');\n'
    scripts = [('js/jquery-latest.js', ['javascript', '']),
               ('js/jquery.tablesorter.min.js', ['javascript', '']),
               ('js/jquery.metadata.js', ['javascript', '']),
               ('', ['javascript', tsStr])]

    page = markup.page()
    pathway_name = re.sub(" ", "_", re.sub("/", "_", t))
    summary_tsv = open(rootDir + pathway_name + '.tsv', 'wb')
    page.init(title=t,
              header=h,
              script=scripts,
              css=(csses, 'print, projection, screen'),
              footer="Last modified on " + dateTime)

    return page, summary_tsv
def create_html_diff(files):
	"""
	"""
	p = markup.page()
	p.html.open()
	p.script(src='https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js')
	p.script.close()
	p.style(inline_css)
	p.body.open()
	p.h1("Diff Viewer")
	p.div.open(class_='outer center')
	for file_changes in files:
		p.h3(file_changes[0])
		p.table.open(class_="center")
		p.tr.open()
		p.th(("Current", "Old"), class_="test")
		p.tr.close()
		for change in file_changes:
			if type(change) == dict:
				p.tr.open()
				p.td((change['left'], change['right']))
				p.tr.close()
		p.table.close()
	p.div.close()
	p.body.close()
	fl = open(os.getcwd()+"\\diffs.html", "w+")
	fl.write(str(p))
	print "Generated diffs.html in the current folder."
	fl.close()
def createPage(pagetitle, css_file='genereport.css', scripts={}):
    page = markup.page()
    page.init(title=pagetitle, css=(css_file), script=scripts)

    page.div.open(id="body")

    return page
Exemple #34
0
def main():
    global page
    # set params
    #first_fhr = 0
    #duration = 300
    #interval = 3
    # Wehere to put generated html files
    #topdir = "./portal"
    # Make HTML
    #import pdb ; pdb.set_trace()
    for plotset in plotsets:
        # hack: Have something to iterate through
        if not "levs" in plotset: plotset["levs"] = [None]
        for lev in plotset["levs"]:
            page = markup.page()
            html_page_header(title="Nature Run Portal",
                             cssFiles=("nature.css"))
            #import pdb ; pdb.set_trace()
            add_top_nav(first_fhr, duration, interval, plotset["fname"],
                        plotset["outpath"], lev)
            add_main_content(first_fhr, duration, interval, plotset["fname"],
                             plotset["outpath"], lev)
            add_bottom_nav()

            filename = get_plotset_filename(plotset, lev)
            #with open("portal.htm", 'w') as f:
            filepath = os.path.join(topdir, filename)
            with open(filepath, 'w') as f:
                f.write(str(page))
def drawMatrix(data):
    panel = markup.page()
    helper.link_css_and_js(panel)
    full_names = {'dom': 'Domesticus', 'mus': 'Musculus', 'cas': 'Castaneus', 'unk': 'Unknown'}
    panel.table()
    panel.tr()
    panel.td('')
    panel.td("Distal interval: Chromosome {}: {:,} - {:,}".format(*tuple(data['Intervals'][1])))
    panel.tr.close()
    panel.tr()
    panel.td("Proximal interval: Chromosome {}: {:,} - {:,}".format(*tuple(data['Intervals'][0])))
    panel.td()
    panel.table(_class="table table-striped")
    panel.tr()
    panel.th('')
    for subspecies in data['Key']:
        panel.th(full_names[subspecies])
    panel.tr.close()
    for subspecies, samples in zip(data['Key'], data['Samples']):
        panel.tr()
        panel.th(full_names[subspecies])
        for sample_set in samples:
            panel.td(', '.join(sample_set) or '-')
        panel.tr.close()
    panel.table.close()
    panel.td.close()
    panel.tr.close()
    panel.table.close()
    return panel
Exemple #36
0
	def __init__(self, _title, _css):
		self.title = _title
		self.css = _css

		self.page = markup.page()

		self.projects = []

		proj = Project(self.page, "daffodil")
		proj.setDescription("This little app will proceduraly generate a city. Future improvements should feature some interesting rendering techniques.")
		proj.setDate("2011")
		proj.setTech("python, Panda3D")
		proj.setStatus("in progress")
		proj.setSources({"git": "https://github.com/omartinak/daffodil"})
		self.projects.append(proj)

		proj = Project(self.page, "pgpPainter")
		proj.setDescription("This project presents a technique that renders a 3D object so it looks like a sketch. This sketch tries to emulate the sketch a human painter would draw, which means it has pronounced contours and a lighter shading is used along the contours rather than natural lighting. The technique works pretty well for static scenes but it is not very usable for the moving ones.")
		proj.setDate("2009")
		proj.setTech("C++, OpenSceneGraph, GLSL")
		proj.setStatus("finished")
		proj.setSources({"zip": "pgpPainter_src.zip"})
		proj.setExecutable({"elf64": "pgpPainter_bin.zip"})
		self.projects.append(proj)

		proj = Project(self.page, "evo3D")
		proj.setDescription("This application uses evolution algorithm to create spatial objects constructed from simple elements. User can control the evolution by evaluating the quality of certain candidates from the population while he can watch the population evolve in front of him. The evolved parameters are the object's growth and its change in color.")
		proj.setDate("2009")
		proj.setTech("java, Qt, OpenGL, genetic algorithms")
		proj.setStatus("finished")
		proj.setSources({"zip": "evo3D_src.zip"})
		proj.setExecutable({"jar": "evo3D_bin.zip"})
		self.projects.append(proj)

		proj = Project(self.page, "g-wars")
		proj.setDescription("g-wars was supposed to be another clone of a well known geometry wars game. It features a simple vector graphics that is post processed with a Cg shader to make it look a little bit fuzzy. It also features a 2D physics engine to make the objects' behaviour more realistic. The game was written with client-server architecture in mind but it was never finished.")
		proj.setDate("2008")
		proj.setTech("C++, SDL, OpenGL, nvidia Cg, Box2D")
		proj.setStatus("unfinished")
		proj.setSources({"zip": "g-wars_src.zip"})
		proj.setExecutable({"elf64": "g-wars_bin.zip"})
		self.projects.append(proj)

		proj = Project(self.page, "Bankshot")
		proj.setDescription("My first finished game as an amateur game developer working for SleepTeam Labs. I wrote the code, they supplied the rest. It is a pong variation with four players, either human or computer. Players are losing score whenever they don't catch the ball. To make the game more interesting players can shoot down various bonuses hanging in the center.")
		proj.setDate("2004")
		proj.setTech("C++, DirectX")
		proj.setStatus("finished")
		proj.setExecutable({"link": "http://www.iwannaplay.com/?GameID=18"})
		self.projects.append(proj)

		proj = Project(self.page, "Ragnarok")
		proj.setDescription("A would be clone of Baldur's Gate II with a flavour of Fallout :) with custom rules created by my friend. Although it was never finished it contains functional combat, inventory, character development and a fog of war. Conversation and trading systems were under development. I have also created a set of tools for preparing maps, creating inventory items and to help with animating sprites.")
		proj.setDate("2002")
		proj.setTech("C++, DirectX")
		proj.setStatus("unfinished")
		proj.setSources({"zip": "ragnarok_src.zip"})
		proj.setExecutable({"win32": "ragnarok_bin.zip"})
		self.projects.append(proj)
Exemple #37
0
	def __init__(self, title=None, options={}):
		super(HtmlReportWriter, self).__init__(title, options)
		self._read_options(options)

		self._page = markup.page()
		self._page.init(title=title)
		if self.style:
			self._page.style(self.style)
Exemple #38
0
def smil_document():
    # There's a problem here: the generator makes everything lower case. It shouldn't.
    doc = markup.page(mode='xml',
                      case='keep',
                      onetags=SMIL_ONETAGS,
                      twotags=SMIL_TWOTAGS)
    doc.init()
    return doc
Exemple #39
0
 def setUp(self):
     import markup
     
     self.page=markup.page()
     self.page.init(
             doctype="Content-Type: text/html; charset=utf-8\r\n\r\n<!DOCTYPE html>",
             script=["http://nvd3.org/lib/d3.v2.js","http://nvd3.org/nv.d3.js"], #must be a list to preserve order
             css=['http://nvd3.org/src/nv.d3.css']
             )
def make_html(reports_dir, filename, total_bugs):
    """Function to create the HTML chart from Launchpad Bug report xls"""
    page = markup.page()
    page.init(title="Launchpad Bug report")
    page.a(name="top")
    page.img(src="images/logo.png", alt="Company_Logo", align="right")
    page.h1("LAUNCHPAD BUG REPORT - OpenStack NOVA     (%s)"%dt.now().strftime("%d-%m-%Y"), style="font-family:Verdana,sans-serif; font-size:18pt; color:rgb(96,0,0)")
    page.hr()
    page.h1("Total Bug Count: %s"%total_bugs, style="font-family:Verdana,sans-serif; font-size:16pt; color:006699")
    page.a("Download .xls Report", href="./"+filename)
    page.br()
    page.br()
    page.a("1. Bug Distribution - By Status", href="#c1", style="text-decoration:none; font-family:Verdana,sans-serif; font-size:12")
    page.br()
    page.a("2. Bug Distribution - By Importance", href="#c2", style="text-decoration:none; font-family:Verdana,sans-serif; font-size:12")
    page.br()
    page.a("3. Bug Distribution - By Milestone", href="#c3", style="text-decoration:none; font-family:Verdana,sans-serif; font-size:12")
    page.br()
    page.a("4. Bug Distribution - By Bug owners", href="#c4", style="text-decoration:none; font-family:Verdana,sans-serif; font-size:12")
    page.br()
    page.a("5. Bug Distribution - By Fixed-by", href="#c5", style="text-decoration:none; font-family:Verdana,sans-serif; font-size:12")
    page.br()
    page.a("6. # of times a file was modified", href="files_count.html", style="text-decoration:none; font-family:Verdana,sans-serif; font-size:12")
    page.br()
    page.a("7. # of lines modified per file", href="lines_count.html", style="text-decoration:none; font-family:Verdana,sans-serif; font-size:12")

    for i in range(2):
        page.br()
    page.a(name="c1")
    page.h1("1.  Bug Distribution - By Status",  style="font-family:Verdana,sans-serif; font-size:14pt; color:rgb(136,0,0)")
    page.img(src="charts/status.png", alt="Statuses Chart")
    page.a("Top", href="#top", style="align:right")
    page.br()
    page.a(name="c2")
    page.h1("2. Bug Distribution - By Importance", style="font-family:Verdana,sans-serif; font-size:14pt; color:rgb(136,0,0)")
    page.img(src="charts/imps.png", alt="Importance Chart")
    page.a("Top", href="#top", style="align:right")
    page.br()
    page.a(name="c3")
    page.h1("3. Bug Distribution - By Milestone", style="font-family:Verdana,sans-serif; font-size:14pt; color:rgb(136,0,0)")
    page.img(src="charts/miles.png", alt="Milestone Chart")
    page.a("Top", href="#top", style="align:right")
    page.br()
    page.a(name="c4")
    page.h1("4. Bug Distribution - By Bug owners (Top 15)", style="font-family:Verdana,sans-serif; font-size:14pt; color:rgb(136,0,0)")
    page.a("Click here for complete table", href="owners.html")
    page.img(src="charts/owners.png", alt="Owners Chart")
    page.a("Top", href="#top", style="align:right")
    page.br()
    page.a(name="c5")
    page.h1("5. Bug Distribution - By Fixed-by (Top 15)", style="font-family:Verdana,sans-serif; font-size:14pt; color:rgb(136,0,0)")
    page.a("Click here for complete table", href="fixers.html")
    page.img(src="charts/fixers.png", alt="Fixers Chart")
    page.a("Top", href="#top", style="align:right")
    html = open(reports_dir+'/index.html', 'w')
    html.write(str(page))
    html.close()
def genHistograms(threads, outputdir, codeCounts, project_title):
    """ Generates an index linking to all the main pages.
			Inputs:
				threads <list>: list of thread objects
				outputdir <str>: directory for output specified in arguments
				codeCounts <dict>: counts per code, processed in readOriginalCSVs
					{
						code1: {
							'threads': <set> of the distinct titles of threads with this code,
							'posts': <int> count of number of posts for this code,
							'posters': <set> of the distinct posters who said something with this code,
						}
						...
					}
				project_title <str>: used to generate the page title in the format "<project_title>: Coded Transcripts"
			Outputs:
				Writes index to file, does not return
	"""
    freqSortedCodeCounts = sorted(codeCounts.items(),
                                  key=lambda tup: len(tup[1]['threads']),
                                  reverse=True)

    with open(outputdir + '/html/' + 'histograms.html', mode='w+') as outFile:
        header = "{}: Histograms".format(project_title)
        page = markup.page()
        page = genHeaderMenu(page, header)

        page.table(style="width: 100%", id_="histograms-table")

        page.tr(class_="table-header")
        page.th('code')
        page.th('# distinct interviews')
        page.th('# distinct quotes')
        page.th('# distinct speakers')
        page.th('speakers')
        page.tr.close()
        for freqSortedCodeCount in freqSortedCodeCounts:
            code = freqSortedCodeCount[0]
            posters = freqSortedCodeCount[1]['posters']
            threads = freqSortedCodeCount[1]['threads']
            post_count = freqSortedCodeCount[1]['posts']
            page.tr()
            page.td()
            page.a(code, href="{}.html".format(urlSafe(code)))
            page.td.close()
            page.td(str(len(threads)))
            page.td(str(post_count))
            page.td(str(len(posters)))
            page.td(class_="histogram-posters")
            for poster in posters:
                page.a(poster, href="{}.html".format(urlSafe(poster)))
            page.td.close()
            page.tr.close()
        page.table.close()

        outFile.write(str(page))
    outFile.close()
def createPage( pagetitle,css_file='genereport.css',scripts={}):
    page = markup.page()
    page.init( title=pagetitle,
               css = (css_file),
               script=scripts)

    page.div.open(id="body")
    
    return page
def process(args, filename):

    info("filename = %s" % filename)
    assert isfile(filename)
    base_name = basename(filename)
    bald_name = splitext(base_name)[0]
    # output_dir = dirname(realpath(filename))
    output_dir = TMP_DIR
    info("base_name = %s" % base_name)
    info("bald_name = %s" % bald_name)
    info("output_dir = %s" % output_dir)
    html_fn = os.path.join(output_dir, bald_name + '-pp.html')
    info('output_dir = %s; html_fn = %s' % (output_dir, html_fn))

    with io.open(filename, 'r', encoding='utf8') as f:
        lines = f.readlines()

    page = markup.page()
    page.init(title=lines[0],
              css=('http://reagle.org/joseph/2016/06/md-pp.css'),
              charset='utf-8')

    margin_markup = re.compile(r'(^[#>:]+)(.*)')
    for line_no, line in enumerate(lines):
        line = line.replace('<!--', '&lt;!--')
        line = line.replace('-->', '--&gt;')
        if not line.strip():  # empty line
            page.p(('&nbsp;'))
        elif margin_markup.match(line):
            token = margin_markup.match(line).group(1)
            if token.startswith('#'):
                if len(token) == 2:
                    page.h1(line)
                elif len(token) == 3:
                    page.h2(line)
                elif len(token) == 4:
                    page.h3(line)
                else:
                    page.h4(line)
            elif token.startswith('>'):
                page.blockquote(line, class_="quote")
            elif token.startswith('  '):
                page.blockquote(line, class_="indent")
            elif token.startswith(':'):
                page.blockquote(line, class_="definition")

        else:
            page.p.open()
            page.span(line_no, class_="line_no")
            page.span(line, class_="prose")
            page.p.close()

    with io.open(html_fn, 'w', encoding='utf8') as f:
        f.write(str(page))

    webbrowser.open('file://' + html_fn)
Exemple #44
0
 def get(self):
     global jobs
     page = markup.page()
     page.init(title='Spooler Jobs')
     page.h1('Requested jobs')
     page.ul()
     for job in jobs:
         page.li(job)
     page.ul.close()
     self.write(str(page))
Exemple #45
0
 def get(self):
     global jobs
     page = markup.page()
     page.init(title='Spooler Jobs')
     page.h1('Requested jobs')
     page.ul()
     for job in jobs:
         page.li(job)
     page.ul.close()
     self.write(str(page))
Exemple #46
0
def dump_images(images, filename="images"):
  """Imprime une liste d'images dans un html"""
  page = markup.page()
  page.init()
  for im in images:
    page.img(width=120, src='../%s' % im['image'])
  f = open('%s/%s.html' % (OUT_DIR, filename), 'w')
  f.write(page.__str__())
  f.close()
  print "Vous pouvez consulter ces images ici: %s" % f.name
Exemple #47
0
def startHTMLPage(jsFile, pageID):
  # Add javascript file to list of imports
  JAVASCRIPT_FILES.append(jsFile)
  page = markup.page()
  page.init( title="Placeholder title", 
             charset=CHARSET_TYPE,
             css=CSS_FILE,
             script=JAVASCRIPT_FILES)
  page.p(id=pageID)
  return page 
Exemple #48
0
	def _assert_to_html(self, result):
		assert_html = markup.page()
		result_str = str(result).replace(' ', NBSP).replace('\t', TAB)
		result_lines = result_str.splitlines()
		
		assert_html.add(result_lines[0])
		for line in result_lines[1:]:
			self.__newline(assert_html)
			assert_html.add(line)
		return assert_html
Exemple #49
0
 def _assert_to_html(self, result):
     assert_html = markup.page()
     result_str = str(result).replace(' ', NBSP).replace('\t', TAB)
     result_lines = result_str.splitlines()
     
     assert_html.add(result_lines[0])
     for line in result_lines[1:]:
         self.__newline(assert_html)
         assert_html.add(line)
     return assert_html
Exemple #50
0
    def generateCraigslist(self):
        page = markup.page(mode="xml")
        page.init( doctype="" )

        page.p.open()
        page.add("Join the ")
        page.a(self.city + " Sunday Night Film Club", href=self.clubURL)
        page.add(" this ")

        page.b.open()
        page.add( self.nextSunday.strftime("%A, %b %e") + self.daySuffix )
        page.b.close()

        page.add(" at ")
        
        page.b.open()
        page.add(self.showTime)
        page.b.close()

        page.add(" for ")

        page.b.open()
        page.add( self.film )
        page.b.close()

        page.add(" at the ")

        page.b.open()
        page.add( self.location )
        page.b.close()

        page.add(". Look for ")

        page.b.open()
        page.add( self.host )
        page.b.close()

        page.add(" wearing ")

        page.add( self.wearing )

        page.add("in the theatre lobby about 15 minutes "
                 "before the film.  As always, after the film we will "
                 "descend on a local establishment for "
                 "dinner/drinks/discussion.")
        page.p.close()

        page.p.open()
        page.add("For links, film synopsis, and further details, visit ")
        page.a("the " + self.city + " Sunday Night Film Club homepage", 
               href=self.clubURL)
        page.add(".")
        page.p.close()

        return page
Exemple #51
0
def genIndex(interviews, outputdir, codes):
    """ Generates an index linking to all the main pages """

    histogram = {}
    for code in codes:
        for interview in interviews:
            for quote in interview.quotes:
                if (code in quote.codes):
                    if (code in histogram):
                        histogram[code] += 1
                    else:
                        histogram[code] = 1

    freqSortedCodes = sorted(histogram.items(),
                             key=operator.itemgetter(1),
                             reverse=True)

    with open(outputdir + '/' + 'index.html', 'w') as outFile:
        header = "Interviews and codes"
        #footer = "This is the end."
        styles = ('layout.css')

        page = markup.page()
        page.init(title=header,
                  header=header,
                  css=styles,
                  charset='utf-8',
                  script=['../format.js', '../jquery-3.3.1.slim.min.js'])
        page.br()
        page.a("Index", color="blue", href="index.html")
        page.add("&nbsp;&nbsp;-&nbsp;&nbsp;")
        page.a("Histograms", color="blue", href="histograms.html")
        page.br()
        page.br()
        page.br()
        page.br()

        page.table(style="width: 100%")
        page.tr()
        page.td(width="50%")
        for interview in interviews:
            page.a(interview.name, href=interview.outFileBase + '.html')
            page.br()
        page.td.close()
        page.td(width="50%")
        for codeFreqPair in freqSortedCodes:
            page.a(codeFreqPair[0], href=urlSafe(codeFreqPair[0]) + '.html')
            page.add(' &nbsp;&nbsp;(' + str(histogram[codeFreqPair[0]]) + ')')
            page.br()
            #page.add('&nbsp;&nbsp;-&nbsp;&nbsp;')
        page.td.close()
        page.tr.close()
        page.table.close()

        outFile.write(str(page))
Exemple #52
0
 def _getNavBar(self):
     if not self.config.navBar:
         return ''
     navbar = markup.page()
     navbar.ul(id='navlist')
     for text, url in self.config.navBar.iteritems():
         navbar.li(id='navlist')
         navbar.a(text, href=url)
         navbar.li.close()
     navbar.ul.close()
     return str(navbar)
Exemple #53
0
    def __init__(self, title=None, outfile=None, options={}):
        ext = os.path.splitext(outfile)[1]
        if ext != "html":
            outfile = "{filename}.html".format(filename=os.path.splitext(outfile)[0])
        
        super(HtmlReportWriter, self).__init__(title, outfile, options)
        self._read_options(options)

        self._page = markup.page()
        self._page.init(title=title)
        if self.style:
            self._page.style(self.style)
Exemple #54
0
def genGetHTML(hostGB):
    print "Please check your working directory for CSRF Proof of Concept HTML File."
    print " "
    #HTML is generated here.
    page = markup.page()
    page.init(title="Pinata-CSRF-Tool")
    #page.form (action=hostGB, method = "GET", id = "formid" )
    page.img(src=hostGB)
    #page.img(src=hostGB.replace('https','http'))

    print " "
    t = open("CSRFGet.html", 'w')
    page = str(page)
    t.write(page)
    t.close()
Exemple #55
0
def generate_html(packages):
    page = markup.page()
    page.init(title="CTS Packages", )
    page.pre()
    for package in packages:
        page.a(package.filename, href=cos_info['cos_url'] + package.filename)
    page.pre.close()
    with open('index.html', 'w') as t:
        t.write(str(page))
        t.close()
    cos_client = CosClient(app_id, secret_id, secret_key, region)
    request = UploadFileRequest(bucket, unicode('/cts/index.html'),
                                unicode('index.html'))
    upload_file_ret = cos_client.upload_file(request)
    print upload_file_ret
def genHeaderMenu(page, header):
    """ Writes the header and menu to the top of each page. Returns the page instance.
	"""
    styles = ('layout.css')
    page = markup.page()
    page.init(title=header, css=styles, charset='utf-8')
    page.div(id_="index-header")
    page.add("<h1>{}</h1>".format(header))
    page.div(id_="index-menu")
    page.a("index", color="blue", href="index.html")
    page.add("&nbsp;&nbsp;-&nbsp;&nbsp;")
    page.a("histograms", color="blue", href="histograms.html")
    page.div.close()
    page.div.close()
    return page
Exemple #57
0
def generate_exp_html(path_to_folder, subfolder, info, figs):

    #   generate page title
    rec_location = info["Cell"]["Location"]
    pagetitle = "".join([rec_location, ": ", subfolder])

    #   creates page instance
    pg = mup.page()

    #   initialize the page, embed css, titles, header and footer
    pg.init(title=pagetitle,
            css=('markup.css', 'two.css'),
            header="".join(
                ['<font size="10" color="red" >', pagetitle, '</font>']),
            footer="The bitter end.")

    #   line break under header
    pg.br()

    #   loop over the figs ordered dictionary for every type of the figure
    for k, v in figs.items():
        images = []
        pg.p("".join(
            ['<font size="5" color="red" >', '<b>', k, '</b>', '</font>']))
        for i in range(0, len(v)):
            # images.append (".".join([v[i],'svg']))
            pg.p()
            v[i].split("_FI")[0]
            pg.a(href="".join([v[i].split("_FI")[0], "_FI_rug.html"]))
            pg.img(src=".".join([v[i], 'svg']),
                   alt="click for rug and return plot",
                   align="middle")
        pg.br()
        pg.hr()

    #   line break before footer
    pg.br()

    #   dump the generated html code into the .html file
    html_name = ".".join(
        ["".join([info["Cell"]["Location"], "_", "index"]), "html"])
    t = []
    f = open(ppjoin(path_to_folder, subfolder, html_name), "w")
    t.append(str(pg))
    f.write(t[0])
    f.close()

    return html_name, rec_location