Login
Back to bricks list
Introduction Version

E-note resource

RESOURCE
Typing name :  RESOURCE.gws_core.ENoteResource Brick :  gws_core
Parent :
Resource set

Resource that contains a rich text that can be exported to a report

Resource to manage a set of resources. By default the sytem create a new resource for each resource in the set when saving the set

Views

VIEW E-NOTEDefault view
View e-note content
VIEW RESOURCE
View the complete resource as json
RESOURCES LIST
List the resources

Attributes

name: strstyle: TypingStyletags: TagListtechnical_info: TechnicalInfoDicttitle: struid: str

Functions

__INIT__

Constructor, please do not overwrite this method, use the init method instead Leave the constructor without parameters.

Parameters:
NameTypeDefault valueDescription
titlestr
ADD_BLANK_LINE

Add a blank line to the e-note content.

ADD_DEFAULT_VIEW_FROM_RESOURCE

Add a default view to the e-note content.

                if not, the view is append at the end of the enote, defaults to None
Parameters:
NameTypeDefault valueDescription
resourceResource Resource to call the view on
titlestr View title, defaults to none , optional
captionstr View caption, defaults to none , optional
parameter_namestr If provided, the view replace the provided variable. , optional
create_new_resourcebool False
ADD_FIGURE

Add a figure to the e-note content.

                  If not, the figure is append at the end of the enote, defaults to None
Parameters:
NameTypeDefault valueDescription
image_pathstr Path of the image file
titlestr Title of the figure, defaults to none , optional
captionstr Caption of the figure, defaults to none , optional
parameter_namestr If provided, the figure replace the provided variable. , optional
ADD_FIGURE_FILE

Add a figure to the e-note content.

                    If not, the figure is append at the end of the enote, defaults to None
                        If False, the file is used as a resource.
                        Set False if the File resource already exist ans saved on the lab, defaults to True

:raises ValueError: description :raises ValueError: description

Parameters:
NameTypeDefault valueDescription
fileFile File of the image
titlestr Title of the figure, defaults to none , optional
captionstr Caption of the figure, defaults to none , optional
parameter_namestr If provided, the figure replace the provided variable. , optional
create_new_resourcebool False If true, a new resource is created with the file. , optional
ADD_HEADER

Add a header to the e-note content.

Parameters:
NameTypeDefault valueDescription
headerstr Header to add
levelRichTextParagraphHeaderLevel Header level
ADD_PARAGRAPH

Add a paragraph to the e-note content.

Parameters:
NameTypeDefault valueDescription
paragraphstr Paragraph to add
ADD_RESOURCE

Add a resource to the set

can be retrieve by calling the get_resource method with the name. If not provided, the resource name is used Otherwise it doesn't create a new resource but references it. In this case the resource must be an input of the task that created the ResourceSet and the resource must have been saved before, defaults to True

Parameters:
NameTypeDefault valueDescription
resourceResource Resource to add
unique_namestr Name used to store the resource in the dict. it must be unique. the resource
create_new_resourcebool True If true, a new resource is created when saving the resource. , optional
ADD_TECHNICAL_INFO

Add technical information on the resource. Technical info are useful to set additional information on the resource.

Parameters:
NameTypeDefault valueDescription
technical_infoTechnicalInfo Technical information to add (key, value)
ADD_VIEW

Add a view to the e-note content.

                  If not, the view is append at the end of the enote, defaults to None
Parameters:
NameTypeDefault valueDescription
view_View :param view_config_values: config value of the view when call to_json_dict, defaults to none :type view_config_values: configparamsdict, optional
view_config_valuesDict Config value of the view when call to_json_dict, defaults to none configparams, optional
titlestr Title of the view, defaults to none , optional
captionstr Caption of the view, defaults to none , optional
parameter_namestr If provided, the view replace the provided variable. , optional
ADD_VIEW_FROM_RESOURCE

Add a view to the e-note content. To get the information of the views, once you opened the view in the application, you can click on View settings > Show view configuration

                if not, the view is append at the end of the enote, defaults to None
Parameters:
NameTypeDefault valueDescription
resourceResource Resource to call the view on
view_method_namestr Name of the view method to call. view settings > show view configuration.
config_valuesDict Config values for the views. access it from view settings > show view configuration., defaults to none configparams, optional
titlestr View title, defaults to none , optional
captionstr View caption, defaults to none , optional
parameter_namestr If provided, the view replace the provided parameter. , optional
create_new_resourcebool False
APPEND_BLOCK

Append a block to the enote

Parameters:
NameTypeDefault valueDescription
blockRichTextBlock Block to add
Return type:
int
APPEND_ENOTE

Append the content of another e-note at the end of this e-note content.

Parameters:
NameTypeDefault valueDescription
enoteENoteResource E-note to append
APPEND_REPORT_RICH_TEXT

Append a rich text (that comes from a report, report template or RichTextParam) to the e-note.

Parameters:
NameTypeDefault valueDescription
rich_textRichText Rich text to append to the e-note (from a report, report template or param) richtext
CALL_VIEW_ON_RESOURCE

Call a view method on the resource.

Parameters:
NameTypeDefault valueDescription
resource_keystr Key of the resource
view_namestr
configDict
Return type:
CallViewResultDTO
CHECK_RESOURCE

You can redefine this method to define custom logic to check this resource. If there is a problem with the resource, return a string that define the error, otherwise return None This method is called on output resources of a task. If there is an error returned, the task will be set to error and next proceses will not be run. It is also call when uploading a resource (usually for files or folder), if there is an error returned, the resource will not be uploaded

