Skip to content

Qt Dictionaries UI can initialize with default English dictionaries before plugin-system config is applied #1846

@Go-Jinhan

Description

@Go-Jinhan

Summary

On macOS, Plover 5.3.0 can initialize the Dictionaries Qt UI with the default English dictionaries even though the actual engine config/system has already switched to a plugin-defined system (Korean Modern C) with plugin-provided dictionaries.

In some runs this also triggers a Qt-side exception in dictionaries_widget:

ValueError: not enough values to unpack (expected 1, got 0)

This looks less like a Korean-only bug and more like a startup/config synchronization bug in the Qt dictionaries UI when using a non-default system with plugin-defined dictionaries.

Environment

  • Plover 5.3.0 macOS app bundle
  • macOS
  • System: Korean Modern C
  • Dictionaries: two plugin-provided Python dictionaries
    • plover_korean/system/cas/dictionaries/ko_cas_numbers.py
    • plover_korean/system/cas/dictionaries/ko_cas_base.py

Expected behavior

After restart, the Dictionaries UI should show the dictionaries from the saved config for the active system.

Actual behavior

Observed behavior before local workaround:

  • Engine startup logs showed loading system: Korean Modern C
  • Engine loaded only the two Korean dictionaries
  • But the Qt dictionaries UI could still initialize from the default English dictionary set (user.json, commands.json, main.json)
  • In some runs, dictionaries_widget then crashed with ValueError: not enough values to unpack (expected 1, got 0) while processing dictionary state changes

So the engine state and the dictionaries UI model could become temporarily inconsistent during startup.

Relevant log excerpts

From engine startup:

loading system: Korean Modern C
loading dictionary: .../ko_cas_numbers.py
loading dictionary: .../ko_cas_base.py
loaded 2 dictionaries

From a failing UI run:

ValueError: not enough values to unpack (expected 1, got 0)

The local investigation strongly suggested that the dictionaries model had initialized with the English defaults first, then later received state/config updates for the Korean dictionaries.

Suspected cause

It appears the Qt Dictionaries UI/model may be built before the loaded config has been fully applied, so it initially reflects the default English Stenotype dictionaries instead of the saved active system dictionaries.

That stale model then receives later config_changed / dictionaries_loaded / dictionary-state events for a different set of dictionaries, which can lead to the mismatch and the ValueError.

In other words, this seems like an initialization-order / synchronization bug between:

  • config loading
  • active system selection
  • dictionaries model population in the Qt UI
  • later dictionary state updates

Notes

I was able to work around this locally by monkey-patching startup so that:

  • config defaults were forced to the saved plugin system before the dictionaries widget initialized
  • the dictionaries UI model was resynchronized from engine config/runtime dictionaries on startup and later updates

That workaround makes me think the underlying issue is in Plover Qt startup ordering rather than in the Korean plugin alone.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions