def savedata( self ): error = QErrorMessage(self) # Check that the type was set if self.typebox.currentText()=="unset" : error.showMessage("Type of resource was not set") error.exec_() return # Check link was set if "http" not in self.linkd.text() : error.showMessage("Link was not set") error.exec_() return # Check something has been put in the description if self.textBrowser.toPlainText()=="" : error.showMessage("Description was not set") error.exec_() return # Generate topic list mytopics = topiclist() thistopic = self.onpage.toPlainText() if( mytopics.get(thistopic).addResource( "EXTERNAL", self.typebox.currentText(), "module", self.linkd.text(), "blank", self.textBrowser.toPlainText() )==0 ) : error.showMessage("This resource has already been added to this page") error.exec_() return self.clearcells() self.close()
def setCurrentPage( self, page ): mytopics = topiclist() mypage = mytopics.strip( page ) self.onpage.setText(mypage) if( mypage=="invalid" ) : return False return True
pageelements.printTopMenuBar(of) of.write('<div id="content" class="container">\n') of.write(' <div class="row margin-vert-30">\n') of.write('<h2> Our Philosophy </h2> \n') of.write( '<p> Mathematics is a language which uses a hierarchy of abstract objects to express meaning. In other words, it is a language and like any language the best way of learning it' ) of.write( ' is not to sit in a room listening to someone else talk it but rather to try to use it. The modules that are on this website embrace this way of teaching maths. The heart of ' ) of.write( ' each module is a set of short projects that you can work through. To help you do these projects you will find short videos that explain the key ideas that you will need ' ) of.write( ' together with practise questions and exercises that should help you build up to the project. Furthermore, to help you we try throughout to illustrate the connections between sub topics using ' ) of.write(' graphs like the one below. </p>') of.write('<h2> Graph of connections </h2>\n') of.write('<!-- Main Text -->\n') of.write( '<object data="main.svg" type="image/svg+xml" width="100%"> </object>\n') of.write(' </div>\n') of.write('</div>\n') pageelements.printFooter(of) mytopics = topic.topiclist() mygraph = basicgraph.basicgraph() mygraph.setNodes(mytopics.topiclist, mytopics.labellist) mygraph.setConnections() mygraph.printFullGraph("main") of.close()
def buildModulePage(modn): tree, mname = ET.parse("Modules/" + modn), modn.replace(".xml", "") # Read in topics mytopics = topic.topiclist() # Create graph and setup the nodes mygraph = basicgraph.basicgraph() mygraph.setNodes(mytopics.topiclist, mytopics.labellist) # Create the connections for the graph mygraph.setConnections() # Print overview page for module of = open("html/" + mname + ".html", "w") pageelements.printHeader(mname + " overview", of) pageelements.printTopMenuBar(of) of.write('<div id="content" class="container">\n') of.write(' <div class="row margin-vert-30">\n') of.write(' <H2> ' + mname + ': ' + tree.find("TITLE").text + '</H2>') of.write(' <H3> Description </H3> <br/> ') of.write(tree.find("DESCRIPTION").text) of.write('<br/> <br/>') if tree.find("HANDBOOK") is not None: of.write(' <H3> Assessment </H3> <br/> ') of.write( ' <p>The module assessment consists of the following activities:</p>' ) of.write(" <table> \n") of.write( "<tr><td><b> item </b></td><td><b> due date </b></td><td><b>weight</b></td></tr>" ) for assessment in tree.find("HANDBOOK").findall("ASSESSMENT"): of.write("<tr><td>" + assessment.find("DESCRIPTION").text + "</td><td>" + assessment.find("WHEN").text + "</td><td>" + assessment.find("WEIGHT").text + "</td></tr>") of.write(" </table> </br>\n") of.write( " <p>Details on what you are expected to work on during each week of the semester can be found by clicking <b><a href='workload-model-" + mname + ".pdf'> here </a> </b>.</p>") if tree.find("LITURGY") is not None: of.write( " <p>A summary of some of the key ideas and theorems that are introduced in this module can be found by clicking <b><a href='essential-ideas-" + mname + ".pdf'> here </a> </b>.</p>") if tree.find("PORTFOLIO") is not None: of.write(' <H3> Portfolio projects </H3> <br/> ') of.write( ' <p>The final aspect of the assessment for this module is a portfolio for which you must produce projects on the following: </p>' ) of.write('<ul>') n = 0 for chp in tree.findall("CHAPTER"): n = n + 1 of.write('<li><a href="' + mname + str(n) + '-overview.html"> ' + chp.find("TITLE").text + '</a></li>') of.write('</ul>') if tree.find("PORTFOLIO") is not None: of.write( "<p>Details on how your final portfolio will be assessed can be found by clicking <b> <a href='portfolio-assessment-" + mname + ".pdf'> here </a> </b>.</p>") of.write( "<p>Some questions to think about when writing your weekly reports can be found by clicking <b> <a href='resources/reflective-questions.pdf'> here </a> </b>.</p>" ) of.write(' </div>\n') of.write('</div>\n') # Run latex to generate pdf files pageelements.printFooter(of) of.close() if tree.find("HANDBOOK") is not None: createWorkloadModel(mname, tree.find("HANDBOOK")) if tree.find("PORTFOLIO") is not None: createPortfolioMarkscheme(mname, tree.find("PORTFOLIO")) if tree.find("LITURGY") is not None: createLiturgy(mname, tree.find("LITURGY")) n, chapters = 0, tree.findall("CHAPTER") for chp in chapters: n = n + 1 modname, chp_topics_t, chp_topics = mname + str(n), chp.findall( "TOPIC"), [] for tp in chp_topics_t: chp_topics.append(tp.text.strip()) # Print overview page for this project of = open("html/" + modname + "-overview.html", "w") pageelements.printHeader(modname + " overview", of) pageelements.printTopMenuBar(of) of.write('<div id="content" class="container">\n') of.write(' <div class="row margin-vert-30">\n') printModuleSidebar(modname, of) of.write(' <div class="col-md-10">\n') of.write(' <h2> Overview: ' + chp.find("TITLE").text + '</h2>\n') of.write('<br/>') intro = chp.find("INTRO") of.write( ET.tostring(intro.find("DESCRIPTION"), encoding="unicode", method="xml")) of.write('<h3> Aims </h3>') of.write( ET.tostring(intro.find("AIMS"), encoding="unicode", method="xml")) of.write(' </div>\n') of.write(' </div>\n') of.write('</div>\n') pageelements.printFooter(of) of.close() # Print final project page for this project of = open("html/" + modname + "-fproject.html", "w") pageelements.printHeader(modname + " overview", of) pageelements.printTopMenuBar(of) of.write('<div id="content" class="container">\n') of.write(' <div class="row margin-vert-30">\n') printModuleSidebar(modname, of) of.write(' <div class="col-md-10">\n') of.write(' <h2> Final project: ' + chp.find("TITLE").text + ' </h2>\n') proj = chp.find("PROJECT") of.write('<br/>') of.write(' <h3> ' + proj.find("TITLE").text + ' </h3>\n') of.write( ET.tostring(proj.find("DESCRIPTION"), encoding="unicode", method="xml")) of.write(' </div>\n') of.write(' </div>\n') of.write('</div>\n') pageelements.printFooter(of) of.close() # Print practise exercises for this project of = open("html/" + modname + "-practise.html", "w") pageelements.printHeader(modname + " overview", of) pageelements.printTopMenuBar(of) of.write('<div id="content" class="container">\n') of.write(' <div class="row margin-vert-30">\n') printModuleSidebar(modname, of) of.write(' <div class="col-md-6">\n') of.write(' <h2> Practise projects: ' + chp.find("TITLE").text + '</h2>\n') of.write(' <p>') of.write( 'The panel on the right of this page contains links to some more challenging programming exercises that require you to use the material that is covered in this ' ) of.write( 'chapter. You are strongly encouraged to create a new python notebook for each of the problems listed here that you attempt. Put all the code you write and the ' ) of.write( 'explanations of the mathematical ideas you use in the notebook. Please note that there is an enormous ammount of information about python available online and we ' ) of.write( 'fully expect you to take advantage of this rich information stream. Some (brief) introductions to the python notebook system are provided below:' ) of.write(' </p>') of.write('<ul>') of.write( '<li> Introductory videos on <a href="https://mediasite.qub.ac.uk/Mediasite/Play/2925f53ceaf642adb26817ec381b01b61d"> <b> running </b> </a> the notebook and <a href="https://mediasite.qub.ac.uk/Mediasite/Play/10d8830c389c4af89ba16e593aec70891d"> <b> writing </b> </a> in the notebook </li>' ) of.write( '<li> Introductory video on <a href="https://mediasite.qub.ac.uk/Mediasite/Play/3cbca07274744689aeaebd82b94060171d"> <b> writing equations </b> </a> with the notebook, notes on <a href="assets/notebook-writing.html"> <b> the markdown language </b> </a> you can use for writing plain text and <a href="https://guides.github.com/pdfs/markdown-cheatsheet-online.pdf"> <b> a short summary </b> </a> of the key markdown commands. </li>' ) of.write( '<li> <a href="http://artofproblemsolving.com/wiki/index.php?title=LaTeX:Symbols"> <b> List of latex commands </b> </a> that can be used to typeset mathematical equations in the jupyter notebook system </li>' ) of.write('</ul>') of.write( '<p> In addition the buttons below allow you to access resources on the python syntax for key programming concepts </p>' ) of.write( '<a href="http://introtopython.org/var_string_num.html" class="btn btn-primary">Variables</a> ' ) of.write( '<a href="https://en.wikibooks.org/wiki/A_Beginner%27s_Python_Tutorial/Functions" type="button" class="btn btn-primary">Functions</a> ' ) of.write( '<a href="http://introtopython.org/if_statements.html" type="button" class="btn btn-primary">Logic</a> ' ) of.write( '<a href="http://introtopython.org/while_input.html" type="button" class="btn btn-primary">Loops</a> ' ) of.write( '<a href="http://introtopython.org/lists_tuples.html" type="button" class="btn btn-primary">Lists</a> ' ) of.write( '<a href="https://matplotlib.org/users/pyplot_tutorial.html" type="button" class="btn btn-primary">Graphs</a>' ) of.write( '<p> If you would like to download the python notebook system onto your own laptop you can find it here:</p>' ) of.write( '<a href="https://www.continuum.io/downloads"> https://www.continuum.io/downloads </a>' ) of.write( '<p> There are some instructions on how to install it on your computer in <a href="https://mediasite.qub.ac.uk/Mediasite/Play/935be4295e7148dd91d6baf4cd2108281d"> <b> this video </b> </a> </p>' ) of.write(' </div>\n') of.write(' <div class="col-md-4">\n') of.write('<table>\n') #of.write('<tr> <td width="2%"></td> <td width="10%"> </td> <td width="50%"> <h4> Description </h4> </td> <td width="15%"> <h4> Topic </h4> </td> <td> <h4> Author </h4> </td> </tr>\n') reslist, topictab = [], "" for top in chp_topics: tstring, reslis = mytopics.get(top).getRelevantResources( mname, "PYTHON", reslist, 2) topictab += tstring of.write(topictab) of.write('</table>\n') of.write(' </div>\n') of.write(' </div>\n') of.write('</div>\n') pageelements.printFooter(of) of.close() # Print apply page for this project of = open("html/" + modname + "-apply.html", "w") pageelements.printHeader(modname + " overview", of) pageelements.printTopMenuBar(of) of.write('<div id="content" class="container">\n') of.write(' <div class="row margin-vert-30">\n') printModuleSidebar(modname, of) of.write(' <div class="col-md-6">\n') of.write(' <h2> Applying your knowledge: ' + chp.find("TITLE").text + '</h2>\n') of.write(' <p>') of.write( 'The panel on the right of this page contains links to some programming exercises that require you to use the material that is covered in this chapter. ' ) of.write( 'You will use a simple programming language called blockly to do these exercises. These activites should allow you to implement the logical structure of the ' ) of.write( 'mathematical concepts that have been introduced in the videos and notes on these topics. Each exercise consists of a number of levels and for each level you ' ) of.write( 'have a task to complete. To complete these levels you will need to use some or all of the following five basic concepts:' ) of.write(' </p>') of.write( '<a href="https://www.youtube.com/watch?v=DdBM740lMpo" class="btn btn-primary">Variables</a> ' ) of.write( '<a href="https://www.youtube.com/watch?v=1ATU98fSTEg" class="btn btn-primary">Functions</a> ' ) of.write( '<a href="https://www.youtube.com/watch?v=WJcuKYJK6rw" class="btn btn-primary">Logic</a> ' ) of.write( '<a href="https://www.youtube.com/watch?v=Jn45JDFkLsI" class="btn btn-primary">Loops</a> ' ) of.write( '<a href="https://www.youtube.com/watch?v=Jn45JDFkLsI" class="btn btn-primary">Lists</button>' ) of.write(' </div>\n') of.write(' <div class="col-md-4">\n') of.write('<table>\n') #of.write('<tr> <td width="2%"></td> <td width="10%"> </td> <td width="50%"> <h4> Description </h4> </td> <td width="15%"> <h4> Topic </h4> </td> <td> <h4> Author </h4> </td> </tr>\n') reslist, topictab = [], "" for top in chp_topics: tstring, reslis = mytopics.get(top).getRelevantResources( mname, "BLOCKLY", reslist, 2) topictab += tstring of.write(topictab) of.write('</table>\n') of.write(' </div>\n') of.write(' </div>\n') of.write('</div>\n') pageelements.printFooter(of) of.close() # Print examples page for this project of = open("html/" + modname + "-examples.html", "w") pageelements.printHeader(modname + " overview", of) pageelements.printTopMenuBar(of) of.write('<div id="content" class="container">\n') of.write(' <div class="row margin-vert-30">\n') printModuleSidebar(modname, of) of.write(' <div class="col-md-6">\n') of.write(' <h2> Applying your knowledge: ' + chp.find("TITLE").text + '</h2>\n') of.write(' <p>') of.write( 'The panel on the right of this page contains links to some example problems that have been solved using the material that is covered in this chapter. ' ) of.write( 'You will find the problems and the solutions together on these pages. However, please try to solve the problem yourself before you consult the solution.' ) of.write(' </p>') of.write(' </div>\n') of.write(' <div class="col-md-4">\n') of.write('<table>\n') #of.write('<tr> <td width="2%"></td> <td width="10%"> </td> <td width="50%"> <h4> Description </h4> </td> <td width="15%"> <h4> Topic </h4> </td> <td> <h4> Author </h4> </td> </tr>\n') reslist, topictab = [], "" for top in chp_topics: tstring, reslis = mytopics.get(top).getRelevantResources( mname, "EXAMPLES", reslist, 2) topictab += tstring of.write(topictab) of.write('</table>\n') of.write(' </div>\n') of.write(' </div>\n') of.write('</div>\n') pageelements.printFooter(of) of.close() # Print understand page for this project of = open("html/" + modname + "-understand.html", "w") pageelements.printHeader(modname + " overview", of) pageelements.printTopMenuBar(of) of.write('<div id="content" class="container">\n') of.write(' <div class="row margin-vert-30">\n') printModuleSidebar(modname, of) of.write(' <div class="col-md-6">\n') of.write(' <h2> Understanding the content: ' + chp.find("TITLE").text + '</h2>\n') of.write(' <p>') of.write( 'The panel on the right of this page contains links to videos on the topics we are studying as part of this chapter. ' ) of.write( 'On the pages for each of these videos you will find a link to a worksheet containing comprehension questions. You should ' ) of.write( 'print out the comprehension questions, watch the video and try to answer the comprehension questions based on the ideas that are explained ' ) of.write( 'in the video. If you are struggling to answer any question please come and ask.' ) of.write(' </p>') of.write(' </div>\n') of.write(' <div class="col-md-4">\n') of.write('<table>\n') #of.write('<tr> <td width="2%"></td> <td width="10%"> </td> <td width="50%"> <h4> Description </h4> </td> <td width="15%"> <h4> Topic </h4> </td> <td> <h4> Author </h4> </td> </tr>\n') reslist, topictab = [], "" for top in chp_topics: tstring, reslis = mytopics.get(top).getRelevantResources( mname, "VIDEO", reslist, 2) topictab += tstring of.write(topictab) of.write('</table>\n') of.write(' </div>\n') of.write(' </div>\n') of.write('</div>\n') pageelements.printFooter(of) of.close() # Print content page for this project of = open("html/" + modname + "-content.html", "w") pageelements.printHeader(modname + " overview", of) pageelements.printTopMenuBar(of) of.write('<div id="content" class="container">\n') of.write(' <div class="row margin-vert-30">\n') printModuleSidebar(modname, of) of.write(' <div class="col-md-6">\n') of.write(' <h2> Chapter content: ' + chp.find("TITLE").text + '</h2>\n') of.write(' <p>') of.write( 'A diagram illustrating the topics you will need to understand for this chapter together with the connections between topics is given below. ' ) of.write( 'Written notes on these various topics can be found be clicking on the links in the right panel.' ) of.write(' <br/><br/>\n') mygraph.printChapterGraph(chp_topics, modname) of.write('<object data="' + modname + '.svg" type="image/svg+xml" width="100%"></object>\n') of.write(' </div>\n') of.write(' <div class="col-md-4">\n') of.write('<table>\n') #of.write('<tr> <td width="2%"></td> <td width="10%"> </td> <td width="50%"> <h4> Description </h4> </td> <td width="15%"> <h4> Topic </h4> </td> <td> <h4> Author </h4> </td> </tr>\n') reslist, topictab = [], "" for top in chp_topics: tstring, reslis = mytopics.get(top).getRelevantResources( mname, "READING", reslist, 2) topictab += tstring of.write(topictab) of.write('</table>\n') of.write(' </div>\n') of.write(' </div>\n') of.write('</div>\n') pageelements.printFooter(of) of.close()
def save( self ): error = QErrorMessage(self) # Check module was set if self.modbox.currentText()=="unset" : error.showMessage("Module for resource was not set") error.exec_() return # Check resource was set if self.resource.toPlainText()=="" : error.showMessage("Resource was not set") error.exec_() return # Check if type was set if self.typebox.currentText()=="unset" : error.showMessage("Type for resource was not set") error.exec_() return # Check that something has been put in the description if self.textBrowser.toPlainText()=="" : error.showMessage("Description was not set") error.exec_() return # Put this information in the topic list mytopics = topiclist() thistopic = self.onpage.toPlainText() # Get extension of file myfile = self.resource.toPlainText() splitup = myfile.split(".") ext = splitup[len(splitup)-1] ftype = "XML" if ext=="ipynb" : ftype = "IPYTHON" elif ext=="zip" : ftype = "IPYTHON" elif ext=="pdf" : ftype = "PDF" elif ext=="tex" : ftype = "LATEX" elif ext=="html" : ftype = "HTML" elif ext=="xml" : f = open( "Resources/" + myfile, "r" ) m_page = f.read() f.close() if m_page.find("<GEOGEBRA>") !=-1 : ftype = "GEOGEBRA" myfile=myfile.replace(".xml","") else : error.showMessage("Invalid extension on input resource file") error.exec_() return # And add the resource to the page author = self.author.toPlainText().replace(" ","~") if mytopics.get(thistopic).addResource( self.typebox.currentText(), ftype, self.modbox.currentText(), myfile, author, self.textBrowser.toPlainText())==0 : error.showMessage("This resource has already been added to this page") error.exec_() return # Clear all input data self.resource.setText("") self.modbox.setCurrentIndex(0) self.typebox.setCurrentIndex(0) self.textBrowser.setText("") # Close the window self.close()
import os import sys import topic import shutil import basicgraph import pageelements of = open("html/index.html", "w" ) pageelements.printHeader( "mathnet", of ) pageelements.printTopMenuBar( of ) of.write('<div id="content" class="container">\n') of.write(' <div class="row margin-vert-30">\n') of.write('<h2> Our Philosophy </h2> \n') of.write('<p> Mathematics is a language which uses a hierarchy of abstract objects to express meaning. In other words, it is a language and like any language the best way of learning it') of.write(' is not to sit in a room listening to someone else talk it but rather to try to use it. The modules that are on this website embrace this way of teaching maths. The heart of ') of.write(' each module is a set of short projects that you can work through. To help you do these projects you will find short videos that explain the key ideas that you will need ') of.write(' together with practise questions and exercises that should help you build up to the project. Furthermore, to help you we try throughout to illustrate the connections between sub topics using ') of.write(' graphs like the one below. </p>') of.write('<h2> Graph of connections </h2>\n') of.write('<!-- Main Text -->\n') of.write('<object data="main.svg" type="image/svg+xml" width="100%"> </object>\n') of.write(' </div>\n') of.write('</div>\n') pageelements.printFooter( of ) mytopics = topic.topiclist() mygraph = basicgraph.basicgraph() mygraph.setNodes(mytopics.topiclist, mytopics.labellist) mygraph.setConnections() mygraph.printFullGraph("main") of.close()
def getResourceHTML(self,printmodule): table = "<tr> \n" if( self.rtype=="VIDEO" ): assert( self.loc=="EXTERNAL" ) table += '<td></td><td><i class="fa fa-video-camera fa-3x"></i></td><td><a href="' + self.linkb + '" ><b>' + self.description + '</b></a></td>' elif( self.rtype=="WEBSITE" ): assert( self.loc=="EXTERNAL" ) table += '<td></td><td><i class="fa fa-external-link fa-3x"></i></td><td><a href="' + self.linkb + '" ><b>' + self.description + '</b></a></td>' elif( self.rtype=="PDF" ): #if not os.path.isfile("html/resources/" + self.linkb): # shutil.copy("Resources/" + self.linkb, "html/resources/" + self.linkb) if printmodule==1 : if( self.loc=="EXAMPLES"): table += '<td></td><td><i class="fa fa-pencil fa-3x"></i></td>' else: table += '<td></td><td><i class="fa fa-book fa-3x"></i></td>' table += '<td><a href="resources/' + self.linkb + '"><b>' + self.description + '</b></a></td>' elif( self.rtype=="LATEX" ): #if not os.path.isfile("html/resources" + self.linkb.replace(".tex",".pdf") ): # cmd = ['pdflatex', '-interaction', 'nonstopmode', "Resources/" + self.linkb] # proc = subprocess.Popen(cmd) # proc.communicate() # proc = subprocess.Popen(cmd) # proc.communicate() # #shutil.copy( self.linkb.replace(".tex",".pdf"), "html/resources/" + self.linkb.replace(".tex",".pdf") ) # if not proc.returncode == 0 : # os.unlink( self.linkb ) # raise ValueError("Error compling latex document entitled " + self.linkb) # # Delete files we don't need after latex has run # for filen in os.listdir("."): # if filen.startswith( self.linkb.replace(".tex","") ): # os.remove(filen) if printmodule==1 : if( self.loc=="EXAMPLES"): table += '<td></td><td><i class="fa fa-pencil fa-3x"></i></td>' else: table += '<td></td><td><i class="fa fa-book fa-3x"></i></td>' table += '<td><a href="resources/' + self.linkb.replace(".tex",".pdf") + '"><b>' + self.description + '</b></a></td>' # elif( self.rtype=="IPYTHON"): # assert( self.loc=="EXERCISE" ) # if not os.path.isfile("html/resources/" + self.linkb): # shutil.copy("Resources/" + self.linkb, "html/resources/" + self.linkb) # table += '<td></td><td><i class="fa fa-laptop fa-3x"></i></td><td>' + '<a href="resources/' + self.linkb + '" download="' + self.linkb + '"> ' + self.description + '</a></td>' elif( self.rtype=="XML") : #if not os.path.isfile("html/" + self.linkb + ".html") : #xml_to_html.build_html_file( self.linkb ) if printmodule==1 : if self.loc=="VIDEO" : table += '<td></td><td><i class="fa fa-video-camera fa-3x"></i></td>' elif self.loc=="EXAMPLES" : table += '<td></td><td><i class="fa fa-pencil fa-3x"></i></td>' table += '<td><a href="' + self.linkb + '.html"><b>' + self.description + '</b></a></td>' elif( self.rtype=="HTML") : # assert( self.loc=="EXERCISE") # if not os.path.isfile("html/" + self.linkb + ".html") : # shutil.copy("Resources/" + self.linkb + ".html", "html/" + self.linkb + ".html") if printmodule==1 : table += '<td></td><td><i class="fa fa-signal fa-3x"></i></td>' table += '<td><a href="' + self.linkb + '.html"><b>' + self.description + '</b></a></td>' elif( self.rtype=="GEOGEBRA"): if printmodule==1 : if( self.loc=="EXERCISE"): # #if not os.path.isfile("html/" + self.linkb + ".html") : # #xml_to_html.build_html_file( self.linkb ) table += '<td></td><td><i class="fa fa-signal fa-3x"></i></td>' else: # #if not os.path.isfile("html/" + self.linkb + ".html") : # #xml_to_html.build_html_file( self.linkb ) table += '<td></td><td><i class="fa fa-signal fa-3x"></i></td>' table += '<td><a href="' + self.linkb + '.html"><b>' + self.description + '</b></a></td>' if( printmodule==1 ): table += '<td>' for mod in self.module : table += '<a href="' + mod.text +'.html">' + mod.text + "</a>" if mod != self.module[-1] : table += ' / ' table += '</td> <td>' + self.author + "</td></tr> \n" elif( printmodule==2 ): mytopics = topic.topiclist() table += '</tr><tr><td> topic: <a href="' + self.topic +'.html">' + mytopics.get(self.topic).label + '</a></td></tr>' table += '<tr><td> author: ' + self.author + '</td></tr>' #table += '<td><a href="' + self.topic +'.html">' + mytopics.get(self.topic).label + "</a></td>" # if ( self.loc!="EXTERNAL" ) : # table += "<td>" + self.author + "</td>" # table += "</tr> \n" return table
def buildTopicPage( tfile ): tree, tname = ET.parse( "Topics/" + tfile ), tfile.replace(".xml","") # Read in topics mytopics = topic.topiclist() # Create graph and setup the nodes mygraph = basicgraph.basicgraph() mygraph.setNodes(mytopics.topiclist, mytopics.labellist) # Create the connections for the graph mygraph.setConnections() # Create the graph for this topic mygraph.printNodeGraph( tname ) of = open( "html/" + tname + ".html", "w" ) # Print header and top menu bar for this page pageelements.printHeader( tname, of ) pageelements.printTopMenuBar( of ) of.write('<div id="content" class="container">\n') of.write(' <div class="panel panel-blue">\n') of.write(' <div class="panel-heading">\n') of.write(' <h1 class="panel-title"> ' + tree.find("TITLE").text + ' </h1>\n') of.write(' </div>\n') of.write(' </div>\n') content = '<div class="col-md-7">' content += '<h3 class="no-margin no-padding">' + tree.find("TITLE").text + '</h3>' content += '<p align="justify">' + tree.find("DESCRIPTION").text + '</p>' content += "<H4> Syllabus Aims </H4> \n" content += ET.tostring( tree.find("AIMS"), encoding="unicode", method="xml" ) content += '</div>' content += '<div class="col-md-5"><object data="' + tname + '.svg" type="image/svg+xml" width="100%"></object></div>' pageelements.printPanel( of, "primary", "collapse-one", "Short description and context", content ) of.write(' <div id="accordion" class="panel-group">') content = "<table>\n" content += '<tr> <td width="2%"></td> <td width="10%"> </td> <td width="70%"> <h3> Description and link </h3> </td> <td width="10%"> <h3> Module </h3> </td> <td width="10%"> <h3> Author </h3> </td> </tr>' # Reading resources reslist = [] tstring, reslist = mytopics.get(tname).getRelevantResources( "", "READING", reslist, 1 ) if len(reslist)>0 : content += tstring content += "</table>\n" pageelements.printPanel( of, "default", "collapse-two", "Written Notes", content ) content = "<table>\n" content += '<tr> <td width="2%"></td> <td width="10%"> </td> <td width="70%"> <h3> Description and link </h3> </td> <td width="10%"> <h3> Module </h3> </td> <td width="10%"> <h3> Author </h3> </td> </tr>' # Videos reslist = [] tstring, reslist = mytopics.get(tname).getRelevantResources( "", "VIDEO", reslist, 1 ) if len(reslist)>0 : content += tstring content += "</table>\n" pageelements.printPanel( of, "default", "collapse-four", "Videos", content ) content = "<table>\n" content += '<tr> <td width="2%"></td> <td width="10%"> </td> <td width="70%"> <h3> Description and link </h3> </td> <td width="10%"> <h3> Module </h3> </td> <td width="10%"> <h3> Author </h3> </td> </tr>' # Examples reslist = [] tstring, reslist = mytopics.get(tname).getRelevantResources( "", "EXAMPLES", reslist, 1 ) if len(reslist)>0 : content += tstring content += "</table>\n" pageelements.printPanel( of, "default", "collapse-three", "Worked examples", content ) content = "<table>\n" content += '<tr> <td width="2%"></td> <td width="10%"> </td> <td width="70%"> <h3> Description and link </h3> </td> <td width="10%"> <h3> Module </h3> </td> <td width="10%"> <h3> Author </h3> </td> </tr>' # Blockly reslist = [] tstring, reslist = mytopics.get(tname).getRelevantResources( "", "BLOCKLY", reslist, 1 ) if len(reslist)>0 : content += tstring content += "</table>\n" pageelements.printPanel( of, "default", "collapse-five", "Applying your knowledge", content ) content = "<table>\n" content += '<tr> <td width="2%"></td> <td width="10%"> </td> <td width="70%"> <h3> Description and link </h3> </td> <td width="10%"> <h3> Module </h3> </td> <td width="10%"> <h3> Author </h3> </td> </tr>' # Python reslist = [] tstring, reslist = mytopics.get(tname).getRelevantResources( "", "PYTHON", reslist, 1 ) if len(reslist)>0 : content += tstring content += "</table>\n" pageelements.printPanel( of, "default", "collapse-six", "Extending your understanding", content ) content = "<table>\n" content += '<tr> <td width="2%"></td> <td width="10%"> </td> <td width="70%"> <h3> Description and link </h3> </td> <td width="10%"> <h3> Module </h3> </td> <td width="10%"> <h3> Author </h3> </td> </tr>' # External resources reslist = [] if len(reslist)>0 : tstring, reslist = mytopics.get(tname).getRelevantResources( "", "EXTERNAL", reslist, 1 ) content += tstring content += "</table>\n" pageelements.printPanel( of, "default", "collapse-seven", "External Resources", content ) of.write(' </div>') # Print the footer of.write("</div>\n") pageelements.printFooter( of ) of.close()
def buildModulePage( modn ): tree, mname = ET.parse( "Modules/" + modn ), modn.replace(".xml","") # Read in topics mytopics = topic.topiclist() # Create graph and setup the nodes mygraph = basicgraph.basicgraph() mygraph.setNodes(mytopics.topiclist, mytopics.labellist) # Create the connections for the graph mygraph.setConnections() # Print overview page for module of = open( "html/" + mname + ".html", "w" ) pageelements.printHeader( mname + " overview", of ) pageelements.printTopMenuBar( of ) of.write('<div id="content" class="container">\n') of.write(' <div class="row margin-vert-30">\n') of.write(' <H2> ' + mname + ': ' + tree.find("TITLE").text + '</H2>') of.write(' <H3> Description </H3> <br/> ' ) of.write( tree.find("DESCRIPTION").text ) of.write('<br/> <br/>') if tree.find("HANDBOOK") is not None : of.write(' <H3> Assessment </H3> <br/> ' ) of.write(' <p>The module assessment consists of the following activities:</p>') of.write(" <table> \n") of.write("<tr><td><b> item </b></td><td><b> due date </b></td><td><b>weight</b></td></tr>") for assessment in tree.find("HANDBOOK").findall("ASSESSMENT") : of.write("<tr><td>" + assessment.find("DESCRIPTION").text + "</td><td>" + assessment.find("WHEN").text + "</td><td>" + assessment.find("WEIGHT").text + "</td></tr>") of.write(" </table> </br>\n") of.write(" <p>Details on what you are expected to work on during each week of the semester can be found by clicking <b><a href='workload-model-" + mname + ".pdf'> here </a> </b>.</p>") if tree.find("LITURGY") is not None : of.write(" <p>A summary of some of the key ideas and theorems that are introduced in this module can be found by clicking <b><a href='essential-ideas-" + mname + ".pdf'> here </a> </b>.</p>") if tree.find("PORTFOLIO") is not None : of.write(' <H3> Portfolio projects </H3> <br/> ' ) of.write(' <p>The final aspect of the assessment for this module is a portfolio for which you must produce projects on the following: </p>') of.write('<ul>') n = 0 for chp in tree.findall("CHAPTER") : n = n + 1 of.write('<li><a href="' + mname + str(n) + '-overview.html"> ' + chp.find("TITLE").text + '</a></li>') of.write('</ul>') if tree.find("PORTFOLIO") is not None : of.write("<p>Details on how your final portfolio will be assessed can be found by clicking <b> <a href='portfolio-assessment-" + mname + ".pdf'> here </a> </b>.</p>") of.write("<p>Some questions to think about when writing your weekly reports can be found by clicking <b> <a href='resources/reflective-questions.pdf'> here </a> </b>.</p>") of.write(' </div>\n') of.write('</div>\n') # Run latex to generate pdf files pageelements.printFooter( of ) of.close() if tree.find("HANDBOOK") is not None : createWorkloadModel( mname, tree.find("HANDBOOK") ) if tree.find("PORTFOLIO") is not None : createPortfolioMarkscheme( mname, tree.find("PORTFOLIO") ) if tree.find("LITURGY") is not None : createLiturgy( mname, tree.find("LITURGY") ) n, chapters = 0, tree.findall("CHAPTER") for chp in chapters : n = n + 1 modname, chp_topics_t, chp_topics = mname + str(n), chp.findall("TOPIC"), [] for tp in chp_topics_t : chp_topics.append( tp.text.strip() ) # Print overview page for this project of = open( "html/" + modname + "-overview.html", "w" ) pageelements.printHeader( modname + " overview", of ) pageelements.printTopMenuBar( of ) of.write('<div id="content" class="container">\n') of.write(' <div class="row margin-vert-30">\n') printModuleSidebar( modname, of ) of.write(' <div class="col-md-10">\n') of.write(' <h2> Overview: ' + chp.find("TITLE").text + '</h2>\n') of.write('<br/>') intro = chp.find("INTRO") of.write( ET.tostring( intro.find("DESCRIPTION"), encoding="unicode", method="xml" ) ) of.write('<h3> Aims </h3>') of.write( ET.tostring( intro.find("AIMS"), encoding="unicode", method="xml" ) ) of.write(' </div>\n') of.write(' </div>\n') of.write('</div>\n') pageelements.printFooter( of ) of.close() # Print final project page for this project of = open( "html/" + modname + "-fproject.html", "w" ) pageelements.printHeader( modname + " overview", of ) pageelements.printTopMenuBar( of ) of.write('<div id="content" class="container">\n') of.write(' <div class="row margin-vert-30">\n') printModuleSidebar( modname, of ) of.write(' <div class="col-md-10">\n') of.write(' <h2> Final project: ' + chp.find("TITLE").text + ' </h2>\n') proj = chp.find("PROJECT") of.write('<br/>') of.write(' <h3> ' + proj.find("TITLE").text + ' </h3>\n') of.write( ET.tostring( proj.find("DESCRIPTION"), encoding="unicode", method="xml" ) ) of.write(' </div>\n') of.write(' </div>\n') of.write('</div>\n') pageelements.printFooter( of ) of.close() # Print practise exercises for this project of = open( "html/" + modname + "-practise.html", "w" ) pageelements.printHeader( modname + " overview", of ) pageelements.printTopMenuBar( of ) of.write('<div id="content" class="container">\n') of.write(' <div class="row margin-vert-30">\n') printModuleSidebar( modname, of ) of.write(' <div class="col-md-6">\n') of.write(' <h2> Practise projects: ' + chp.find("TITLE").text + '</h2>\n') of.write(' <p>') of.write('The panel on the right of this page contains links to some more challenging programming exercises that require you to use the material that is covered in this ') of.write('chapter. You are strongly encouraged to create a new python notebook for each of the problems listed here that you attempt. Put all the code you write and the ') of.write('explanations of the mathematical ideas you use in the notebook. Please note that there is an enormous ammount of information about python available online and we ') of.write('fully expect you to take advantage of this rich information stream. Some (brief) introductions to the python notebook system are provided below:') of.write(' </p>') of.write('<ul>') of.write('<li> Introductory videos on <a href="https://mediasite.qub.ac.uk/Mediasite/Play/2925f53ceaf642adb26817ec381b01b61d"> <b> running </b> </a> the notebook and <a href="https://mediasite.qub.ac.uk/Mediasite/Play/10d8830c389c4af89ba16e593aec70891d"> <b> writing </b> </a> in the notebook </li>') of.write('<li> Introductory video on <a href="https://mediasite.qub.ac.uk/Mediasite/Play/3cbca07274744689aeaebd82b94060171d"> <b> writing equations </b> </a> with the notebook, notes on <a href="assets/notebook-writing.html"> <b> the markdown language </b> </a> you can use for writing plain text and <a href="https://guides.github.com/pdfs/markdown-cheatsheet-online.pdf"> <b> a short summary </b> </a> of the key markdown commands. </li>') of.write('<li> <a href="http://artofproblemsolving.com/wiki/index.php?title=LaTeX:Symbols"> <b> List of latex commands </b> </a> that can be used to typeset mathematical equations in the jupyter notebook system </li>') of.write('</ul>') of.write('<p> In addition the buttons below allow you to access resources on the python syntax for key programming concepts </p>') of.write('<a href="http://introtopython.org/var_string_num.html" class="btn btn-primary">Variables</a> ') of.write('<a href="https://en.wikibooks.org/wiki/A_Beginner%27s_Python_Tutorial/Functions" type="button" class="btn btn-primary">Functions</a> ') of.write('<a href="http://introtopython.org/if_statements.html" type="button" class="btn btn-primary">Logic</a> ') of.write('<a href="http://introtopython.org/while_input.html" type="button" class="btn btn-primary">Loops</a> ') of.write('<a href="http://introtopython.org/lists_tuples.html" type="button" class="btn btn-primary">Lists</a> ') of.write('<a href="https://matplotlib.org/users/pyplot_tutorial.html" type="button" class="btn btn-primary">Graphs</a>') of.write('<p> If you would like to download the python notebook system onto your own laptop you can find it here:</p>') of.write('<a href="https://www.continuum.io/downloads"> https://www.continuum.io/downloads </a>') of.write('<p> There are some instructions on how to install it on your computer in <a href="https://mediasite.qub.ac.uk/Mediasite/Play/935be4295e7148dd91d6baf4cd2108281d"> <b> this video </b> </a> </p>') of.write(' </div>\n') of.write(' <div class="col-md-4">\n') of.write('<table>\n') #of.write('<tr> <td width="2%"></td> <td width="10%"> </td> <td width="50%"> <h4> Description </h4> </td> <td width="15%"> <h4> Topic </h4> </td> <td> <h4> Author </h4> </td> </tr>\n') reslist, topictab = [], "" for top in chp_topics : tstring, reslis = mytopics.get(top).getRelevantResources( mname, "PYTHON", reslist, 2 ) topictab += tstring of.write( topictab ) of.write('</table>\n') of.write(' </div>\n') of.write(' </div>\n') of.write('</div>\n') pageelements.printFooter( of ) of.close() # Print apply page for this project of = open( "html/" + modname + "-apply.html", "w" ) pageelements.printHeader( modname + " overview", of ) pageelements.printTopMenuBar( of ) of.write('<div id="content" class="container">\n') of.write(' <div class="row margin-vert-30">\n') printModuleSidebar( modname, of ) of.write(' <div class="col-md-6">\n') of.write(' <h2> Applying your knowledge: ' + chp.find("TITLE").text + '</h2>\n') of.write(' <p>') of.write('The panel on the right of this page contains links to some programming exercises that require you to use the material that is covered in this chapter. ') of.write('You will use a simple programming language called blockly to do these exercises. These activites should allow you to implement the logical structure of the ') of.write('mathematical concepts that have been introduced in the videos and notes on these topics. Each exercise consists of a number of levels and for each level you ') of.write('have a task to complete. To complete these levels you will need to use some or all of the following five basic concepts:') of.write(' </p>') of.write('<a href="https://www.youtube.com/watch?v=DdBM740lMpo" class="btn btn-primary">Variables</a> ') of.write('<a href="https://www.youtube.com/watch?v=1ATU98fSTEg" class="btn btn-primary">Functions</a> ') of.write('<a href="https://www.youtube.com/watch?v=WJcuKYJK6rw" class="btn btn-primary">Logic</a> ') of.write('<a href="https://www.youtube.com/watch?v=Jn45JDFkLsI" class="btn btn-primary">Loops</a> ') of.write('<a href="https://www.youtube.com/watch?v=Jn45JDFkLsI" class="btn btn-primary">Lists</button>') of.write(' </div>\n') of.write(' <div class="col-md-4">\n') of.write('<table>\n') #of.write('<tr> <td width="2%"></td> <td width="10%"> </td> <td width="50%"> <h4> Description </h4> </td> <td width="15%"> <h4> Topic </h4> </td> <td> <h4> Author </h4> </td> </tr>\n') reslist, topictab = [], "" for top in chp_topics : tstring, reslis = mytopics.get(top).getRelevantResources( mname, "BLOCKLY", reslist, 2 ) topictab += tstring of.write( topictab ) of.write('</table>\n') of.write(' </div>\n') of.write(' </div>\n') of.write('</div>\n') pageelements.printFooter( of ) of.close() # Print examples page for this project of = open( "html/" + modname + "-examples.html", "w" ) pageelements.printHeader( modname + " overview", of ) pageelements.printTopMenuBar( of ) of.write('<div id="content" class="container">\n') of.write(' <div class="row margin-vert-30">\n') printModuleSidebar( modname, of ) of.write(' <div class="col-md-6">\n') of.write(' <h2> Applying your knowledge: ' + chp.find("TITLE").text + '</h2>\n') of.write(' <p>') of.write('The panel on the right of this page contains links to some example problems that have been solved using the material that is covered in this chapter. ') of.write('You will find the problems and the solutions together on these pages. However, please try to solve the problem yourself before you consult the solution.') of.write(' </p>') of.write(' </div>\n') of.write(' <div class="col-md-4">\n') of.write('<table>\n') #of.write('<tr> <td width="2%"></td> <td width="10%"> </td> <td width="50%"> <h4> Description </h4> </td> <td width="15%"> <h4> Topic </h4> </td> <td> <h4> Author </h4> </td> </tr>\n') reslist, topictab = [], "" for top in chp_topics : tstring, reslis = mytopics.get(top).getRelevantResources( mname, "EXAMPLES", reslist, 2 ) topictab += tstring of.write( topictab ) of.write('</table>\n') of.write(' </div>\n') of.write(' </div>\n') of.write('</div>\n') pageelements.printFooter( of ) of.close() # Print understand page for this project of = open( "html/" + modname + "-understand.html", "w" ) pageelements.printHeader( modname + " overview", of ) pageelements.printTopMenuBar( of ) of.write('<div id="content" class="container">\n') of.write(' <div class="row margin-vert-30">\n') printModuleSidebar( modname, of ) of.write(' <div class="col-md-6">\n') of.write(' <h2> Understanding the content: ' + chp.find("TITLE").text + '</h2>\n') of.write(' <p>') of.write('The panel on the right of this page contains links to videos on the topics we are studying as part of this chapter. ') of.write('On the pages for each of these videos you will find a link to a worksheet containing comprehension questions. You should ') of.write('print out the comprehension questions, watch the video and try to answer the comprehension questions based on the ideas that are explained ') of.write('in the video. If you are struggling to answer any question please come and ask.'); of.write(' </p>') of.write(' </div>\n') of.write(' <div class="col-md-4">\n') of.write('<table>\n') #of.write('<tr> <td width="2%"></td> <td width="10%"> </td> <td width="50%"> <h4> Description </h4> </td> <td width="15%"> <h4> Topic </h4> </td> <td> <h4> Author </h4> </td> </tr>\n') reslist, topictab = [], "" for top in chp_topics : tstring, reslis = mytopics.get(top).getRelevantResources( mname, "VIDEO", reslist, 2 ) topictab += tstring of.write( topictab ) of.write('</table>\n') of.write(' </div>\n') of.write(' </div>\n') of.write('</div>\n') pageelements.printFooter( of ) of.close() # Print content page for this project of = open( "html/" + modname + "-content.html", "w" ) pageelements.printHeader( modname + " overview", of ) pageelements.printTopMenuBar( of ) of.write('<div id="content" class="container">\n') of.write(' <div class="row margin-vert-30">\n') printModuleSidebar( modname, of ) of.write(' <div class="col-md-6">\n') of.write(' <h2> Chapter content: ' + chp.find("TITLE").text + '</h2>\n') of.write(' <p>') of.write('A diagram illustrating the topics you will need to understand for this chapter together with the connections between topics is given below. ') of.write('Written notes on these various topics can be found be clicking on the links in the right panel.') of.write(' <br/><br/>\n') mygraph.printChapterGraph( chp_topics, modname ) of.write('<object data="' + modname + '.svg" type="image/svg+xml" width="100%"></object>\n') of.write(' </div>\n') of.write(' <div class="col-md-4">\n') of.write('<table>\n') #of.write('<tr> <td width="2%"></td> <td width="10%"> </td> <td width="50%"> <h4> Description </h4> </td> <td width="15%"> <h4> Topic </h4> </td> <td> <h4> Author </h4> </td> </tr>\n') reslist, topictab = [], "" for top in chp_topics : tstring, reslis = mytopics.get(top).getRelevantResources( mname, "READING", reslist, 2 ) topictab += tstring of.write( topictab ) of.write('</table>\n') of.write(' </div>\n') of.write(' </div>\n') of.write('</div>\n') pageelements.printFooter( of ) of.close()