Back to bricks list
Introduction
Getting Started
Developer guide
Release
Architecture
CLI
Technical documentations
Version

Note resource

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

Resource that contains a rich text that can be exported to a lab note

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 NOTE RESOURCEDefault view
View note resource content
VIEW RESOURCE
View the complete resource as json
RESOURCES LIST
List the resources
Attributes
flagged: boolname: 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.

Title : str
ADD_BLANK_LINE

Add a blank line to the note resource content.

ADD_DEFAULT_VIEW_FROM_RESOURCE

Add a default view to the note resource content. This method is reponsible for generating the view of the input resource and the input resource will be attached to the NoteResource.

resource : Resource
resource to call the view on
Title : str
view title
caption : str
view caption
parameter_name : str
if provided, the view replace the provided variable. if not, the view is append at the end of the note
create_new_resource : bool - False
ADD_FIGURE_FILE

Add a figure to the note resource content.

file : File
file of the image
Title : str
title of the figure
caption : str
caption of the figure
parameter_name : str
if provided, the figure replace the provided variable. If not, the figure is append at the end of the note
create_new_resource : bool - False
if True, a new resource is created with the file. If False, the file is used as a resource. Set False if the File resource already exist ans saved on the lab
ADD_FIGURE_FROM_PATH

Add a figure to the note resource content.

image_path : str
path of the image file
Title : str
title of the figure
caption : str
caption of the figure
parameter_name : str
if provided, the figure replace the provided variable. If not, the figure is append at the end of the note
ADD_FILE

Add a file to the note resource content.

file : File
file to add
parameter_name : str
if provided, the file replace the provided variable. If not, the file is append at the end of the note
create_new_resource : bool - False
if True, a new resource is created with the file. If False, the file is used as a resource. Set False if the File resource already exist ans saved on the lab
ADD_FILE_FROM_PATH

Add a file to the note resource content.

file_path : str
path of the file
parameter_name : str
if provided, the file replace the provided variable. If not, the file is append at the end of the note
ADD_HEADER

Add a header to the note resource content.

header : str
header to add
level : RichTextParagraphHeaderLevel
header level
ADD_PARAGRAPH

Add a paragraph to the note resource content.

paragraph : str
paragraph to add
ADD_RESOURCE

Add a resource to the set

resource : Resource
resource to add
unique_name : str
name used to store the resource in the dict. It must be unique. The resource can be retrieve by calling the get_resource method with the name. If not provided, the resource name is used
create_new_resource : bool - True
If true, a new resource is created when saving the resource. 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
ADD_TECHNICAL_INFO

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

technical_info : TechnicalInfo
technical information to add (key, value) this is a long description of the technical information
ADD_TIMESTAMP

Add a time stamp to the note resource content.

timestamp_data : RichTextTimestampData
time stamp data
parameter_name : str
if provided, the time stamp replace the provided variable.
ADD_VIEW

Add a view to the note resource content. In this case the resource is not attached to the NoteResource, the view is considered as standalone. This can be useful when you want to add a view of a resource that does not exist in the system (manually created resource).

view_ : View
view_config_values : Dict
config value of the view when call to_json_dict
Title : str
title of the view
caption : str
caption of the view
parameter_name : str
if provided, the view replace the provided variable. If not, the view is append at the end of the note
ADD_VIEW_FROM_RESOURCE

Add a view to the note resource content. This method is reponsible for generating the view of the input resource and the input resource will be attached to the NoteResource. To get the information of the views, once you opened the view in the application, you can click on View settings > Show view configuration

resource : Resource
resource to call the view on
view_method_name : str
name of the view method to call. View settings > Show view configuration.
config_values : Dict
config values for the views. Access it from View settings > Show view configuration.
Title : str
view title
caption : str
view caption
parameter_name : str
if provided, the view replace the provided parameter. if not, the view is append at the end of the note
create_new_resource : bool - False
APPEND_ADVANCED_RICH_TEXT

Append a rich text (that comes from a note or note template) to the note resource.

rich_text : RichText
rich text to append to the note resource (from a note or note template)
object_type : RichTextObjectType
type of the object that has the rich text
object_id : str
id of the object that has the rich text
APPEND_BASIC_RICH_TEXT