Return type:
Optional
CLEAR_RESOURCES

Clear the resources

CLONE

Clone the resource to create a new instance with a new id. It copies the RFields.

Return type:
ResourceType
EXPORT_AS_REPORT

Export the note as a report. The report is automatically saved in the database.

Parameters:
NameTypeDefault valueDescription
titlestr
Return type:
Report
EXPORT_AS_REPORT_RICH_TEXT

Convert the enote rich text to a report rich text.

Return type:
RichText
GET_BLOCK_AT_INDEX

Get the block at the specified index

Parameters:
NameTypeDefault valueDescription
indexint Index of the block
Return type:
RichTextBlock
GET_BLOCK_BY_ID

Get the block by id

Parameters:
NameTypeDefault valueDescription
block_idstr Id of the block
Return type:
RichTextBlock
GET_BLOCK_INDEX_BY_ID

Get the index of the block by id

Parameters:
NameTypeDefault valueDescription
block_idstr Id of the block
Return type:
int
GET_BLOCKS

Get the blocks of the e-note

Return type:
List
GET_BLOCKS_BY_TYPE

Get the blocks of the e-note by type

Parameters:
NameTypeDefault valueDescription
block_typeRichTextBlockType Type of the block
Return type:
List
GET_DEFAULT_NAME

You can redefine this method to set a name of the resource. When saving the resource the name will be saved automatically This can be useful to distinguish this resource from another one or to search for the resource

Return type:
str
GET_FIGURE

Get the figure of the enote as a File resource.

:raises ValueError: The resource must be a File object

Parameters:
NameTypeDefault valueDescription
filenamestr Filename of the figure
Return type:
File
GET_FIGURE_PATH

Get the path of the figure file.

Parameters:
NameTypeDefault valueDescription
filenamestr Filename of the figure
Return type:
str
GET_RESOURCE

Return the resource with the given name

:raises Exception: if the resource with the given name is not found

Parameters:
NameTypeDefault valueDescription
resource_namestr Name of the resource
Return type:
Resource
GET_RESOURCE_MODEL_IDS

Return the resource model ids of the sub resources

Return type:
Set
GET_RESOURCE_MODELS

Return the resource models of the sub resources list

Return type:
List[ResourceModel]
GET_RESOURCE_OR_NONE

Return the resource with the given name or None if not found

Parameters:
NameTypeDefault valueDescription
resource_namestr Name of the resource
Return type:
gws_core.resource.resource.Resource | None
GET_RESOURCES

Return the sub resources as a dict

Return type:
Dict
GET_RESOURCES_AS_SET

Return the sub resources as a set

Return type:
Set
GET_TECHNICAL_INFO

Get the technical information of the resource

Parameters:
NameTypeDefault valueDescription
keystr Key of the technical information
Return type:
TechnicalInfo
HAS_RESOURCE_MODEL

Return true if the resource with the given id is in the resource list

Parameters:
NameTypeDefault valueDescription
resource_model_idstr Id of the resourcemodel
Return type:
bool
INIT

This can be overwritten to perform custom initialization of the resource. This method is called after the init (constructor) of the resource. The values of RFields are set when this method is called.

REPLACE_RESOURCES_BY_MODEL_ID

Replace current resources by the resources in the dict

Parameters:
NameTypeDefault valueDescription
resourcesDict Dict where key is the resource model id and value is the resource [str, resource]
RESOURCE_EXISTS

Return true if the resource with the given name exists in the dict

Parameters:
NameTypeDefault valueDescription
resource_namestr Name of the resource
Return type:
Resource
SET_PARAMETER

Set the value of a parameter.

Parameters:
NameTypeDefault valueDescription
parameter_namestr Parameter name
valueAny Value of the parameter. this is convert to str
CLASSNAME - @classmethod

Returns the name of the class

Parameters:
NameTypeDefault valueDescription
slugifybool False True to slugify the class name if true, defaults to false , optional
snakefybool False True to snakefy the class name if true, defaults to false , optional
replace_uppercasebool False Replace upper cases by "-" if true, defaults to false , optional
Return type:
str
COPY_STYLE - @classmethod

Copy the style of the resource with the possibility to override some properties. Useful when settings the style for a task based on the resource style.

Parameters:
NameTypeDefault valueDescription
icon_technical_namestr Technical name of the icon if provided, the icon_type must also be provided, defaults to none , optional
icon_typeTypingIconType Type of the icon if provided, the icon_technical_name must also be provided, defaults to none , optional
background_colorstr Background color, defaults to none , optional
icon_colorTypingIconColor Icon color, defaults to none , optional
Return type:
TypingStyle
DECORATED_METHOD_NAMES - @classmethod
Parameters:
NameTypeDefault valueDescription
decorator_nameAny
FULL_CLASSNAME - @classmethod

Returns the full name of the class

Parameters:
NameTypeDefault valueDescription
slugifybool False Slugify the returned class name if true, defaults to false , optional
snakefybool False Snakefy the returned class name if true, defaults to false ``
Return type:
str
INHERITORS - @classmethod

Get all the classes that inherit this class

Return type:
List
METHOD_NAMES - @classmethod

Returns the list of the methods

Return type:
List
MODULE_NAME - @classmethod

Returns the module name of the class

Return type:
str
PROPERTY_METHOD_NAMES - @classmethod
PROPERTY_NAMES - @classmethod

Retrieves the property names

Parameters:
NameTypeDefault valueDescription
instancetype The s of the properties to retrieve. set `none` to retrieve all. `type` or `union[type]`
excludetype
Return type:
List