Python Shell

Christoph Holtermann c.holtermann at gmx.de
Tue Jan 18 08:25:06 EST 2011


Hello !
> How far into Python are you? 
Somewhere in the middle ;-)
> It should be pretty easy to write an interpreter for a very simple language like your last suggestion. You would need to decide how you wanted it to work (how will you refer to the objects?). Also, you would need to decide how fancy the environment should be. 
Yes, that's something to think about. I thought of something like IPython. There is on one hand classical python and it's
enriched by magic functions.

An other example for something like a shell is the interface of bacula. It doesn't include a complex language but short commands,
a bit too short for my taste.
> For instance you could model what you want on IDLE, so there's a prompt, and various commands defined under it. I think IDLE is written using tkinter. I don't know what the best way to do GUI's in Python is; there's a Gtk+ interface that's essentially the same as the c/c++ interface (http://www.pygtk.org/) (and Glade is supposed to work either with c or with python). The object/method syntax is fine (a) if you know it, and (b) you code ways to make Gnucash objects into Python objects 
I don't yet really understand that. I had a look at IDLE. It has a GUI but it's not ipython. I don't care so much for a GUI, my approach is to have
a good console access. But I didn't really get your point yet.
> (object.prettyPrint() just calls the prettyPrint method on the value of object, so you need to define that kind of object with its methods, and set its data fields to be a Gnucash object).
I thought a bit about about the displaying problem. It seems to me that displaying is a task which could go into a seperate module. This module
could provide a function for example "display(object)". It would also add a function object.display() to every object it knows. For example
a transaction. display(transaction) would then call transaction.display().

I would want to have some preferences which parts of the transaction are printed, maybe a short and a long form. So i would need a way to
modify the behaviour of object.display().

I will do some sketches at bugzilla, so maybe it would be easier to understand.

It's a basic question. Maybe it's better to ask that in a python mailing-list. Does someone know a better fitting one ?

regars,

Christoph Holtermann


More information about the gnucash-devel mailing list