def main(chapter_cls=None): # to run interactively with ipython: # ipython -i --gui=qt script.py # in this case, QtGui.QApplication.instance() will be prebuilt from PyQt4 import QtGui from superficie.viewer.Viewer import Viewer app = QtGui.QApplication.instance() run_exec = False if not app: import sys app = QtGui.QApplication(sys.argv) run_exec = True visor = Viewer() if chapter_cls: visor.book.addChapter(chapter_cls()) ## ============================ visor.whichPage = 0 visor.resize(400, 400) visor.show() visor.trackCameraPosition(True) visor.viewAll() visor.chaptersStack.show() visor.notesStack.show() if run_exec: sys.exit(app.exec_()) return visor
self.addChild(critic4) figuras = [ Plano1, Esfera1, Esfera2, Esfera3, ParaboloideHiperbolico, ParaboloideHiperbolicoReglado, ParaboloideHiperbolicoCortes, ToroMeridianos, ToroParalelos, ToroVerticalMorseConstr, ToroVerticalMorse ] class CamposVectoriales(Chapter): def __init__(self): Chapter.__init__(self, name=u"Campos vectoriales, singularidades e índice") for f in figuras: self.addPage(f()) if __name__ == "__main__": import sys from superficie.viewer.Viewer import Viewer app = QtGui.QApplication(sys.argv) visor = Viewer() visor.book.addChapter(CamposVectoriales()) visor.chapter.chapterSpecificIn() visor.whichPage = 0 visor.resize(400, 400) visor.show() visor.chaptersStack.show() sys.exit(app.exec_())
ParaboloideHiperbolico, ParaboloideHiperbolicoReglado, ParaboloideHiperbolicoCortes, ToroMeridianos, ToroParalelos, ToroVerticalMorseConstr, ToroVerticalMorse ] class CamposVectoriales(Chapter): def __init__(self): Chapter.__init__(self, name=u"Campos vectoriales, singularidades e índice") for f in figuras: self.addPage(f()) if __name__ == "__main__": import sys from superficie.viewer.Viewer import Viewer app = QtGui.QApplication(sys.argv) visor = Viewer() visor.book.addChapter(CamposVectoriales()) visor.chapter.chapterSpecificIn() visor.whichPage = 0 visor.resize(400, 400) visor.show() visor.chaptersStack.show() sys.exit(app.exec_())
val = quad.function(1, 1) self.checkReturnValue(quad.function, val) ## ============================ self.quads[quad.function] = quad self.addChild(quad) ## ============================ self.updateAll() class F(object): def __init__(self, func): self.func = func func2 = lambda x, y: x + y self.wrapper = lambda: func2 print self.wrapper.func_code.co_freevars eval(self.wrapper.func_code) def __call__(self, *args): return eval(self.wrapper.func_code) func = F(lambda x, y: x + y) # print func(1,1) MiPlot3D(lambda x, y: (-x - sin(y)) * f, (-1, 1), (-1, 1)) viewer.resize(400, 400) viewer.show() viewer.chaptersStack.show() viewer.viewAll() sys.exit(app.exec_())