本文整理汇总了Python中HTML类的典型用法代码示例。如果您正苦于以下问题:Python HTML类的具体用法?Python HTML怎么用?Python HTML使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HTML类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: retrieveData
def retrieveData (self,event):
socials=self.intxt.GetLineText(1).split(' ')
self.doScreen() #fix the screens coming back with old data
self.htmlList=[] #clear out html pages
cnxn=accP2()
cursor=cnxn.cursor()
for social in socials:
if len(social) < 11:
social=social[0:3]+'-'+social[3:5]+'-'+social[5:] # get all socsecs if just the number entered
htmlText=htmlString() # set up an instance of the html string
EEData = xyz99(None,'ssn',None,None,social)
for i,j in zip(EEData.Fields, EEData.Types):
pass
# print i,j
EEHTML = HTML.table([['No employee found'],['No data returned']])
if len(EEData.OutData) > 0:
self.EEDataXL = [(field,data) for field,data in zip(EEData.Fields , EEData.OutData[0])]
self.EETypes = [(field,data) for field,data in zip(EEData.Fields , EEData.Types)]
EEHTML = HTML.table(EEData.outStringTable())
#then get the IB data
self.ibRecs = getibData(social,cursor)
IBHTML = HTML.table([['No record in IBControl table'],['No data returned']])
if max([len(i) for i in self.ibRecs]) > 1: # getibData returns a list of tuples, which only have the column name in each if they are empty
columnAlign = ['top' ]* len(self.ibRecs[0])
IBHTML = HTML.table(self.ibRecs,col_valign=columnAlign)
OutputTable = [['Employee Data','IB Control Data'],[EEHTML, IBHTML]]
htmlText.v+= HTML.table(OutputTable,col_valign=('top','top'))
htmlText.v+='</td>'
htmlText.vend()
htmlText.vreduceFont()
self.Addapanel(htmlText)
cnxn.close()
self.bigPanel.SetSizerAndFit(self.subPans)
self.bigPanel.Layout()
示例2: main
def main():
# part1:
#-------------------------------------------------------------------
Part1.Part1()
#-------------------------------------------------------------------
# part2:
#-------------------------------------------------------------------
# set last parameter to true to enable export of shots
stitched_shots, all_shots, outstitched_shots = Part2.Part2(False)
#-------------------------------------------------------------------
#html stuff:
#-------------------------------------------------------------------
HTML.html_stuff(stitched_shots, all_shots, outstitched_shots, 'Oberstdorf16-shots.csv',
'./html_input/index_part1.txt', './html_input/index_part2.txt', './html_output/index.html')
#-------------------------------------------------------------------
#xml stuff:
#-------------------------------------------------------------------
XML.create_XML('caffe_output.txt')
示例3: package
class Document:
generator = HTML.META(name="generator",
content="HyperText package (Python)")
DOCTYPE = HTML.DOCTYPE
body_element = HTML.BODY
def __init__(self, *content, **attrs):
from HTML import HEAD, HTML
self.doctype = self.DOCTYPE
self.body = apply(self.body_element, content, attrs)
self.head = HEAD(self.generator)
if hasattr(self, 'style'): self.head.append(self.style)
if hasattr(self, 'title'): self.head.append(self.title)
self.html = HTML(self.head, self.body)
self.setup()
def setup(self): pass
def append(self, *items): map(self.body.content.append, items)
def __str__(self, indent=0, perlevel=2):
return join([self.doctype.__str__(indent, perlevel),
self.html.__str__(indent, perlevel)], '')
def writeto(self, fp=sys.stdout, indent=0, perlevel=2):
self.doctype.writeto(fp, indent, perlevel)
self.html.writeto(fp, indent, perlevel)
示例4: create_testbeam_html_pages
def create_testbeam_html_pages(self):
testbeams = [self.results[x].getint('RunInfo', 'runno') / 100 for x in self.results]
testbeams = sorted(list(set(testbeams)))
testbeamDate = utilities.get_dict_from_file('%s/testBeamDates.cfg' % self.config_dir)
for testbeam in testbeams:
key = '%s' % testbeam
if not key in testbeamDate:
testbeamDate[key] = 'unkown'
irr = utilities.get_dict_from_file('%s/irradiationType.cfg' % self.config_dir)
allDiamonds = self.get_list_of_diamonds(self.results)
allDiamonds = sorted(allDiamonds, key=lambda z: '%s-%s' % (irr.get(z, 'unkown'), z))
allDiamondLinks = map(lambda z: HTML.link('%s (%s)' % (z, irr.get(z, 'unknown')), 'results_%s.html' % z),
allDiamonds)
testBeamLinkTable = []
header = [HTML.link('Test Beam', 'results.html')] + allDiamondLinks
for testbeam in testbeams:
results = filter(lambda z: self.results[z].getint('RunInfo', 'runno') / 100 == testbeam, self.results)
results = {key: self.results[key] for key in results}
diamonds = self.get_list_of_diamonds(results)
# results = sorted(results,key=itemgetter(mapping['RunNo'],mapping['dia'],mapping['corrected']))
print testbeam, len(results), diamonds
fileName = '%s/results_%sXX.html' % (self.config.get('HTML', 'outputDir'), testbeam)
fileName = fileName.replace('//', '/')
# raw_input(fileName)
self.create_html_overview_table(results, fileName)
fileName = 'results_%sXX.html' % testbeam
row = [HTML.link('%sXX - %s ' % (testbeam, testbeamDate['%s' % testbeam]), fileName)] + map(
lambda z: z in diamonds, allDiamonds)
testBeamLinkTable.append(row)
htmlcode = HTML.table(testBeamLinkTable, header_row=header)
fileName = '%s/results_testBeams.html' % self.config.get('HTML', 'outputDir')
utilities.save_html_code(fileName, htmlcode)
示例5: link
def link(tmp_list):
"""
generate links to Tapper
"""
if len(tmp_list) > 1:
link_html = HTML.link("results+", "https://tapper/tapper/reports/idlist/" + ",".join(str(l) for l in tmp_list))
elif len(tmp_list) == 1:
link_html = HTML.link("results", "https://tapper/tapper/reports/id/" + ",".join(str(l) for l in tmp_list))
return link_html
示例6: feed2html
def feed2html(self, feed):
table_data = []
entrylist = []
for entry in feed.entry:
entrylist = [ HTML.link(entry.media.title.text,entry.media.player.url), entry.published.text[:10], entry.media.category[0].text, self.sec2time(entry.media.duration.seconds), self.formatViewCount(entry.statistics.view_count), '%.2f'%float(entry.rating.average)]
table_data.append(entrylist)
html_string = HTML.table(table_data, header_row=['Video title','Video published on','Video category','Video duration','Video view count','Video rating'])
return html_string
示例7: main
def main():
'''
Application to manage all the most used packages using apt-get.
Unfinished.
'''
form = cgi.FieldStorage()
sm=serviceManagerBuilder()
config=Configuration()
view = View(config.system.actions)
table_data = [
['Smith', 'John', 30],
['Carpenter', 'Jack', 47],
['Johnson', 'Paul', 62],
]
htmlcode = HTML.table(table_data,
header_row=['Last name', 'First name', 'Age'])
ins = open( "recommendationsList.txt", "r" )
packages = []
for line in ins:
packages.append( line )
installedPackages = [[]]
toInstallPackages = [[]]
i = -1
j = -1
for a in packages:
a = a.rstrip() # strip the new line
bashCommand = "dpkg-query -l | grep '" + a + " '"
output = execute( bashCommand )
if output == "" :
i += 1
toInstallPackages.append( [a, 'w8'] )
else :
j += 1
installedPackages.append( [ a, 'w8'] )
if i != -1 :
htmlcode += HTML.table( toInstallPackages,
header_row=['Package Name', 'p'] )
if j != -1 :
htmlcode += HTML.table( installedPackages,
header_row=['Package Name', 'p'] )
#if installed add it in the installedPackages array
#else in the restPackages
#subprocess.call("./checkIfInstalled.sh", shell=True)\ -> maybe generate xml file to get response so it is then compatible with the android
view.setContent('Arxidi2 App', htmlcode )
view.output()
示例8: make_debian_links
def make_debian_links(pkg, version):
"""Return a string containing debian links for a package"""
pts_base = "http://packages.qa.debian.org/"
bts_base = "http://bugs.debian.org/cgi-bin/pkgreport.cgi?src="
deb_buildd_base = "https://buildd.debian.org/status/logs.php?arch=&pkg="
pts = HTML.link('PTS', pts_base + pkg)
bts = HTML.link('BTS', bts_base + pkg)
deb_buildd = HTML.link('Buildd', deb_buildd_base + pkg)
return " ".join((pts, bts, deb_buildd))
示例9: html_write
def html_write(info,data,oligo,inputfile,linklist):
tabinfo=HTML.table(info)
tab=HTML.table(data)
linkhome=HTML.link('Home','../report.html')
htmlcode=('<haed><link rel="stylesheet" type="text/css" href="http://matrix.petoukhov.com/css/default.css"'
+ 'media="screen" /></haed>'+linkhome+'<hr><br>'+ tabinfo+'<hr><br>'+tab
)
fname=inputfile.path+str(oligo)+'-plet_'+inputfile.get_level()+'.html'
fres=open(fname,'w')
fres.write(htmlcode)
fres.close()
form_linklist(linklist,inputfile,oligo)
示例10: make_ubuntu_links
def make_ubuntu_links(pkg, version):
"""Return a string containing ubuntu links for a package"""
puc_base = "http://packages.ubuntu.com/search?searchon=sourcenames&keywords="
lp_base = "https://launchpad.net/ubuntu/+source/"
ubu_bugs_base = "https://launchpad.net/ubuntu/+source/%s/+bugs"
ubu_buildd_base = "https://launchpad.net/ubuntu/+source/%s/%s"
puc = HTML.link('packages.u.c.', puc_base + pkg)
lp = HTML.link('LP', lp_base + pkg)
ubu_bugs = HTML.link('Bugs', ubu_bugs_base % pkg)
ubu_buildd = HTML.link('Buildd', ubu_buildd_base % (pkg, version))
return " ".join((puc, lp, ubu_bugs, ubu_buildd))
示例11: link
def link(tmp_list):
'''
generate links to Tapper
'''
if len(tmp_list) > 1:
link_html = HTML.link('results+',
'https://tapper/tapper/reports/idlist/' +
','.join(str(l) for l in tmp_list))
elif len(tmp_list) == 1:
link_html = HTML.link('results',
'https://tapper/tapper/reports/id/' +
','.join(str(l) for l in tmp_list))
return link_html
示例12: form_linklist
def form_linklist(linklist,fname,oligo=0):
if oligo==0:
linklist.append(
{'linktype':'data','deep':fname.compdeep,'type':fname.comptype,
'link':HTML.link(fname.get_level(),fname.get_name())
}
)
else:
linklist.append(
{'linktype':'table','deep':fname.compdeep,'type':fname.comptype,
'link':HTML.link(fname.get_level(),fname.path+str(oligo)+'-plet_'+fname.get_level()+'.html'),
'oligo':oligo
}
)
示例13: main
def main():
leftDirectionPins, rightDirectionPins = getDirections()
leftValuesPins, rightValuesPins = getValues()
pins = [[]]
text = ''
for index in range(len(leftPins)):
leftDirectionText, leftValuesText = getFieldTexts(index, leftPins, leftDirectionPins, leftValuesPins)
pins.append( [ leftDirectionText, leftValuesText, leftPins[index] ] )
for index in range(len(rightPins)):
rightDirectionText, rightValuesText = getFieldTexts(index, rightPins, rightDirectionPins, rightValuesPins)
pins[index+1]+=[rightPins[index], rightValuesText, rightDirectionText ]
html_code='<div style="clear: both">'+\
'<h4 style="float: left">RPi.GPIO version: ' + str(GPIO.VERSION) + '</h4>'+\
'<h4 style="float: right">RPi Board Revision: ' + str(GPIO.RPI_REVISION) + '</h4>' +\
'</div>' +\
'<hr />'
html_code += '<div id="gpio_table">\n'
html_code += HTML.table( pins, header_row=[ 'DIRECTION', 'VALUE', 'LEFT', 'RIGHT', 'VALUE', 'DIRECTION' ] )
html_code += '</div>\n'
html_code += '<center><div id="user_space"></div><button class="btn btn-primary" onclick="gpio_clear()">Cleanup GPIO</button></center>'
view.setContent('GPIO Manager', html_code)
view.output()
示例14: run
def run(run_options=None):
logging.debug('Process run......')
f = open('videoplayback_result.html', 'w')
file_list = glob.glob('%s/*' % HOST_MEDIA_PATH)
result_list = {}
for file in file_list:
baseFile = os.path.basename(file)
result_list[baseFile] = ['N/A', 'N/A', 'N/A', 'N/A', '-1', 'N/A', 'N/A', 'N/A']
num = 1
sortedResult = []
for file in file_list:
testID = 'Video-%d' % num
baseFile = os.path.basename(file)
runEachTest(testID, baseFile, result_list[baseFile])
sortedResult.append(result_list[baseFile])
time.sleep(2)
num += 1
htmlcode = HTML.table(sortedResult,
header_row=['Test ID', 'File Name', 'Codec Type',
'Video Size', 'FPS', 'Frame Drop',
'Playback Result', 'Screen Capture'])
os.system('adb shell input keyevent KEYCODE_HOME')
f.write(htmlcode)
f.close()
return True
示例15: create_diamond_html_pages
def create_diamond_html_pages(self):
diamonds = self.get_list_of_diamonds(self.results)
diamondLinkList = []
for diamond in diamonds:
print 'Create Page for diamond: "%s"' % diamond
results = filter(lambda x: self.results[x].get('RunInfo', 'dia') == diamond, self.results)
results = {key: self.results[key] for key in results}
fileName = '%s/results_%s.html' % (self.config.get('HTML', 'outputDir'), diamond)
diamondLinkList.append(HTML.link(diamond, 'results_%s.html' % diamond))
self.create_html_overview_table(results, fileName)
htmlcode = HTML.list(diamondLinkList)
fileName = '%s/results_diamonds.html' % self.config.get('HTML', 'outputDir')
if self.verbosity:
print 'save diamond file to: "%s"' % fileName
utilities.save_html_code(fileName, htmlcode)
pass