plover.gui_qt – Qt plugins¶
This module provides the Qt-based steno engine, which is necessary for developing GUI tool plugins.
- class plover.gui_qt.Engine¶
This is largely just a subclass of
StenoEngine, except for some Qt-specific logic, such as the signals below.Since Qt’s signals will fit better into the Qt processing model than Plover’s default engine hooks, GUI plugins should use the API provided by this engine over the built-in one where possible.
- signal_connect(name: str, callback: Function)¶
Registers
callbackas a callback to be called when thenamehook is triggered. The callback is called with the arguments shown in Engine Hooks when the hook is triggered.The individual Qt signals are also available below for convenience, for example if you need to trigger them manually. For example,
engine.signal_lookup.emit()would trigger thelookuphook. The arguments for each signal are shown in Engine Hooks.
- signal_stroked: QSignal¶
The signal version of the
strokedhook.
- signal_translated: QSignal¶
The signal version of the
translatedhook.
- signal_machine_state_changed: QSignal¶
The signal version of the
machine_state_changedhook.
- signal_output_changed: QSignal¶
The signal version of the
output_changedhook.
- signal_config_changed: QSignal¶
The signal version of the
config_changedhook.
- signal_dictionaries_loaded: QSignal¶
The signal version of the
dictionaries_loadedhook.
- signal_send_string: QSignal¶
The signal version of the
send_stringhook.
- signal_send_backspaces: QSignal¶
The signal version of the
send_backspaceshook.
- signal_send_key_combination: QSignal¶
The signal version of the
send_key_combinationhook.
- signal_add_translation: QSignal¶
The signal version of the
add_translationhook.
- signal_focus: QSignal¶
The signal version of the
focushook.
- signal_configure: QSignal¶
The signal version of the
configurehook.
- signal_lookup: QSignal¶
The signal version of the
lookuphook.
- signal_suggestions: QSignal¶
The signal version of the
suggestionshook.
- signal_quit: QSignal¶
The signal version of the
quithook.
Tools¶
Plover provides a helper class for creating GUI tools:
- class plover.gui_qt.tool.Tool(engine)¶
A subclass of
QDialogfor creating GUI tools. When writing a GUI tool, you would typically subclass bothTooland some generated code class (namedUi_YourToolor something) to take care of the UI setup.- setupUi(widget)¶
Sets up the user interface for this tool. You would typically call this in the
__init__method of your subclass to actually build the UI. Make sure to passselfin if you do.
- TITLE: str¶
The title that would show up in the main window’s toolbar and the tools list in the main menu.
- __doc__: str¶
The text description that shows up in the tooltip on hover. If not set, this would fallback to the TITLE
- ICON: str¶
The path to the icon for this tool, usually of the form
:/icon.svg. This file should be included as a resource in the GUI plugin.
- ROLE: str¶
A unique name to identify this tool when saving and loading state.
- SHORTCUT: str¶
A keyboard shortcut to activate this window, for example
Ctrl+F. If shortcut is in use by Plover, this will override it.
- _save_state(settings: QSettings)¶
Saves the current state of this tool to
settings. Callsettings.setValue(key, value)to store individual properties in this settings object.
- _restore_state(settings: QSettings)¶
Restores the current state of this tool from
settings. Callsettings.value(key)to retrieve values for the desired properties.
Machine Options¶
- class plover.gui_qt.machine_options.MachineOption¶
Represents the user interface for manipulating machine-specific configuration options. Each
MachineOptionclass is also a subclass of aQWidgetand is set up with a UI, similar toToolabove.This isn’t itself a real class, though; in order to support a machine options UI for your machine, subclass
QWidgetand your UI class of choice and implement the method and attribute below.- setValue(value)¶
Sets the contained value to
value.
- valueChanged: QSignal¶
A signal that gets emitted when the contained value is changed. Callbacks are called with the new value.
- class plover.gui_qt.machine_options.KeyboardOption¶
A :class:
MachineOptionclass for keyboard-specific options.
- class plover.gui_qt.machine_options.SerialOption¶
A :class:
MachineOptionclass for serial connection-specific options.
Utilities¶
- plover.gui_qt.utils.ToolBar(*action_list: List[QAction]) QToolBar¶
Returns a toolbar with a button for each of the specified actions.
Returns a dictionary mapping action names to action objects in
menu. This traverses the entire menu tree recursively.