def testMakeHtmlTableWithJS(self): # CSS and Javascript is going to determine much of the formatting. project = self.setupSimplestProject() h = HTMLfile(project.htmlPath('test.html'), project) columnFormats = [('col1', {}), ('col2', {}), ('col3', {})] t = MakeHtmlTable(h.main, showHeader=False, classId="testJsTable", id="testJsTableId", columnFormats=columnFormats, bla="0") for row in t.rows(range(2)): rStr = str(row) t.nextColumn() t(None, rStr) t.nextColumn() t('a', rStr + "." + str(2), href='someRefHere') t.nextColumn() # empty one t.nextColumn() t(None, rStr + "." + str(4)) #end for h.main('h3', 'Text to start below the table.') h.render()
def test_HTMLfile_simple(self): project = self.setupSimplestProject() myhtml = HTMLfile('myTest.html', project, 'A Test') myhtml.header("a header") myhtml('h1', 'It is a test') myhtml.main("a main") myhtml.openTag('a', href="http://www.apple.com") myhtml('img', src='apple1.jpg') myhtml.closeTag('a') myhtml('a', 'testing link', href="http://www.bioc.cam.ac.uk/") myhtml.render() ############### myhtml = HTMLfile('myTest2.html', project, 'A Test 2') myhtml.header('h1', 'It is a test 2') myhtml.header('h2', 'another line') myhtml.main('a', href="http://www.apple.com", closeTag=False) myhtml.main('img', src='apple1.jpg') myhtml.main('a', openTag=False) myhtml.main('a', 'testing link', href="http://www.bioc.cam.ac.uk/") myhtml('br', 'used call') myhtml.render()
def test_HTMLfile_simple(self): project = self.setupSimplestProject() myhtml = HTMLfile('myTest.html', project, 'A Test') myhtml.header("a header") myhtml('h1', 'It is a test') myhtml.main("a main") myhtml.openTag('a', href="http://www.apple.com") myhtml('img', src = 'apple1.jpg') myhtml.closeTag('a') myhtml('a', 'testing link', href="http://www.bioc.cam.ac.uk/") myhtml.render() ############### myhtml = HTMLfile('myTest2.html', project, 'A Test 2') myhtml.header('h1', 'It is a test 2') myhtml.header('h2', 'another line') myhtml.main('a', href="http://www.apple.com", closeTag=False) myhtml.main('img', src = 'apple1.jpg') myhtml.main('a', openTag=False) myhtml.main('a', 'testing link', href="http://www.bioc.cam.ac.uk/") myhtml('br', 'used call') myhtml.render()
def testROGscore(self): entryId = 'test' project = Project(entryId) self.failIf(project.removeFromDisk()) project = Project.open(entryId, status='new') molecule = Molecule(name='moleculeName') molecule.ensemble = Ensemble(molecule) # Needed for html. project.appendMolecule(molecule) # Needed for html. # Add some crud to prevent warnings/errors later. molecule.addChain('top') top = molecule.allChains()[0] # Disable warnings temporarily v = cing.verbosity cing.verbosity = verbosityNothing for i in range(1 * 10): res = top.addResidue(repr(random()), i) for j in range(5): _atom = res.addAtom(repr(random()), j) cing.verbosity = v molecule.updateAll() project.setupHtml() # Needed for creating the sub dirs. a = Atom(resName='ALA', atomName='HN') a.criticize() self.assertTrue(a) self.assertEquals(a.rogScore.colorLabel, COLOR_ORANGE) self.assertEquals(a.rogScore.colorCommentList[0][0], COLOR_ORANGE) self.assertEquals(a.rogScore.colorCommentList[0][1], ROGscore.ROG_COMMENT_NO_COOR) lotr_remark = 'One ring to rule them all' preserved_remark = 'Preserved' nowHasEffect_remark = 'Now has effect' nowHasEffectToo_remark = 'Now has effect too' # Next line will have to wipe out the orange comments. a.rogScore.setMaxColor(COLOR_RED, lotr_remark) a.rogScore.setMaxColor(COLOR_ORANGE, nowHasEffect_remark) a.rogScore.setMaxColor(COLOR_RED, preserved_remark) a.rogScore.setMaxColor(COLOR_ORANGE, nowHasEffectToo_remark) self.assertEquals(len(a.rogScore.colorCommentList), 5) self.assertEquals(a.rogScore.colorCommentList[0][1], ROGscore.ROG_COMMENT_NO_COOR) self.assertEquals(a.rogScore.colorCommentList[1][1], nowHasEffect_remark) myhtml = HTMLfile('testROGscore.html', project, 'A Test') myhtml.main("a main") a.rogScore.createHtmlForComments(myhtml.main) kw = {} a.rogScore.addHTMLkeywords(kw) myhtml.main("a", 'or by popup', **kw) myhtml.render()
def testROGscore(self): entryId = 'test' project = Project(entryId) self.failIf(project.removeFromDisk()) project = Project.open(entryId, status='new') molecule = Molecule(name='moleculeName') molecule.ensemble = Ensemble(molecule) # Needed for html. project.appendMolecule(molecule) # Needed for html. # Add some crud to prevent warnings/errors later. molecule.addChain('top') top = molecule.allChains()[0] # Disable warnings temporarily v = cing.verbosity cing.verbosity = verbosityNothing for i in range( 1*10): res = top.addResidue( repr(random()),i ) for j in range( 5): _atom = res.addAtom( repr(random()),j ) cing.verbosity = v molecule.updateAll() project.setupHtml() # Needed for creating the sub dirs. a = Atom(resName='ALA', atomName='HN') a.criticize() self.assertTrue(a) self.assertEquals(a.rogScore.colorLabel, COLOR_ORANGE) self.assertEquals(a.rogScore.colorCommentList[0][0], COLOR_ORANGE) self.assertEquals(a.rogScore.colorCommentList[0][1], ROGscore.ROG_COMMENT_NO_COOR) lotr_remark = 'One ring to rule them all' preserved_remark = 'Preserved' nowHasEffect_remark = 'Now has effect' nowHasEffectToo_remark = 'Now has effect too' # Next line will have to wipe out the orange comments. a.rogScore.setMaxColor(COLOR_RED, lotr_remark) a.rogScore.setMaxColor(COLOR_ORANGE, nowHasEffect_remark ) a.rogScore.setMaxColor(COLOR_RED, preserved_remark) a.rogScore.setMaxColor(COLOR_ORANGE, nowHasEffectToo_remark) self.assertEquals(len(a.rogScore.colorCommentList), 5) self.assertEquals(a.rogScore.colorCommentList[0][1], ROGscore.ROG_COMMENT_NO_COOR) self.assertEquals(a.rogScore.colorCommentList[1][1], nowHasEffect_remark) myhtml = HTMLfile('testROGscore.html', project, 'A Test') myhtml.main("a main") a.rogScore.createHtmlForComments(myhtml.main) kw = {} a.rogScore.addHTMLkeywords(kw) myhtml.main("a", 'or by popup', **kw) myhtml.render()
def testMakeHtmlTableWithJS(self): # CSS and Javascript is going to determine much of the formatting. project = self.setupSimplestProject() h = HTMLfile(project.htmlPath('test.html'), project) columnFormats = [ ('col1', {}), ('col2', {}), ('col3', {}) ] t = MakeHtmlTable(h.main, showHeader=False, classId="testJsTable", id="testJsTableId", columnFormats=columnFormats, bla="0") for row in t.rows(range(2)): rStr = str(row) t.nextColumn() t(None, rStr) t.nextColumn() t('a', rStr + "." + str(2), href='someRefHere') t.nextColumn() # empty one t.nextColumn() t(None, rStr + "." + str(4)) #end for h.main('h3', 'Text to start below the table.') h.render()