コード例 #1
0
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
コード例 #2
0
        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_())
コード例 #3
0
def tuplize(arg):
    """returns arg if it is already a sequence, (arg,) otherwise"""
    return arg if isinstance(arg, collections.Sequence) else (arg,)


if __name__ == "__main__":
    from PyQt4 import QtGui, QtCore
    import sys
    from superficie.Plot3D import Plot3D, RevolutionPlot3D, ParametricPlot3D, Mesh
    from superficie.Viewer import Viewer
    from math import sin

    app = QtGui.QApplication(sys.argv)
    Mesh.autoAdd = True
    viewer = Viewer()
    viewer.createChapter()

    class MiPlot3D(Plot3D):
        def __init__(self, *args, **kwargs):
            super(MiPlot3D, self).__init__(*args, **kwargs)

        def With(self, param_lst):
            print param_lst

    def setupParameter(self, param):
        self.addParameter(('v', 0, 1, 0))
        ## ============================
        d = self.getParametersValues()
        for quad in self.quads.values():
            quad.function.updateGlobals(d)