Bug fixes

Closes #65,#59,#154,#180,#187,#209
This commit is contained in:
Timmy Welch 2022-02-21 20:05:07 -08:00
parent 773735bf6e
commit 03b8bf4671
9 changed files with 18 additions and 50 deletions

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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()

View File

@ -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,

View File

@ -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:

View File

@ -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:

View File

@ -1,5 +1,4 @@
beautifulsoup4 >= 4.1
PyPDF2==1.24
configparser
natsort
pillow>=4.3.0