Add a button to attempt to identify a scanner page

This commit is contained in:
Timmy Welch 2024-04-27 18:10:49 -07:00
parent 787f3e8ea1
commit d98f815ce0
3 changed files with 31 additions and 5 deletions

View File

@ -110,6 +110,7 @@ class PageListEditor(QtWidgets.QWidget):
self.leBookmark.editingFinished.connect(self.save_bookmark)
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.pre_move_row = -1
self.first_front_page: int | None = None
@ -135,6 +136,21 @@ class PageListEditor(QtWidgets.QWidget):
action_item.setShortcut(shortcut)
self.addAction(action_item)
def identify_scanner_page(self) -> None:
if self.comic_archive is None:
return
row = self.comic_archive.get_scanner_page_index()
if row is None:
return
page_dict: ImageMetadata = self.listWidget.item(row).data(QtCore.Qt.ItemDataRole.UserRole)
page_dict["type"] = PageType.Deleted
item = self.listWidget.item(row)
item.setData(QtCore.Qt.ItemDataRole.UserRole, page_dict)
item.setText(self.list_entry_text(page_dict))
self.change_page()
def select_page_type_item(self, idx: int) -> None:
if self.cbPageType.isEnabled() and self.listWidget.count() > 0:
self.cbPageType.setCurrentIndex(idx)

View File

@ -835,6 +835,8 @@ class TaggerWindow(QtWidgets.QMainWindow):
widget.setChecked(False)
if isinstance(widget, QtWidgets.QTableWidget):
widget.setRowCount(0)
if isinstance(widget, QtWidgets.QListWidget):
widget.clear()
# recursive call on children
for child in widget.children():
@ -2139,6 +2141,7 @@ class TaggerWindow(QtWidgets.QMainWindow):
def load_archive(self, comic_archive: ComicArchive) -> None:
self.comic_archive = None
self.clear_form()
self.metadata = GenericMetadata()
if not os.path.exists(comic_archive.path):
self.fileSelectionList.dirty_flag = False

View File

@ -91,7 +91,10 @@
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout_1">
<item row="0" column="0">
<item row="1" column="1">
<widget class="QComboBox" name="cbPageType"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblPageType">
<property name="text">
<string>Page Type:</string>
@ -101,16 +104,20 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="cbPageType"/>
</item>
<item row="0" column="2">
<item row="1" column="2">
<widget class="QCheckBox" name="chkDoublePage">
<property name="text">
<string>&amp;Double Page?</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="QPushButton" name="btnIdentifyScannerPage">
<property name="text">
<string>Identify Scanner page</string>
</property>
</widget>
</item>
</layout>
</item>
<item>