[ocrfeeder] Fix setting the OCR engine for the first time in the BoxEditor
- From: Joaquim Rocha <jrocha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ocrfeeder] Fix setting the OCR engine for the first time in the BoxEditor
- Date: Tue, 7 Jan 2020 23:30:27 +0000 (UTC)
commit f3b6e1e89814f0ff8927a8f0f71b10390c9a260f
Author: Joaquim Rocha <me joaquimrocha com>
Date: Tue Jan 7 23:47:44 2020 +0100
Fix setting the OCR engine for the first time in the BoxEditor
The code that sets the OCR engine for the BoxEditor was not getting
the current_engine set the first time it checks it, so it was not
trying to get the index for that engine, and defaulted it to None.
Since it was later comparing it to an int, there was a TypeError
exception because of that.
src/ocrfeeder/studio/widgetPresenter.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/ocrfeeder/studio/widgetPresenter.py b/src/ocrfeeder/studio/widgetPresenter.py
index 07ddddd..359af9e 100644
--- a/src/ocrfeeder/studio/widgetPresenter.py
+++ b/src/ocrfeeder/studio/widgetPresenter.py
@@ -692,13 +692,13 @@ class BoxEditor(Gtk.ScrolledWindow):
for engine in engines_list:
self.ocr_combo_box.append_text(engine)
if engines_list:
- engine_index = None
+ engine_index = -1
if current_engine:
try:
engine_index = engines_list.index(current_engine)
except ValueError:
- engine_index = -1
- if not engine_index >= 0:
+ pass
+ if engine_index < 0:
try:
engine_index = engines_list.index(ConfigurationManager().favorite_engine)
except ValueError:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]