GLXCurses.Adjustment module

class GLXCurses.Adjustment.Adjustment[source]

Bases: GLXCurses.Object.Object

A representation of an adjustable bounded value

Properties

lower

The minimum value of the adjustment.

Type:float
Flags:Read / Write
Default value:0.0
page_increment

The page increment of the adjustment.

Type:float
Flags:Read / Write
Default value:0.0
page_size

The page size of the adjustment. Note that the page-size is irrelevant and should be set to zero if the adjustment is used for a simple scalar value, e.g. in a SpinButton.

Type:float
Flags:Read / Write
Default value:0.0
step_increment

The step increment of the adjustment.

Type:float
Flags:Read / Write
Default value:0.0
minimum_increment

The smaller of step increment and page increment.

Type:float
Flags:Read / Write
Default value:0.0
upper

The maximum value of the adjustment.

Type:float
Flags:Read / Write
Default value:0.0

Note

The values will be restricted by upper - page-size if the page-size property is nonzero.

value

The value of the adjustment.

Type:float
Flags:Read / Write
Default value:0.0

Description

The Adjustment object represents a value which has an associated lower and upper bound, together with step and page increments,and a page size.It is used within several widgets, including SpinButton, Viewport, and Range (which is a base class for Scrollbar and Scale).

The Adjustment object does not update the value itself. Instead it is left up to the owner of the Adjustment to control the value.

Functions

new(value=0.0, lower=0.0, upper=0.0, step_increment=0.0, page_increment=0.0, page_size=0.0)[source]

Creates a new GLXCurses.Adjustment.

Parameters:
  • value (float) – The initial value
  • lower (float) – The minimum value
  • upper (float) – The maximum value
  • step_increment (float) – The step increment
  • page_increment (float) – The page increment
  • page_size (float) – The page size
Returns:

a new GLXCurses.Adjustment

Return type:

GLXCurses.Adjustment

Raises:
  • TypeError – if value is not float
  • TypeError – if lower is not float
  • TypeError – if upper is not float
  • TypeError – if step_increment is not float
  • TypeError – if page_increment is not float
  • TypeError – if page_size is not float
get_value()[source]

Gets the current value of the adjustment. See set_value()

Returns:A current value Adjustment
Return type:float
set_value(value)[source]

Set the Adjustment value attribute.

The value passed as argument is clamped to lie between lower and lower attributes.

Note

For adjustments which are used in a Scrollbar, the effective range of allowed values goes from lower to upper - page_size.

Raises:TypeError – when value passed as argument is not a :py:__area_data:float
clamp_page(lower=None, upper=None)[source]

Updates the value attribute to ensure that the range between lower and upper parameters is in the current page (i.e. between value and value + page_size).

If the range is larger than the page size, then only the start of it will be in the current page. A value-changed signal will be emitted if the value is changed.

Parameters:
  • lower (float) – the lower value
  • upper (float) – the upper value
Raises:
  • TypeError – when lower are not :py:__area_data:float type
  • TypeError – when upper are not :py:__area_data:float type
emit_changed()[source]

Emits a “changed” signal from the Adjustment.

This is typically called by the owner of the Adjustment, after it has changed any of the Adjustment attributes other than the value.

emit_value_changed()[source]

Emits a “value-changed” signal from the Adjustment. This is typically called by the owner of the Adjustment after it has changed the “value” property.

configure(value=None, lower=None, upper=None, step_increment=None, page_increment=None, page_size=None)[source]

Sets all properties of the adjustment at once.

Use this function to avoid multiple emissions of the “changed” signal.

See Adjustment.set_lower() for an alternative way of compressing multiple emissions of “changed” into one.

Parameters:
  • value (float) – the new value
  • lower (float) – the new minimum value
  • upper (float) – the new maximum value
  • step_increment (float) – the new step increment
  • page_increment (float) – the new page increment
  • page_size (float) – the new page size
Raises:

TypeError – when one of parameters are not :py:__area_data:float type

get_lower()[source]

Retrieves the minimum value of the adjustment.

Returns:The current minimum value of the adjustment
Return type:float
get_page_increment()[source]

Retrieves the page increment of the adjustment.

Returns:The current page increment of the adjustment
Return type:float
get_page_size()[source]

Retrieves the page size of the adjustment.

Returns:The current page size of the adjustment
Return type:float
get_step_increment()[source]

Retrieves the step increment of the adjustment.

Returns:The current step increment of the adjustment.
Return type:float
get_minimum_increment()[source]

Get the smaller of step increment and page increment. Note that value is compute, then it have no need of a set_minimum_increment() method.

Returns:the minimum increment of adjustment
Return type:float
get_upper()[source]

Retrieves the maximum value of the adjustment.

Returns:The current maximum value of the adjustment
Return type:float
set_lower(lower)[source]

Sets the minimum value of the adjustment.

When setting multiple adjustment properties via their individual setters, multiple Adjustment.changed() signals will be emitted. However, since the emission of the Adjustment.changed() signal is tied to the emission of the notify signals of the changed properties, it’s possible to compress the Adjustment.changed() signals into one by calling object_freeze_notify() and object_thaw_notify() around the calls to the individual setters.

Alternatively, using Adjustment.configure() has the same effect of compressing Adjustment.changed() emissions.

Warning

Unfortunately object_freeze_notify() and object_thaw_notify() don’t exist yet. then only Adjustment.configure() will make the work.

Parameters:lower (float) – the new minimum value
Raises:TypeError – when “lower” argument is not a :py:__area_data:float
set_page_increment(page_increment)[source]

Sets the page increment of the adjustment.

See also

Adjustment.set_lower() about how to compress multiple emissions of the Adjustment.changed() signal when setting multiple adjustment attributes.

Parameters:page_increment (float) – the new page increment
Raises:TypeError – when “page_increment” argument is not a :py:__area_data:float
set_page_size(page_size)[source]

Sets the page size of the adjustment.

See also

Adjustment.set_lower() about how to compress multiple emissions of the Adjustment.changed() signal when setting multiple adjustment attributes.

Parameters:page_size (float) – the new page size
Raises:TypeError – when “page_size” argument is not a :py:__area_data:float
set_step_increment(step_increment)[source]

Sets the step increment of the adjustment.

See also

Adjustment.set_lower() about how to compress multiple emissions of the Adjustment.changed() signal when setting multiple adjustment attributes.

Parameters:step_increment (float) – the new step increment
Raises:TypeError – when “step_increment” argument is not a :py:__area_data:float
set_upper(upper)[source]

Sets the maximum value of the adjustment.

See also

Adjustment.set_lower() about how to compress multiple emissions of the Adjustment.changed() signal when setting multiple adjustment attributes.

Parameters:upper (float) – the new maximum value
Raises:TypeError – when “upper” argument is not a :py:__area_data:float