当前位置: 首页>>代码示例>>Python>>正文


Python HTML.HTML类代码示例

本文整理汇总了Python中HTML.HTML的典型用法代码示例。如果您正苦于以下问题:Python HTML类的具体用法?Python HTML怎么用?Python HTML使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了HTML类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: createReports

def createReports(symObj,site,datacenter,sid):
    #
    www = HTML()
    # Create directories if they don't exist
    f = Files()
    f.dir = "/www/" + site + "/OR/"
    f.mkdir()
    htmlfile = '/www/' + site + '/OR/index.html'
    perf = '/opt/EMC/Scripts/shell/rcopyperf_' + sid + '.log'
    f.read_file(perf)
    page = []
    page.append(www.start_html_refresh('OR Sessions'))
    page.append(www.EMC_Header(site,datacenter))
    page.append(www.start_table(1,"OR Port Performance"))
    header = ["FA Port","MB/s","Ceiling","Number of Devices"]
    page.append(www.th_list(header))
    perftotal = 0
    for line in f.readfile:
      line = line.strip()
      fields = line.split()
      if len(fields) == 5:
        fields = fields[1:5]
      perftotal += int(fields[1])
      page.append(www.tr_list(fields))
    page.append(www.tr + www.th + "Total OR MB/s" + www.th + str(perftotal))
    page.append(www.end_table)  
    page.append('<br><br><pre>\n')
    for line in symObj.or_list:
      page.append(line)
    f.write_file(htmlfile,page)
开发者ID:vicengle,项目名称:EMC_VMAX,代码行数:30,代码来源:vmax3_OR_Monitor.py

示例2: createReports

def createReports(sloObj,site,datacenter):
    
    www = HTML()
    html_index = '/www/' + site + '/fast.html'
    sloCSV = '/www/' + site + '/CSV/' + site + '_slo.csv'
    csv = open(sloCSV, 'w')
    f_index = open(html_index,'w')
    f_index.write(www.start_html('SLO Summary'))
    linkpath = "/" + site + "/CSV/"  + site + '_slo.csv'
    fpSummLink = '<a href=' + linkpath + '>SLO CSV</a>\n'
    f_index.write(www.EMC_Header(site,datacenter,'',fpSummLink))
    csv.write('SLO Report for ' + site + '\n\n')
    csv.write("SLO Policy,Response Time Target\n")
    
    f_index.write(www.start_table(3,'SLO Policies'))
    f_index.write(www.tr + www.th + 'Policy Name' + www.th + 'Response Time Target (ms)\n')
      
    for slo in sloObj.slo_policies:
      html = www.tr + www.td + slo +  www.td + sloObj.slo_policies[slo]  + "\n"
      csv.write(slo + ',' + sloObj.slo_policies[slo] + '\n')
      f_index.write(html)
    f_index.write(www.end_table)  
    f_index.write(www.end_html)  
    f_index.close()
    csv.close()
开发者ID:vicengle,项目名称:EMC_VMAX,代码行数:25,代码来源:slo.py

示例3: __init__

    def __init__(self, settings, session, data, inputs):

        # --- Definitions
        
        self.settings = settings
        self.session = session
        self.data = data
        self.inputs = inputs
        self.html = HTML(self)
        self.display = True;
        
        # --- Pre-processing
        self.pre_process()
        
        # --- Actions
        if self.inputs.getvalue('form_action') is not None:
            
            # NB: stop is for redirection
            stop = self.form_action()
            
        else:
            stop = None
            
        # --- Html
        if stop is None:    
            self.html.meta(Language=self.session.language)
            self.html.favicon('Core/Style/Icons/favicon.ico?v={0}'.format(time()))
            self.html.style('fonts')
            self.html.style('common')
            self.html.jsfile('Core/JS/jquery.js')
            self.html.jsfile('Core/JS/common.js')
            self.set_html()
开发者ID:LaboJeanPerrin,项目名称:Data.Manager,代码行数:32,代码来源:Spot.py

示例4: test_html_object_set_element

	def test_html_object_set_element(self):
		html_obj = HTML()
		test_element = html_element()
		html_obj.add_element(test_element)
		swap_element = html_element(False, "a", "Anchor")
		html_obj.set_element(0, swap_element)
		self.assertEqual(swap_element, html_obj.get_element(0))
开发者ID:Trey50Daniel,项目名称:HTMLBuilder,代码行数:7,代码来源:HtmlElement_tests.py

