kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #08801
Decoupling issues with python
I have two somewhat important issues with the python binding... as you
know I'm implementing the plot interface.
- Decoupling the message logs: for 'big' messages we usually show
message boxes; these *could* be acceptable for scripting (maybe
a better solution would be throwing an exception...) but other
messages (for example the 'created %s directory') are currently
hardwired to the text control in the dialog... this is a clear
'functionality tied to UI' issue (and MVC was created to address it);
sadly most (if not all) the features in kicad are similarily tied to
the UI code. This makes difficult to export stuff to 'pure' scripting.
Currently I'm using an optional pointer to the message log box;
I don't know where these messages should go during scripting (standard
output? is it redirected to the python console?)
Ideally a 'message log' interface should be defined with a couple of
implementations (message box and python log/whatever); this could be
used also in other situations requiring progress log;
- Access to core classes: from what I've seen of the python bindings it
seems that the root object is the BOARD, which makes sense; sadly the
plot routines at the moment are in the PCB_EDIT_FRAME (like a lot of
the operations); another issue of feature/UI intermingling. I'll try
to extract them from PCB_EDIT_FRAME and put them relative to the BOARD
or, better yet, externally; I'm not a fan of 'everything in classes':
external stuff should be externally (the old OO philosophical dilemma:
the BOARD drivers the PLOTTER, the PLOTTER reads the BOARD or
something else read the BOARD and drive the PLOTTER?). Also the
PCB_EDIT_FRAME has already way too methods, and a diet could improve
it :D
- Is it correct that everything is compiled twice? I see that
a pcbnew.so is being generated... is this for running as a python
module (i.e. from python and not with python inside)?
--
Lorenzo Marcantonio
Logos Srl
Follow ups