Add button to autodetect double pages
A page is marked as a double page if it's as least as wide as tall. Closes: #578 Co-authored-by: Sven Hesse <drmccoy@drmccoy.de>
This commit is contained in:
parent
0a4aef1a1b
commit
e96cb8ad15
@ -21,7 +21,7 @@ import logging
|
||||
from PyQt5 import QtCore, QtWidgets, uic
|
||||
|
||||
from comicapi.comicarchive import ComicArchive, tags
|
||||
from comicapi.genericmetadata import ImageMetadata, PageType
|
||||
from comicapi.genericmetadata import GenericMetadata, ImageMetadata, PageType
|
||||
from comictaggerlib.coverimagewidget import CoverImageWidget
|
||||
from comictaggerlib.ui import ui_path
|
||||
from comictaggerlib.ui.qtutils import enable_widget
|
||||
@ -113,6 +113,7 @@ class PageListEditor(QtWidgets.QWidget):
|
||||
self.btnUp.clicked.connect(self.move_current_up)
|
||||
self.btnDown.clicked.connect(self.move_current_down)
|
||||
self.btnIdentifyScannerPage.clicked.connect(self.identify_scanner_page)
|
||||
self.btnIdentifyDoublePage.clicked.connect(self.identify_double_page)
|
||||
self.pre_move_row = -1
|
||||
self.first_front_page: int | None = None
|
||||
|
||||
@ -164,6 +165,16 @@ class PageListEditor(QtWidgets.QWidget):
|
||||
item.setText(self.list_entry_text(page_dict))
|
||||
self.change_page()
|
||||
|
||||
def identify_double_page(self) -> None:
|
||||
if self.comic_archive is None:
|
||||
return
|
||||
md = GenericMetadata(pages=self.get_page_list())
|
||||
double_pages = [x.get("double_page", False) for x in md.pages]
|
||||
self.comic_archive.apply_archive_info_to_metadata(md, True, True)
|
||||
self.set_data(self.comic_archive, pages_list=md.pages)
|
||||
if double_pages != [x.get("double_page", False) for x in md.pages]:
|
||||
self.modified.emit()
|
||||
|
||||
def select_page_type_item(self, idx: int) -> None:
|
||||
if self.cbPageType.isEnabled() and self.listWidget.count() > 0:
|
||||
self.cbPageType.setCurrentIndex(idx)
|
||||
|
@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>527</width>
|
||||
<width>600</width>
|
||||
<height>323</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -114,17 +114,24 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<item row="2" column="2">
|
||||
<widget class="QCheckBox" name="cbxBlur">
|
||||
<property name="text">
|
||||
<string>Blur image (no spoilers)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="btnIdentifyScannerPage">
|
||||
<property name="text">
|
||||
<string>Identify Scanner page</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QCheckBox" name="cbxBlur">
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="btnIdentifyDoublePage">
|
||||
<property name="text">
|
||||
<string>Blur image (no spoilers)</string>
|
||||
<string>Identify Double Page</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
Reference in New Issue
Block a user