GLXCurses.Adjustment module¶
-
class
GLXCurses.Adjustment.Adjustment[source]¶ Bases:
GLXCurses.Object.ObjectA 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-sizeif the page-size property is nonzero.
-
value¶ The value of the adjustment.
Type: float Flags: Read / Write Default value: 0.0
Description
The
Adjustmentobject 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, includingSpinButton,Viewport, andRange(which is a base class forScrollbarandScale).The Adjustment object does not update the value itself. Instead it is left up to the owner of the
Adjustmentto 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.AdjustmentReturn type: Raises: - TypeError – if
valueis not float - TypeError – if
loweris not float - TypeError – if
upperis not float - TypeError – if
step_incrementis not float - TypeError – if
page_incrementis not float - TypeError – if
page_sizeis 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
Adjustmentvalueattribute.The
valuepassed as argument is clamped to lie betweenlowerandlowerattributes.Note
For adjustments which are used in a
Scrollbar, the effective range of allowed values goes fromlowertoupper-page_size.Raises: TypeError – when valuepassed as argument is not a :py:__area_data:float
-
clamp_page(lower=None, upper=None)[source]¶ Updates the
valueattribute to ensure that the range betweenlowerandupperparameters is in the current page (i.e. betweenvalueandvalue+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
lowerare not :py:__area_data:float type - TypeError – when
upperare 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 theAdjustmentattributes 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 theAdjustment.changed()signal is tied to the emission of thenotifysignals of the changed properties, it’s possible to compress theAdjustment.changed()signals into one by callingobject_freeze_notify()andobject_thaw_notify()around the calls to the individual setters.Alternatively, using
Adjustment.configure()has the same effect of compressingAdjustment.changed()emissions.Warning
Unfortunately
object_freeze_notify()andobject_thaw_notify()don’t exist yet. then onlyAdjustment.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 theAdjustment.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 theAdjustment.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 theAdjustment.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 theAdjustment.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
-