Manager for layout and schematic windows and its linkage. More...
| layout* | currentLayout() |
| schematic* | currentSchematic() |
| textEdit* | currentTextEditor() |
| void | closeLayout(layout *l) |
| void | closeLayout3d(layout3d *l) |
| void | closeSchematic(schematic *s) |
| bool | defaultGui |
| textEdit * | getCentralTextEditor() |
| layout* | getLayout(schematic *s) |
| layout3d* | getLayout3d(layout *l) |
| textEdit* | getOpenTextEditor() |
| schematic* | getSchematic(layout *lay) |
| bool | hasSchematic(layout *lay) |
| int | lastReportRang() |
| string | lastReportText() |
| layout* | newLayout() |
| layout* | newSchematic() |
| void | updateMacros() |
project is a static manager for editor windows. It creates layout, schematic, 3d and text windows and can link a layout to a schematic for schematic-driven layout. In a C++ macro started from a layout, layout is already the current window; project::currentLayout() returns that same pointer. In in-process Python there is no global layout, so currentLayout() or newLayout() is the usual start. NULL means the script was not started from that kind of window; then call newLayout() (or the matching newSchematic). Reports from long operations are available as lastReportText and lastReportRang even if the user never saw the dialog.
Example:
layout *l = project::currentLayout();
if (l == NULL)
l = project::newLayout();
l->drawing->point(0, 0);
l->drawing->point(1000, 2000);
l->drawing->box();
If the window that started the script is a layout window, that layout is returned. In a C++ macro this is the same window as the global layout pointer. In in-process Python there is no global layout, so this is the usual way to get the window. NULL is returned if the script was not started from a layout window.
Returns: the current layout window, or NULL.
Examples:
// direct ways to access the calling window:
layout->drawing->point(0,0);
layout->drawing->point(1000,2000);
layout->drawing->box();
//receiving the pointer via the project class:
layout *l=project::currentLayout();
if (l==NULL) l=project::newLayout();
l->drawing->point(0,0);
l->drawing->point(1000,2000);
l->drawing->box();
l=project.currentLayout()
if l is None: l=project.newLayout();
#the existing layout window is used for this point
l.drawing.point(0,0)
l.drawing.point(1000,2000)
l.drawing.box()
(introduced with release 20260616)
Same as currentLayout, but for the schematic window that started the script.
Returns: that schematic, or NULL if the script was not started from a schematic.
(introduced with release 20260616)
Same as currentLayout, but for the text editor window that started the script.
Returns: that textEdit, or NULL if the script was not started from a text editor.
(introduced with release 20260616)
Closes and unregisters layout window l.
Closes and unregisters 3d window l.
Closes and unregisters schematic window s.
If true, new layout and schematic windows get the standard toolbars and menus. If false, every menu and toolbar must be added by hand.
Returns: a pointer to the central text editor used for reports and error messages.
Returns: the layout window linked with schematic s. If none exists, one is created.
Returns: the 3d window linked with layout l. If none exists, one is created.
Returns: a pointer to an open text editor. Opens a new Text Editor if none is open.
Returns: the schematic window linked with layout lay. If none exists, one is created.
Returns: true if layout lay already has a connected schematic window.
Some longer operations build a report that may be shown to the user, depending on setup. This method returns the severity of that report. (introduced with release 20250129)
Returns: the report range:
| Values: | Report Rang: |
|---|---|
| 0 | fatal error |
| 1 | error |
| 2 | string warning |
| 3 | warnings |
| 4 | information |
| 5 | no further comments |
Returns: the full report text, whether or not it was shown to the user. (introduced with release 20250129)
Creates a new layout window.
Returns: a pointer to that window. In C++ macros use the keyword class to separate the type layout from the existing pointer layout.
class layout *myLayout=project::newLayout();
myLayout->open("filename");
Creates a new schematic window.
Returns: a pointer to the new window.
Calls updateMacros on every layout, schematic, and text editor window, so a change to setup::macroPath takes effect everywhere. (introduced with release 20260720)