ooodev.format.inner.direct.structs.gradient_struct module

Module for Gradient struct.

New in version 0.9.0.

class ooodev.format.inner.direct.structs.gradient_struct.GradientStruct(*, style=GradientStyle.LINEAR, step_count=0, x_offset=50, y_offset=50, angle=0, border=0, start_color=0, start_intensity=100, end_color=16777215, end_intensity=100)[source]

Bases: StructBase

Represents UNO Gradient struct.

New in version 0.9.0.

__init__(*, style=GradientStyle.LINEAR, step_count=0, x_offset=50, y_offset=50, angle=0, border=0, start_color=0, start_intensity=100, end_color=16777215, end_intensity=100)[source]

Constructor

Parameters:
  • style (GradientStyle, optional) – Specifies the style of the gradient. Defaults to GradientStyle.LINEAR.

  • step_count (int, optional) – Specifies the number of steps of change color. Defaults to 0.

  • x_offset (Intensity, int, optional) – Specifies the X-coordinate, where the gradient begins. This is effectively the center of the RADIAL, ELLIPTICAL, SQUARE and RECT style gradients. Defaults to 50.

  • y_offset (Intensity, int, optional) – Specifies the Y-coordinate, where the gradient begins. See: x_offset. Defaults to 50.

  • angle (Angle, int, optional) – Specifies angle of the gradient. Defaults to 0.

  • border (int, optional) – Specifies percent of the total width where just the start color is used. Defaults to 0.

  • start_color (Color, optional) – Specifies the color at the start point of the gradient. Defaults to Color(0).

  • start_intensity (Intensity, int, optional) – Specifies the intensity at the start point of the gradient. Defaults to 100.

  • end_color (Color, optional) – Specifies the color at the end point of the gradient. Defaults to Color(16777215).

  • end_intensity (Intensity, int, optional) – Specifies the intensity at the end point of the gradient. Defaults to 100.

Raises:

ValueError – If step_count is less than zero.

Return type:

None

apply(obj: Any)[source]
apply(obj, **kwargs)

Applies tab properties to obj

Parameters:

obj (object) – UNO object.

Return type:

None

classmethod from_obj(obj)[source]
classmethod from_obj(obj, **kwargs)
classmethod from_obj(obj, **kwargs)

Gets instance from object

Parameters:

obj (object) – UNO object

Raises:

PropertyNotFoundError – If obj does not have required property

Returns:

GradientStruct instance that represents obj gradient properties.

Return type:

GradientStruct

classmethod from_preset(preset)[source]
classmethod from_preset(preset, **kwargs)
classmethod from_preset(preset, **kwargs)

Gets instance from preset.

Parameters:

preset (PresetGradientKind) – Preset.

Returns:

Gradient from a preset.

Return type:

GradientStruct

New in version 0.10.2.

classmethod from_uno_struct(value)[source]
classmethod from_uno_struct(value, **kwargs)
classmethod from_uno_struct(value, **kwargs)

Converts a Gradient instance to a GradientStruct.

Parameters:

value (Gradient) – UNO Gradient.

Returns:

GradientStruct set with Gradient properties.

Return type:

GradientStruct

get_attrs()[source]

Gets the attributes that are slated for change in the current instance

Returns:

Tuple of attributes

Return type:

Tuple(str, …)

get_json()[source]

Get Gradient represented as a json string for use with dispatch commands.

Returns:

Json string.

Return type:

str

get_uno_struct()[source]

Gets UNO Gradient from instance.

Returns:

Gradient instance

Return type:

Gradient

property prop_angle: Angle

Gets/Sets angle of the gradient.

Return type:

Angle

property prop_border: Intensity

Gets/Sets percent of the total width where just the start color is used.

Return type:

Intensity

property prop_end_color: Color

Gets/Sets the color at the end point of the gradient.

Return type:

NewType()(Color, int)

property prop_end_intensity: Intensity

Gets/Sets the intensity at the end point of the gradient.

Return type:

Intensity

property prop_format_kind: FormatKind

Gets the kind of style

Return type:

FormatKind

property prop_start_color: Color

Gets/Sets the color at the start point of the gradient.

Return type:

NewType()(Color, int)

property prop_start_intensity: Intensity

Gets/Sets the intensity at the start point of the gradient.

Return type:

Intensity

property prop_step_count: int

Gets/Sets the number of steps of change color.

Return type:

int

property prop_style: GradientStyle

Gets/Sets the style of the gradient.

Return type:

GradientStyle

property prop_x_offset: Intensity

Gets/Sets the X-coordinate, where the gradient begins.

Return type:

Intensity

property prop_y_offset: Intensity

Gets/Sets the Y-coordinate, where the gradient begins.

Return type:

Intensity