Editor Dialogs

This section documents the code underlying the different editor dialogs. Read this together with the reference dialog descriptions.

Plover2CAT dialogs have their own UI and code files as they subclass QDialog. In general, these dialogs will receive a dict along with other parameters, and changes are made to the internal dict. After accepted, the dialog dict is then accessed from outside.

class affixDialogWindow.affixDialogWindow(*args: Any, **kwargs: Any)

Bases: QDialog, Ui_affixDialog

Create, save and edit paragraph affixes for editor. The affix editor dialog is a modal dialog opened through the menu. Text strings are added before and after each paragraph based on the style of each paragraph. The affix data is stored as auto_paragraph_affixes in the config.

Parameters:
  • affix_dict (dict, can be empty, required) – dict of dicts of the form {"Style": {"prefix": str, "suffix": str}}

  • style_names (list, required) – style names from style file

Returns:

QDialog status code inherited from the QDialog class. Editor will access affix_dict from instance.

Return type:

QDialog.DialogCode, either Accepted or Rejected

display_affix()

Display saved affixes for present style for editing

insert_tab()

Insert tab character into affix field QLineedit

store_affix()

Saves affix strings from fields into affix_dict

class fieldDialogWindow.fieldDialogWindow(*args: Any, **kwargs: Any)

Bases: QDialog, Ui_fieldDialog

Create, save and edit field values.

The field editor is a modeal dialog opened through the menu. Each field has an unique name and value. Fields are inserted into the transcript text by name and their value is displayed.

Parameters:

user_field_dict (dict, required) – dict of {name: value}

Returns:

QDialog status code inherited from the QDialog class. Editor will access affix_dict from instance.

Return type:

QDialog.DialogCode, either Accepted or Rejected

update_cell(row, col)

Update underlying field dict based on the cell changed.

new_field()

Add new field to field dict.

remove_field()

Delete field from field dict by deleting key:value pair.

class shortcutDialogWindow.shortcutDialogWindow(*args: Any, **kwargs: Any)

Bases: QDialog, Ui_shortcutDialog

Set shortcuts for menu items in editor through the modal dialog.

Parameters:
  • shortcut_dict (dict) – existing dict of shortcuts, {action: “str of keys”}

  • menu_names (list) – visible text of QAction objects in menus

  • action_names (list) – object names of QAction objects in menus

display_shortcut(index)

Display existing shortcut, if set, of selected menu item

check_save_shortcut()

Check if shortcut displayed is valid

class indexDialogWindow.indexDialogWindow(*args: Any, **kwargs: Any)

Bases: QDialog, Ui_indexDialog

Create, save and edit index entries for editor.

The index editor dialog is a non-modal dialog opened through the menu. Index entries are numbered, and have a description that can be hidden. Index entries have to belong to an index with a prefix string, and there can be multiple indices.

Parameters:

index_dict (dict) – dict with {index_name: {prefix: str, hidden: bool, entries: {name: description, …}}, ..}

index_insert

Signal emitted when user has selected an entry to insert into text

alias of object

updated_dict

Signal emitted when the index dictionary has been updated

update_display(index)

Display existing entries for selected index.

save_index()

Save selected index.

new_index()

Create new index.

enable_add(index)

Allow new entry to be added if index is selected.

add_new_entry()

Add new entry to currently selected index.

enable_insert()

Allow insert into text if an entry is selected.

insert_entry()

Insert selected entry into text

update_dict(index_dict)

Update existing index dict, used when indices are gathered from transcript

class captionDialogWindow.captionDialogWindow(*args: Any, **kwargs: Any)

Bases: QDialog, Ui_captionDialog

Set up configuration for captioning.

The fields for word buffer, caption length and max lines displayed have default values. Caption font is selected through a QFontDialog. Based on the endpoint selected, URL, Port and Password fields are enabled and disabled. The settings are fed into captionWorker.

Note

The value set in word buffer is special as it remains outside of captionWorker.

font

QFont, default for caption display.

enable_host_ui(index)

Enable and disable related fields for endpoints.

Supported endpoints: None, Microsoft Teams (untested), Zoom (untested), OBS for twitch (tested). Teams and Zoom both require at least an URL. OBS requires a local port and password. See how-to page for details.

set_font()

Set font for display in caption window.

class suggestDialogWindow.suggestDialogWindow(*args: Any, **kwargs: Any)

Bases: QDialog, Ui_suggestDialog

Analyze existing transcript for common phrases and words.

The suggest dialog presently works by analyzing the open transcript, through other sources are possible in the future. It can do a word frequency search, an n-gram search, or both, filtering by minimum occurrence. The word frequency search can use the SCOWL size filter, while very common words are filtered out first.

Parameters:
  • text (str) – string of text

  • engine – existing Plover engine

  • scowl_dict (dict) – SCOWL word list packaged with Plover

analyze()

Starts analyzing text based on selected filters and parameters.

analyze_ngrams(min_ngram=2, max_ngram=3, min_occurrence=3)

Run n-gram search and filter for display.

analyze_words(scowl_size=35, min_occurrence=1)

Run word search and filter based on occurrence and SCOWL size.

get_outline(translation)

Get list of outlines for translation from engine.

update_text(text)

Update text for analysis

send_dictionary()

Add selected outline to dictionary.

class recorderDialogWindow.recorderDialogWindow(*args: Any, **kwargs: Any)

Bases: QDialog, Ui_recorderDialog

Set QRecorder settings for audio recording.

Parameters:

recorder (QMediaRecorder) – a QMediaRecorder instance

Returns:

QDialog status code inherited from the QDialog class.

Return type:

QDialog.DialogCode, either Accepted or Rejected