Beispiel #1
0
 def onCompletion(self, txt):
     doc = create_xml_doc(txt)
     #node = doc.firstChild
     
     #node = doc.getElementById("topDirectory")
     nodes = doc.getElementsByTagName("recipe")
     if len(nodes)>0:
         rlist = []
         for i in range(0, len(nodes)):
             node = nodes.item(i)
             rlist.append(node.getAttribute("name"))
             
         rlist.sort()
         for r in rlist:
             self.panel.recipeList.addItem(r)
Beispiel #2
0
    def fromXML(self,text):
        doc = create_xml_doc(text)
        #node = doc.firstChild
        
        #node = doc.getElementById("topDirectory")
        nodes = doc.getElementsByTagName("dirEntry")
        node = nodes.item(0)
        s = repr(node)
        
        newproto = self.createProto(node)    
        plist = [newproto]
        #plist = [Proto(node.tagName)]

        for i in range(len(plist)):
            num = str(len(plist))
            # self.createItem(plist[i])
            self.fTree.addItem(plist[i].item)
            plist[i].item.setState(True)
Beispiel #3
0
 def onCompletion(self, txt):
     doc = create_xml_doc(txt)
     #node = doc.firstChild
     
     #node = doc.getElementById("topDirectory")
     nodes = doc.getElementsByTagName("recipe")
     rdict = {}
     if len(nodes)>0:
         rlist = []
         for i in range(0, len(nodes)):
             node = nodes.item(i)
             rlist.append(node.getAttribute("name"))
             rdict.update({node.getAttribute("name"):node.getAttribute("path")})
             
         rlist.sort()
         for r in rlist:
             self.panel.RList.addItem(r)
         c = self.panel.RList.getItemCount()
         self.panel.recipeDict = rdict
         self.panel.RList.setVisibleItemCount(c)
    def onCompletion(self, txt):
        local = self.local
        try:
            try:
                doc = create_xml_doc(txt)
                rhtml = ""
                sci = doc.getElementsByTagName("dataset")
                scinode = sci.item(0)
                if scinode:
                    filenamenode= scinode.getElementsByTagName("filename")
                    sciname = filenamenode.item(0).textContent
                    datalabelnode = scinode.getElementsByTagName("datalabel").item(0)
                    datalab = datalabelnode.textContent
                else:
                    if local:
                        self.panel.localcalreport.setHTML(
                            """ 
                            <h2>Local Calibration Search Results</h2>
                            <span style="color:red">
                                Error From Local Calibration Result
                            </span>
                            """)
                    else:
                        self.panel.globalcalreport.setHTML(
                            """
                            <h2>Global Calibration Search Results</h2>
                            <span style="color:red">
                                    Error From Global Calibration Result
                            </span>
                            """)
                    return


                # title of results
                if local:
                    rhtml += "<h2>Local Calibration Search Results</h2>"
                else:
                    rhtml += "<h2>Global Calibration Search Results</h2>"
                rhtml += "For fileset: <b>%s</b><br/>\n" % str(sciname)
                
                # add data label                
                rhtml += "data label: %s<br/>" % str(datalab)
                
                # 
                nodes = doc.getElementsByTagName("calibration")
                rhtml += '<table cellspacing="2px">\n'
                rhtml += """
                            <COLGROUP align="right" />
                            <COLGROUP align="left" />
                         """
                rhtml += "<thead>\n"
                rhtml += "<tr>\n"
                rhtml += '<td style="background-color:grey">%s</td>\n' % 'Calibration Type'
                rhtml += '<td style="background-color:grey">%s</td>\n' % 'Canonical Filename'
                rhtml += "</tr>\n"
                rhtml += "</thead>\n"
                for i in range(0, len(nodes)):
                    node = nodes.item(i)
                    ctnode = node.getElementsByTagName("caltype").item(0)
                    fnnode = node.getElementsByTagName("filename").item(0)
                    caltype = ctnode.textContent
                    fname = fnnode.textContent
                    rhtml += "<tr>\n"
                    rhtml += "<td>%s:</td>\n"%caltype
                    rhtml += "<td><b>%s</b></td>\n"%fname
                    rhtml += "</tr>\n"
                rhtml += "</table>\n"


                if local:
                    self.panel.localcalreport.setHTML(rhtml)
                else:
                    self.panel.globalcalreport.setHTML(rhtml)
            except:

                if local:
                    self.panel.localcalreport.setHTML(
                        """ 
                        <h2>Local Calibration Search Results</h2>
                        <span style="color:red">
                            Error From Local Calibration Result
                        </span>
                        """)
                else:
                    self.panel.globalcalreport.setHTML(
                        """
                        <h2>Global Calibration Search Results</h2>
                        <span style="color:red">
                                Error From Global Calibration Result
                        </span>
                        """)
        except:
            pass