diff --git a/Lector.pro b/Lector.pro index dcaf3ba..94b2849 100644 --- a/Lector.pro +++ b/Lector.pro @@ -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 \ No newline at end of file diff --git a/lector/widgets.py b/lector/widgets.py index c5aeff5..22fbf03 100644 --- a/lector/widgets.py +++ b/lector/widgets.py @@ -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): diff --git a/resources/translations/Lector_es.ts b/resources/translations/Lector_es.ts index ee9e3c8..0b1cb98 100644 --- a/resources/translations/Lector_es.ts +++ b/resources/translations/Lector_es.ts @@ -1,6 +1,5 @@ - - + BookToolBar @@ -283,17 +282,17 @@ Library - + Author Autor - + Year Año - + manually added añadido manualmente @@ -397,40 +396,50 @@ Guardar cambios e iniciar exploración de biblioteca - + Books Libros - + Start reading Comenzar a leer - + Edit Editar - + Delete Eliminar - + Mark read Marcar como leído - + Mark unread Marcar como no leído - + Manually Added Añadido manualmente + + + Save page as... + Guardar la página como… + + + + Images + Imágenes + MetadataUI @@ -448,12 +457,12 @@ PliantQGraphicsScene - + Select new cover Seleccione una cubierta nueva - + Images Imágenes @@ -461,58 +470,68 @@ PliantQGraphicsView - + Save page as... Guardar la página como… - + Zoom in (+) Ampliar (+) - + Zoom out (-) Reducir (-) - + Fit width (W) Ajustar a la anchura (W) - + Best fit (B) Ajuste perfecto (B) - + Original size (O) Tamaño original (O) - + Toggle distraction free mode Alternar el modo de concentración + + + Table of Contents + Sumario + PliantQTextBrowser - + Define Definir - + Search Buscar - + Toggle distraction free mode Alternar el modo de concentración + + + Table of Contents + Sumario + SettingsUI @@ -547,7 +566,7 @@ Comprobando las carpetas de la biblioteca - + Parsing files Procesando los archivos diff --git a/resources/translations/SAMPLE.ts b/resources/translations/SAMPLE.ts index 20e50ab..3f95dc4 100644 --- a/resources/translations/SAMPLE.ts +++ b/resources/translations/SAMPLE.ts @@ -282,17 +282,17 @@ Library - + Author - + Year - + manually added @@ -396,40 +396,50 @@ - + Books - + Start reading - + Edit - + Delete - + Mark read - + Mark unread - + Manually Added + + + Save page as... + + + + + Images + + MetadataUI @@ -447,12 +457,12 @@ PliantQGraphicsScene - + Select new cover - + Images @@ -460,37 +470,37 @@ PliantQGraphicsView - + Save page as... - + Zoom in (+) - + Zoom out (-) - + Fit width (W) - + Best fit (B) - + Original size (O) - + Toggle distraction free mode @@ -498,17 +508,17 @@ PliantQTextBrowser - + Define - + Search - + Toggle distraction free mode @@ -546,7 +556,7 @@ - + Parsing files