示例5: insertTab

    def insertTab(self, text, asHTML, beforeIndex=None):
        """ 1st arg can, instead of being 'text', be a widget
        """
        if beforeIndex is None:
            beforeIndex = asHTML
            asHTML = False

        if (beforeIndex < 0) or (beforeIndex > self.getTabCount()):
            #throw new IndexOutOfBoundsException();
            pass

        if isinstance(text, str):
            if asHTML:
                item = HTML(text)
            else:
                item = Label(text)
            item.setWordWrap(False)
        else:
            # passing in a widget, it's expected to have its own style
            item = text

        self.insertTabWidget(item, beforeIndex)
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:22,代码来源:TabBar.py

示例6: createReports

def createReports(srdfObj,site,datacenter):
    Alerts = {}
    alert = 0
    www = HTML()
    f = Files()
    mailObj = EMail()
    dates = DateString()
    page = []
    csvpage = []
    htmlfile = '/www/SRDF.html'
    csvfile = '/www/SRDF.csv'
    reportDate =  str(time.strftime("%c")) 
    page.append(www.start_html('SRDF Report'))
    html = '<p>Report Date: ' + reportDate + '<br><br>'
    html += 'SRDF Status Report<br><br>'
    page.append(html)
    for group in srdfObj.SRDF_Groups:
      # Print header table
      page.append('<p><br><table align=center  border=3>\n')
      row = ['Group ID','SymID','RemoteSymID','Tracks Pending','Delta Time']
      page.append(www.th_list(row))  
      csvpage.append(', '.join(row) + '\n')
      info = srdfObj.SRDF_Groups_Info[group]
      row = [  group, info['symid'],info['remote_symid'],info['tracks'],info['delta']  ]
      page.append(www.tr_list(row)) 
      page.append(www.end_table)
      csvpage.append(', '.join(row) + '\n')
      # Print Pair data
      page.append('<p><br><table align=center  border=3>\n')
      row = ['Source','Target','Link State','Mode','Replication State']
      page.append(www.th_list(row)) 
      csvpage.append(', '.join(row) + '\n')     
      pairs = srdfObj.SRDF_Groups_Pairs[group]
      for pair in pairs:
        list = pair.split(',')
        if  list[4] != 'Consistent':
          bgcolor="#B0B3AF"
          alert += 1
          Alerts[group] = "SRDF is not in a consistent state for " + group
        else:
          bgcolor="#69F24E"
        page.append(www.tr_list(list,bgcolor)) 
        csvpage.append(', '.join(list) + '\n')     
      page.append(www.end_table)
     
    
    page.append(www.end_html)
    f.write_file(htmlfile,page)
    f.write_file(csvfile,csvpage)

    if alert > 0:
      alertMessage = "The Following SRDF Groups are not Consistent\n\n"
      for groupalert in Alerts:
        alertMessage += Alerts[groupalert]     
      mailObj.subject = "VMAX SRDF Alert " + site + ', ' + datacenter
      mailObj.message = alertMessage
      mailObj.send_mail()   
开发者ID:vicengle,项目名称:EMC_VMAX,代码行数:57,代码来源:SRDF_TF.py

示例7: createReports

def createReports(fpObj,site,datacenter):
  htmlpage = []
  csvpage = []
  www = HTML()
  f = Files()
  html_index = '/www/' + site + '/fast_demand.html'
  fastCSV = '/www/' + site + '/CSV/' + site + '_fast_demand.csv'
  
  htmlpage.append(www.start_html('MV Summary'))
  linkpath = "/" + site + "/CSV/"  + site + '_fast_demand.csv'
  fpSummLink = '<a href=' + linkpath + '>FAST CSV</a>\n'
  htmlpage.append(www.EMC_Header(site,datacenter,'',fpSummLink))
  csvpage.append('FAST-VP Report for ' + site + '\n\n')
  
  htmlpage.append(www.start_table(3,'FAST-VP Demand report'))
  heading = ['SG_Name']
  for tier in fpObj.tiernames:
    heading.append(tier)
  htmlpage.append(www.th_list(heading))
  csvpage.append(', '.join(heading))

  for sg in fpObj.tiers:
    # 
    line = [str(sg)]
    for tiername in fpObj.tiernames:
      if tiername in fpObj.tiers[sg]:
        line.append(fpObj.tiers[sg][tiername])
      else:
        line.append('0')
    
    csvpage.append(', '.join(line))
    htmlpage.append(www.tr_list(line))
  htmlpage.append(www.end_table)  
  htmlpage.append(www.end_html)  
  f.write_file(html_index,htmlpage)
  f.write_file(fastCSV,csvpage)    
