qcc_kplugin.dialogs¶
Dialogs that fit the screen.
A long dialog (route options, a component’s parameters, Simulate) used to grow past the bottom of the screen, with its OK button out of reach and no way to scroll or shrink it. Here:
Rowscollects form rows likeQFormLayout.addRowdoes, in sections, and lays them out in one column, or in two when one column would be taller than the screen allows (Settings ▸ “Long dialogs in two columns”).fit()puts a dialog’s body in a scroll area with the buttons below it (always visible), makes the dialog resizable (a size grip) and sizes it to its content, but never wider or taller than the free screen area.fit_window()caps a non-modal window (results text, the circuit picture) to the screen.
Only the layout changes: the widgets, their order and their labels are the dialogs’ own.
Attributes¶
Classes¶
Form rows in sections, laid out by |
Functions¶
|
Width and height (logical pixels) of the free screen area (without the task bar) under |
|
Lay |
|
Resize a non-modal window to |
|
Two layouts (or widgets) next to each other when two columns are on, else one under the other. |
|
Settings ▸ "Long dialogs in two columns" (on by default). |
Module Contents¶
- class qcc_kplugin.dialogs.Rows(parent=None)¶
Form rows in sections, laid out by
build().addRowtakes whatQFormLayout.addRowtakes (a label and a widget or layout, or one widget or layout spanning the row);section()starts a new section (with an optional bold title). Two columns split only between sections (or, with a single section, between rows).- addRow(*args)¶
- build(columns: int | None = None) pya.QWidget¶
The dialog body: the rows in one or two columns (each a form, top-aligned).
- section(title: str | None = None)¶
Start a section;
titleadds a bold label as its first row. Returns the label (or None).
- split(columns: int | None = None) list[list[tuple]]¶
The rows of each column: one, or two balanced by height when two are allowed and needed.
- units() list[list[tuple]]¶
- columns = 1¶
- parent = None¶
- sections: list[list[tuple]] = [[]]¶
- qcc_kplugin.dialogs.available_size(widget=None) tuple[int, int]¶
Width and height (logical pixels) of the free screen area (without the task bar) under
widget, else under KLayout’s main window.
- qcc_kplugin.dialogs.fit(dialog, body, buttons=None, want: tuple[int, int] | None = None) pya.QScrollArea¶
Lay
dialogout asbody(a widget or layout) in a scroll area andbuttonsbelow it, resizable, sized to the content (at leastwant) and at mostSCREEN_SHAREof the free screen area. Returns the area.
- qcc_kplugin.dialogs.fit_window(window, width: int, height: int) None¶
Resize a non-modal window to
widthxheight, but at mostSCREEN_SHAREof the screen.
- qcc_kplugin.dialogs.side_by_side(parent, left, right, columns: int | None = None) pya.QWidget¶
Two layouts (or widgets) next to each other when two columns are on, else one under the other.
- qcc_kplugin.dialogs.two_columns_enabled() bool¶
Settings ▸ “Long dialogs in two columns” (on by default).
- qcc_kplugin.dialogs.FALLBACK_SCREEN = (1280, 800)¶
- qcc_kplugin.dialogs.SCREEN_SHARE = (0.92, 0.88)¶
- qcc_kplugin.dialogs.TWO_COLUMNS_ABOVE = 0.6¶