Components¶
-
class
mhi.enerplot.
Component
¶ The base type for all Enerplot components.
Include graph frames, dividers, and sticky notes
-
id
¶ The id of the component (read-only)
-
book_name
¶ The book the component belongs to (read-only)
-
book
¶ The book the component belongs to (read-only)
-
classid
¶ The classid of the component (read-only)
-
parent
()¶ Retrieve the owner of this component
-
attributes
(**kwargs)¶ Set or get a component’s attributes
A component’s attributes are used to describe the component’s location and size relative to its parent.
Parameters: **kwargs – key=value arguments Returns: The component’s current attributes. Return type: dict See also
-
position
(x=None, y=None)¶ Get or set the component’s position.
If the x & y parameters are given, the position is set. If they are omitted, the current position is returned.
Parameters: - x (int) – The component’s new x location on the sheet
- y (int) – The component’s new y location on the sheet
Returns: The current location of the component
Return type: Tuple[x,y]
-
size
(width=None, height=None)¶ Get or set the component’s size
If the width & height parameters are given, the size is set. If they are omitted, the current size is returned.
Parameters: - width (int) – The component’s new width
- height (int) – The component’s new height
Returns: The current size of the component
Return type: Tuple[width, height]
-
extents
(x=None, y=None, width=None, height=None)¶ Get or set the component’s position and size
If all parameters are given, the position and size is set. If all parameters are omitted, the current extents are returned.
Parameters: - x (int) – The component’s new x location on the sheet
- y (int) – The component’s new y location on the sheet
- width (int) – The component’s new width
- height (int) – The component’s new height
Returns: The current extents of the component
Return type: Tuple[x,y,width,height]
-
properties
(paramlist='', **kwargs)¶ Set or get a component’s properties
A component’s properties are used to describe the component’s appearance or control the component’s behaviour.
Parameters: **kwargs – key=value arguments Returns: The component’s current property values Return type: dict See also
-
copy_as_metafile
()¶ Copy component to clipboard as a metafile
-
copy_as_bitmap
()¶ Copy component to clipboard as a bitmap
-
cut
()¶ Remove the component to the clipboard
-
copy
()¶ Copy the component to the clipboard
-
paste
()¶ Paste the component(s) from the clipboard to this canvas
-
list
(classid=None)¶ List all the components contained inside this object, possibly restricted to a certain classid.
Parameters: classid (str) – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, or “Sticky”. Returns: the list of components Return type: List[Component]
-
find
([classid,] [key=value, ...])¶ Find the (singular) component that matches the given criteria, or None if no matching component can be found. Raises an exception if more than one component matches the given criteria.
Parameters: - classid (str) – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, or “Sticky”.
- key=value – additional parameters which must be matched.
Returns: the found component or None
Return type:
-
find_first
([classid,] [key=value, ...])¶ Find a component that matches the given criteria, or None if no matching component can be found.
Parameters: - classid (str) – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, or “Sticky”.
- key=value – additional parameters which must be matched.
Returns: the found component or None
Return type:
-
find_all
([classid,] [key=value, ...])¶ Find all components that matches the given criteria, or None if no matching component can be found.
Parameters: - classid (str) – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, or “Sticky”.
- key=value – additional parameters which must be matched.
Returns: the list of matching components
Return type: List[Component]
-
Lines¶
-
class
mhi.enerplot.
Line
¶ Divider Line
-
horizontal
(width)¶ Change the line to be horizontal, with the given length.
Parameters: width (int) – Length of the horizontal line Returns: self, to allow fluent-style chained commands.
-
vertical
(height)¶ Change the line to be vertical, with the given length.
Parameters: width (int) – Length of the horizontal line Returns: self, to allow fluent-style chained commands.
-
flat
(style=None, weight=None, colour=None)¶ Change the line to be a “flat” (non-3D) line. Optionally change the line’s style, weight and/or colour.
Parameters: - style (str) – new style
Solid
,Dash
,Dot
orDotDash
- weight (str) – new weight (
"0.2 pt"
to"1.4 pt"
in increments of 0.2 pt) - colour – new colour (
"red"
,"#FF0000"
, …)
Returns: self, to allow fluent-style chained commands.
- style (str) – new style
-
solid
(weight=None, colour=None)¶ Change the line to be a solid, non-3D line. Optionally change the line’s weight and/or colour.
Parameters: - weight (str) – new weight (
"0.2 pt"
to"1.4 pt"
in increments of 0.2 pt) - colour – new colour (
"red"
,"#FF0000"
, …)
Returns: self, to allow fluent-style chained commands.
- weight (str) – new weight (
-
dashed
(weight=None, colour=None)¶ Change the line to be a dashed, non-3D line. Optionally change the line’s weight and/or colour.
Parameters: - weight (str) – new weight (
"0.2 pt"
to"1.4 pt"
in increments of 0.2 pt) - colour – new colour (
"red"
,"#FF0000"
, …)
Returns: self, to allow fluent-style chained commands.
- weight (str) – new weight (
-
dotted
(weight=None, colour=None)¶ Change the line to be a dotted, non-3D line. Optionally change the line’s weight and/or colour.
Parameters: - weight (str) – new weight (
"0.2 pt"
to"1.4 pt"
in increments of 0.2 pt) - colour – new colour (
"red"
,"#FF0000"
, …)
Returns: self, to allow fluent-style chained commands.
- weight (str) – new weight (
-
dot_dash
(weight=None, colour=None)¶ Change the line to be a dot-dashed, non-3D line. Optionally change the line’s weight and/or colour.
Parameters: - weight (str) – new weight (
"0.2 pt"
to"1.4 pt"
in increments of 0.2 pt) - colour – new colour (
"red"
,"#FF0000"
, …)
Returns: self, to allow fluent-style chained commands.
- weight (str) – new weight (
-
raised
(colour=None)¶ Change the line to be a raised, 3D line. Optionally change the line’s colour.
Parameters: colour – new colour ( "red"
,"#FF0000"
, …)Returns: self, to allow fluent-style chained commands.
-
attributes
(**kwargs)¶ Set or get a component’s attributes
A component’s attributes are used to describe the component’s location and size relative to its parent.
Parameters: **kwargs – key=value arguments Returns: The component’s current attributes. Return type: dict See also
-
book
¶ The book the component belongs to (read-only)
-
book_name
¶ The book the component belongs to (read-only)
-
classid
¶ The classid of the component (read-only)
-
copy
()¶ Copy the component to the clipboard
-
copy_as_bitmap
()¶ Copy component to clipboard as a bitmap
-
copy_as_metafile
()¶ Copy component to clipboard as a metafile
-
cut
()¶ Remove the component to the clipboard
-
extents
(x=None, y=None, width=None, height=None)¶ Get or set the component’s position and size
If all parameters are given, the position and size is set. If all parameters are omitted, the current extents are returned.
Parameters: - x (int) – The component’s new x location on the sheet
- y (int) – The component’s new y location on the sheet
- width (int) – The component’s new width
- height (int) – The component’s new height
Returns: The current extents of the component
Return type: Tuple[x,y,width,height]
-
find
([classid,] [key=value, ...])¶ Find the (singular) component that matches the given criteria, or None if no matching component can be found. Raises an exception if more than one component matches the given criteria.
Parameters: - classid (str) – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, or “Sticky”.
- key=value – additional parameters which must be matched.
Returns: the found component or None
Return type:
-
find_all
([classid,] [key=value, ...])¶ Find all components that matches the given criteria, or None if no matching component can be found.
Parameters: - classid (str) – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, or “Sticky”.
- key=value – additional parameters which must be matched.
Returns: the list of matching components
Return type: List[Component]
-
find_first
([classid,] [key=value, ...])¶ Find a component that matches the given criteria, or None if no matching component can be found.
Parameters: - classid (str) – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, or “Sticky”.
- key=value – additional parameters which must be matched.
Returns: the found component or None
Return type:
-
id
¶ The id of the component (read-only)
-
list
(classid=None)¶ List all the components contained inside this object, possibly restricted to a certain classid.
Parameters: classid (str) – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, or “Sticky”. Returns: the list of components Return type: List[Component]
-
main
¶ A reference to the
Application
object that returned thisRemotable
object.
-
parent
()¶ Retrieve the owner of this component
-
paste
()¶ Paste the component(s) from the clipboard to this canvas
-
position
(x=None, y=None)¶ Get or set the component’s position.
If the x & y parameters are given, the position is set. If they are omitted, the current position is returned.
Parameters: - x (int) – The component’s new x location on the sheet
- y (int) – The component’s new y location on the sheet
Returns: The current location of the component
Return type: Tuple[x,y]
-
properties
(paramlist='', **kwargs)¶ Set or get a component’s properties
A component’s properties are used to describe the component’s appearance or control the component’s behaviour.
Parameters: **kwargs – key=value arguments Returns: The component’s current property values Return type: dict See also
-
size
(width=None, height=None)¶ Get or set the component’s size
If the width & height parameters are given, the size is set. If they are omitted, the current size is returned.
Parameters: - width (int) – The component’s new width
- height (int) – The component’s new height
Returns: The current size of the component
Return type: Tuple[width, height]
-
Text Areas¶
-
class
mhi.enerplot.
TextArea
¶ Text Area - Sticky Notes & Captions
-
text
¶ Text in the text area
-
colour
(foreground=None, background=None)¶ Alter the foreground and/or background colours of the Text Area.
Parameters: - foreground (colour) – Desired foreground colour
- background (colour) – Desired foreground colour
Returns: self, to allow fluent-style chained commands.
-
arrows
(*args, add=None, remove=None)¶ Get or set the arrows on the Text Area.
With no arguments, the current arrows are returned as a string.
If any positional arguments are given, the arrows are set to the indicated directions only.
If the add keyword argument is specified, these arrows are added on the text area, joining any existing arrows.
If the remove keyword argument is specified, these arrows are removed from the text area.
The direction arrows may be given as iterable group of strings, or as a space-separated string.
Parameters: - *args – arrow directions to set on the Text Area
- add – arrow directions to add to the Text Area
- remove – arrow directions to remove from the Text Area
Returns: - a string describing the current arrow configuration, or
- self, to allow fluent-style chained commands
Examples:
note.arrows("N", "NE") # Set North & North-East arrows only. note.arrows("N NE") # Set North & North-East arrows only. note.arrows(add="N NE") # Add the North & North-East arrows. note.arrows(remove=("N", "NE")) # Remove those arrows.
-
attributes
(**kwargs)¶ Set or get a component’s attributes
A component’s attributes are used to describe the component’s location and size relative to its parent.
Parameters: **kwargs – key=value arguments Returns: The component’s current attributes. Return type: dict See also
-
book
¶ The book the component belongs to (read-only)
-
book_name
¶ The book the component belongs to (read-only)
-
classid
¶ The classid of the component (read-only)
-
copy
()¶ Copy the component to the clipboard
-
copy_as_bitmap
()¶ Copy component to clipboard as a bitmap
-
copy_as_metafile
()¶ Copy component to clipboard as a metafile
-
cut
()¶ Remove the component to the clipboard
-
extents
(x=None, y=None, width=None, height=None)¶ Get or set the component’s position and size
If all parameters are given, the position and size is set. If all parameters are omitted, the current extents are returned.
Parameters: - x (int) – The component’s new x location on the sheet
- y (int) – The component’s new y location on the sheet
- width (int) – The component’s new width
- height (int) – The component’s new height
Returns: The current extents of the component
Return type: Tuple[x,y,width,height]
-
find
([classid,] [key=value, ...])¶ Find the (singular) component that matches the given criteria, or None if no matching component can be found. Raises an exception if more than one component matches the given criteria.
Parameters: - classid (str) – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, or “Sticky”.
- key=value – additional parameters which must be matched.
Returns: the found component or None
Return type:
-
find_all
([classid,] [key=value, ...])¶ Find all components that matches the given criteria, or None if no matching component can be found.
Parameters: - classid (str) – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, or “Sticky”.
- key=value – additional parameters which must be matched.
Returns: the list of matching components
Return type: List[Component]
-
find_first
([classid,] [key=value, ...])¶ Find a component that matches the given criteria, or None if no matching component can be found.
Parameters: - classid (str) – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, or “Sticky”.
- key=value – additional parameters which must be matched.
Returns: the found component or None
Return type:
-
id
¶ The id of the component (read-only)
-
list
(classid=None)¶ List all the components contained inside this object, possibly restricted to a certain classid.
Parameters: classid (str) – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, or “Sticky”. Returns: the list of components Return type: List[Component]
-
main
¶ A reference to the
Application
object that returned thisRemotable
object.
-
parent
()¶ Retrieve the owner of this component
-
paste
()¶ Paste the component(s) from the clipboard to this canvas
-
position
(x=None, y=None)¶ Get or set the component’s position.
If the x & y parameters are given, the position is set. If they are omitted, the current position is returned.
Parameters: - x (int) – The component’s new x location on the sheet
- y (int) – The component’s new y location on the sheet
Returns: The current location of the component
Return type: Tuple[x,y]
-
properties
(paramlist='', **kwargs)¶ Set or get a component’s properties
A component’s properties are used to describe the component’s appearance or control the component’s behaviour.
Parameters: **kwargs – key=value arguments Returns: The component’s current property values Return type: dict See also
-
size
(width=None, height=None)¶ Get or set the component’s size
If the width & height parameters are given, the size is set. If they are omitted, the current size is returned.
Parameters: - width (int) – The component’s new width
- height (int) – The component’s new height
Returns: The current size of the component
Return type: Tuple[width, height]
-