开发者ID:vicengle,项目名称:EMC_VMAX,代码行数:36,代码来源:fast_dev.py

示例8: insertTab

    def insertTab(self, text, asHTML, beforeIndex=None):
        """ 1st arg can, instead of being 'text', be a widget.

            1st arg can also be None, which results in a blank
            space between tabs.  Use this to push subsequent
            tabs out to the right hand end of the TabBar.
            (the "blank" tab, by not being focussable, is not
            clickable).
        """
        if beforeIndex is None:
            beforeIndex = asHTML
            asHTML = False

        if (beforeIndex < 0) or (beforeIndex > self.getTabCount()):
            #throw new IndexOutOfBoundsException();
            pass

        if text is None:
            text = HTML("&nbsp;", True)
            text.setWidth("100%")
            text.setStyleName("gwt-TabBarRest")
            self.panel.insert(text, beforeIndex + 1)
            self.panel.setCellWidth(text, "100%")
            return

        try:
            istext = isinstance(text, str) or isinstance(text, unicode)
        except:
            istext = isinstance(text, str)

        if istext:
            if asHTML:
                item = HTML(text)
            else:
                item = Label(text)
            item.setWordWrap(False)
        else:
            # passing in a widget, it's expected to have its own style
            item = text

        self.insertTabWidget(item, beforeIndex)
开发者ID:certik,项目名称:pyjamas,代码行数:41,代码来源:TabBar.py

示例9: __init__

    def __init__(self, autoHide=None, modal=True, **kwargs):

        PopupPanel.__init__(self, autoHide, modal, **kwargs)
        self.caption = HTML()
        self.child = None
        self.dragging = False
        self.dragStartX = 0
        self.dragStartY = 0
        self.panel = FlexTable(Height="100%", BorderWidth="0",
                                CellPadding="0", CellSpacing="0")
        self.panel.setWidget(0, 0, self.caption)
        self.panel.getCellFormatter().setHeight(1, 0, "100%")
        self.panel.getCellFormatter().setWidth(1, 0, "100%")
        self.panel.getCellFormatter().setAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE)
        PopupPanel.setWidget(self, self.panel)

        self.setStyleName("gwt-DialogBox")
        self.caption.setStyleName("Caption")
        self.caption.addMouseListener(self)
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:19,代码来源:DialogBox.py

示例10: Settings

#
#
#
#
#
if __name__ == "__main__":

    DebugLevel = logging.DEBUG
    logging.basicConfig(level=DebugLevel)

    from Settings import Settings
    from Top import Top
    Top.settings = Settings(FromConfigFile = True)

    from HTML import HTML
    WebPage = HTML()
    WebPage.makeHeader()

    f = Gaussian()
    f.file = sys.argv[1]
    #import profile
    #profile.run('f.parse()')
    f.parse()
    f.postprocess()
    print f.steps[0]
    b1, b2 = f.webData()

    WebPage.makeLine(b1,b2)
    WebPage.makeTail()
    WebPage.write()
开发者ID:mtthwflst,项目名称:terse,代码行数:30,代码来源:ArchiveGaussian.py

示例11: DialogBox