Append a basic rich content to this note resource content. It does not support file, figure, or views

rich_text : RichText
rich text to append
APPEND_BLOCK

Append a block to the note

block : RichTextBlock
block to add
Return type : int
APPEND_NOTE_RESOURCE

Append the content of another note resource at the end of this note resource content.

note : NoteResource
note resource to append
CALL_VIEW_ON_RESOURCE

Call a view method on the resource.

resource_key : str
key of the resource
view_name : str
config : Dict
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_LAB_NOTE

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

Title : str
scenario_id : str
Id of the scenario to associate the note with
folder_id : str
Return type : Note
GET_BLOCK_AT_INDEX

Get the block at the specified index

index : int
index of the block
Return type : RichTextBlock
GET_BLOCK_BY_ID

Get the block by id

block_id : str
id of the block
Return type : RichTextBlock
GET_BLOCK_INDEX_BY_ID

Get the index of the block by id

block_id : str
id of the block
Return type : int
GET_BLOCKS

Get the blocks of the note resource

Return type : List
GET_BLOCKS_BY_TYPE

Get the blocks of the note resource by type

block_type : RichTextBlockType
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_DEFAULT_STYLE

Get the default style of the resource

Return type : TypingStyle
GET_FIGURE

Get the figure of the note as a File resource.

filename : str
filename of the figure
Return type : File
GET_FILE

Get the file of the note as a File resource.

filename : str
filename of the file
Return type : File
GET_FILE_PATH

Get the path of the file.

filename : str
filename of the file
Return type : str
GET_MODEL_ID

Get the id of the resource model in the database. It is provided by the system for input resources of a task.

Return type : str
GET_NAME_OR_DEFAULT

Get the name of the resource or the default name if the name is None

Return type : str
GET_RESOURCE

Return the resource with the given name

resource_name : str
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

resource_name : str
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_RICH_TEXT
Return type : RichText
GET_TECHNICAL_INFO

Get the technical information of the resource

key : str
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

resource_model_id : str
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

resources : Dict
dict where key is the resource model id and value is the resource
RESOURCE_EXISTS

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

resource_name : str
name of the resource
Return type : Resource
SAVE_NEW_CHILDREN_RESOURCES
resource_origin : ResourceOrigin
scenario : Scenario
task_model : TaskModel
port_name : str
Return type : List[ResourceModel]
SET_PARAMETER

Set the value of a parameter.

parameter_name : str
parameter name
value : Any
value of the parameter. This is convert to str
replace_block : bool - False
if True, the block containing the parameter is replaced by a new block with the value
CLASSNAME - @classmethod

Returns the name of the class

slugify : bool - False
True to slugify the class name if True
snakefy : bool - False
True to snakefy the class name if True
replace_uppercase : bool - False
Replace upper cases by "-" if True
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.

Icon technical name : str
technical name of the icon if provided, the icon_type must also be provided
Icon type : TypingIconType
type of the icon if provided, the icon_technical_name must also be provided
background_color : str
background color
icon_color : TypingIconColor
icon color
Return type : TypingStyle
FULL_CLASSNAME - @classmethod

Returns the full name of the class

slugify : bool - False
Slugify the returned class name if True
snakefy : bool - False
Snakefy the returned class name if True
Return type : str
GET_HUMAN_NAME - @classmethod

Get the human name of the resource

Return type : str
GET_SHORT_DESCRIPTION - @classmethod

Get the short description of the resource

Return type : str
GET_STYLE - @classmethod

Get the style of the resource

Return type : TypingStyle
GET_TYPING_NAME - @classmethod

Get the typing name of the resource

Return type : str
INHERITORS - @classmethod

Get all the classes that inherit this class

Return type : List
FROM_NOTE - @staticmethod

Create a note resource from a note.

note : Note
note to create the note resource from
Title : str
title of the note resource. If none the title of note is used
Return type : NoteResource
FROM_NOTE_TEMPLATE - @staticmethod

Create a note resource from a note template.

note_template : NoteTemplate
note template to create the note resource from
Title : str
title of the note resource. If none the title of note template is used
Return type : NoteResource