コード例 #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
            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_())