Skip to content

Commit 6fc7d0d

Browse files
committed
feat: Added the cache indicator for the advanced mode.
1 parent ddf3012 commit 6fc7d0d

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class EbookTranslator(InterfaceActionBase):
2020
title = _(name)
2121
supported_platforms = ['windows', 'osx', 'linux']
2222
author = 'bookfere.com'
23-
version = (2, 1, 3)
23+
version = (2, 1, 4)
2424
__version__ = 'v' + '.'.join(map(str, version))
2525
description = _('A Calibre plugin to translate ebook into a specified '
2626
'language (optionally keeping the original content).')

advanced.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,16 @@ def layout_control(self):
520520
target_lang.setFixedWidth(150)
521521
target_layout.addWidget(target_lang)
522522

523+
cache_group = QGroupBox(_('Cache Status'))
524+
cache_layout = QVBoxLayout(cache_group)
525+
cache_status = QLabel(
526+
_('Enabled') if self.cache.is_persistence() else _('Disabled'))
527+
cache_status.setAlignment(Qt.AlignCenter)
528+
cache_status.setStyleSheet(
529+
'border-radius:2px;color:white;background-color:%s;'
530+
% ('green' if self.cache.is_persistence() else 'grey'))
531+
cache_layout.addWidget(cache_status)
532+
523533
save_group = QGroupBox(_('Output Ebook'))
524534
save_layout = QHBoxLayout(save_group)
525535
save_ebook = QPushButton(_('Output'))
@@ -535,6 +545,7 @@ def layout_control(self):
535545

536546
ebook_title.textChanged.connect(self.ebook.set_title)
537547

548+
layout.addWidget(cache_group)
538549
layout.addWidget(engine_group)
539550
layout.addWidget(source_group)
540551
layout.addWidget(target_group)
@@ -662,8 +673,8 @@ def auto_open_close_splitter():
662673

663674
def change_selected_item():
664675
rows = self.table.get_selected_rows()
665-
if not self.on_working and len(rows) > 0:
666-
paragraph = self.table.paragraph(rows.pop(0))
676+
if not self.on_working and len(rows) == 1:
677+
paragraph = self.table.paragraph(rows.pop(-1))
667678
self.raw_text.emit(paragraph.raw)
668679
self.original_text.emit(paragraph.original)
669680
self.translation_text[str].emit(paragraph.translation)

0 commit comments

Comments
 (0)