CanvasBase module
- class lys.widgets.canvas.interface.CanvasBase.CanvasBase[source]
Bases:
objectBase class for canvas.
Canvas is composed of
Area.CanvasSize,Area.CanvasSize,Axes.CanvasAxis,Axes.CanvasTicks,AxisLabel.CanvasAxisLabel,AxisLabel.CanvasTickLabel,Data.CanvasData, andAnnotation.CanvasAnnotation.All of these classes inherits
CanvasPartand added byaddCanvasPart().Users can access all public methods of the classes above.
- LoadFromDictionary(dictionary)[source]
Load the content of the canvas as dictionary.
- Parameters:
dictionary (dict) – The content of the canvas is loaded from dictionary.
- SaveAsDictionary(dictionary=None)[source]
Save the content of the canvas as dictionary.
- Parameters:
dictionary (dict) – The content of the canvas is written in dictionary.
- Returns:
The dictionary in which the information of the canvas is written
- Return type:
dict
- addCanvasPart(part)[source]
Add
CanvasPartas a part of the canvas.- Parameters:
part (CanvasPart) – The part to be added.
- static dataTypes(wave)[source]
Return possible data type (image, vector, etc).
- Parameters:
wave (Wave) – The wave to be checked.
- Returns:
Possible data type.
- Return type:
list of str
- delayUpdate()[source]
This method should be used (as [with] block) when the canvas is heavily modified to avoid drawing repeatedly.
- finalize()[source]
Finalize the canvas.
Several graph library (including matplotlib) requires explicit finalization to break circular reference, which causes memory leak.
Call this method to finalize the canvas, which is usually done by parent widget (such as Graph).
- finalized
pyqtSignal that is emitted when the canvas is finalized.
- initCanvas
pyqtSignal that is emitted when the canvas is initialized.
- loadCanvas
pyqtSignal that is emitted when
LoadFromDictionary()is called.
- saveCanvas
pyqtSignal that is emitted when
SaveAsDictionary()is called.
- updated
pyqtSignal that is emitted when the canvas is updated.
- class lys.widgets.canvas.interface.CanvasBase.CanvasPart(canvas)[source]
Bases:
QObjectThe canvas that inherit
CanvasBaseclass is composed of multiple CanvasPart.
- lys.widgets.canvas.interface.CanvasBase.disableSaveCanvas(func)[source]
When methods of
CanvasBaseor :class:’CanvasPart’ that is decorated by disableSaveCanvas is called, then updated signal of the canvas is not emitted in that method.
- lys.widgets.canvas.interface.CanvasBase.saveCanvas(func)[source]
When methods of
CanvasBaseor :class:’CanvasPart’ that is decorated by saveCanvas is called, then updated signal of the canvas is emitted.