From 5ae17c17a5a62237fc8f6a95f58dbda29bd75cf8 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Mon, 20 Jul 2026 23:56:56 +0200 Subject: [PATCH] Updating Python stubs --- src/pymod/distutils_src/klayout/dbcore.pyi | 74 ++++++++++++--------- src/pymod/distutils_src/klayout/laycore.pyi | 19 ++++++ 2 files changed, 60 insertions(+), 33 deletions(-) diff --git a/src/pymod/distutils_src/klayout/dbcore.pyi b/src/pymod/distutils_src/klayout/dbcore.pyi index f18782fc3..bf92a578a 100644 --- a/src/pymod/distutils_src/klayout/dbcore.pyi +++ b/src/pymod/distutils_src/klayout/dbcore.pyi @@ -16161,8 +16161,7 @@ class DText: Setter: @brief Sets the vertical alignment - This property specifies how the text is aligned relative to the anchor point. - This property has been introduced in version 0.22 and extended to enums in 0.28. + This is the version accepting integer values. It's provided for backward compatibility. """ x: float r""" @@ -39453,23 +39452,14 @@ class Layout: ... @overload @classmethod - def new(cls, editable: bool) -> Layout: - r""" - @brief Creates a layout object - - This constructor specifies whether the layout is editable. In editable mode, some optimizations are disabled and the layout can be manipulated through a variety of methods. - - This method was introduced in version 0.22. - """ - ... - @overload - @classmethod - def new(cls, editable: bool, manager: Manager) -> Layout: + def new(cls, editable: bool, manager: Optional[Manager] = ...) -> Layout: r""" @brief Creates a layout object attached to a manager This constructor specifies a manager object which is used to store undo information for example. It also allows one to specify whether the layout is editable. In editable mode, some optimizations are disabled and the layout can be manipulated through a variety of methods. + The manager object can be nil - in that case, undo/redo is not supported. + This method was introduced in version 0.22. """ ... @@ -39484,6 +39474,20 @@ class Layout: Starting with version 0.25, layouts created with the default constructor are always editable. Before that version, they inherited the editable flag from the application. """ ... + @overload + @classmethod + def new(cls, source_cell: Cell, editable: Optional[Any] = ..., manager: Optional[Manager] = ...) -> Layout: + r""" + @brief Creates a layout object as a copy of another cell + + This convenience constructor creates a new layout object as a hierarchical copy of the source cell including all child cells and shapes. + + If 'editable' is a boolean value, the new layout object will be made editable depending on that value. If 'nil' is used for 'editable', the editable attribute is copied from the layout the source cell lives in. + 'manager' can be a \Manager object to which the new layout will be attached. + + This method was introduced in version 0.30.10. + """ + ... @classmethod def properties_array(cls, properties_id: int) -> Any: r""" @@ -39591,22 +39595,14 @@ class Layout: """ ... @overload - def __init__(self, editable: bool) -> None: - r""" - @brief Creates a layout object - - This constructor specifies whether the layout is editable. In editable mode, some optimizations are disabled and the layout can be manipulated through a variety of methods. - - This method was introduced in version 0.22. - """ - ... - @overload - def __init__(self, editable: bool, manager: Manager) -> None: + def __init__(self, editable: bool, manager: Optional[Manager] = ...) -> None: r""" @brief Creates a layout object attached to a manager This constructor specifies a manager object which is used to store undo information for example. It also allows one to specify whether the layout is editable. In editable mode, some optimizations are disabled and the layout can be manipulated through a variety of methods. + The manager object can be nil - in that case, undo/redo is not supported. + This method was introduced in version 0.22. """ ... @@ -39620,6 +39616,19 @@ class Layout: Starting with version 0.25, layouts created with the default constructor are always editable. Before that version, they inherited the editable flag from the application. """ ... + @overload + def __init__(self, source_cell: Cell, editable: Optional[Any] = ..., manager: Optional[Manager] = ...) -> None: + r""" + @brief Creates a layout object as a copy of another cell + + This convenience constructor creates a new layout object as a hierarchical copy of the source cell including all child cells and shapes. + + If 'editable' is a boolean value, the new layout object will be made editable depending on that value. If 'nil' is used for 'editable', the editable attribute is copied from the layout the source cell lives in. + 'manager' can be a \Manager object to which the new layout will be attached. + + This method was introduced in version 0.30.10. + """ + ... def _const_cast(self) -> Layout: r""" @brief Returns a non-const reference to self. @@ -49955,17 +49964,17 @@ class Netlist: @overload def circuit_by_cell_index(self, cell_index: int) -> Circuit: r""" - @brief Gets the circuit object for a given cell index (const version). + @brief Gets the circuit object for a given cell index. If the cell index is not valid or no circuit is registered with this index, nil is returned. - - This constness variant has been introduced in version 0.26.8. """ ... @overload def circuit_by_cell_index(self, cell_index: int) -> Circuit: r""" - @brief Gets the circuit object for a given cell index. + @brief Gets the circuit object for a given cell index (const version). If the cell index is not valid or no circuit is registered with this index, nil is returned. + + This constness variant has been introduced in version 0.26.8. """ ... @overload @@ -66555,10 +66564,10 @@ class Shape: Applies to texts only. Will throw an exception if the object is not a text. Setter: - @brief Sets the text transformation + @brief Sets the text transformation in micrometer units Applies to texts only. Will throw an exception if the object is not a text. - This method has been introduced in version 0.23. + This method has been introduced in version 0.25. """ text_valign: int r""" @@ -71393,8 +71402,7 @@ class Text: Setter: @brief Sets the vertical alignment - This property specifies how the text is aligned relative to the anchor point. - This property has been introduced in version 0.22 and extended to enums in 0.28. + This is the version accepting integer values. It's provided for backward compatibility. """ x: int r""" diff --git a/src/pymod/distutils_src/klayout/laycore.pyi b/src/pymod/distutils_src/klayout/laycore.pyi index e0354dfaa..9787e56c6 100644 --- a/src/pymod/distutils_src/klayout/laycore.pyi +++ b/src/pymod/distutils_src/klayout/laycore.pyi @@ -10956,6 +10956,16 @@ class PixelBuffer: By default, the pixel buffer does not support an alpha channel. """ @classmethod + def from_bytes(cls, data: bytes) -> PixelBuffer: + r""" + @brief Reconstructs a pixel buffer from a byte stream produced by \to_bytes + + The width and height are taken from the header and the stream length is checked against them. The dimensions are capped at 65536 x 65536; a header exceeding this limit raises an error. + + This method has been added in version 0.30.10. + """ + ... + @classmethod def from_png_data(cls, data: bytes) -> PixelBuffer: r""" @brief Reads the pixel buffer from a PNG byte stream @@ -11142,6 +11152,15 @@ class PixelBuffer: @brief Swaps data with another PixelBuffer object """ ... + def to_bytes(self) -> bytes: + r""" + @brief Converts the pixel buffer to a raw byte stream + + The stream starts with an 8-byte header (width and height as 32-bit unsigned integers) followed by the raw ARGB32 pixel data with 4 bytes per pixel in row-major order, top to bottom. Unlike \to_png_data this method has zero encoding overhead. Use \from_bytes to reconstruct the pixel buffer. + + This method has been added in version 0.30.10. + """ + ... def to_png_data(self) -> bytes: r""" @brief Converts the pixel buffer to a PNG byte stream