-
Notifications
You must be signed in to change notification settings - Fork 297
Description
Describe the bug
Typing in the input bar on the Plover: Lookup window triggers a QT error message in the console.
To Reproduce
Steps to reproduce the behavior:
- Open the Plover: Lookup window
- type the letter
a.
Expected behavior
Lookup window searches for stuff as it always has
Actual behavior
Lookup results remain blank, plover prints this to the console:
2025-12-02 20:30:22,118 [MainThread] ERROR: Qt GUI error
Traceback (most recent call last):
File "/usr/lib/python3.13/site-packages/plover/gui_qt/lookup_dialog.py", line 44, in lookup
self._update_suggestions(suggestion_list)
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/site-packages/plover/gui_qt/lookup_dialog.py", line 38, in _update_suggestions
self.suggestions.append(suggestion_list)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/site-packages/plover/gui_qt/suggestions_widget.py", line 180, in append
self.scrollToBottom()
~~~~~~~~~~~~~~~~~~~^^
File "/usr/lib/python3.13/site-packages/plover/gui_qt/suggestions_widget.py", line 113, in rowCount
return 0 if parent.isValid() else len(self._suggestion_list)
~~~~~~~~~~~~~~^^
File "/usr/lib/python3.13/site-packages/plover/gui_qt/suggestions_widget.py", line 113, in rowCount
return 0 if parent.isValid() else len(self._suggestion_list)
~~~~~~~~~~~~~~^^
File "/usr/lib/python3.13/site-packages/plover/gui_qt/suggestions_widget.py", line 99, in sizeHint
size = self._size_hint_cache.get(index.row())
~~~~~~~~~^^
File "/usr/lib/python3.13/site-packages/plover/gui_qt/suggestions_widget.py", line 113, in rowCount
return 0 if parent.isValid() else len(self._suggestion_list)
~~~~~~~~~~~~~~^^
File "/usr/lib/python3.13/site-packages/plover/gui_qt/suggestions_widget.py", line 113, in rowCount
return 0 if parent.isValid() else len(self._suggestion_list)
~~~~~~~~~~~~~~^^
File "/usr/lib/python3.13/site-packages/plover/gui_qt/suggestions_widget.py", line 99, in sizeHint
size = self._size_hint_cache.get(index.row())
~~~~~~~~~^^
File "/usr/lib/python3.13/site-packages/plover/gui_qt/suggestions_widget.py", line 113, in rowCount
return 0 if parent.isValid() else len(self._suggestion_list)
~~~~~~~~~~~~~~^^
File "/usr/lib/python3.13/site-packages/plover/gui_qt/suggestions_widget.py", line 113, in rowCount
return 0 if parent.isValid() else len(self._suggestion_list)
~~~~~~~~~~~~~~^^
File "/usr/lib/python3.13/site-packages/plover/gui_qt/suggestions_widget.py", line 99, in sizeHint
size = self._size_hint_cache.get(index.row())
~~~~~~~~~^^
File "/usr/lib/python3.13/site-packages/plover/gui_qt/suggestions_widget.py", line 113, in rowCount
return 0 if parent.isValid() else len(self._suggestion_list)
~~~~~~~~~~~~~~^^
File "/usr/lib/python3.13/site-packages/plover/gui_qt/suggestions_widget.py", line 113, in rowCount
return 0 if parent.isValid() else len(self._suggestion_list)
~~~~~~~~~~~~~~^^
File "/usr/lib/python3.13/site-packages/plover/gui_qt/suggestions_widget.py", line 102, in sizeHint
size = self._suggestion_size_hint(index)
File "/usr/lib/python3.13/site-packages/plover/gui_qt/suggestions_widget.py", line 73, in _suggestion_size_hint
translation, strokes = self._format_suggestion(index)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
File "/usr/lib/python3.13/site-packages/plover/gui_qt/suggestions_widget.py", line 63, in _format_suggestion
translation = escape_translation(suggestion.text) + ":"
^^^^^^^^^^^^^^^
AttributeError: Error calling Python override of QAbstractListModel::rowCount(): Error calling Python override of QAbstractListModel::rowCount(): Error calling Python override of QStyledItemDelegate::sizeHint(): Error calling Python override of QAbstractListModel::rowCount(): Error calling Python override of QAbstractListModel::rowCount(): Error calling Python override of QStyledItemDelegate::sizeHint(): Error calling Python override of QAbstractListModel::rowCount(): Error calling Python override of QAbstractListModel::rowCount(): Error calling Python override of QStyledItemDelegate::sizeHint(): Error calling Python override of QAbstractListModel::rowCount(): Error calling Python override of QAbstractListModel::rowCount(): Error calling Python override of QStyledItemDelegate::sizeHint(): 'list' object has no attribute 'text'
Reproducing this within pdb shows that on this frame near the top:
File "/usr/lib/python3.13/site-packages/plover/gui_qt/lookup_dialog.py", line 38, in _update_suggestions
self.suggestions.append(suggestion_list)
the suggestion_list has instances of plover.suggestions.Suggestion like it's supposed to, but by the time we get to this frame near the bottom it's been converted to a builtins.list:
File "/usr/lib/python3.13/site-packages/plover/gui_qt/suggestions_widget.py", line 103, in sizeHint
size = self._suggestion_size_hint(index)
(Pdb) p suggestion
['a', [['AEU'], ['A', 'S-P'], ['A', 'AEU'], ['AEU', 'AEU'], ['A*', 'SP-S']]]
(Pdb) type(suggestion)
<class 'list'>
Pdb up/down skips most of the frames in between for some reason.
Screenshots
N/A
Operating system
ArchLinux with Python 3.13, with the following installed versions of dependencies:
| package | version |
|---|---|
| dbus | 1.16.2-1 |
| python | 3.13.7-1 |
| python-appdirs | 1.4.4-11 |
| python-pyqt5 | 5.15.11-3 |
| python-pyserial | 3.5-7 |
| python-rtf_tokenize | 1.0.0-8 |
| python-setuptools | 1:80.9.0-2 |
| python-wcwidth | 0.2.14-1 |
| python-xlib | 0.33-4 |
| qt5-svg | 5.15.18+kde+r5-1 |
| python-hid | 1.0.6-3 |
- Plover Version bf2eaa5
Hardware
N/A
Workaround
Because the data are intact, just no longer the correct type, accessing the fields by index rather than by name works fine.
diff --git a/plover/gui_qt/suggestions_widget.py b/plover/gui_qt/suggestions_widget.py
index 626ebb13..d0d43ac9 100644
--- a/plover/gui_qt/suggestions_widget.py
+++ b/plover/gui_qt/suggestions_widget.py
@@ -60,12 +60,12 @@ class SuggestionsDelegate(QStyledItemDelegate):
def _format_suggestion(self, index):
suggestion = index.data(Qt.ItemDataRole.DisplayRole)
- translation = escape_translation(suggestion.text) + ":"
- if not suggestion.steno_list:
+ translation = escape_translation(suggestion[0]) + ":"
+ if not suggestion[1]:
translation += " " + NO_SUGGESTIONS_STRING
return translation, None
strokes = ""
- for strokes_list in suggestion.steno_list[:MAX_SUGGESTIONS_COUNT]:
+ for strokes_list in suggestion[1][:MAX_SUGGESTIONS_COUNT]:
strokes += "\n " + "/".join(strokes_list)
return translation, strokes
@@ -119,11 +119,11 @@ class SuggestionsModel(QAbstractListModel):
if role == Qt.ItemDataRole.DisplayRole:
return suggestion
if role == Qt.ItemDataRole.AccessibleTextRole:
- translation = escape_translation(suggestion.text)
- if suggestion.steno_list:
+ translation = escape_translation(suggestion[0])
+ if suggestion[1]:
steno = ", ".join(
"/".join(strokes_list)
- for strokes_list in suggestion.steno_list[:MAX_SUGGESTIONS_COUNT]
+ for strokes_list in suggestion[1][:MAX_SUGGESTIONS_COUNT]
)
else:
steno = NO_SUGGESTIONS_STRING