This module provides a convenient interface for working with templates.
Available functions
create - Creates new template, raises CreateTemplateError if the template cannot be created Function arguments:
name (str): Template name
content (str, optional): Template content
get - Returns an already created template, raises TemplateNotFound if the template cannot be found Function arguments:
name (str): Template name
get_or_create - returns an existing or creates a new template using the create function Function arguments:
name (str): Template name
content (str, optional): Template content
All functions return an object of the GUITemplate class
Class attributes
name (str): Template name
guid (str): Template guid
content (str): Template content
shared (bool): True if template is shared
Class methods
channels_content: Takes a list of guid channels as arguments.
show: Displays the template on the monitor. The monitor number is specified as an optional monitor argument, which by default is 1.
delete: Deletes the current template.
To understand what content needs to be transferred to the template, you can create any template using the Trassir interface and then see the content in the settings, turning on the advanced settings with the F4 key
Example: Template with channels
Creating or loading of an existing template named "4 channels"
Adding the first 4 channels from all available channels to the template
import host
import templates
all_channels = [guid for _, guid, _, _ in host.objects_list("Channel")]
tmpl = templates.get_or_create("4 channels")
tmpl.channels_content(*all_channels[:4])