diff --git a/comicapi/comicarchive.py b/comicapi/comicarchive.py index 02ee666..9aa80c9 100644 --- a/comicapi/comicarchive.py +++ b/comicapi/comicarchive.py @@ -25,7 +25,6 @@ import time import io import natsort -from PyPDF2 import PdfFileReader try: from unrar.cffi import rarfile except: @@ -528,34 +527,6 @@ class UnknownArchiver: def getArchiveFilenameList(self): return [] -class PdfArchiver: - - def __init__(self, path): - self.path = path - - def getArchiveComment(self): - return "" - - def setArchiveComment(self, comment): - return False - - def readArchiveFile(self, page_num): - return subprocess.check_output( - ['mudraw', '-o', '-', self.path, str(int(os.path.basename(page_num)[:-4]))]) - - def writeArchiveFile(self, archive_file, data): - return False - - def removeArchiveFile(self, archive_file): - return False - - def getArchiveFilenameList(self): - out = [] - pdf = PdfFileReader(open(self.path, 'rb')) - for page in range(1, pdf.getNumPages() + 1): - out.append("/%04d.jpg" % (page)) - return out - class ComicArchive: logo_data = None class ArchiveType: @@ -596,9 +567,6 @@ class ComicArchive: self.archiver = RarArchiver( self.path, rar_exe_path=self.rar_exe_path) - elif os.path.basename(self.path)[-3:] == 'pdf': - self.archive_type = self.ArchiveType.Pdf - self.archiver = PdfArchiver(self.path) if ComicArchive.logo_data is None: #fname = ComicTaggerSettings.getGraphic('nocover.png') @@ -677,7 +645,7 @@ class ComicArchive: if ( # or self.isFolder() ) - (self.isZip() or self.isRar() or self.isPdf()) + (self.isZip() or self.isRar()) and (self.getNumberOfPages() > 0) diff --git a/comicapi/issuestring.py b/comicapi/issuestring.py index 2f441c1..62732a8 100644 --- a/comicapi/issuestring.py +++ b/comicapi/issuestring.py @@ -38,8 +38,7 @@ class IssueString: if text is None: return - if isinstance(text, int): - text = str(text) + text = str(text) if len(text) == 0: return diff --git a/comictaggerlib/coverimagewidget.py b/comictaggerlib/coverimagewidget.py index 866c779..562498d 100644 --- a/comictaggerlib/coverimagewidget.py +++ b/comictaggerlib/coverimagewidget.py @@ -320,7 +320,7 @@ class CoverImageWidget(QWidget): img_w = scaled_pixmap.width() img_h = scaled_pixmap.height() self.lblImage.resize(img_w, img_h) - self.lblImage.move((frame_w - img_w) / 2, (frame_h - img_h) / 2) + self.lblImage.move(int((frame_w - img_w) / 2), int((frame_h - img_h) / 2)) def showPopup(self): self.popup = ImagePopup(self, self.current_pixmap) diff --git a/comictaggerlib/imagehasher.py b/comictaggerlib/imagehasher.py index 79cf120..dabbac0 100755 --- a/comictaggerlib/imagehasher.py +++ b/comictaggerlib/imagehasher.py @@ -20,7 +20,6 @@ from functools import reduce try: from PIL import Image - from PIL import WebPImagePlugin pil_available = True except ImportError: pil_available = False diff --git a/comictaggerlib/imagepopup.py b/comictaggerlib/imagepopup.py index e216484..c6e2ef5 100644 --- a/comictaggerlib/imagepopup.py +++ b/comictaggerlib/imagepopup.py @@ -87,7 +87,7 @@ class ImagePopup(QtWidgets.QDialog): img_w = display_pixmap.width() img_h = display_pixmap.height() self.lblImage.resize(img_w, img_h) - self.lblImage.move((win_w - img_w) / 2, (win_h - img_h) / 2) + self.lblImage.move(int((win_w - img_w) / 2), int((win_h - img_h) / 2)) def mousePressEvent(self, event): self.close() diff --git a/comictaggerlib/issueidentifier.py b/comictaggerlib/issueidentifier.py index 502a8c3..6c0e1cf 100644 --- a/comictaggerlib/issueidentifier.py +++ b/comictaggerlib/issueidentifier.py @@ -19,7 +19,6 @@ import io try: from PIL import Image - from PIL import WebPImagePlugin pil_available = True except ImportError: pil_available = False @@ -231,9 +230,9 @@ class IssueIdentifier: sys.stdout.flush() def log_msg(self, msg, newline=True): - self.output_function(msg) if newline: - self.output_function("\n") + msg += "\n" + self.output_function(msg) def getIssueCoverMatchScore( self, diff --git a/comictaggerlib/taggerwindow.py b/comictaggerlib/taggerwindow.py index eebc86b..f78fa7c 100644 --- a/comictaggerlib/taggerwindow.py +++ b/comictaggerlib/taggerwindow.py @@ -1385,8 +1385,8 @@ class TaggerWindow(QtWidgets.QMainWindow): else: screen = QtWidgets.QDesktopWidget().screenGeometry() size = self.frameGeometry() - self.move((screen.width() - size.width()) / 2, - (screen.height() - size.height()) / 2) + self.move(int((screen.width() - size.width()) / 2), + int((screen.height() - size.height()) / 2)) def adjustLoadStyleCombo(self): # select the current style @@ -1721,7 +1721,7 @@ class TaggerWindow(QtWidgets.QMainWindow): def autoTagLog(self, text): IssueIdentifier.defaultWriteOutput(text) if self.atprogdialog is not None: - self.atprogdialog.textEdit.insertPlainText(text) + self.atprogdialog.textEdit.append(text.rstrip()) self.atprogdialog.textEdit.ensureCursorVisible() QtCore.QCoreApplication.processEvents() QtCore.QCoreApplication.processEvents() @@ -2064,8 +2064,13 @@ class TaggerWindow(QtWidgets.QMainWindow): self.comic_archive = None self.clearForm() - self.settings.last_opened_folder = os.path.abspath( - os.path.split(comic_archive.path)[0]) + if not os.path.exists(comic_archive.path): + self.fileSelectionList.dirty_flag = False + self.fileSelectionList.removeArchiveList([comic_archive]) + QtCore.QTimer.singleShot(1, self.fileSelectionList.revertSelection) + return + + self.settings.last_opened_folder = os.path.abspath(os.path.split(comic_archive.path)[0]) self.comic_archive = comic_archive self.metadata = self.comic_archive.readMetadata(self.load_data_style) if self.metadata is None: diff --git a/comictaggerlib/ui/qtutils.py b/comictaggerlib/ui/qtutils.py index 2541d9a..55644d4 100644 --- a/comictaggerlib/ui/qtutils.py +++ b/comictaggerlib/ui/qtutils.py @@ -51,9 +51,9 @@ if qt_available: mysize = window.geometry() # The horizontal position is calculated as screen width - window width # /2 - hpos = (main_window_size.width() - window.width()) / 2 + hpos = int((main_window_size.width() - window.width()) / 2) # And vertical position the same, but with the height dimensions - vpos = (main_window_size.height() - window.height()) / 2 + vpos = int((main_window_size.height() - window.height()) / 2) # And the move call repositions the window window.move( hpos + @@ -63,7 +63,6 @@ if qt_available: try: from PIL import Image - from PIL import WebPImagePlugin import io pil_available = True except ImportError: diff --git a/requirements.txt b/requirements.txt index 792c868..61bc2f0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,4 @@ beautifulsoup4 >= 4.1 -PyPDF2==1.24 configparser natsort pillow>=4.3.0