LayoutEditor for Python
LayoutEditor for Python is a stand alone python module with a fully featured graphical user interface of the LayoutEditor. It allows to embed the LayoutEditor into your own python application with a graphical user interface. The user interface of the LayoutEditor can be adjusted and new features can be added. The application programming interface (API) of LayoutEditor for python is similar to the native macros of the LayoutEditor. However to control data access and adjust the user interface additional features are available. Using these additional feature is essential to get a stable application. If you just need simple scripting with python, you should better use LayoutEditor macros or LayoutScript for Python. LayoutEditor for Python requires a full version license of the LayoutEditor. A free demo is not available.
Contents
-
LayoutEditor for Python
- Getting Started
-
Additional Methods
- class backgroundModule
- class booleanHAndler
-
class drawingField
- bool drawingField::mutexAddGuiTryLock()
- void drawingField::mutexAddUnlock()
- bool drawingField::mutexReadTryLock()
- bool drawingField::mutexReadGuiTryLock()
- void drawingField::mutexReadLock()
- void drawingField::mutexReadUnlock()
- void drawingField::mutexChangeLock()
- bool drawingField::mutexChangeTryLock()
- bool drawingField::mutexChangeGuiTryLock()
- void drawingField::mutexChangeUnlock()
- bool drawingField::paint()
- bool drawingField::recountSelect()
- void drawingField::setAlignCenterMode()
- void drawingField::setAlignCenterXMode()
- void drawingField::setAlignCenterYMode()
- void drawingField::setAlignBottomMode()
- void drawingField::setAlignLeftMode()
- void drawingField::setAlignRightMode()
- void drawingField::setAlignTopMode()
- void drawingField::setAlignValueMode()
- void drawingField::setAngleMode()
- void drawingField::setArcMode()
- void drawingField::setBezier2Mode()
- void drawingField::setBezier3Mode()
- void drawingField::setBoxMode()
- void drawingField::setCdeselectMode()
- void drawingField::setCellOriginMode()
- void drawingField::setCellrefMode()
- void drawingField::setCellrefArrayMode()
- void drawingField::setCenterMode()
- void drawingField::setCenterXMode()
- void drawingField::setCenterYMode()
- void drawingField::setCircleMode()
- void drawingField::setCircleBoxMode()
- void drawingField::setCircleFitMode()
- void drawingField::setCommandMode()
- void drawingField::setCopyMode()
- void drawingField::setCrossMode()
- void drawingField::setCselectMode()
- void drawingField::setCutMode()
- void drawingField::setElementSizeMode()
- void drawingField::setFdeselectMode()
- void drawingField::setFselectMode()
- void drawingField::setInsertPointMode()
- void drawingField::setLengthMode()
- void drawingField::setLengthElementMode()
- void drawingField::setMirrorMode()
- void drawingField::setModifyAdded()
- void drawingField::setModifyChanged()
- void drawingField::setModifySaved()
- void drawingField::setMoveEdgeMode()
- void drawingField::setMoveMode()
- void drawingField::setMovePointMode()
- void drawingField::setMoveXMode()
- void drawingField::setMoveYMode()
- void drawingField::setNodeMode()
- void drawingField::setPathMode()
- void drawingField::setPdeselectMode()
- void drawingField::setPolygonMode()
- void drawingField::setPolygonArcMode()
- void drawingField::setPropertiesMode()
- void drawingField::setPselectMode()
- void drawingField::setRotateMode()
- void drawingField::setRulerMode()
- void drawingField::setSectorMode()
- void drawingField::setSelectCellMode()
- void drawingField::setSpiralMode()
- void drawingField::setTextMode()
- bool drawingField::setZoomMode()
- bool drawingField::showDevice(string device)
- bool drawingField::showDeviceNode(string device,int i)
- bool drawingField::showNode(int i)
- class drc
- class extracntionModule
-
class layout
- void layout::addCommandLineDock()
- void layout::addLayerDock()
- void layout::addMacros()
- void layout::addMouseHelp()
- void layout::add3dDock()
- QMenu * layout::getMenu(string name)
- void layout::guiSetupBasic()
- void layout::guiSetupFull()
- void layout::guiSetupReduced()
- void layout::guiSetupViewer()
- void layout::guiUpdate()
- void layout::menuAdd(string name,string entries )
- QToolBar * layout::toolBarLast()
- class netListModule
-
class schematic
- void schematic::addComponentDock()
- void schematic::addMacros()
- void schematic::addMouseHelp()
- QMenu * schematic::getMenu(string name)
- void schematic::guiSetup()
- void schematic::guiUpdate()
- void schematic::menuAdd(string name,string entries )
- void schematic::open(string file)
- QToolBar * schematic::toolBarLast()
-
class schematicDisplay
- QColor schematicDisplay::defaultColor
- bool schematicDisplay::mutexAddGuiTryLock()
- void schematicDisplay::mutexAddUnlock()
- bool schematicDisplay::mutexReadTryLock()
- bool schematicDisplay::mutexReadGuiTryLock()
- void schematicDisplay::mutexReadLock()
- void schematicDisplay::mutexReadUnlock()
- void schematicDisplay::mutexChangeLock()
- bool schematicDisplay::mutexChangeTryLock()
- bool schematicDisplay::mutexChangeGuiTryLock()
- void schematicDisplay::mutexChangeUnlock()
- void schematicDisplay::paint()
- bool schematicDisplay::setModifyAdded()
- void schematicDisplay::setArcMode()
- void schematicDisplay::setBusMode()
- void schematicDisplay::setCircleMode()
- void schematicDisplay::setEditMode()
- void schematicDisplay::setGroundMode()
- void schematicDisplay::setLabelNodeMode()
- void schematicDisplay::setLineMode()
- bool schematicDisplay::setModifyChanged()
- bool schematicDisplay::setModifySaved()
- void schematicDisplay::setPlaceComponentMode(component *c)
- void schematicDisplay::setPolygonMode()
- void schematicDisplay::setPortMode()
- void schematicDisplay::setRectMode()
- void schematicDisplay::setTextMode()
- void schematicDisplay::setSheet(const string &s)
- void schematicDisplay::setWireMode()
- void schematicDisplay::setZoomMode()
- class textEdit
- Signals for class layout
- Signals for class schematic
- Signals for class textEdit
- Additional Classes
Getting Started
The LayoutEditor Python module is named pylayout. Script using pylayout can be started from the integrated TextEditor with the execute button without any further setup. To use it a stand alone python script the environment variables PYTHONHOME, PYTHONPATH, PATH and LD_LIBRARY_PATH had to be set correctly. A LayoutEditor full version license key had to be registered inside the normal LayoutEditor before loading the module. The 'layout.py' (layout.pyw) script build a complete LayoutEditor application from python. Review this script is also a good start to learn LayoutEditor for python.
LayoutEditor for Python is shipped with the LayoutEditor in most packages. It is includes in any Linux and Mac package as well as the ZIP packages for Windows. The Windows-installer as well as the Windows XP packages do not include any scripting.
Python Macros
Python macros can be used in the same way as C/C++ macros. The application interface has the same structure. There are only a few python specific differences. One difference is, that python macros must contain the word 'python' in the first line to be recognize as a python macro. A simple python macro would look like this:
1 #!use python
2 #name=#1: Python Exsample 1
3 #help=Helptext for Sample 1
4
5 #adding a box
6 layout.drawing.point(0,0)
7 layout.drawing.point(4000,2000)
8 layout.drawing.box()
9
10 #adding a cell reference
11 c=layout.drawing.findCell("myCell")
12 p1=pylayout.point (0,0)
13 if c!=None:
14 layout.drawing.currentCell.addCellref(c,p1)
15
16 # full scale of the view
17 layout.drawing.scaleFull()
This simple example will add a box to the current cell on the active layer.
Notes:
Python macros executed by the LayoutEditor will be run with the exec(..) command from Python. That Python command has limitations in defining own functions or classes. To use own functions and classes in Python macros, the classes/functions had to be defined in a separate file and this file had to be imported in your python application.
Additional Methods
To control data access and adjust the user interface additional features are available. Most important features are the mutex methods. You should always lock a mutex before access any data. Without a concurrent write access can cause unpredictable behaviour or even an segmentation fault of complete application. In details these are the additional methods:
class backgroundModule
void backgroundModule::initDock()
adds the background dock to the available dock, but keep it hidden.
class booleanHAndler
booleanHandler::booleanHandler(drawingField *drawing)
Create a boolean class to perform boolean operations
This feature is only part of the LayoutEditor Python Module.
class drawingField
bool drawingField::mutexAddGuiTryLock()
Simultan access to the design data may be fatal. Some simultan access makes no probelm. To organisize the access a mutex system is used. Each program had to say the mutex before the access to the data in which kind it will used the data. Three type are sepatated. Read, Add and Change. The mutex will answer if this access is ok or not. You also can decide to wait until the dataacces is avaiable. After the use of the data the mutex had to be freed.
if drawing.mutexReadTryLock(): # your code to read the data drawing.mutexReadUnlock()
The methods with 'Gui' will do the same as without it, but show a message the the data is not avaiable.
void drawingField::mutexAddUnlock()
see above
bool drawingField::mutexReadTryLock()
see above
bool drawingField::mutexReadGuiTryLock()
see above
void drawingField::mutexReadLock()
see above
void drawingField::mutexReadUnlock()
see above
void drawingField::mutexChangeLock()
see above
bool drawingField::mutexChangeTryLock()
see above
bool drawingField::mutexChangeGuiTryLock()
see above
void drawingField::mutexChangeUnlock()
see above
bool drawingField::paint()
triggers a repaint of the design
bool drawingField::recountSelect()
triggers a recount of selected elements
void drawingField::setAlignCenterMode()
Activates the align center mode.
void drawingField::setAlignCenterXMode()
Activates the align center x mode.
void drawingField::setAlignCenterYMode()
Activates the align center y mode.
void drawingField::setAlignBottomMode()
Activates the align bottom mode.
void drawingField::setAlignLeftMode()
Activates the align left mode.
void drawingField::setAlignRightMode()
Activates the align right mode.
void drawingField::setAlignTopMode()
Activates the align top mode.
void drawingField::setAlignValueMode()
Activates the align value mode.
void drawingField::setAngleMode()
Activates the angle mode.
void drawingField::setArcMode()
Activates the arc mode.
void drawingField::setBezier2Mode()
Activates the bezier2 mode.
void drawingField::setBezier3Mode()
Activates the bezier3 mode.
void drawingField::setBoxMode()
Activates the box mode.
void drawingField::setCdeselectMode()
Activates the cdeselect mode.
void drawingField::setCellOriginMode()
Activates the cell origin mode.
void drawingField::setCellrefMode()
Activates the cellref mode.
void drawingField::setCellrefArrayMode()
Activates the cellref array mode.
void drawingField::setCenterMode()
Activates the center mode.
void drawingField::setCenterXMode()
Activates the center x mode.
void drawingField::setCenterYMode()
Activates the center y mode.
void drawingField::setCircleMode()
Activates the circle mode.
void drawingField::setCircleBoxMode()
Activates the circle box mode.
void drawingField::setCircleFitMode()
Activates the circle fit mode.
void drawingField::setCommandMode()
Activates the command mode.
void drawingField::setCopyMode()
Activates the copy mode.
void drawingField::setCrossMode()
Activates the CrossSectionMode.
void drawingField::setCselectMode()
Activates the cselect mode.
void drawingField::setCutMode()
Activates the cut mode.
void drawingField::setElementSizeMode()
Activates the element size mode.
void drawingField::setFdeselectMode()
Activates the fdeselect mode.
void drawingField::setFselectMode()
Activates the fselect mode.
void drawingField::setInsertPointMode()
Activates the insert point mode.
void drawingField::setLengthMode()
Activates the length mode.
void drawingField::setLengthElementMode()
Activates the length element mode.
void drawingField::setMirrorMode()
Activates the mirror mode.
void drawingField::setModifyAdded()
marks the design shapes to be added
void drawingField::setModifyChanged()
marks the design to be modified
void drawingField::setModifySaved()
marks the design not to be modified
void drawingField::setMoveEdgeMode()
Activate the move edge mod2
void drawingField::setMoveMode()
Activates the move mode.
void drawingField::setMovePointMode()
Activates the move point mode.
void drawingField::setMoveXMode()
Activates the move x mode.
void drawingField::setMoveYMode()
Activates the move y mode.
void drawingField::setNodeMode()
Activates the node mode.
void drawingField::setPathMode()
Activates the path mode.
void drawingField::setPdeselectMode()
Activates the pdeselect mode.
void drawingField::setPolygonMode()
Activates the polygon mode.
void drawingField::setPolygonArcMode()
Activates the polygon arc mode.
void drawingField::setPropertiesMode()
Activates the properties mode.
void drawingField::setPselectMode()
Activates the pselect mode.
void drawingField::setRotateMode()
Activates the rotate mode.
void drawingField::setRulerMode()
Activates the ruler mode.
void drawingField::setSectorMode()
Activates the sector mode.
void drawingField::setSelectCellMode()
Activates the selct cell mode.
void drawingField::setSpiralMode()
Activates the spiral mode.
void drawingField::setTextMode()
Activates the text mode.
bool drawingField::setZoomMode()
Activates the zoom mode.
bool drawingField::showDevice(string device)
Shows the device device
bool drawingField::showDeviceNode(string device,int i)
Shows the node i on the device device
bool drawingField::showNode(int i)
shows the node i
class drc
void drc::initDock()
adds the drc dock to the available dock, but keep it hidden.
class extracntionModule
void extractionModule::initDock()
adds the extraction dock to the available dock, but keep it hidden.
class layout
void layout::addCommandLineDock()
Add a c/cpp commandline macro dock and make it invisible.
void layout::addLayerDock()
Add a layer dock to the window and adds it to the left dock. Add a layer menu to the main menu.
void layout::addMacros()
Macro in the macro folder will be added to the menu.
void layout::addMouseHelp()
Add a mouse help dock to the window and adds it to the left dock.
void layout::add3dDock()
A 3d view windows is added.
QMenu * layout::getMenu(string name)
Returns a point to the menu with the name. If the menu does not exist it will be created. To get submenus use 'mainentry/submenu' as name.
void layout::guiSetupBasic()
Will perform a basic menu and tool bar setup of the layout window. This feature should only used, if the window was created in pure mode without and menu and tool bar setup.
void layout::guiSetupFull()
Will perform a full menu and tool bar setup of the layout window. This feature should only used, if the window was created in pure mode without and menu and tool bar setup.
void layout::guiSetupReduced()
Will perform a reduced menu and tool bar setup of the layout window. This feature should only used, if the window was created in pure mode without and menu and tool bar setup.
void layout::guiSetupViewer()
Will perform a viewer menu and tool bar setup of the layout window. This feature should only used, if the window was created in pure mode without and menu and tool bar setup.
void layout::guiUpdate()
The user interface is updated. It updates the setup of the layerbuttons, the list of existing cell ,.. Call this function after you have changed the design in a script. The c/c++ macro interface call the function automatic after the execution of a macro.
void layout::menuAdd(string name,string entries )
Add a new entry to the main menu. The first parameter is the name of the menu. The second parameter contains last entries of the new menu seperated with a semicolon.
QToolBar * layout::toolBarLast()
Returns: a pointer to the last created toolBar
class netListModule
void netListModule::initDock()
adds the netlist dock to the available dock, but keep it hidden.
bool netListModule::netMutexTryLock()
a mutex used for the access to the netlist. Return true if it can be locked.
void netListModule::netMutexLock()
The mutex used for the access to the netlist will be unlocked.
void netListModule::netMutexUnlock()
The mutex used for the access to the netlist will be unlocked.
class schematic
void schematic::addComponentDock()
A dock for choosing and editing components is added
void schematic::addMacros()
Macro in the macro folder will be added to the menu.
void schematic::addMouseHelp()
Add a mouse help dock to the window and adds it to the left dock.
QMenu * schematic::getMenu(string name)
Returns a pointer to the menu with the name. If the menu does not exist it will be created. To get submenus use 'mainentry/submenu' as name.
void schematic::guiSetup()
Will perform a std. menu and tool bar setup of the schematic window. This feature should only used, if the window was created in pure mode without and menu and tool bar setup.
void schematic::guiUpdate()
The user interface is updated. It updates the setup of the layerbuttons, the list of existing cell ,.. Call this function after you have changed the design in a script. The c/c++ macro interface call the function automatic after the execution of a macro.
void schematic::menuAdd(string name,string entries )
Add a new entry to the main menu. The first parameter is the name of the menu. The second parameter contains last entries of the new menu seperated with a semicolon.
void schematic::open(string file)
opens the named file and adds its contents to the existing sheet collection.
QToolBar * schematic::toolBarLast()
Returns: a pointer to the last created toolBar
class schematicDisplay
QColor schematicDisplay::defaultColor
color used for any new graphical element.
bool schematicDisplay::mutexAddGuiTryLock()
Simultan access to the design data may be fatal. Some simultan access makes no probelm. To organisize the access a mutex system is used. Each program had to say the mutex before the access to the data in which kind it will used the data. Three type are sepatated. Read, Add and Change. The mutex will answer if this access is ok or not. You also can decide to wait until the dataacces is avaiable. After the use of the data the mutex had to be freed.
if drawing.mutexReadTryLock(): # your code to read the data drawing.mutexReadUnlock()
The methods with 'Gui' will do the same as without it, but show a message the the data is not aviaable.
void schematicDisplay::mutexAddUnlock()
see above
bool schematicDisplay::mutexReadTryLock()
see above
bool schematicDisplay::mutexReadGuiTryLock()
see above
void schematicDisplay::mutexReadLock()
see above
void schematicDisplay::mutexReadUnlock()
see above
void schematicDisplay::mutexChangeLock()
see above
bool schematicDisplay::mutexChangeTryLock()
see above
bool schematicDisplay::mutexChangeGuiTryLock()
see above
void schematicDisplay::mutexChangeUnlock()
see above
void schematicDisplay::paint()
triggers a repaint of the design
bool schematicDisplay::setModifyAdded()
marks the design shapes to be added
void schematicDisplay::setArcMode()
Activates the arc mode.
void schematicDisplay::setBusMode()
Activates the bus mode.
void schematicDisplay::setCircleMode()
Activates the circle mode.
void schematicDisplay::setEditMode()
Activates the edit mode.
void schematicDisplay::setGroundMode()
Activates the ground mode.
void schematicDisplay::setLabelNodeMode()
Activates the label node mode.
void schematicDisplay::setLineMode()
Activates the line mode.
bool schematicDisplay::setModifyChanged()
marks the design to be modified
bool schematicDisplay::setModifySaved()
marks the design not to be modified
void schematicDisplay::setPlaceComponentMode(component *c)
Activates the edit mode.
void schematicDisplay::setPolygonMode()
Activates the polygon mode.
void schematicDisplay::setPortMode()
Activates the port mode.
void schematicDisplay::setRectMode()
Activates the rect mode.
void schematicDisplay::setTextMode()
Activates the text mode.
void schematicDisplay::setSheet(const string &s)
sets s as the current displayed sheet
void schematicDisplay::setWireMode()
Activates the wire mode.
void schematicDisplay::setZoomMode()
Activates the zoom mode.
class textEdit
void textEdit::addMacros()
Macros in the macro folder will be added to the menu.
QMenu *textEdit::getMenu(string name)
Returns a point to the menu with the name. If the menu does not exist it will be created. To get submenus use 'mainentry/submenu' as name.
QToolBar * textEdit::toolBarLast()
Returns: a pointer to the last created toolBar
Signals for class layout
void layout::newCurrentCell(const string &s)
This signal is emitted when the current displayed cell has changed.
void layout::closed()
This signal is emitted when the window is closed and destroyed
void layout::cellsChanged(stringList list,string currentCell )
This signal is emitted when cells has been added or deleted.
Signals for class schematic
void schematic::sheetsChanged(stringList list,string currentCell )
This signal is emitted when sheetss has been added or deleted.
void schematic::closed()
This signal is emitted when the window is closed and destroyed
Signals for class textEdit
void textEdit::closed()
This signal is emitted when the window is closed and destroyed
Additional Classes
class oaInfo
The oaInfo class with information on OpenAccess libraies.
class splash
The splash class supplier a splash window of LayoutEditor based applications.