OK, this one is simple.
For any complex set up of this simple machine, it just reads and executes a python file in the local context. The sophisticated users are pros, and they will mangle the code so the important set up parameters are well named. Hence, standard python sourcee works for set up.
For example, I will set up an arbitrary eval or exec window, so that I can abritrarily exec or eval in the local context. Using my internal knowledge of the code, I start setting configuration variables.
I will soon learn what counts and what doesn't, and end up with a simple python syntax that sets up my module, watch window, loads the source automatically. And, when I am fairly happy, the core things that make me happy will stand out as a class. The class then being formalized a bit and obvious to everyone, oh yea, they will say. I might be a hero. So we gey the standard set up and trap python code, Users can run pbug minimized, and they all set up running their own analysis code
Add, I did remove any entry boxes, every thing initialized from the init file which is selected from the file dialog. No fuss, no muss; make the init file as complex as you wish, and we will soon find out what we want in it. That brings the code down to 280 lines, with all these feature. 20 kines is help text The help method uses the table box, but that becomes useful when wewant feed back on the internals later.
Examples with the init code.
You have access to the set watch variable and set break variable. Just call hem directly in the init, even in he middle of a debug. You hit some hot spot in the code, right then and there, you load up a new init file and set up your watches and breaks All your watches are really expression in the watdh window, and are treated as expression for eval..
Loading user modules
Init uses the simplest method:
fileobj =open(filename,'r')
exec(fileobj.read())
OK, why not? exec does it all Python allow us to set the user code in a completely fresh frame, evidently, so calling exec in the fresh from does it. When the user modue needs to be called, its done, just pre-install the user module name with the init code. The Snippet class exposes all the necessary parameters for the code under test.
No comments:
Post a Comment