class DialogBox(PopupPanel):
    def __init__(self, autoHide=None, modal=True, **kwargs):

        PopupPanel.__init__(self, autoHide, modal, **kwargs)
        self.caption = HTML()
        self.child = None
        self.dragging = False
        self.dragStartX = 0
        self.dragStartY = 0
        self.panel = FlexTable(Height="100%", BorderWidth="0",
                                CellPadding="0", CellSpacing="0")
        self.panel.setWidget(0, 0, self.caption)
        self.panel.getCellFormatter().setHeight(1, 0, "100%")
        self.panel.getCellFormatter().setWidth(1, 0, "100%")
        self.panel.getCellFormatter().setAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE)
        PopupPanel.setWidget(self, self.panel)

        self.setStyleName("gwt-DialogBox")
        self.caption.setStyleName("Caption")
        self.caption.addMouseListener(self)

    def getHTML(self):
        return self.caption.getHTML()

    def getText(self):
        return self.caption.getText()

    def onEventPreview(self, event):
        # preventDefault on mousedown events, outside of the
        # dialog, to stop text-selection on dragging
        type = DOM.eventGetType(event)
        if type == 'mousedown':
            target = DOM.eventGetTarget(event)
            elem = self.caption.getElement()
            event_targets_popup = target and DOM.isOrHasChild(elem, target)
            if event_targets_popup:
                DOM.eventPreventDefault(event)
        return PopupPanel.onEventPreview(self, event)

    def onMouseDown(self, sender, x, y):
        self.dragging = True
        DOM.setCapture(self.caption.getElement())
        self.dragStartX = x
        self.dragStartY = y

    def onMouseEnter(self, sender):
        pass

    def onMouseLeave(self, sender):
        pass

    def onMouseMove(self, sender, x, y):
        if self.dragging:
            absX = x + self.getAbsoluteLeft()
            absY = y + self.getAbsoluteTop()
            self.setPopupPosition(absX - self.dragStartX, absY - self.dragStartY)

    def onMouseUp(self, sender, x, y):
        self.dragging = False
        DOM.releaseCapture(self.caption.getElement())

    def remove(self, widget):
        if self.child != widget:
            return False

        self.panel.remove(widget)
        self.child = None
        return True

    def setHTML(self, html):
        self.caption.setHTML(html)

    def setText(self, text):
        self.caption.setText(text)

    def doAttachChildren(self):
        PopupPanel.doAttachChildren(self)
        self.caption.onAttach()

    def doDetachChildren(self):
        PopupPanel.doDetachChildren(self)
        self.caption.onDetach()

    def setWidget(self, widget):
        if self.child is not None:
            self.panel.remove(self.child)

        if widget is not None:
            self.panel.setWidget(1, 0, widget)

        self.child = widget
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:91,代码来源:DialogBox.py

示例12: test_html_object_change_has_body

	def test_html_object_change_has_body(self):
		html_obj = HTML(True, True)
		html_obj.change_has_body()
		self.assertEqual(False, html_obj.has_body)
开发者ID:Trey50Daniel,项目名称:HTMLBuilder,代码行数:4,代码来源:HtmlElement_tests.py

示例13: test_html_object_get_nested_level

	def test_html_object_get_nested_level(self):
		html_obj = HTML()
		self.assertEqual(0, html_obj.get_top_element_nested_level())
开发者ID:Trey50Daniel,项目名称:HTMLBuilder,代码行数:3,代码来源:HtmlElement_tests.py

示例14: createReports

