Is it possible to integrate a KLayout GDS Viewer into a python application?
I am currently building Python Integration Preview thinking that it would enable me to integrate the viewer into my python app. Is my proceedings correct?
Yeah i was wondering about the possibility of just taking GDS Viewing capability in KLayout and embedding within my Python UI(instead of launching it as a seperate process) and have communications between KLayout and my Python program.
What i need basically is a two way interaction between my python program and KLayout!
Well, that can be done, but it's pretty complex. The recipe is that:
Define a TCP/IP protocol that is capable of handling the communication you want to implement.
Implement a TCP/IP server inside KLayout using a Ruby script. This script will listen to a TCP/IP port and has to implement your protocol. Internally, the script will map requests to Ruby API calls (i.e. pan, zoom, load layout etc.)
Implement a client inside you Python tool which forms the other end of the protocol.
You find some example for this scheme here: http://www.klayout.de/rba_examples.html#example9. This sample turns KLayout into a screenshot server using HTTP as the protocol. That way we can use any Browser as the client.
But be warned: that is not an easy task. There are manifold interactions between the event loop of the GUI application and the TCP/IP connection and I know of users who had trouble getting that scheme to run reliably.
Comments
Hi Ganesh,
KLayout is not a UI component, if you mean that.
But you can run it as an external executable using "fork" or "system".
Is that what you intend?
Matthias
What i need basically is a two way interaction between my python program and KLayout!
Well, that can be done, but it's pretty complex. The recipe is that:
You find some example for this scheme here: http://www.klayout.de/rba_examples.html#example9. This sample turns KLayout into a screenshot server using HTTP as the protocol. That way we can use any Browser as the client.
But be warned: that is not an easy task. There are manifold interactions between the event loop of the GUI application and the TCP/IP connection and I know of users who had trouble getting that scheme to run reliably.
KLayout simply isn't Apache.
Matthias