def socket_get_rendering(message): available_renderings = [r for r in Rendering.objects().order_by('-date_created') if any(a.status == Assignment.UNASSIGNED for a in Assignment.objects(rendering=r))] if available_renderings: rendering_dict = available_renderings[0].to_dict() # rendering_dict['completion'] = rendering.completion emit('new rendering', dict(ok=True, result=rendering_dict)) else: return emit('new rendering', dict(ok=False))
def gen_db(): # DB init db = mongoengine.connect(config.db_name) db.drop_database(config.db_name) print '. Dropped database' dummy = User.new_user('*****@*****.**', 'ahmed.kachkach', 'ahmed.kachkach') dummy.save() # GLSL init glsl_scene = boiler_scene(dummy, title="Dummy Scene", description="Just a random dummy scene") glsl_scene.save() another_glsl_scene = boiler_scene(dummy, title="Another Dummy Scene", description="And here you go : yet another dummy scene.") another_glsl_scene.save() pyramideScene = pyramide_scene(dummy, title="Pyramide", description="Pyramide of balls") pyramideScene.save() #Rendering.create(width=1000, height=600, samples=16, scene=glsl_scene).save() Rendering.create(width=1366, height=768, samples=64, scene=another_glsl_scene, max_iterations=5).save() Rendering.create(width=1366, height=768, samples=128, scene=pyramideScene, max_iterations=5).save() print '. Generated dummy data !'
def profile(): scenes = Scene.objects(created_by=g.user) renderings = Rendering.objects(scene__in=scenes) return render_template('profile.html', renderings=renderings)
def renderings(): renderings = Rendering.objects() return render_template('renderings.html', renderings=renderings)