예제 #1
0
def main():
    try:
        set_sys_path()
        make_user_dir()
        get_platform_paths()
        redirect_standard_streams()
        get_hg_revision()
        os.environ['MH_VERSION'] = getVersionStr()
        os.environ['MH_SHORT_VERSION'] = getShortVersion()
        os.environ['MH_MESH_VERSION'] = getBasemeshVersion()
        args = parse_arguments()
        init_logging()
    except Exception as e:
        print >> sys.stderr,  "error: " + format(unicode(e))
        import traceback
        bt = traceback.format_exc()
        print >> sys.stderr, bt
        return

    # Pass release info to debug dump using environment variables
    os.environ['MH_FROZEN'] = "Yes" if isBuild() else "No"
    os.environ['MH_RELEASE'] = "Yes" if isRelease() else "No"

    debug_dump()

    from core import G
    G.args = args

    # Set numpy properties
    if not args.get('debugnumpy', False):
        import numpy
        # Suppress runtime errors
        numpy.seterr(all = 'ignore')

    # Here pyQt and PyOpenGL will be imported
    from mhmain import MHApplication
    application = MHApplication()
    # application.run() we want to run the startup sequence synchronously
    application.startupSequence()
    
    #application2= MHApplication();
    #application2.startupSequence();

    #import cProfile
    #cProfile.run('application.run()')

    close_standard_streams()
예제 #2
0
def result():
    weight = float(request.form.get('weight').upper())
    muscle = float(request.form.get('muscle').upper())
    chest = float(request.form.get('chest').upper())
    hip = float(request.form.get('hip').upper())
    waist = float(request.form.get('waist').upper())
    age = float(request.form.get('age').upper())

    set_sys_path()

    from core import Globals, G
    g.G = Globals()

    make_user_dir()
    get_platform_paths()
    redirect_standard_streams()
    # init_logging()

    from core import G
    G.args = dict()

    from mhmain import MHApplication
    application = MHApplication()
    application.startupSequence()

    from webfunctions import support, webfunctions

    id = str(uuid.uuid4())
    directory = os.path.dirname(
        os.path.realpath(__file__)) + '/static/models/' + id
    os.makedirs(directory)
    filename = directory + '/model.obj'
    # log.message('Requesting model ' + filename)
    support.exportObj(filename, age, weight, muscle, chest, waist, hip)

    #clean up
    close_standard_streams()
    return jsonify(model='/models/' + id + '/model.obj',
                   texture='/models/' + id + '/model.mtl')