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
Attributes
name: str
style: TypingStyle
tags: TagList
technical_info: TechnicalInfoDict
title: str
uid: str
Functions
Constructor, please do not overwrite this method, use the init method instead Leave the constructor without parameters.
Name | Type | Default value | Description |
---|---|---|---|
title | str |
Add a blank line to the note resource content.
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.
if not, the view is append at the end of the note, defaults to None
Name | Type | Default value | Description |
---|---|---|---|
resource | Resource | Resource to call the view on | |
title | str | View title, defaults to none , optional | |
caption | str | View caption, defaults to none , optional | |
parameter_name | str | If provided, the view replace the provided variable. , optional | |
create_new_resource | bool | False |
Add a figure to the note resource content.
If not, the figure is append at the end of the note, 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
Name | Type | Default value | Description |
---|---|---|---|
file | File | File of the image | |
title | str | Title of the figure, defaults to none , optional | |
caption | str | Caption of the figure, defaults to none , optional | |
parameter_name | str | If provided, the figure replace the provided variable. , optional | |
create_new_resource | bool | False | If true, a new resource is created with the file. , optional |
Add a figure to the note resource content.
If not, the figure is append at the end of the note, defaults to None
Name | Type | Default value | Description |
---|---|---|---|
image_path | str | Path of the image file | |
title | str | Title of the figure, defaults to none , optional | |
caption | str | Caption of the figure, defaults to none , optional | |
parameter_name | str | If provided, the figure replace the provided variable. , optional |
Add a file to the note resource content.
If not, the file is append at the end of the note, 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
Name | Type | Default value | Description |
---|---|---|---|
file | File | File to add | |
parameter_name | str | If provided, the file replace the provided variable. , optional | |
create_new_resource | bool | False | If true, a new resource is created with the file. , optional |
Add a file to the note resource content.
If not, the file is append at the end of the note, defaults to None
Name | Type | Default value | Description |
---|---|---|---|
file_path | str | Path of the file | |
parameter_name | str | If provided, the file replace the provided variable. , optional |
Add a header to the note resource content.
Name | Type | Default value | Description |
---|---|---|---|
header | str | Header to add | |
level | RichTextParagraphHeaderLevel | Header level |
Add a paragraph to the note resource content.
Name | Type | Default value | Description |
---|---|---|---|
paragraph | str | Paragraph to add |
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
Name | Type | Default value | Description |
---|---|---|---|
resource | Resource | Resource to add | |
unique_name | str | Name used to store the resource in the dict. it must be unique. the resource | |
create_new_resource | bool | True | If true, a new resource is created when saving the resource. , optional |
Add technical information on the resource. Technical info are useful to set additional information on the resource.
Name | Type | Default value | Description |
---|---|---|---|
technical_info | TechnicalInfo | Technical information to add (key, value) |
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).
If not, the view is append at the end of the note, defaults to None
Name | Type | Default value | Description |
---|---|---|---|
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_values | Dict | Config value of the view when call to_json_dict, defaults to none configparams, optional | |
title | str | Title of the view, defaults to none , optional | |
caption | str | Caption of the view, defaults to none , optional | |
parameter_name | str | If provided, the view replace the provided variable. , optional |
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
if not, the view is append at the end of the note, defaults to None
Name | Type | Default value | Description |
---|---|---|---|
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., defaults to none configparams, optional | |
title | str | View title, defaults to none , optional | |
caption | str | View caption, defaults to none , optional | |
parameter_name | str | If provided, the view replace the provided parameter. , optional | |
create_new_resource | bool | False |
Append a rich text (that comes from a note or note template) to the note resource.
Name | Type | Default value | Description |
---|---|---|---|
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 a basic rich content to this note resource content. It does not support file, figure, or views
Name | Type | Default value | Description |
---|---|---|---|
rich_text | RichText | Rich text to append |
Append a block to the note
Name | Type | Default value | Description |
---|---|---|---|
block | RichTextBlock | Block to add |
int |
Append the content of another note resource at the end of this note resource content.
Name | Type | Default value | Description |
---|---|---|---|
note | NoteResource | Note resource to append |
Call a view method on the resource.
Name | Type | Default value | Description |
---|---|---|---|
resource_key | str | Key of the resource | |
view_name | str | ||
config | Dict |
CallViewResultDTO |
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
Optional |
Clear the resources
Clone the resource to create a new instance with a new id. It copies the RFields.
ResourceType |
Export the note as a note. The note is automatically saved in the database.
Name | Type | Default value | Description |
---|---|---|---|
title | str |
Note |
Get the block at the specified index
Name | Type | Default value | Description |
---|---|---|---|
index | int | Index of the block |
RichTextBlock |
Get the block by id
Name | Type | Default value | Description |
---|---|---|---|
block_id | str | Id of the block |
RichTextBlock |
Get the index of the block by id
Name | Type | Default value | Description |
---|---|---|---|
block_id | str | Id of the block |
int |
Get the blocks of the note resource
List |
Get the blocks of the note resource by type
Name | Type | Default value | Description |
---|---|---|---|
block_type | RichTextBlockType | Type of the block |
List |
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
str |
Get the figure of the note as a File resource.
:raises ValueError: The resource must be a File object
Name | Type | Default value | Description |
---|---|---|---|
filename | str | Filename of the figure |
File |
Get the file of the note as a File resource.
:raises ValueError: The resource must be a File object
Name | Type | Default value | Description |
---|---|---|---|
filename | str | Filename of the file |
File |
Get the path of the file.
Name | Type | Default value | Description |
---|---|---|---|
filename | str | Filename of the file |
str |
Get the id of the resource model in the database. It is provided by the system for input resources of a task.
str |
Get the name of the resource or the default name if the name is None
str |
Return the resource with the given name
:raises Exception: if the resource with the given name is not found
Name | Type | Default value | Description |
---|---|---|---|
resource_name | str | Name of the resource |
Resource |
Return the resource model ids of the sub resources
Set |
Return the resource models of the sub resources list
List[ResourceModel] |
Return the resource with the given name or None if not found
Name | Type | Default value | Description |
---|---|---|---|
resource_name | str | Name of the resource |
gws_core.resource.resource.Resource | None |
Return the sub resources as a dict
Dict |
Return the sub resources as a set
Set |
Get the technical information of the resource
Name | Type | Default value | Description |
---|---|---|---|
key | str | Key of the technical information |
TechnicalInfo |
Return true if the resource with the given id is in the resource list
Name | Type | Default value | Description |
---|---|---|---|
resource_model_id | str | Id of the resourcemodel |
bool |
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 current resources by the resources in the dict
Name | Type | Default value | Description |
---|---|---|---|
resources | Dict | Dict where key is the resource model id and value is the resource [str, resource] |
Return true if the resource with the given name exists in the dict
Name | Type | Default value | Description |
---|---|---|---|
resource_name | str | Name of the resource |
Resource |
Set the value of a parameter.
Name | Type | Default value | Description |
---|---|---|---|
parameter_name | str | Parameter name | |
value | Any | Value of the parameter. this is convert to str |
Returns the name of the class
Name | Type | Default value | Description |
---|---|---|---|
slugify | bool | False | True to slugify the class name if true, defaults to false , optional |
snakefy | bool | False | True to snakefy the class name if true, defaults to false , optional |
replace_uppercase | bool | False | Replace upper cases by "-" if true, defaults to false , optional |
str |
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.
Name | Type | Default value | Description |
---|---|---|---|
icon_technical_name | str | Technical name of the icon if provided, the icon_type must also be provided, defaults to none , optional | |
icon_type | TypingIconType | Type of the icon if provided, the icon_technical_name must also be provided, defaults to none , optional | |
background_color | str | Background color, defaults to none , optional | |
icon_color | TypingIconColor | Icon color, defaults to none , optional |
TypingStyle |
Name | Type | Default value | Description |
---|---|---|---|
decorator_name | Any |
Returns the full name of the class
Name | Type | Default value | Description |
---|---|---|---|
slugify | bool | False | Slugify the returned class name if true, defaults to false , optional |
snakefy | bool | False | Snakefy the returned class name if true, defaults to false `` |
str |
Get the human name of the resource
str |
Get the short description of the resource
str |
Get the typing name of the resource
str |
Get all the classes that inherit this class
List |
Returns the list of the methods
List |
Returns the module name of the class
str |
Retrieves the property names
Name | Type | Default value | Description |
---|---|---|---|
instance | type | The s of the properties to retrieve. set `none` to retrieve all. `type` or `union[type]` | |
exclude | type |
List |
Create a note resource from a note.
Name | Type | Default value | Description |
---|---|---|---|
note | Note | Note to create the note resource from | |
title | str | Title of the note resource. if none the title of note is used, defaults to none , optional |
NoteResource |
Create a note resource from a note template.
Name | Type | Default value | Description |
---|---|---|---|
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, defaults to none , optional |
NoteResource |