Editor Window
The editor window methods should mainly focus on GUI/control management while editing is left up to the transcript objects.
This settings are stored locally and generally set the window properties/GUI.
geometry: window geometrywindowstate: window statewindowfont: window fonttapefont: paper tape fontsuggestionsource: use clippy-2 or tapey tapebackgroundcolor: background color of windowrecentfiles: list of file paths of recently opened transcriptsautosaveinterval: interval between autosave attempts
- class PloverCATWindow.PloverCATWindow(*args: Any, **kwargs: Any)
Bases:
QMainWindow,Ui_PloverCATMain window that can hold multiple transcripts.
This manages the main window, the dialog and global settings. Connections should be made from this class to each transcript
PloverCATEditorwhich is displayed as a tab in center widget.Generally, actions performed on the transcript should call a transcript method, and the transcript should not be modified directly.
Any action that needs to be undo-able must use a transcript method.
The
__init__method sets up the window, summarized.Access settings for window settings (dock, layout) from last time
Connect menu items with methods but enable only needed
Connect Plover engine hooks
Create empty dialogs
- Variables:
engine – Plover engine instance
video – holds a
QVideoWidgetif one exists for media in transcripttextEdit – hold current transcript
index_dialog – instance of
indexDialogWindowcaption_dialog – instance of
captionDialogWindowtape_dialog – instance of
tapeDialogWindowsuggest_dialog – instance of
suggestDialogWindowcap_worker – instance of
capWorkerautosave_time – autosave timer as
QTimercutcopy_storage – deque, length 5, holding date for copy/pasting
thread – thread for non-main thread processing
progressBar – instance of
QProgressBarfor displaycaption_cursor_pos – integer position of text last sent to display
- set_shortcuts()
Set shortcuts for menu items using keysequence strings.
JSON file should be called
shortcuts.jsonunder aplover2catfile in the Plover home directory
- edit_shortcuts()
Edit menu shortcuts from dialog.
shortcuts.jsonwill be created if it does not exist.
- about()
Display version info in dialog.
- acknowledge()
Display acknowledgements in dialog.
- open_help()
Link to Readthedocs help pages.
- display_message(txt)
Display message in status bar.
- Parameters:
txt (str) – message to display
- dock_handler(status, name)
Update dock visibility status
- update_gui()
Wrapper for updating parts of GUI when cursor changes position.
- update_tape(txt)
Update tape with new stroke(s). :param str txt: line(s) from tape
- display_block_steno(strokes)
Update reveal steno dock with element data.
- Parameters:
strokes –
element_collection
- display_block_data()
Display paragraph attributes and set style if necessary.
- refresh_steno_display(cursor=None)
Refresh steno display with data from cursor paragraph.
- Parameters:
cursor – a
QTextCursor, defaultNonefor current cursor
- refresh_editor_styles()
Reapply styles to every paragraph.
- update_style_display(style)
Update GUI display for style properties.
- Parameters:
style (str) – name of style
Create right-click menu at cursor click position.
- Parameters:
pos – position to display menu
Disable (or enable) GUI options for transcript.
- Parameters:
value (bool) – default
Trueto disable all menus not needed when no transcript open
Disable (or enable) GUI options for when audio is loaded and make signal/slot connections.
- Parameters:
value (bool) – default
Truefor when audio is present and GUI should change
- update_duration(duration)
Update duration label in GUI with duration of media.
- Parameters:
duration (int) – length in milliseconds
- update_seeker_track(position)
Update position on seeker and label to position of media.
- Parameters:
position (int) – present position of media
- get_tapey_tape()
Obtain suggestions from Tapey Tape file.
- get_clippy()
Obtain suggestions from plover-clippy-2 file by parsing default clippy output based on color codes.
- get_suggestions()
Wrapper to get suggestions from Tapey Tape or plover-clippy-2
- update_record_time()
Display recording time in status bar.
- open_root()
Open root directory of current transcript.
Generate menu items for recent files.
- clear_layout(layout)
Clear flow layout for recent files.
- change_window_font()
Change window font.
- change_backgrounds()
Change window background color.
- change_tape_font()
Change paper tape font.
- show_invisible_char()
Show/hide invisible chars in current transcript.
- calculate_space_width(font)
Calculate approximate width of a font character in inches and set in GUI.
- Parameters:
font –
QFont
- show_toolbox_pane(pane)
Show a pane from toolbox if hidden.
- Parameters:
pane – a
QWidgetin the Toolbox dock’sQTabWidget
- show_find_replace()
Show Find/Replace pane in toolbox, and fill search field with text if selection.
- show_stenospell()
Show Stenospell pane in toolbox, and fill search field with text if selection.
- search_online(link)
Search online with selected text using link source in default browser.
Listed sources: Wikipedia, Merriam-Webster, OED, Google, DuckDuckGo.
- Parameters:
link – a URL string template for query search
Jump to paragraph from navigation dock.
- Parameters:
item –
QListWidgetItem, should have par number in data
- jump_par()
Jump to paragraph based on user-input paragraph number.
- check_undo_stack(index)
Refresh config and style GUI based on labels in
QUndoStack.
- update_config_gui()
Update config GUI for parameters in current transcript.
- setup_page()
Set up line wrap and text width for
QTextDocumentbased on config page size.
Create menu items for each existing style, add shortcuts for first 10.
Create menu items for each existing field for insertion, add shortcuts for first 10.
Create menu items for index entries for insertion.
Create
QListWidgetItemsto display headings in navigation dock.
- stroke_to_text_move()
Locate text in transcript based on selected line in tape.
- text_to_stroke_move()
Locate stroke line in tape based on cursor position in transcript.
- update_spell_gui()
List spellchecking dictionaries in GUI.
Create menu items of data in storage for pasting.
- set_autosave_time()
Set autosave time interval that applies to all transcripts.
- autosave_setup(checked)
Set up/stop timer for autosave.
- setup_completion(checked)
Set/clean up autocompletion for transcript.
- model_from_file(fileName)
Load candidates for autocompletion.
- Parameters:
fileName – path to JSON file
- create_new()
Create new transcript.
- open_file(file_path=None)
Open transcript.
- Parameters:
file_path (str) – path to transcript directory
- recentfile_open(action)
Handler to open a recent transcript.
- recentfile_store(path)
Store transcript path in settings to open.
- switch_restore(index)
Facilitate switching between opened transcripts.
- Parameters:
index (int) – index of tab to switch to
- setup_connections()
Set up necessary connections between GUI and transcript.
- breakdown_connections()
Disconnect GUI and transcript.
- action_close()
Close window after saving settings and checking for multiple transcripts.
- close_file(tab_index=None)
Close transcript tab, checking for changes.
- Parameters:
tab_index (int) – index of tab to close
- save_file()
Save current transcript.
- save_as_file()
Save current transcript in new location.
- autosave()
Autosave current transcript.
- revert_file()
Revert transcript to previous commit.
- import_rtf()
Import RTF/CRE transcript file.
This will erase existing transcript data if to proceed. Transcript will close and re-open.
- add_dict(dict_path)
Add transcript dictionary.
- remove_dict(dict_path)
Remove transcript dictionary.
- select_style_file()
Select a style file for the transcript.
- style_from_template()
Generate a style file from ODF or RTF/CRE file.
This does not set the new file as style.
- style_edit()
Gather attribute values from GUI to set/edit for a style.
- create_new_style()
Create new style based on old.
- update_paragraph_style(index=None, action=None)
Set a paragraph’s style.
Can be triggered from style selection dropdown, or style menu.
- Parameters:
index – index of selected style from dropdown
action –
QActioncontaining style name in data
- transcript_suggest()
Open suggestions dialog.
- log_to_tape(stroke)
Log stroke to tape.
This deals with managing capturing output and window focus.
- Parameters:
stroke – stroke to log.
- on_send_string(txt_string)
Set string sent by Plover in transcript.
- count_backspaces(backspace)
Set number of backspaces sent by Plover in transcript.
- on_stroke(stroke_pressed)
Send stroke from Plover to transcript.
This will also trigger displaying captions, managing capturing output and window focus.
- tape_translate()
Translate tape contents into transcript.
- reset_paragraph()
Remove all data from paragraph block, and erase action history.
- cut_steno(cut=True)
Cut/copy selection and generate menu item.
- paste_steno(action=None)
Paste into transcript.
Each element in the content is individually inserted, as images would not work otherwise.
- Parameters:
action – a QAction containing data to be pasted
- define_retroactive()
Define outline for selected text and update transcript.
- define_scan()
Find last untranslated in transcript and define.
- delete_scan()
Find last untranslated and remove.
- add_autocomplete_item()
Add autocomplete term to wordlist.
- enable_affix(check)
Toggle paragraph affixes.
- edit_auto_affixes()
Open affix editor.
- insert_text(text=None)
Insert text.
- Parameters:
text (str) – text to insert, if
None, opens modal for input
- insert_file_text()
Insert text (possibly multi-line) from plain text file.
- insert_image()
Insert image.
- insert_field(action)
Insert field.
- Parameters:
action –
QActionwith field name data.
- edit_fields()
Open fields editor.
- edit_indices()
Open index editor.
- insert_index_entry(el=None, action=None)
Insert index entry.
One of
eloractionhas to be specified.- Parameters:
el –
index_textelementaction –
QActionwith index entry data.
- update_indices()
Have transcript update index entries and regenerate menu.
- edit_paragraph_properties()
Collect paragraph properties from GUI to set.
- spell_steno()
Search and display closest outlines.
- set_sp_dict(index)
Load selected spellchecking dictionary.
- sp_check(word)
Perform spellcheck for a word.
- spellcheck()
Scan text word by word and spellcheck.
- sp_ignore_all()
Add word to be ignored by spellchecking.
- sp_insert_suggest(item=None)
Perform spellcheck replacement.
- Parameters:
item – a
QListWidgetItem, ifNone, use selected from GUI
- search(direction=1)
Search wrapper.
- Parameters:
direction (int) – 1 to search forward, -1 to search back
- Returns:
success of search
- search_all()
Find all matches and display in pane.
- text_search(direction=1)
Search text.
Uses the
QTextDocumentsearch functionalities.
- steno_wrapped_search(direction=1)
Wrapper for steno search.
- Returns:
search status
- steno_search(direction=1)
Search steno underlying each paragraph.
- untrans_search(direction=1)
Search for untranslated steno.
- search_text_options()
Enable GUI options for text search.
- search_steno_options()
Enable GUI options for steno search.
- search_untrans_options()
Enable GUI options for untranslated steno search.
- replace(to_next=True, steno='', replace_term=None)
Perform replacement.
- Parameters:
to_next (bool) – do search for next match
steno (str) – steno to put into replacement element
replace_term – text to put as replacement, or text from GUI
- replace_everything(steno='')
Replace all matches in transcript.
- Parameters:
steno – the steno for the replacement element, default
""
- open_audio()
Select media file for playing.
- set_audio_delay(value)
Set offset for media.
- set_up_video(avail)
Set up video for media.
- Parameters:
avail (bool) – whether media has video or not
- show_hide_video()
Hide video if shown.
- record_or_pause()
Toggle between record / pause for the audio recorder.
- stop_record()
Stop recording.
- sync_media_pos()
Sync media to time at cursor position
- sync_media_tape(tape_line)
Sync media to time at selected tape line
- tts_synthesize()
TTS synthesize from selection or cursor position
- tts_setup()
Set up TTS engine and connections
- tts_end()
Stop TTS playback
- tts_pop_engine(index=None)
Populate TTS engine choices
- tts_state_manage(state)
Respond to changes in TTS state
- tts_set_engine(index=None)
Set TTS engine
- tts_pop_locale()
Populate locales in ui for selected TTS engine
- tts_set_locale(index)
Set locale for present TTS engine
- tts_pop_voice()
Populate voices in ui for selected TTS engine
- tts_set_voice(index)
Set voice for present TTS engine
- tts_set_pitch(pitch)
Set TTS pitch
- tts_set_volume(volume)
Set TTS volume
- tts_set_rate(rate)
Set TTS rate
- setup_caption_window(display_font, max_blocks)
Set a new window for displaying captions.
- Parameters:
display_font –
QFontmax_blocks – maximum number of lines to display
- add_cap(cap)
Display caption in caption window.
- setup_captions(checked)
Set up or clean up caption worker and window.
- display_captions()
Send captions for display if enabled.
- flush_caption()
Send all remaining text up to cursor to caption display.
- export_text()
Export transcript to text file.
- export_tape()
Export tape to text file.
- export_ascii()
Export transcript to formatted ASCII file.
- export_html()
Export transcript to HTML file.
- export_plain_ascii()
Export transcript to plain ASCII file.
- export_srt()
Export transcript to SRT formatted file.
- export_odt()
Export transcript to ODF TextDocument.
- export_rtf()
Export transcript to RTF/CRE file.