Dialog Template

From STX Wiki
Jump to navigation Jump to search

STx projects support user-defined attributes for describing sound files and segments. Accessing these user-defined attributes via the GUI is achieved by displaying a list of existing attributes (e.g. here in the Edit Segment dialog).

Ws dialog aseg properties list.png

Using a dialog template, however, this list can be displayed using a number of different dialog controls.

Ws dialog aseg properties template.png

This can be very useful, if you are entering a lot of data.

Dialog templates are defined using XML and must be stored in the templates directory.

Defining a dialog template

The STx dialog template is an XML file. The root element must be one of the following tags:

  • DialogTemplate
  • ASegTemplate
  • attrTemplate

Below is an example of an audio segment template.

<?xml version="1.0" encoding="UTF-8"?>
        <Control Type="Static" Text="Type" Window="0  0  4 1" Flags="/R"/>
        <Control Type="ComboBox" Name="Type" Window="0  4  9 1" Flags="/E/U" Default="uncl" Values="uttr phon word syll uncl"/>
        <Control Type="Static" Text="Speaker" Window="1  0  7 1" Flags="/R"/>
        <Control Type="ComboBox" Name="Spk" Window="1  7  6 1" Flags="/E/U" Default="uncl" Values="m1 m2 m3 f1 f2 f3 uncl"/>
        <Control Type="Static" Text="TR1" Window="2 13  3 1" Flags="/R"/>
        <Control Type="Edit" Name="TR1" Window="2 16 37 3" Flags="/M/W=**ff" Font="Userfont"/>
        <Control Type="Static" Text="TR2" Window="1 13  3 1" Flags="/R"/>
        <Control Type="Edit" Name="TR2" Window="1 16 37 1" Flags="/W=**f*" Font="Userfont"/>
        <Control Type="Static" Text="TR3" Window="0 13  3 1" Flags="/R"/>
        <Control Type="Edit" Name="TR3" Window="0 16 37 1" Flags="/W=**f*" Font="Userfont"/>

For a detailed description of template parameters, please see the template file DefaultASegTemplate.xml in the templates directory.

Note that the Segment Template Management dialog is useful for developing templates.

Assigning templates

There are a number of places where dialog templates can be used.

  • Edit Segment dialog
  • Waveform & Segmentation Viewer and Spectrogram & Parameters Viewer

A segment template can be assigned to a sound file via the Templates context menu in the Overview. The assigned template is then used in the Waveform & Segmentation Viewer and Spectrogram & Parameters Viewer segment dialogs.

Segment Template Management Dialog

Ws dialog asegtemplate management dialog.png

Segment templates are special templates used to display segment attributes (xml root ASegTemplate). A list of available templates (those found in the templates directory) can be displayed using the ASegTemplate Management Dialog, reachable via the Overview context menu Template->Manage whilst a sound file is selected.

This dialog is particularly useful, when developing templates, since clicking the Show button will display a dialog based on the template.