Skip to content

Commit

Permalink
feat: Showing last modification time for caches on cache manager. res…
Browse files Browse the repository at this point in the history
…olved #258
  • Loading branch information
bookfere committed Apr 11, 2024
1 parent ce522c9 commit f3403f9
Show file tree
Hide file tree
Showing 11 changed files with 182 additions and 113 deletions.
8 changes: 4 additions & 4 deletions cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
from qt.core import (
Qt, QDialog, QWidget, QVBoxLayout, QHBoxLayout, QPushButton, QLabel,
QTableView, QAbstractTableModel, QAbstractItemView, pyqtSignal,
QLineEdit, QFileDialog, QModelIndex, QMenu, QCursor)
QLineEdit, QFileDialog, QModelIndex, QMenu, QCursor, QHeaderView)
except ImportError:
from PyQt5.Qt import (
Qt, QDialog, QWidget, QVBoxLayout, QHBoxLayout, QPushButton, QLabel,
QTableView, QAbstractTableModel, QAbstractItemView, pyqtSignal,
QLineEdit, QFileDialog, QModelIndex, QMenu, QCursor)
QLineEdit, QFileDialog, QModelIndex, QMenu, QCursor, QHeaderView)

load_translations()

Expand Down Expand Up @@ -70,7 +70,7 @@ def control_widget(self):
self.cache_path.setReadOnly(True)
self.cache_path.setPlaceholderText(
_('Choose a path to store cache files.'))
self.cache_move = QPushButton(_('Choose'))
self.cache_move = QPushButton(_('Move'))
self.cache_reset = QPushButton(_('Reset'))
self.cache_reveal = QPushButton(_('Reveal'))

Expand Down Expand Up @@ -200,7 +200,7 @@ def delete_cache(self):
class CacheTableModel(QAbstractTableModel):
headers = [
_('Title'), _('Engine'), _('Language'), _('Merge Length'),
_('Size (MB)'), _('Filename'),
_('Size (MB)'), _('Last Modification Time'), _('Filename'),
]

def __init__(self):
Expand Down
7 changes: 5 additions & 2 deletions lib/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import sqlite3
import os.path
import tempfile
from datetime import datetime
from glob import glob

from .utils import size_by_unit
Expand Down Expand Up @@ -125,9 +126,11 @@ def get_list(cls):
title = cache.get_info('title') or '[%s]' % _('Unknown')
engine = cache.get_info('engine_name')
lang = cache.get_info('target_lang')
merge = int(cache.get_info('merge_length') or 0) or 'N/A'
merge = int(cache.get_info('merge_length') or 0)
size = size_by_unit(os.path.getsize(file_path), 'MB')
names.append((title, engine, lang, merge, size, name))
time = datetime.fromtimestamp(os.path.getmtime(file_path)) \
.strftime('%Y-%m-%d %H:%M:%S')
names.append((title, engine, lang, merge, size, time, name))
cache.close()
return names

Expand Down
2 changes: 1 addition & 1 deletion lib/translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def _translate_text(self, row, text, retry=0, interval=0):
.format(retry, interval), sep('┈'), _('Error: {}')
.format(traceback_error())]
if row >= 0:
error_messages.insert(1, _('row: {}').format(row))
error_messages.insert(1, _('Row: {}').format(row))
self.log('\n'.join(error_messages), True)
time.sleep(interval)
return self._translate_text(text, retry, interval)
Expand Down
15 changes: 12 additions & 3 deletions translations/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Ebook Translator Calibre Plugin\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2024-04-11 22:35+0800\n"
"POT-Creation-Date: 2024-04-12 03:10+0800\n"
"PO-Revision-Date: 2023-04-17 14:17+0800\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
Expand Down Expand Up @@ -190,8 +190,8 @@ msgstr "La ruta especificada no existe."
msgid "Choose a path to store cache files."
msgstr ""

msgid "Choose"
msgstr "Elegir"
msgid "Move"
msgstr ""

msgid "Reset"
msgstr ""
Expand Down Expand Up @@ -239,6 +239,9 @@ msgstr ""
msgid "Filename"
msgstr ""

msgid "Last Modification Time"
msgstr ""

msgid "Size (MB)"
msgstr ""

Expand Down Expand Up @@ -307,6 +310,9 @@ msgid ""
"for more control and customization."
msgstr ""

msgid "Choose"
msgstr "Elegir"

msgid "Batch Mode"
msgstr ""

Expand Down Expand Up @@ -467,6 +473,9 @@ msgstr ""
msgid "Error: {}"
msgstr ""

msgid "Row: {}"
msgstr ""

msgid "Translating: {}/{}"
msgstr "Traduciendo: {}/{}"

Expand Down
15 changes: 12 additions & 3 deletions translations/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Ebook Translator Calibre Plugin\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2024-04-11 22:35+0800\n"
"POT-Creation-Date: 2024-04-12 03:10+0800\n"
"PO-Revision-Date: 2023-10-01 15:35-0400\n"
"Last-Translator: <a href=\"https://www.mobileread.com/forums/member.php?"
"u=90932\">PoP</a>\n"
Expand Down Expand Up @@ -190,8 +190,8 @@ msgstr "Le chemin spécifié n'existe pas."
msgid "Choose a path to store cache files."
msgstr "Choisissez le chemin pour enregistrer les fichiers cache."

msgid "Choose"
msgstr "Choisissez"
msgid "Move"
msgstr ""

msgid "Reset"
msgstr "Repartir"
Expand Down Expand Up @@ -243,6 +243,9 @@ msgstr "Longueur de fusion"
msgid "Filename"
msgstr "Nom du fichier"

msgid "Last Modification Time"
msgstr ""

msgid "Size (MB)"
msgstr "Taille (MB)"

Expand Down Expand Up @@ -313,6 +316,9 @@ msgstr ""
"Ce mode présente des options additionnelles lors de la traduction, "
"permettant plus de contrôle et de personnalisation."

msgid "Choose"
msgstr "Choisissez"

msgid "Batch Mode"
msgstr "Mode de traitement en lot"

Expand Down Expand Up @@ -476,6 +482,9 @@ msgstr ""
msgid "Error: {}"
msgstr "Erreur: {}"

msgid "Row: {}"
msgstr ""

msgid "Translating: {}/{}"
msgstr "Traduisant: {}/{}"

Expand Down
Loading

0 comments on commit f3403f9

Please sign in to comment.