From f31abe2df9ea5760060bb13fc47753a2d4c93f1e Mon Sep 17 00:00:00 2001 From: lordwelch Date: Sun, 7 Mar 2021 19:40:25 -0800 Subject: [PATCH] Add a shortcut for marking a page as an ad --- comictaggerlib/pagelisteditor.py | 12 ++++++++++++ comictaggerlib/taggerwindow.py | 7 +++++++ comictaggerlib/ui/taggerwindow.ui | 9 +++++++++ 3 files changed, 28 insertions(+) diff --git a/comictaggerlib/pagelisteditor.py b/comictaggerlib/pagelisteditor.py index 2a5dd0c..9b1bfe1 100644 --- a/comictaggerlib/pagelisteditor.py +++ b/comictaggerlib/pagelisteditor.py @@ -27,6 +27,8 @@ from .coverimagewidget import CoverImageWidget from .genericmetadata import GenericMetadata, PageType from .settings import ComicTaggerSettings +import sys + # from pageloader import PageLoader @@ -79,6 +81,7 @@ class PageListEditor(QWidget): uic.loadUi(ComicTaggerSettings.getUIFile("pagelisteditor.ui"), self) + self.setEnabled(True) self.pageWidget = CoverImageWidget(self.pageContainer, CoverImageWidget.ArchiveMode) gridlayout = QGridLayout(self.pageContainer) gridlayout.addWidget(self.pageWidget) @@ -109,6 +112,15 @@ class PageListEditor(QWidget): self.pre_move_row = -1 self.first_front_page = None + def toggleAd(self): + ad = self.comboBox.findData(PageType.Advertisement) + if self.comboBox.currentIndex() == ad: + self.comboBox.setCurrentIndex(0) + self.changePageType(0) + else: + self.comboBox.setCurrentIndex(ad) + self.changePageType(ad) + def resetPage(self): self.pageWidget.clear() self.comboBox.setDisabled(True) diff --git a/comictaggerlib/taggerwindow.py b/comictaggerlib/taggerwindow.py index a2161ae..f5d3a0f 100644 --- a/comictaggerlib/taggerwindow.py +++ b/comictaggerlib/taggerwindow.py @@ -411,6 +411,13 @@ class TaggerWindow(QtWidgets.QMainWindow): self.toolBar.addAction(self.actionClearEntryForm) self.toolBar.addAction(self.actionPageBrowser) + self.actionMarkAd.setShortcut("A") + self.actionMarkAd.triggered.connect(self.toggleAd) + + def toggleAd(self): + if self.tabWidget.tabText(self.tabWidget.currentIndex()) == "Pages": + self.pageListEditor.toggleAd() + def repackageArchive(self): ca_list = self.fileSelectionList.getSelectedArchiveList() rar_count = 0 diff --git a/comictaggerlib/ui/taggerwindow.ui b/comictaggerlib/ui/taggerwindow.ui index a5af903..3694d2c 100644 --- a/comictaggerlib/ui/taggerwindow.ui +++ b/comictaggerlib/ui/taggerwindow.ui @@ -1199,6 +1199,7 @@ + @@ -1402,6 +1403,14 @@ perform a literal search on the series and return the first 50 results + + + Mark Advertisement + + + mark the current page as an advertisement + +