Switch context menu TOC to combobox

Update translations
This commit is contained in:
BasioMeusPuga
2018-03-19 23:40:16 +05:30
parent ca67071e91
commit 39cf03a70e
4 changed files with 95 additions and 82 deletions

View File

@@ -27,8 +27,5 @@ SOURCES += lector/__main__.py \
resources/metadata.py \
resources/mainwindow.py
TRANSLATIONS += resources/translations/Lector_de.ts \
resources/translations/Lector_es.ts \
resources/translations/Lector_hi.ts \
resources/translations/Lector_jp.ts \
resources/translations/Lector_zn.ts
TRANSLATIONS += resources/translations/Lector_es.ts \
resources/translations/SAMPLE.ts

View File

@@ -711,16 +711,7 @@ class PliantQGraphicsView(QtWidgets.QGraphicsView):
self._translate('PliantQGraphicsView', 'Original size (O)'))
if not self.main_window.settings['show_bars']:
tocSubMenu = contextMenu.addMenu(
self._translate('PliantQGraphicsView', 'Table of Contents'))
tocSubMenu.setIcon(
self.main_window.QImageFactory.get_image('tableofcontents'))
current_toc = [i[0] for i in self.parent.metadata['content']]
for count, i in enumerate(current_toc):
this_action = tocSubMenu.addAction(i)
this_action.setData(count)
this_action.triggered.connect(self.set_chapter)
self.common_functions.generate_combo_box_action(contextMenu)
action = contextMenu.exec_(self.sender().mapToGlobal(position))
@@ -747,9 +738,6 @@ class PliantQGraphicsView(QtWidgets.QGraphicsView):
if action in view_action_dict:
self.main_window.modify_comic_view(view_action_dict[action])
def set_chapter(self):
self.common_functions.set_chapter(self.sender().data())
def closeEvent(self, *args):
# In case the program is closed when a contentView is fullscreened
self.main_window.closeEvent()
@@ -841,16 +829,7 @@ class PliantQTextBrowser(QtWidgets.QTextBrowser):
self._translate('PliantQTextBrowser', 'Toggle distraction free mode'))
if not self.main_window.settings['show_bars']:
tocSubMenu = contextMenu.addMenu(
self._translate('PliantQTextBrowser', 'Table of Contents'))
tocSubMenu.setIcon(
self.main_window.QImageFactory.get_image('tableofcontents'))
current_toc = [i[0] for i in self.parent.metadata['content']]
for count, i in enumerate(current_toc):
this_action = tocSubMenu.addAction(i)
this_action.setData(count)
this_action.triggered.connect(self.set_chapter)
self.common_functions.generate_combo_box_action(contextMenu)
action = contextMenu.exec_(self.sender().mapToGlobal(position))
@@ -861,9 +840,6 @@ class PliantQTextBrowser(QtWidgets.QTextBrowser):
if action == toggleAction:
self.main_window.toggle_distraction_free()
def set_chapter(self):
self.common_functions.set_chapter(self.sender().data())
def closeEvent(self, *args):
self.main_window.closeEvent()
@@ -939,9 +915,20 @@ class PliantWidgetsCommonFunctions():
if not was_button_pressed:
self.pw.ignore_wheel_event = True
def set_chapter(self, chapter_index):
self.main_window.bookToolBar.tocBox.setCurrentIndex(
chapter_index)
def generate_combo_box_action(self, contextMenu):
contextMenu.addSeparator()
toc_combobox = QtWidgets.QComboBox()
toc_data = [i[0] for i in self.pw.parent.metadata['content']]
toc_combobox.addItems(toc_data)
toc_combobox.setCurrentIndex(
self.pw.main_window.bookToolBar.tocBox.currentIndex())
toc_combobox.currentIndexChanged.connect(
self.pw.main_window.bookToolBar.tocBox.setCurrentIndex)
comboboxAction = QtWidgets.QWidgetAction(self.pw)
comboboxAction.setDefaultWidget(toc_combobox)
contextMenu.addAction(comboboxAction)
class PliantDockWidget(QtWidgets.QDockWidget):

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="es" sourcelanguage="en">
<!DOCTYPE TS><TS version="2.0" language="es" sourcelanguage="en">
<context>
<name>BookToolBar</name>
<message>
@@ -283,17 +282,17 @@
<context>
<name>Library</name>
<message>
<location filename="../../lector/library.py" line="121"/>
<location filename="../../lector/library.py" line="124"/>
<source>Author</source>
<translation>Autor</translation>
</message>
<message>
<location filename="../../lector/library.py" line="122"/>
<location filename="../../lector/library.py" line="125"/>
<source>Year</source>
<translation>Año</translation>
</message>
<message>
<location filename="../../lector/library.py" line="257"/>
<location filename="../../lector/library.py" line="260"/>
<source>manually added</source>
<translation>añadido manualmente</translation>
</message>
@@ -397,40 +396,50 @@
<translation>Guardar cambios e iniciar exploración de biblioteca</translation>
</message>
<message>
<location filename="../../lector/__main__.py" line="593"/>
<location filename="../../lector/__main__.py" line="596"/>
<source> Books</source>
<translation> Libros</translation>
</message>
<message>
<location filename="../../lector/__main__.py" line="1020"/>
<location filename="../../lector/__main__.py" line="1023"/>
<source>Start reading</source>
<translation>Comenzar a leer</translation>
</message>
<message>
<location filename="../../lector/__main__.py" line="1026"/>
<location filename="../../lector/__main__.py" line="1029"/>
<source>Edit</source>
<translation>Editar</translation>
</message>
<message>
<location filename="../../lector/__main__.py" line="1030"/>
<location filename="../../lector/__main__.py" line="1033"/>
<source>Delete</source>
<translation>Eliminar</translation>
</message>
<message>
<location filename="../../lector/__main__.py" line="1033"/>
<location filename="../../lector/__main__.py" line="1036"/>
<source>Mark read</source>
<translation>Marcar como leído</translation>
</message>
<message>
<location filename="../../lector/__main__.py" line="1036"/>
<location filename="../../lector/__main__.py" line="1039"/>
<source>Mark unread</source>
<translation>Marcar como no leído</translation>
</message>
<message>
<location filename="../../lector/__main__.py" line="1135"/>
<location filename="../../lector/__main__.py" line="1138"/>
<source>Manually Added</source>
<translation>Añadido manualmente</translation>
</message>
<message>
<location filename="../../lector/widgets.py" line="719"/>
<source>Save page as...</source>
<translation type="unfinished">Guardar la página como</translation>
</message>
<message>
<location filename="../../lector/widgets.py" line="720"/>
<source>Images</source>
<translation type="unfinished">Imágenes</translation>
</message>
</context>
<context>
<name>MetadataUI</name>
@@ -448,12 +457,12 @@
<context>
<name>PliantQGraphicsScene</name>
<message>
<location filename="../../lector/widgets.py" line="927"/>
<location filename="../../lector/widgets.py" line="956"/>
<source>Select new cover</source>
<translation>Seleccione una cubierta nueva</translation>
</message>
<message>
<location filename="../../lector/widgets.py" line="928"/>
<location filename="../../lector/widgets.py" line="957"/>
<source>Images</source>
<translation>Imágenes</translation>
</message>
@@ -461,58 +470,68 @@
<context>
<name>PliantQGraphicsView</name>
<message>
<location filename="../../lector/widgets.py" line="683"/>
<location filename="../../lector/widgets.py" line="682"/>
<source>Save page as...</source>
<translation>Guardar la página como</translation>
</message>
<message>
<location filename="../../lector/widgets.py" line="687"/>
<location filename="../../lector/widgets.py" line="693"/>
<source>Zoom in (+)</source>
<translation>Ampliar (+)</translation>
</message>
<message>
<location filename="../../lector/widgets.py" line="691"/>
<location filename="../../lector/widgets.py" line="697"/>
<source>Zoom out (-)</source>
<translation>Reducir (-)</translation>
</message>
<message>
<location filename="../../lector/widgets.py" line="695"/>
<location filename="../../lector/widgets.py" line="701"/>
<source>Fit width (W)</source>
<translation>Ajustar a la anchura (W)</translation>
</message>
<message>
<location filename="../../lector/widgets.py" line="699"/>
<location filename="../../lector/widgets.py" line="705"/>
<source>Best fit (B)</source>
<translation>Ajuste perfecto (B)</translation>
</message>
<message>
<location filename="../../lector/widgets.py" line="703"/>
<location filename="../../lector/widgets.py" line="709"/>
<source>Original size (O)</source>
<translation>Tamaño original (O)</translation>
</message>
<message>
<location filename="../../lector/widgets.py" line="707"/>
<location filename="../../lector/widgets.py" line="685"/>
<source>Toggle distraction free mode</source>
<translation>Alternar el modo de concentración</translation>
</message>
<message>
<location filename="../../lector/widgets.py" line="714"/>
<source>Table of Contents</source>
<translation type="obsolete">Sumario</translation>
</message>
</context>
<context>
<name>PliantQTextBrowser</name>
<message>
<location filename="../../lector/widgets.py" line="807"/>
<location filename="../../lector/widgets.py" line="818"/>
<source>Define</source>
<translation>Definir</translation>
</message>
<message>
<location filename="../../lector/widgets.py" line="812"/>
<location filename="../../lector/widgets.py" line="823"/>
<source>Search</source>
<translation>Buscar</translation>
</message>
<message>
<location filename="../../lector/widgets.py" line="816"/>
<location filename="../../lector/widgets.py" line="827"/>
<source>Toggle distraction free mode</source>
<translation>Alternar el modo de concentración</translation>
</message>
<message>
<location filename="../../lector/widgets.py" line="844"/>
<source>Table of Contents</source>
<translation type="obsolete">Sumario</translation>
</message>
</context>
<context>
<name>SettingsUI</name>
@@ -547,7 +566,7 @@
<translation>Comprobando las carpetas de la biblioteca</translation>
</message>
<message>
<location filename="../../lector/settingsdialog.py" line="233"/>
<location filename="../../lector/settingsdialog.py" line="234"/>
<source>Parsing files</source>
<translation>Procesando los archivos</translation>
</message>

