ctn-archive / nengo_gui_2014

HTML5 graphical interface for Nengo -- now obsolete! Please use https://github.com/nengo/nengo_gui instead
Other
6 stars 0 forks source link

Mark GUI code at the bottom of scripts #119

Open hunse opened 10 years ago

hunse commented 10 years ago

GUI code could be put in a special section thatnotes that it's auto generated. This code could also be hidden when opening the file in the GUI.

tbekolay commented 10 years ago

I was also thinking that it would also be good to include a section like:

if __name__ == '__main__':
    sim = nengo.Simulator(model)
    sim.run(1.0)  # Run time, in seconds

assuming that __name__ != '__main__' in nengo_gui. The nengo_gui stuff could be in else of that maybe? With the auto generated comment.

jgosmann commented 10 years ago

+1 for being able to execute different code when the model is run as script or when it is run in the GUI.

hunse commented 10 years ago

That seems like a good idea. I don't like autogenerating the simulation section that people will later modify, though.

What would the __name__ be in nengo_gui? We should use that to determine whether to run the GUI code.

tcstewar commented 10 years ago

My plan had been that the nengo_gui just ignores everything past the first *.Simulator() call. Probably by monkey-patching in a version of nengo.Simulator (and nengo_ocl.Simulator and neurogrid.Simulator and so on) that raises an Exception. But not quite sure about that.