def createReports(sgObj,site,datacenter):
    #
    # Create directories if they don't exist
    orange = '#F7EE6F'
    green =  '#69F24E'       
    dir = "/www/" + site + "/SG/"
    if not os.path.isdir(dir):
      subprocess.call(["mkdir", dir]) 
    dir = '/www/' + site + '/CSV'      
    if not os.path.isdir(dir):
      subprocess.call(["mkdir", dir]) 
    #
    #    
    reportDate =  str(time.strftime("%c"))
    GB =  float(sgObj.ProvisionedCapacity)/1024
    ProvisionedGB = "%.2f" % GB
    info1 = 'Total Porvisioned(GB)=' + str(ProvisionedGB)

    www = HTML()
    html_index = '/www/' + site + '/index.html'
    sgSummCSV = '/www/' + site + '/CSV/' + site + '_SG_Summary.csv'
    f_index = open(html_index,'w')
    f_SummCSV = open(sgSummCSV,'w')
    f_SummCSV.write("Storage Group,SLO Policy,Capacity GB,Masking View,Max IOPS,Max MB/s\n")
    linkpath = "/" + site + "/CSV/"  + site + '_SG_Summary.csv'
    sgSummLink = '<a href=' + linkpath + '>Summary CSV</a>\n'
    f_index.write(www.start_html('SG Summary'))
    f_index.write(www.EMC_Header(site,datacenter,info1,sgSummLink))
    f_index.write(www.start_table())
    f_index.write(www.end_table)
    fpTables = {}
    policies = {}
    for sg in sgObj.SGs:

      #
      color = ''  
      link = "/" + site + "/SG/" + sg + ".html"
      sgGB = float(sgObj.SG2Capacity[sg])/1024
      sgProvisionedGB = "%.2f" % sgGB
      MVs = sgObj.SGinMV[sg]
      fp = sgObj.SGinSLO[sg]
      policies[fp] = 1
      if not fp in fpTables:
        fpTables[fp] = []      
      IOPS_LIMIT = str(sgObj.SG_IOPS_Limit[sg])
      MB_LIMIT = str(sgObj.SG_MB_Limit[sg])
      if MVs.upper() == 'NO':
        color = orange
      
      rowlist = ["<a href=" + link + '>' + sg + "</a>",fp, str(sgProvisionedGB),MVs,IOPS_LIMIT,MB_LIMIT]
      SGhtml = www.tr_list(rowlist,color)
      fpTables[fp].append(SGhtml)
      
      f_SummCSV.write(sg + ',' + fp + ',' + str(sgProvisionedGB)   + ',' + MVs + ',' + IOPS_LIMIT + ',' + MB_LIMIT + "\n")
      # go ahead and write out the sg detail HTML page.
      sgfile = "/www/" + site + "/SG/" + sg + ".html"
      sgCSV = "/www/" + site + "/CSV/" + site + '_' + sg + ".csv"
      linkpath = "/" + site + "/CSV/" + site + '_' + sg + ".csv"
      link1 = '<a href=' + linkpath + '>SG CSV</a>\n'
      f_sg = open(sgfile,'w')
      f_sgCSV = open(sgCSV,'w')
      f_sgCSV.write('Storage Group Report for ' + sg + '\n\n\n')
      f_sg.write(www.start_html('SG Detail'))
      f_sg.write(www.EMC_Header(site,datacenter,'',link1))
      html = "<p><H3><center>Detailed Storage Report for " + sg + " SSC_VMAX40K_1794</center></H3>\n"
      f_sg.write(html)
      f_sg.write(www.start_table())
      f_sg.write(www.tr + www.th + "Storage Group<th>SLO Policy<TH>Capacity GB</tr>\n") 
      html = www.tr + www.td +  sg + www.td + fp + www.td + str(sgProvisionedGB) + "\n"
      f_sg.write(html)
      f_sg.write(www.end_table)  
      
      f_sg.write(www.start_table(3,'Device List'))
      f_sg.write(www.tr + www.th + "Device<th>Capacity GB</tr>\n") 
      f_sgCSV.write("Volume,Capacity GB\n")
      for device in sgObj.SGs[sg]:
        devGB = float(sgObj.SGs[sg][device])/1024
        dev_formatted = "%.2f" % devGB
        html = www.tr + www.td + device + www.td + str(dev_formatted) +"\n"
        f_sg.write(html)
        f_sgCSV.write(device + ',' + str(dev_formatted) + '\n')
      f_sg.write(www.end_table)
      f_sg.write(www.end_html)
      f_sg.close()
      f_sgCSV.close()
      
    for fp in policies:
      f_index.write(www.start_table(3,'Groups with SLO ' + fp + ' Policy'))
      f_index.write("<tr><th>Storage Group<th>SLO Policy<TH>Capacity GB<TH>Masking View<TH>IOPS Limit<TH>MB/s Limit</tr>\n")   
      for line in fpTables[fp]:
        f_index.write(line)
      f_index.write(www.end_table)    
    f_index.write(www.end_html)  
    f_index.close()
    f_SummCSV.close()
开发者ID:vicengle,项目名称:EMC_VMAX,代码行数:95,代码来源:sg_vmax3_report.py

示例15: outputHtmlUserlist

def outputHtmlUserlist(fname, db, keys):
    h = HTML()
    head = h.head("")
    with h.body(""):
        with h.table(border='1', newlines=True):
            with h.colgroup:
                h.col(span="1", style="width: 64px;")
                h.col(span="1", style="width: 130px;")
                h.col(span="1", style="width: 250px;")
                h.col(span="1", style="width: 250px;")
            with h.tr:
                h.th("avatar")
                h.th("username")
                h.th("fullname")
                h.th("location")
            for u in keys:
                with h.tr:
                    with h.td():
                        h.img('',src=escape(db.usernames[u].avatar), width="64", height="64")
                    h.td(u)
                    h.td(escape(db.usernames[u].fullname))
                    h.td(escape(db.usernames[u].location))
    open(fname, "w").write(str(h))
开发者ID:52M,项目名称:twister-core,代码行数:23,代码来源:usernameCrawler.py


注:本文中的HTML.HTML类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。