Bases: enaml.widgets.widget.Widget
A Widget subclass which adds constraint information.
A ConstraintsWidget is augmented with symbolic constraint variables which define a box model on the widget. This box model is used to declare constraints between this widget and other components which participate in constraints-based layout.
Constraints are added to a widget by assigning a list to the ‘constraints’ attribute. This list may contain raw LinearConstraint objects (which are created by manipulating the symbolic constraint variables) or DeferredConstraints objects which generated these LinearConstraint objects on-the-fly.
A ConstraintsWidget also has a ‘constraints_id’ which is a uuid given to the object and to each of its constraint variables in order to track ownership of the constraint variables. This id is automatically generated, and should not be modified by the user.
The list of user-specified constraints or constraint-generating objects for this component.
A read-only symbolic object that represents the left boundary of the component
A read-only symbolic object that represents the top boundary of the component
A read-only symbolic object that represents the width of the component
A read-only symbolic object that represents the height of the component
A read-only symbolic object that represents the right boundary of the component
A read-only symbolic object that represents the bottom boundary of the component
A read-only symbolic object that represents the vertical center of the component
A read-only symbolic object that represents the horizontal center of the component
How strongly a component hugs it’s width hint. Valid strengths are ‘weak’, ‘medium’, ‘strong’, ‘required’ and ‘ignore’. Default is ‘strong’. This trait should be overridden on a per-control basis to specify a logical default for the given control.
How strongly a component hugs it’s height hint. Valid strengths are ‘weak’, ‘medium’, ‘strong’, ‘required’ and ‘ignore’. Default is ‘strong’. This trait should be overridden on a per-control basis to specify a logical default for the given control.
How strongly a component resists clipping its contents. Valid strengths are ‘weak’, ‘medium’, ‘strong’, ‘required’ and ‘ignore’. The default is ‘strong’ for width.
How strongly a component resists clipping its contents. Valid strengths are ‘weak’, ‘medium’, ‘strong’, ‘required’ and ‘ignore’. The default is ‘strong’ for height.
Populates the initial attributes dict for the component.
A ConstraintsWidget adds the ‘layout’ key to the creation attributes dict. The value is a dict with the following keys.
A method which returns self or None based on the truthness of the argument.
This can be useful to easily turn off the effects of an object in constraints-based layout.
Parameters: | switch (bool) – A boolean which indicates whether this instance or None should be returned. |
---|---|
Returns: | result (self or None) – If ‘switch’ is boolean True, self is returned. Otherwise, None is returned. |
alias of __NoInterface__
Bases: enaml.qt.qt_widget.QtWidget
A Qt implementation of an Enaml ConstraintsWidget.
Peform a relayout for this constraints widget.
The default behavior of this method is to proxy the call up the tree of ancestors until it is either handled by a subclass which has reimplemented this method (see QtContainer), or the ancestor is not an instance of QtConstraintsWidget, at which point the layout request is dropped.
Replace constraints in the current layout system.
The default behavior of this method is to proxy the call up the tree of ancestors until it is either handled by a subclass which has reimplemented this method (see QtContainer), or the ancestor is not an instance of QtConstraintsWidget, at which point the request is dropped.
Parameters: |
---|
Clear the given constraints from the current layout system.
The default behavior of this method is to proxy the call up the tree of ancestors until it is either handled by a subclass which has reimplemented this method (see QtContainer), or the ancestor is not an instance of QtConstraintsWidget, at which point the request is dropped. This method will not trigger a relayout.
Parameters: | cns (list) – The list of casuarius constraints to remove from the current layout system. |
---|
Creates the list of size hint constraints for this widget.
This method uses the provided size hint of the widget and the policies for ‘hug’ and ‘resist’ to generate constraints which respect the size hinting of the widget.
If the size hint of the underlying widget is not valid, then no constraints will be generated.
Returns: | result (list) – A list of casuarius LinearConstraint instances. |
---|
Notify the layout system that the size hint of this widget has been updated.
Generate the constraints which must always be applied.
These constraints are generated once the first time this method is called. The results are then cached and returned immediately on future calls.
Returns: | result (list) – A list of casuarius LinearConstraint instance. |
---|
Get the list of user constraints defined for this widget.
The default implementation returns the list of constraint information sent by the server.
Returns: | result (list) – The list of dictionaries which represent the user defined linear constraints. |
---|
A method which can be called to create a function which will update the layout geometry of the underlying widget.
The parameter and return values below describe the function that is returned by calling this method.
Parameters: |
|
---|---|
Returns: | result ((x, y)) – The computed layout ‘x’ and ‘y’ amount, expressed in the coordinates of the layout owner widget. |
Bases: enaml.wx.wx_widget.WxWidget
A Wx implementation of an Enaml ConstraintsWidget.
Peform a relayout for this constraints widget.
The default behavior of this method is to proxy the call up the tree of ancestors until it is either handled by a subclass which has reimplemented this method (see WxContainer), or the ancestor is not an instance of WxConstraintsWidget, at which point the layout request is dropped.
Replace constraints in the current layout system.
The default behavior of this method is to proxy the call up the tree of ancestors until it is either handled by a subclass which has reimplemented this method (see WxContainer), or the ancestor is not an instance of WxConstraintsWidget, at which point the request is dropped.
Parameters: |
---|
Clear the given constraints from the current layout system.
The default behavior of this method is to proxy the call up the tree of ancestors until it is either handled by a subclass which has reimplemented this method (see WxContainer), or the ancestor is not an instance of WxConstraintsWidget, at which point the request is dropped. This method will not trigger a relayout.
Parameters: | cns (list) – The list of casuarius constraints to remove from the current layout system. |
---|
Creates the list of size hint constraints for this widget.
This method uses the provided size hint of the widget and the policies for ‘hug’ and ‘resist_clip’ to generate casuarius LinearConstraint objects which respect the size hinting of the widget.
If the size hint of the underlying widget is not valid, then no constraints will be generated.
Returns: | result (list) – A list of casuarius LinearConstraint instances. |
---|
Notify the layout system that the size hint of this widget has been updated.
Generate the constraints which must always be applied.
These constraints are generated once the first time this method is called. The results are then cached and returned immediately on future calls.
Returns: | result (list) – A list of casuarius LinearConstraint instance. |
---|
Get the list of user constraints defined for this widget.
The default implementation returns the list of constraint information sent by the server.
Returns: | result (list) – The list of dictionaries which represent the user defined linear constraints. |
---|
A method which can be called to create a function which will update the layout geometry of the underlying widget.
The parameter and return values below describe the function that is returned by calling this method.
Parameters: |
|
---|---|
Returns: | result ((x, y)) – The computed layout ‘x’ and ‘y’ amount, expressed in the coordinates of the layout owner widget. |