qcc_kplugin.dialogs =================== .. py:module:: qcc_kplugin.dialogs .. autoapi-nested-parse:: 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: * :class:`Rows` collects form rows like ``QFormLayout.addRow`` does, 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"). * :func:`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. * :func:`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 ---------- .. autoapisummary:: qcc_kplugin.dialogs.FALLBACK_SCREEN qcc_kplugin.dialogs.SCREEN_SHARE qcc_kplugin.dialogs.TWO_COLUMNS_ABOVE Classes ------- .. autoapisummary:: qcc_kplugin.dialogs.Rows Functions --------- .. autoapisummary:: qcc_kplugin.dialogs.available_size qcc_kplugin.dialogs.fit qcc_kplugin.dialogs.fit_window qcc_kplugin.dialogs.side_by_side qcc_kplugin.dialogs.two_columns_enabled Module Contents --------------- .. py:class:: Rows(parent=None) Form rows in sections, laid out by :meth:`build`. ``addRow`` takes what ``QFormLayout.addRow`` takes (a label and a widget or layout, or one widget or layout spanning the row); :meth:`section` starts a new section (with an optional bold title). Two columns split only between sections (or, with a single section, between rows). .. py:method:: addRow(*args) .. py:method:: build(columns: int | None = None) -> pya.QWidget The dialog body: the rows in one or two columns (each a form, top-aligned). .. py:method:: section(title: str | None = None) Start a section; ``title`` adds a bold label as its first row. Returns the label (or None). .. py:method:: 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. .. py:method:: units() -> list[list[tuple]] .. py:attribute:: columns :value: 1 .. py:attribute:: parent :value: None .. py:attribute:: sections :type: list[list[tuple]] :value: [[]] .. py:function:: 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. .. py:function:: fit(dialog, body, buttons=None, want: tuple[int, int] | None = None) -> pya.QScrollArea Lay ``dialog`` out as ``body`` (a widget or layout) in a scroll area and ``buttons`` below it, resizable, sized to the content (at least ``want``) and at most :data:`SCREEN_SHARE` of the free screen area. Returns the area. .. py:function:: fit_window(window, width: int, height: int) -> None Resize a non-modal window to ``width`` x ``height``, but at most :data:`SCREEN_SHARE` of the screen. .. py:function:: 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. .. py:function:: two_columns_enabled() -> bool Settings ▸ "Long dialogs in two columns" (on by default). .. py:data:: FALLBACK_SCREEN :value: (1280, 800) .. py:data:: SCREEN_SHARE :value: (0.92, 0.88) .. py:data:: TWO_COLUMNS_ABOVE :value: 0.6