def CreateHTML(regid): template = open('template.html','r').read() conn = sqlite3.connect('regtesting.db') conn.row_factory = sqlite3.Row cursor = conn.cursor() cursor.execute('select * from reg where regid = ' + str(regid)) row = cursor.fetchone() path = str(row['regid']) + '_' + str(row['regname']) description = row['description'] if os.access(path,os.F_OK) ==False: os.mkdir(path) listSingleShot = creategraph.createSingleShot(path + '/' + path + '_single',row['regid']) listSpread = creategraph.createSpread(path + '/' + path + '_spread',row['regid']) results = {} resCursor = conn.cursor() resCursor.execute('select * from results where regid = ' + str(row['regid'])) for row in resCursor: results[row['millesecond']] = row['reading'] listClean = [] listSortedKeys = results.keys() listSortedKeys.sort() for key in listSortedKeys: listClean.append(results[key]) creategraph.createCSVData(path+'/'+path,path,listClean) title = path rawDataLink = path+'/'+path+'.csv' folder =path fullSpreadThumb=listSpread[1] fullSpread=listSpread[0] singleThumb=listSingleShot[1] single=listSingleShot[0] #Dictionary holding the formatting strings formatDict = {} formatDict['summary'] = title formatDict['description'] = description formatDict['dataurl'] = rawDataLink formatDict['folder'] = folder formatDict['spreadpng'] = fullSpread formatDict['spreadpngthumb'] = fullSpreadThumb formatDict['singlepng'] = single formatDict['singlepngthumb'] = singleThumb newTemplate = template % formatDict write = open(title+'.html','w') write.write(newTemplate) write.close() return title+'.html'
def createHTML(self): template = open('template.html','r').read() conn = sqlite3.connect('regtesting.db') conn.row_factory = sqlite3.Row if os.access(REG_TESTING+self.path,os.F_OK) ==False: os.mkdir(REG_TESTING+self.path) listSingleShot = creategraph.createSingleShot(self.path,self.singletimes,self.singleshotreadings,self.path + '/' + self.path + '_single',self.regid) listSpread = self.createSpread() self.listClean = [] listSortedKeys = self.results.keys() listSortedKeys.sort() for key in listSortedKeys: self.listClean.append(self.results[key]) self.createCSVData(REG_TESTING+self.path+'/'+self.path) title = self.path rawDataLink = self.path+'/'+self.path+'.csv' folder =self.path fullSpreadThumb=listSpread[1] fullSpread=listSpread[0] singleThumb=listSingleShot[1] single=listSingleShot[0] #Dictionary holding the formatting strings formatDict = {} formatDict['summary'] = title formatDict['description'] = self.description formatDict['dataurl'] = rawDataLink formatDict['folder'] = folder formatDict['spreadpng'] = fullSpread formatDict['spreadpngthumb'] = fullSpreadThumb formatDict['singlepng'] = single formatDict['singlepngthumb'] = singleThumb newTemplate = template % formatDict write = open(REG_TESTING+title+'.html','w') write.write(newTemplate) write.close() return title+'.html'