View File

@@ -282,17 +282,17 @@
<context>
<name>Library</name>
<message>
<location filename="../../lector/library.py" line="121"/>
<location filename="../../lector/library.py" line="124"/>
<source>Author</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../lector/library.py" line="122"/>
<location filename="../../lector/library.py" line="125"/>
<source>Year</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../lector/library.py" line="257"/>
<location filename="../../lector/library.py" line="260"/>
<source>manually added</source>
<translation type="unfinished"></translation>
</message>
@@ -396,40 +396,50 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../lector/__main__.py" line="593"/>
<location filename="../../lector/__main__.py" line="596"/>
<source> Books</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../lector/__main__.py" line="1020"/>
<location filename="../../lector/__main__.py" line="1023"/>
<source>Start reading</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../lector/__main__.py" line="1026"/>
<location filename="../../lector/__main__.py" line="1029"/>
<source>Edit</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../lector/__main__.py" line="1030"/>
<location filename="../../lector/__main__.py" line="1033"/>
<source>Delete</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../lector/__main__.py" line="1033"/>
<location filename="../../lector/__main__.py" line="1036"/>
<source>Mark read</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../lector/__main__.py" line="1036"/>
<location filename="../../lector/__main__.py" line="1039"/>
<source>Mark unread</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../lector/__main__.py" line="1135"/>
<location filename="../../lector/__main__.py" line="1138"/>
<source>Manually Added</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../lector/widgets.py" line="719"/>
<source>Save page as...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../lector/widgets.py" line="720"/>
<source>Images</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MetadataUI</name>
@@ -447,12 +457,12 @@
<context>
<name>PliantQGraphicsScene</name>
<message>
<location filename="../../lector/widgets.py" line="927"/>
<location filename="../../lector/widgets.py" line="956"/>
<source>Select new cover</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../lector/widgets.py" line="928"/>
<location filename="../../lector/widgets.py" line="957"/>
<source>Images</source>
<translation type="unfinished"></translation>
</message>
@@ -460,37 +470,37 @@
<context>
<name>PliantQGraphicsView</name>
<message>
<location filename="../../lector/widgets.py" line="683"/>
<location filename="../../lector/widgets.py" line="682"/>
<source>Save page as...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../lector/widgets.py" line="687"/>
<location filename="../../lector/widgets.py" line="693"/>
<source>Zoom in (+)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../lector/widgets.py" line="691"/>
<location filename="../../lector/widgets.py" line="697"/>
<source>Zoom out (-)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../lector/widgets.py" line="695"/>
<location filename="../../lector/widgets.py" line="701"/>
<source>Fit width (W)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../lector/widgets.py" line="699"/>
<location filename="../../lector/widgets.py" line="705"/>
<source>Best fit (B)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../lector/widgets.py" line="703"/>
<location filename="../../lector/widgets.py" line="709"/>
<source>Original size (O)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../lector/widgets.py" line="707"/>
<location filename="../../lector/widgets.py" line="685"/>
<source>Toggle distraction free mode</source>
<translation type="unfinished"></translation>
</message>
@@ -498,17 +508,17 @@
<context>
<name>PliantQTextBrowser</name>
<message>
<location filename="../../lector/widgets.py" line="807"/>
<location filename="../../lector/widgets.py" line="818"/>
<source>Define</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../lector/widgets.py" line="812"/>
<location filename="../../lector/widgets.py" line="823"/>
<source>Search</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../lector/widgets.py" line="816"/>
<location filename="../../lector/widgets.py" line="827"/>
<source>Toggle distraction free mode</source>
<translation type="unfinished"></translation>
</message>
@@ -546,7 +556,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../lector/settingsdialog.py" line="233"/>
<location filename="../../lector/settingsdialog.py" line="234"/>
<source>Parsing files</source>
<translation type="unfinished"></translation>
</message>