2015-02-21 18:30:32 -08:00
|
|
|
"""A PyQT4 dialog to select specific series/volume from list"""
|
2022-06-02 18:32:16 -07:00
|
|
|
#
|
2015-02-21 18:30:32 -08:00
|
|
|
# Copyright 2012-2014 Anthony Beville
|
2022-06-02 18:32:16 -07:00
|
|
|
#
|
2015-02-21 18:30:32 -08:00
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
2022-06-02 18:32:16 -07:00
|
|
|
#
|
2015-02-21 18:30:32 -08:00
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
2022-06-02 18:32:16 -07:00
|
|
|
#
|
2015-02-21 18:30:32 -08:00
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
2022-06-02 18:32:16 -07:00
|
|
|
from __future__ import annotations
|
2012-11-06 12:56:30 -08:00
|
|
|
|
2022-06-07 11:49:56 -07:00
|
|
|
import itertools
|
2022-04-04 18:59:26 -07:00
|
|
|
import logging
|
2022-06-07 11:49:56 -07:00
|
|
|
from collections import deque
|
2015-02-13 15:08:07 -08:00
|
|
|
|
2022-12-14 23:13:53 -08:00
|
|
|
import settngs
|
2022-07-13 19:56:34 -07:00
|
|
|
from PyQt5 import QtCore, QtGui, QtWidgets, uic
|
Code cleanup
Remove no longer used google scripts
Remove convenience files from comicataggerlib and import comicapi directly
Add type-hints to facilitate auto-complete tools
Make PyQt5 code more compatible with PyQt6
Implement automatic tooling
isort and black for code formatting
Line length has been set to 120
flake8 for code standards with exceptions:
E203 - Whitespace before ':' - format compatiblity with black
E501 - Line too long - flake8 line limit cannot be set
E722 - Do not use bare except - fixing bare except statements is a
lot of overhead and there are already
many in the codebase
These changes, along with some manual fixes creates much more readable code.
See examples below:
diff --git a/comicapi/comet.py b/comicapi/comet.py
index d1741c5..52dc195 100644
--- a/comicapi/comet.py
+++ b/comicapi/comet.py
@@ -166,7 +166,2 @@ class CoMet:
- if credit['role'].lower() in set(self.editor_synonyms):
- ET.SubElement(
- root,
- 'editor').text = "{0}".format(
- credit['person'])
@@ -174,2 +169,4 @@ class CoMet:
self.indent(root)
+ if credit["role"].lower() in set(self.editor_synonyms):
+ ET.SubElement(root, "editor").text = str(credit["person"])
diff --git a/comictaggerlib/autotagmatchwindow.py b/comictaggerlib/autotagmatchwindow.py
index 4338176..9219f01 100644
--- a/comictaggerlib/autotagmatchwindow.py
+++ b/comictaggerlib/autotagmatchwindow.py
@@ -63,4 +63,3 @@ class AutoTagMatchWindow(QtWidgets.QDialog):
self.skipButton, QtWidgets.QDialogButtonBox.ActionRole)
- self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText(
- "Accept and Write Tags")
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText("Accept and Write Tags")
diff --git a/comictaggerlib/cli.py b/comictaggerlib/cli.py
index 688907d..dbd0c2e 100644
--- a/comictaggerlib/cli.py
+++ b/comictaggerlib/cli.py
@@ -293,7 +293,3 @@ def process_file_cli(filename, opts, settings, match_results):
if opts.raw:
- print((
- "{0}".format(
- str(
- ca.readRawCIX(),
- errors='ignore'))))
+ print(ca.read_raw_cix())
else:
2022-04-01 16:50:46 -07:00
|
|
|
from PyQt5.QtCore import pyqtSignal
|
|
|
|
|
|
|
|
from comicapi import utils
|
2022-05-17 13:57:04 -07:00
|
|
|
from comicapi.comicarchive import ComicArchive
|
Code cleanup
Remove no longer used google scripts
Remove convenience files from comicataggerlib and import comicapi directly
Add type-hints to facilitate auto-complete tools
Make PyQt5 code more compatible with PyQt6
Implement automatic tooling
isort and black for code formatting
Line length has been set to 120
flake8 for code standards with exceptions:
E203 - Whitespace before ':' - format compatiblity with black
E501 - Line too long - flake8 line limit cannot be set
E722 - Do not use bare except - fixing bare except statements is a
lot of overhead and there are already
many in the codebase
These changes, along with some manual fixes creates much more readable code.
See examples below:
diff --git a/comicapi/comet.py b/comicapi/comet.py
index d1741c5..52dc195 100644
--- a/comicapi/comet.py
+++ b/comicapi/comet.py
@@ -166,7 +166,2 @@ class CoMet:
- if credit['role'].lower() in set(self.editor_synonyms):
- ET.SubElement(
- root,
- 'editor').text = "{0}".format(
- credit['person'])
@@ -174,2 +169,4 @@ class CoMet:
self.indent(root)
+ if credit["role"].lower() in set(self.editor_synonyms):
+ ET.SubElement(root, "editor").text = str(credit["person"])
diff --git a/comictaggerlib/autotagmatchwindow.py b/comictaggerlib/autotagmatchwindow.py
index 4338176..9219f01 100644
--- a/comictaggerlib/autotagmatchwindow.py
+++ b/comictaggerlib/autotagmatchwindow.py
@@ -63,4 +63,3 @@ class AutoTagMatchWindow(QtWidgets.QDialog):
self.skipButton, QtWidgets.QDialogButtonBox.ActionRole)
- self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText(
- "Accept and Write Tags")
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText("Accept and Write Tags")
diff --git a/comictaggerlib/cli.py b/comictaggerlib/cli.py
index 688907d..dbd0c2e 100644
--- a/comictaggerlib/cli.py
+++ b/comictaggerlib/cli.py
@@ -293,7 +293,3 @@ def process_file_cli(filename, opts, settings, match_results):
if opts.raw:
- print((
- "{0}".format(
- str(
- ca.readRawCIX(),
- errors='ignore'))))
+ print(ca.read_raw_cix())
else:
2022-04-01 16:50:46 -07:00
|
|
|
from comicapi.genericmetadata import GenericMetadata
|
|
|
|
from comictaggerlib.coverimagewidget import CoverImageWidget
|
|
|
|
from comictaggerlib.issueidentifier import IssueIdentifier
|
|
|
|
from comictaggerlib.issueselectionwindow import IssueSelectionWindow
|
|
|
|
from comictaggerlib.matchselectionwindow import MatchSelectionWindow
|
|
|
|
from comictaggerlib.progresswindow import IDProgressWindow
|
2022-10-25 21:48:01 -07:00
|
|
|
from comictaggerlib.ui import ui_path
|
Code cleanup
Remove no longer used google scripts
Remove convenience files from comicataggerlib and import comicapi directly
Add type-hints to facilitate auto-complete tools
Make PyQt5 code more compatible with PyQt6
Implement automatic tooling
isort and black for code formatting
Line length has been set to 120
flake8 for code standards with exceptions:
E203 - Whitespace before ':' - format compatiblity with black
E501 - Line too long - flake8 line limit cannot be set
E722 - Do not use bare except - fixing bare except statements is a
lot of overhead and there are already
many in the codebase
These changes, along with some manual fixes creates much more readable code.
See examples below:
diff --git a/comicapi/comet.py b/comicapi/comet.py
index d1741c5..52dc195 100644
--- a/comicapi/comet.py
+++ b/comicapi/comet.py
@@ -166,7 +166,2 @@ class CoMet:
- if credit['role'].lower() in set(self.editor_synonyms):
- ET.SubElement(
- root,
- 'editor').text = "{0}".format(
- credit['person'])
@@ -174,2 +169,4 @@ class CoMet:
self.indent(root)
+ if credit["role"].lower() in set(self.editor_synonyms):
+ ET.SubElement(root, "editor").text = str(credit["person"])
diff --git a/comictaggerlib/autotagmatchwindow.py b/comictaggerlib/autotagmatchwindow.py
index 4338176..9219f01 100644
--- a/comictaggerlib/autotagmatchwindow.py
+++ b/comictaggerlib/autotagmatchwindow.py
@@ -63,4 +63,3 @@ class AutoTagMatchWindow(QtWidgets.QDialog):
self.skipButton, QtWidgets.QDialogButtonBox.ActionRole)
- self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText(
- "Accept and Write Tags")
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText("Accept and Write Tags")
diff --git a/comictaggerlib/cli.py b/comictaggerlib/cli.py
index 688907d..dbd0c2e 100644
--- a/comictaggerlib/cli.py
+++ b/comictaggerlib/cli.py
@@ -293,7 +293,3 @@ def process_file_cli(filename, opts, settings, match_results):
if opts.raw:
- print((
- "{0}".format(
- str(
- ca.readRawCIX(),
- errors='ignore'))))
+ print(ca.read_raw_cix())
else:
2022-04-01 16:50:46 -07:00
|
|
|
from comictaggerlib.ui.qtutils import reduce_widget_font_size
|
2022-12-21 17:00:59 -08:00
|
|
|
from comictalker.resulttypes import ComicSeries
|
2022-10-27 15:36:57 -07:00
|
|
|
from comictalker.talkerbase import ComicTalker, TalkerError
|
2012-11-12 16:12:43 -08:00
|
|
|
|
2022-04-04 18:59:26 -07:00
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
Code cleanup
Remove no longer used google scripts
Remove convenience files from comicataggerlib and import comicapi directly
Add type-hints to facilitate auto-complete tools
Make PyQt5 code more compatible with PyQt6
Implement automatic tooling
isort and black for code formatting
Line length has been set to 120
flake8 for code standards with exceptions:
E203 - Whitespace before ':' - format compatiblity with black
E501 - Line too long - flake8 line limit cannot be set
E722 - Do not use bare except - fixing bare except statements is a
lot of overhead and there are already
many in the codebase
These changes, along with some manual fixes creates much more readable code.
See examples below:
diff --git a/comicapi/comet.py b/comicapi/comet.py
index d1741c5..52dc195 100644
--- a/comicapi/comet.py
+++ b/comicapi/comet.py
@@ -166,7 +166,2 @@ class CoMet:
- if credit['role'].lower() in set(self.editor_synonyms):
- ET.SubElement(
- root,
- 'editor').text = "{0}".format(
- credit['person'])
@@ -174,2 +169,4 @@ class CoMet:
self.indent(root)
+ if credit["role"].lower() in set(self.editor_synonyms):
+ ET.SubElement(root, "editor").text = str(credit["person"])
diff --git a/comictaggerlib/autotagmatchwindow.py b/comictaggerlib/autotagmatchwindow.py
index 4338176..9219f01 100644
--- a/comictaggerlib/autotagmatchwindow.py
+++ b/comictaggerlib/autotagmatchwindow.py
@@ -63,4 +63,3 @@ class AutoTagMatchWindow(QtWidgets.QDialog):
self.skipButton, QtWidgets.QDialogButtonBox.ActionRole)
- self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText(
- "Accept and Write Tags")
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText("Accept and Write Tags")
diff --git a/comictaggerlib/cli.py b/comictaggerlib/cli.py
index 688907d..dbd0c2e 100644
--- a/comictaggerlib/cli.py
+++ b/comictaggerlib/cli.py
@@ -293,7 +293,3 @@ def process_file_cli(filename, opts, settings, match_results):
if opts.raw:
- print((
- "{0}".format(
- str(
- ca.readRawCIX(),
- errors='ignore'))))
+ print(ca.read_raw_cix())
else:
2022-04-01 16:50:46 -07:00
|
|
|
|
|
|
|
class SearchThread(QtCore.QThread):
|
2015-02-12 14:57:46 -08:00
|
|
|
searchComplete = pyqtSignal()
|
|
|
|
progressUpdate = pyqtSignal(int, int)
|
|
|
|
|
2022-10-04 15:50:55 -07:00
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
talker_api: ComicTalker,
|
|
|
|
series_name: str,
|
|
|
|
refresh: bool,
|
|
|
|
literal: bool = False,
|
|
|
|
series_match_thresh: int = 90,
|
|
|
|
) -> None:
|
2015-02-12 14:57:46 -08:00
|
|
|
QtCore.QThread.__init__(self)
|
2022-06-28 07:21:35 -07:00
|
|
|
self.talker_api = talker_api
|
2015-02-12 14:57:46 -08:00
|
|
|
self.series_name = series_name
|
2022-05-17 13:57:04 -07:00
|
|
|
self.refresh: bool = refresh
|
2022-06-28 07:21:35 -07:00
|
|
|
self.error_e: TalkerError
|
|
|
|
self.ct_error = False
|
2022-12-21 17:00:59 -08:00
|
|
|
self.ct_search_results: list[ComicSeries] = []
|
2022-06-07 11:49:56 -07:00
|
|
|
self.literal = literal
|
2022-07-08 12:33:00 -07:00
|
|
|
self.series_match_thresh = series_match_thresh
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
def run(self) -> None:
|
2015-02-12 14:57:46 -08:00
|
|
|
try:
|
2022-06-28 07:21:35 -07:00
|
|
|
self.ct_error = False
|
2022-10-27 15:36:57 -07:00
|
|
|
self.ct_search_results = self.talker_api.search_for_series(
|
2023-02-03 13:38:17 -08:00
|
|
|
self.series_name, self.prog_callback, self.refresh, self.literal, self.series_match_thresh
|
Code cleanup
Remove no longer used google scripts
Remove convenience files from comicataggerlib and import comicapi directly
Add type-hints to facilitate auto-complete tools
Make PyQt5 code more compatible with PyQt6
Implement automatic tooling
isort and black for code formatting
Line length has been set to 120
flake8 for code standards with exceptions:
E203 - Whitespace before ':' - format compatiblity with black
E501 - Line too long - flake8 line limit cannot be set
E722 - Do not use bare except - fixing bare except statements is a
lot of overhead and there are already
many in the codebase
These changes, along with some manual fixes creates much more readable code.
See examples below:
diff --git a/comicapi/comet.py b/comicapi/comet.py
index d1741c5..52dc195 100644
--- a/comicapi/comet.py
+++ b/comicapi/comet.py
@@ -166,7 +166,2 @@ class CoMet:
- if credit['role'].lower() in set(self.editor_synonyms):
- ET.SubElement(
- root,
- 'editor').text = "{0}".format(
- credit['person'])
@@ -174,2 +169,4 @@ class CoMet:
self.indent(root)
+ if credit["role"].lower() in set(self.editor_synonyms):
+ ET.SubElement(root, "editor").text = str(credit["person"])
diff --git a/comictaggerlib/autotagmatchwindow.py b/comictaggerlib/autotagmatchwindow.py
index 4338176..9219f01 100644
--- a/comictaggerlib/autotagmatchwindow.py
+++ b/comictaggerlib/autotagmatchwindow.py
@@ -63,4 +63,3 @@ class AutoTagMatchWindow(QtWidgets.QDialog):
self.skipButton, QtWidgets.QDialogButtonBox.ActionRole)
- self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText(
- "Accept and Write Tags")
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText("Accept and Write Tags")
diff --git a/comictaggerlib/cli.py b/comictaggerlib/cli.py
index 688907d..dbd0c2e 100644
--- a/comictaggerlib/cli.py
+++ b/comictaggerlib/cli.py
@@ -293,7 +293,3 @@ def process_file_cli(filename, opts, settings, match_results):
if opts.raw:
- print((
- "{0}".format(
- str(
- ca.readRawCIX(),
- errors='ignore'))))
+ print(ca.read_raw_cix())
else:
2022-04-01 16:50:46 -07:00
|
|
|
)
|
2022-06-28 07:21:35 -07:00
|
|
|
except TalkerError as e:
|
|
|
|
self.ct_search_results = []
|
|
|
|
self.ct_error = True
|
|
|
|
self.error_e = e
|
2015-02-12 14:57:46 -08:00
|
|
|
|
|
|
|
finally:
|
|
|
|
self.searchComplete.emit()
|
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
def prog_callback(self, current: int, total: int) -> None:
|
2015-02-12 14:57:46 -08:00
|
|
|
self.progressUpdate.emit(current, total)
|
2012-11-12 16:12:43 -08:00
|
|
|
|
|
|
|
|
2015-02-13 15:08:07 -08:00
|
|
|
class IdentifyThread(QtCore.QThread):
|
|
|
|
identifyComplete = pyqtSignal()
|
|
|
|
identifyLogMsg = pyqtSignal(str)
|
|
|
|
identifyProgress = pyqtSignal(int, int)
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
def __init__(self, identifier: IssueIdentifier) -> None:
|
2015-02-12 14:57:46 -08:00
|
|
|
QtCore.QThread.__init__(self)
|
|
|
|
self.identifier = identifier
|
Code cleanup
Remove no longer used google scripts
Remove convenience files from comicataggerlib and import comicapi directly
Add type-hints to facilitate auto-complete tools
Make PyQt5 code more compatible with PyQt6
Implement automatic tooling
isort and black for code formatting
Line length has been set to 120
flake8 for code standards with exceptions:
E203 - Whitespace before ':' - format compatiblity with black
E501 - Line too long - flake8 line limit cannot be set
E722 - Do not use bare except - fixing bare except statements is a
lot of overhead and there are already
many in the codebase
These changes, along with some manual fixes creates much more readable code.
See examples below:
diff --git a/comicapi/comet.py b/comicapi/comet.py
index d1741c5..52dc195 100644
--- a/comicapi/comet.py
+++ b/comicapi/comet.py
@@ -166,7 +166,2 @@ class CoMet:
- if credit['role'].lower() in set(self.editor_synonyms):
- ET.SubElement(
- root,
- 'editor').text = "{0}".format(
- credit['person'])
@@ -174,2 +169,4 @@ class CoMet:
self.indent(root)
+ if credit["role"].lower() in set(self.editor_synonyms):
+ ET.SubElement(root, "editor").text = str(credit["person"])
diff --git a/comictaggerlib/autotagmatchwindow.py b/comictaggerlib/autotagmatchwindow.py
index 4338176..9219f01 100644
--- a/comictaggerlib/autotagmatchwindow.py
+++ b/comictaggerlib/autotagmatchwindow.py
@@ -63,4 +63,3 @@ class AutoTagMatchWindow(QtWidgets.QDialog):
self.skipButton, QtWidgets.QDialogButtonBox.ActionRole)
- self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText(
- "Accept and Write Tags")
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText("Accept and Write Tags")
diff --git a/comictaggerlib/cli.py b/comictaggerlib/cli.py
index 688907d..dbd0c2e 100644
--- a/comictaggerlib/cli.py
+++ b/comictaggerlib/cli.py
@@ -293,7 +293,3 @@ def process_file_cli(filename, opts, settings, match_results):
if opts.raw:
- print((
- "{0}".format(
- str(
- ca.readRawCIX(),
- errors='ignore'))))
+ print(ca.read_raw_cix())
else:
2022-04-01 16:50:46 -07:00
|
|
|
self.identifier.set_output_function(self.log_output)
|
|
|
|
self.identifier.set_progress_callback(self.progress_callback)
|
2012-11-12 16:12:43 -08:00
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
def log_output(self, text: str) -> None:
|
Code cleanup
Remove no longer used google scripts
Remove convenience files from comicataggerlib and import comicapi directly
Add type-hints to facilitate auto-complete tools
Make PyQt5 code more compatible with PyQt6
Implement automatic tooling
isort and black for code formatting
Line length has been set to 120
flake8 for code standards with exceptions:
E203 - Whitespace before ':' - format compatiblity with black
E501 - Line too long - flake8 line limit cannot be set
E722 - Do not use bare except - fixing bare except statements is a
lot of overhead and there are already
many in the codebase
These changes, along with some manual fixes creates much more readable code.
See examples below:
diff --git a/comicapi/comet.py b/comicapi/comet.py
index d1741c5..52dc195 100644
--- a/comicapi/comet.py
+++ b/comicapi/comet.py
@@ -166,7 +166,2 @@ class CoMet:
- if credit['role'].lower() in set(self.editor_synonyms):
- ET.SubElement(
- root,
- 'editor').text = "{0}".format(
- credit['person'])
@@ -174,2 +169,4 @@ class CoMet:
self.indent(root)
+ if credit["role"].lower() in set(self.editor_synonyms):
+ ET.SubElement(root, "editor").text = str(credit["person"])
diff --git a/comictaggerlib/autotagmatchwindow.py b/comictaggerlib/autotagmatchwindow.py
index 4338176..9219f01 100644
--- a/comictaggerlib/autotagmatchwindow.py
+++ b/comictaggerlib/autotagmatchwindow.py
@@ -63,4 +63,3 @@ class AutoTagMatchWindow(QtWidgets.QDialog):
self.skipButton, QtWidgets.QDialogButtonBox.ActionRole)
- self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText(
- "Accept and Write Tags")
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText("Accept and Write Tags")
diff --git a/comictaggerlib/cli.py b/comictaggerlib/cli.py
index 688907d..dbd0c2e 100644
--- a/comictaggerlib/cli.py
+++ b/comictaggerlib/cli.py
@@ -293,7 +293,3 @@ def process_file_cli(filename, opts, settings, match_results):
if opts.raw:
- print((
- "{0}".format(
- str(
- ca.readRawCIX(),
- errors='ignore'))))
+ print(ca.read_raw_cix())
else:
2022-04-01 16:50:46 -07:00
|
|
|
self.identifyLogMsg.emit(str(text))
|
2012-11-12 16:12:43 -08:00
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
def progress_callback(self, cur: int, total: int) -> None:
|
2015-02-13 15:08:07 -08:00
|
|
|
self.identifyProgress.emit(cur, total)
|
2012-11-12 16:12:43 -08:00
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
def run(self) -> None:
|
Code cleanup
Remove no longer used google scripts
Remove convenience files from comicataggerlib and import comicapi directly
Add type-hints to facilitate auto-complete tools
Make PyQt5 code more compatible with PyQt6
Implement automatic tooling
isort and black for code formatting
Line length has been set to 120
flake8 for code standards with exceptions:
E203 - Whitespace before ':' - format compatiblity with black
E501 - Line too long - flake8 line limit cannot be set
E722 - Do not use bare except - fixing bare except statements is a
lot of overhead and there are already
many in the codebase
These changes, along with some manual fixes creates much more readable code.
See examples below:
diff --git a/comicapi/comet.py b/comicapi/comet.py
index d1741c5..52dc195 100644
--- a/comicapi/comet.py
+++ b/comicapi/comet.py
@@ -166,7 +166,2 @@ class CoMet:
- if credit['role'].lower() in set(self.editor_synonyms):
- ET.SubElement(
- root,
- 'editor').text = "{0}".format(
- credit['person'])
@@ -174,2 +169,4 @@ class CoMet:
self.indent(root)
+ if credit["role"].lower() in set(self.editor_synonyms):
+ ET.SubElement(root, "editor").text = str(credit["person"])
diff --git a/comictaggerlib/autotagmatchwindow.py b/comictaggerlib/autotagmatchwindow.py
index 4338176..9219f01 100644
--- a/comictaggerlib/autotagmatchwindow.py
+++ b/comictaggerlib/autotagmatchwindow.py
@@ -63,4 +63,3 @@ class AutoTagMatchWindow(QtWidgets.QDialog):
self.skipButton, QtWidgets.QDialogButtonBox.ActionRole)
- self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText(
- "Accept and Write Tags")
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText("Accept and Write Tags")
diff --git a/comictaggerlib/cli.py b/comictaggerlib/cli.py
index 688907d..dbd0c2e 100644
--- a/comictaggerlib/cli.py
+++ b/comictaggerlib/cli.py
@@ -293,7 +293,3 @@ def process_file_cli(filename, opts, settings, match_results):
if opts.raw:
- print((
- "{0}".format(
- str(
- ca.readRawCIX(),
- errors='ignore'))))
+ print(ca.read_raw_cix())
else:
2022-04-01 16:50:46 -07:00
|
|
|
self.identifier.search()
|
2015-02-13 15:08:07 -08:00
|
|
|
self.identifyComplete.emit()
|
2012-11-12 16:12:43 -08:00
|
|
|
|
|
|
|
|
2022-12-21 17:00:59 -08:00
|
|
|
class SeriesSelectionWindow(QtWidgets.QDialog):
|
Code cleanup
Remove no longer used google scripts
Remove convenience files from comicataggerlib and import comicapi directly
Add type-hints to facilitate auto-complete tools
Make PyQt5 code more compatible with PyQt6
Implement automatic tooling
isort and black for code formatting
Line length has been set to 120
flake8 for code standards with exceptions:
E203 - Whitespace before ':' - format compatiblity with black
E501 - Line too long - flake8 line limit cannot be set
E722 - Do not use bare except - fixing bare except statements is a
lot of overhead and there are already
many in the codebase
These changes, along with some manual fixes creates much more readable code.
See examples below:
diff --git a/comicapi/comet.py b/comicapi/comet.py
index d1741c5..52dc195 100644
--- a/comicapi/comet.py
+++ b/comicapi/comet.py
@@ -166,7 +166,2 @@ class CoMet:
- if credit['role'].lower() in set(self.editor_synonyms):
- ET.SubElement(
- root,
- 'editor').text = "{0}".format(
- credit['person'])
@@ -174,2 +169,4 @@ class CoMet:
self.indent(root)
+ if credit["role"].lower() in set(self.editor_synonyms):
+ ET.SubElement(root, "editor").text = str(credit["person"])
diff --git a/comictaggerlib/autotagmatchwindow.py b/comictaggerlib/autotagmatchwindow.py
index 4338176..9219f01 100644
--- a/comictaggerlib/autotagmatchwindow.py
+++ b/comictaggerlib/autotagmatchwindow.py
@@ -63,4 +63,3 @@ class AutoTagMatchWindow(QtWidgets.QDialog):
self.skipButton, QtWidgets.QDialogButtonBox.ActionRole)
- self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText(
- "Accept and Write Tags")
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText("Accept and Write Tags")
diff --git a/comictaggerlib/cli.py b/comictaggerlib/cli.py
index 688907d..dbd0c2e 100644
--- a/comictaggerlib/cli.py
+++ b/comictaggerlib/cli.py
@@ -293,7 +293,3 @@ def process_file_cli(filename, opts, settings, match_results):
if opts.raw:
- print((
- "{0}".format(
- str(
- ca.readRawCIX(),
- errors='ignore'))))
+ print(ca.read_raw_cix())
else:
2022-04-01 16:50:46 -07:00
|
|
|
def __init__(
|
|
|
|
self,
|
2022-05-17 13:57:04 -07:00
|
|
|
parent: QtWidgets.QWidget,
|
|
|
|
series_name: str,
|
|
|
|
issue_number: str,
|
2022-06-02 18:32:16 -07:00
|
|
|
year: int | None,
|
2022-05-17 13:57:04 -07:00
|
|
|
issue_count: int,
|
|
|
|
cover_index_list: list[int],
|
2022-11-28 21:44:01 -08:00
|
|
|
comic_archive: ComicArchive | None,
|
2022-12-15 20:10:35 -08:00
|
|
|
options: settngs.Namespace,
|
2022-06-28 07:21:35 -07:00
|
|
|
talker_api: ComicTalker,
|
2022-05-17 13:57:04 -07:00
|
|
|
autoselect: bool = False,
|
2022-06-07 11:49:56 -07:00
|
|
|
literal: bool = False,
|
2022-05-17 13:57:04 -07:00
|
|
|
) -> None:
|
Code cleanup
Remove no longer used google scripts
Remove convenience files from comicataggerlib and import comicapi directly
Add type-hints to facilitate auto-complete tools
Make PyQt5 code more compatible with PyQt6
Implement automatic tooling
isort and black for code formatting
Line length has been set to 120
flake8 for code standards with exceptions:
E203 - Whitespace before ':' - format compatiblity with black
E501 - Line too long - flake8 line limit cannot be set
E722 - Do not use bare except - fixing bare except statements is a
lot of overhead and there are already
many in the codebase
These changes, along with some manual fixes creates much more readable code.
See examples below:
diff --git a/comicapi/comet.py b/comicapi/comet.py
index d1741c5..52dc195 100644
--- a/comicapi/comet.py
+++ b/comicapi/comet.py
@@ -166,7 +166,2 @@ class CoMet:
- if credit['role'].lower() in set(self.editor_synonyms):
- ET.SubElement(
- root,
- 'editor').text = "{0}".format(
- credit['person'])
@@ -174,2 +169,4 @@ class CoMet:
self.indent(root)
+ if credit["role"].lower() in set(self.editor_synonyms):
+ ET.SubElement(root, "editor").text = str(credit["person"])
diff --git a/comictaggerlib/autotagmatchwindow.py b/comictaggerlib/autotagmatchwindow.py
index 4338176..9219f01 100644
--- a/comictaggerlib/autotagmatchwindow.py
+++ b/comictaggerlib/autotagmatchwindow.py
@@ -63,4 +63,3 @@ class AutoTagMatchWindow(QtWidgets.QDialog):
self.skipButton, QtWidgets.QDialogButtonBox.ActionRole)
- self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText(
- "Accept and Write Tags")
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText("Accept and Write Tags")
diff --git a/comictaggerlib/cli.py b/comictaggerlib/cli.py
index 688907d..dbd0c2e 100644
--- a/comictaggerlib/cli.py
+++ b/comictaggerlib/cli.py
@@ -293,7 +293,3 @@ def process_file_cli(filename, opts, settings, match_results):
if opts.raw:
- print((
- "{0}".format(
- str(
- ca.readRawCIX(),
- errors='ignore'))))
+ print(ca.read_raw_cix())
else:
2022-04-01 16:50:46 -07:00
|
|
|
super().__init__(parent)
|
|
|
|
|
2022-12-23 00:09:19 -08:00
|
|
|
uic.loadUi(ui_path / "seriesselectionwindow.ui", self)
|
Code cleanup
Remove no longer used google scripts
Remove convenience files from comicataggerlib and import comicapi directly
Add type-hints to facilitate auto-complete tools
Make PyQt5 code more compatible with PyQt6
Implement automatic tooling
isort and black for code formatting
Line length has been set to 120
flake8 for code standards with exceptions:
E203 - Whitespace before ':' - format compatiblity with black
E501 - Line too long - flake8 line limit cannot be set
E722 - Do not use bare except - fixing bare except statements is a
lot of overhead and there are already
many in the codebase
These changes, along with some manual fixes creates much more readable code.
See examples below:
diff --git a/comicapi/comet.py b/comicapi/comet.py
index d1741c5..52dc195 100644
--- a/comicapi/comet.py
+++ b/comicapi/comet.py
@@ -166,7 +166,2 @@ class CoMet:
- if credit['role'].lower() in set(self.editor_synonyms):
- ET.SubElement(
- root,
- 'editor').text = "{0}".format(
- credit['person'])
@@ -174,2 +169,4 @@ class CoMet:
self.indent(root)
+ if credit["role"].lower() in set(self.editor_synonyms):
+ ET.SubElement(root, "editor").text = str(credit["person"])
diff --git a/comictaggerlib/autotagmatchwindow.py b/comictaggerlib/autotagmatchwindow.py
index 4338176..9219f01 100644
--- a/comictaggerlib/autotagmatchwindow.py
+++ b/comictaggerlib/autotagmatchwindow.py
@@ -63,4 +63,3 @@ class AutoTagMatchWindow(QtWidgets.QDialog):
self.skipButton, QtWidgets.QDialogButtonBox.ActionRole)
- self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText(
- "Accept and Write Tags")
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText("Accept and Write Tags")
diff --git a/comictaggerlib/cli.py b/comictaggerlib/cli.py
index 688907d..dbd0c2e 100644
--- a/comictaggerlib/cli.py
+++ b/comictaggerlib/cli.py
@@ -293,7 +293,3 @@ def process_file_cli(filename, opts, settings, match_results):
if opts.raw:
- print((
- "{0}".format(
- str(
- ca.readRawCIX(),
- errors='ignore'))))
+ print(ca.read_raw_cix())
else:
2022-04-01 16:50:46 -07:00
|
|
|
|
2022-12-06 00:20:01 -08:00
|
|
|
self.imageWidget = CoverImageWidget(
|
2022-12-15 20:10:35 -08:00
|
|
|
self.imageContainer, CoverImageWidget.URLMode, options.runtime_config.user_cache_dir, talker_api
|
2022-12-06 00:20:01 -08:00
|
|
|
)
|
2018-09-19 13:05:39 -07:00
|
|
|
gridlayout = QtWidgets.QGridLayout(self.imageContainer)
|
2015-02-13 15:08:07 -08:00
|
|
|
gridlayout.addWidget(self.imageWidget)
|
2015-02-15 02:44:00 -08:00
|
|
|
gridlayout.setContentsMargins(0, 0, 0, 0)
|
2015-02-12 14:57:46 -08:00
|
|
|
|
Code cleanup
Remove no longer used google scripts
Remove convenience files from comicataggerlib and import comicapi directly
Add type-hints to facilitate auto-complete tools
Make PyQt5 code more compatible with PyQt6
Implement automatic tooling
isort and black for code formatting
Line length has been set to 120
flake8 for code standards with exceptions:
E203 - Whitespace before ':' - format compatiblity with black
E501 - Line too long - flake8 line limit cannot be set
E722 - Do not use bare except - fixing bare except statements is a
lot of overhead and there are already
many in the codebase
These changes, along with some manual fixes creates much more readable code.
See examples below:
diff --git a/comicapi/comet.py b/comicapi/comet.py
index d1741c5..52dc195 100644
--- a/comicapi/comet.py
+++ b/comicapi/comet.py
@@ -166,7 +166,2 @@ class CoMet:
- if credit['role'].lower() in set(self.editor_synonyms):
- ET.SubElement(
- root,
- 'editor').text = "{0}".format(
- credit['person'])
@@ -174,2 +169,4 @@ class CoMet:
self.indent(root)
+ if credit["role"].lower() in set(self.editor_synonyms):
+ ET.SubElement(root, "editor").text = str(credit["person"])
diff --git a/comictaggerlib/autotagmatchwindow.py b/comictaggerlib/autotagmatchwindow.py
index 4338176..9219f01 100644
--- a/comictaggerlib/autotagmatchwindow.py
+++ b/comictaggerlib/autotagmatchwindow.py
@@ -63,4 +63,3 @@ class AutoTagMatchWindow(QtWidgets.QDialog):
self.skipButton, QtWidgets.QDialogButtonBox.ActionRole)
- self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText(
- "Accept and Write Tags")
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText("Accept and Write Tags")
diff --git a/comictaggerlib/cli.py b/comictaggerlib/cli.py
index 688907d..dbd0c2e 100644
--- a/comictaggerlib/cli.py
+++ b/comictaggerlib/cli.py
@@ -293,7 +293,3 @@ def process_file_cli(filename, opts, settings, match_results):
if opts.raw:
- print((
- "{0}".format(
- str(
- ca.readRawCIX(),
- errors='ignore'))))
+ print(ca.read_raw_cix())
else:
2022-04-01 16:50:46 -07:00
|
|
|
reduce_widget_font_size(self.teDetails, 1)
|
|
|
|
reduce_widget_font_size(self.twList)
|
2015-02-12 14:57:46 -08:00
|
|
|
|
Code cleanup
Remove no longer used google scripts
Remove convenience files from comicataggerlib and import comicapi directly
Add type-hints to facilitate auto-complete tools
Make PyQt5 code more compatible with PyQt6
Implement automatic tooling
isort and black for code formatting
Line length has been set to 120
flake8 for code standards with exceptions:
E203 - Whitespace before ':' - format compatiblity with black
E501 - Line too long - flake8 line limit cannot be set
E722 - Do not use bare except - fixing bare except statements is a
lot of overhead and there are already
many in the codebase
These changes, along with some manual fixes creates much more readable code.
See examples below:
diff --git a/comicapi/comet.py b/comicapi/comet.py
index d1741c5..52dc195 100644
--- a/comicapi/comet.py
+++ b/comicapi/comet.py
@@ -166,7 +166,2 @@ class CoMet:
- if credit['role'].lower() in set(self.editor_synonyms):
- ET.SubElement(
- root,
- 'editor').text = "{0}".format(
- credit['person'])
@@ -174,2 +169,4 @@ class CoMet:
self.indent(root)
+ if credit["role"].lower() in set(self.editor_synonyms):
+ ET.SubElement(root, "editor").text = str(credit["person"])
diff --git a/comictaggerlib/autotagmatchwindow.py b/comictaggerlib/autotagmatchwindow.py
index 4338176..9219f01 100644
--- a/comictaggerlib/autotagmatchwindow.py
+++ b/comictaggerlib/autotagmatchwindow.py
@@ -63,4 +63,3 @@ class AutoTagMatchWindow(QtWidgets.QDialog):
self.skipButton, QtWidgets.QDialogButtonBox.ActionRole)
- self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText(
- "Accept and Write Tags")
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText("Accept and Write Tags")
diff --git a/comictaggerlib/cli.py b/comictaggerlib/cli.py
index 688907d..dbd0c2e 100644
--- a/comictaggerlib/cli.py
+++ b/comictaggerlib/cli.py
@@ -293,7 +293,3 @@ def process_file_cli(filename, opts, settings, match_results):
if opts.raw:
- print((
- "{0}".format(
- str(
- ca.readRawCIX(),
- errors='ignore'))))
+ print(ca.read_raw_cix())
else:
2022-04-01 16:50:46 -07:00
|
|
|
self.setWindowFlags(
|
|
|
|
QtCore.Qt.WindowType(
|
|
|
|
self.windowFlags()
|
|
|
|
| QtCore.Qt.WindowType.WindowSystemMenuHint
|
|
|
|
| QtCore.Qt.WindowType.WindowMaximizeButtonHint
|
|
|
|
)
|
|
|
|
)
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-12-06 00:20:01 -08:00
|
|
|
self.options = options
|
2015-02-12 14:57:46 -08:00
|
|
|
self.series_name = series_name
|
|
|
|
self.issue_number = issue_number
|
2022-12-23 00:09:19 -08:00
|
|
|
self.issue_id: str = ""
|
2015-02-12 14:57:46 -08:00
|
|
|
self.year = year
|
|
|
|
self.issue_count = issue_count
|
2022-12-23 00:09:19 -08:00
|
|
|
self.series_id: str = ""
|
2015-02-12 14:57:46 -08:00
|
|
|
self.comic_archive = comic_archive
|
|
|
|
self.immediate_autoselect = autoselect
|
|
|
|
self.cover_index_list = cover_index_list
|
2022-12-21 17:00:59 -08:00
|
|
|
self.ct_search_results: list[ComicSeries] = []
|
2022-06-07 11:49:56 -07:00
|
|
|
self.literal = literal
|
2022-06-02 18:32:16 -07:00
|
|
|
self.ii: IssueIdentifier | None = None
|
|
|
|
self.iddialog: IDProgressWindow | None = None
|
|
|
|
self.id_thread: IdentifyThread | None = None
|
|
|
|
self.progdialog: QtWidgets.QProgressDialog | None = None
|
|
|
|
self.search_thread: SearchThread | None = None
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2023-01-25 11:10:58 -08:00
|
|
|
self.use_filter = self.options.talkers_always_use_publisher_filter
|
2022-01-22 14:40:45 -08:00
|
|
|
|
2022-06-28 07:21:35 -07:00
|
|
|
# Load to retrieve settings
|
|
|
|
self.talker_api = talker_api
|
|
|
|
|
2023-01-04 15:51:39 -08:00
|
|
|
# Display talker logo and set url
|
2023-01-22 09:16:33 -08:00
|
|
|
self.lblSourceName.setText(talker_api.static_options.attribution_string)
|
2023-01-12 08:58:50 -08:00
|
|
|
|
|
|
|
self.imageSourceWidget = CoverImageWidget(
|
2023-01-13 13:27:40 -08:00
|
|
|
self.imageSourceLogo,
|
2023-01-12 08:58:50 -08:00
|
|
|
CoverImageWidget.URLMode,
|
|
|
|
options.runtime_config.user_cache_dir,
|
|
|
|
talker_api,
|
|
|
|
False,
|
|
|
|
)
|
2023-01-13 13:27:40 -08:00
|
|
|
gridlayoutSourceLogo = QtWidgets.QGridLayout(self.imageSourceLogo)
|
2023-01-12 08:58:50 -08:00
|
|
|
gridlayoutSourceLogo.addWidget(self.imageSourceWidget)
|
2023-01-13 13:27:40 -08:00
|
|
|
gridlayoutSourceLogo.setContentsMargins(0, 2, 0, 0)
|
2023-01-12 08:58:50 -08:00
|
|
|
self.imageSourceWidget.set_url(talker_api.source_details.logo)
|
2023-01-04 15:51:39 -08:00
|
|
|
|
2022-11-28 20:54:24 -08:00
|
|
|
# Set the minimum row height to the default.
|
|
|
|
# this way rows will be more consistent when resizeRowsToContents is called
|
|
|
|
self.twList.verticalHeader().setMinimumSectionSize(self.twList.verticalHeader().defaultSectionSize())
|
Code cleanup
Remove no longer used google scripts
Remove convenience files from comicataggerlib and import comicapi directly
Add type-hints to facilitate auto-complete tools
Make PyQt5 code more compatible with PyQt6
Implement automatic tooling
isort and black for code formatting
Line length has been set to 120
flake8 for code standards with exceptions:
E203 - Whitespace before ':' - format compatiblity with black
E501 - Line too long - flake8 line limit cannot be set
E722 - Do not use bare except - fixing bare except statements is a
lot of overhead and there are already
many in the codebase
These changes, along with some manual fixes creates much more readable code.
See examples below:
diff --git a/comicapi/comet.py b/comicapi/comet.py
index d1741c5..52dc195 100644
--- a/comicapi/comet.py
+++ b/comicapi/comet.py
@@ -166,7 +166,2 @@ class CoMet:
- if credit['role'].lower() in set(self.editor_synonyms):
- ET.SubElement(
- root,
- 'editor').text = "{0}".format(
- credit['person'])
@@ -174,2 +169,4 @@ class CoMet:
self.indent(root)
+ if credit["role"].lower() in set(self.editor_synonyms):
+ ET.SubElement(root, "editor").text = str(credit["person"])
diff --git a/comictaggerlib/autotagmatchwindow.py b/comictaggerlib/autotagmatchwindow.py
index 4338176..9219f01 100644
--- a/comictaggerlib/autotagmatchwindow.py
+++ b/comictaggerlib/autotagmatchwindow.py
@@ -63,4 +63,3 @@ class AutoTagMatchWindow(QtWidgets.QDialog):
self.skipButton, QtWidgets.QDialogButtonBox.ActionRole)
- self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText(
- "Accept and Write Tags")
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText("Accept and Write Tags")
diff --git a/comictaggerlib/cli.py b/comictaggerlib/cli.py
index 688907d..dbd0c2e 100644
--- a/comictaggerlib/cli.py
+++ b/comictaggerlib/cli.py
@@ -293,7 +293,3 @@ def process_file_cli(filename, opts, settings, match_results):
if opts.raw:
- print((
- "{0}".format(
- str(
- ca.readRawCIX(),
- errors='ignore'))))
+ print(ca.read_raw_cix())
else:
2022-04-01 16:50:46 -07:00
|
|
|
self.twList.currentItemChanged.connect(self.current_item_changed)
|
|
|
|
self.twList.cellDoubleClicked.connect(self.cell_double_clicked)
|
2015-02-12 14:57:46 -08:00
|
|
|
self.btnRequery.clicked.connect(self.requery)
|
Code cleanup
Remove no longer used google scripts
Remove convenience files from comicataggerlib and import comicapi directly
Add type-hints to facilitate auto-complete tools
Make PyQt5 code more compatible with PyQt6
Implement automatic tooling
isort and black for code formatting
Line length has been set to 120
flake8 for code standards with exceptions:
E203 - Whitespace before ':' - format compatiblity with black
E501 - Line too long - flake8 line limit cannot be set
E722 - Do not use bare except - fixing bare except statements is a
lot of overhead and there are already
many in the codebase
These changes, along with some manual fixes creates much more readable code.
See examples below:
diff --git a/comicapi/comet.py b/comicapi/comet.py
index d1741c5..52dc195 100644
--- a/comicapi/comet.py
+++ b/comicapi/comet.py
@@ -166,7 +166,2 @@ class CoMet:
- if credit['role'].lower() in set(self.editor_synonyms):
- ET.SubElement(
- root,
- 'editor').text = "{0}".format(
- credit['person'])
@@ -174,2 +169,4 @@ class CoMet:
self.indent(root)
+ if credit["role"].lower() in set(self.editor_synonyms):
+ ET.SubElement(root, "editor").text = str(credit["person"])
diff --git a/comictaggerlib/autotagmatchwindow.py b/comictaggerlib/autotagmatchwindow.py
index 4338176..9219f01 100644
--- a/comictaggerlib/autotagmatchwindow.py
+++ b/comictaggerlib/autotagmatchwindow.py
@@ -63,4 +63,3 @@ class AutoTagMatchWindow(QtWidgets.QDialog):
self.skipButton, QtWidgets.QDialogButtonBox.ActionRole)
- self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText(
- "Accept and Write Tags")
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText("Accept and Write Tags")
diff --git a/comictaggerlib/cli.py b/comictaggerlib/cli.py
index 688907d..dbd0c2e 100644
--- a/comictaggerlib/cli.py
+++ b/comictaggerlib/cli.py
@@ -293,7 +293,3 @@ def process_file_cli(filename, opts, settings, match_results):
if opts.raw:
- print((
- "{0}".format(
- str(
- ca.readRawCIX(),
- errors='ignore'))))
+ print(ca.read_raw_cix())
else:
2022-04-01 16:50:46 -07:00
|
|
|
self.btnIssues.clicked.connect(self.show_issues)
|
|
|
|
self.btnAutoSelect.clicked.connect(self.auto_select)
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-01-22 15:00:22 -08:00
|
|
|
self.cbxFilter.setChecked(self.use_filter)
|
Code cleanup
Remove no longer used google scripts
Remove convenience files from comicataggerlib and import comicapi directly
Add type-hints to facilitate auto-complete tools
Make PyQt5 code more compatible with PyQt6
Implement automatic tooling
isort and black for code formatting
Line length has been set to 120
flake8 for code standards with exceptions:
E203 - Whitespace before ':' - format compatiblity with black
E501 - Line too long - flake8 line limit cannot be set
E722 - Do not use bare except - fixing bare except statements is a
lot of overhead and there are already
many in the codebase
These changes, along with some manual fixes creates much more readable code.
See examples below:
diff --git a/comicapi/comet.py b/comicapi/comet.py
index d1741c5..52dc195 100644
--- a/comicapi/comet.py
+++ b/comicapi/comet.py
@@ -166,7 +166,2 @@ class CoMet:
- if credit['role'].lower() in set(self.editor_synonyms):
- ET.SubElement(
- root,
- 'editor').text = "{0}".format(
- credit['person'])
@@ -174,2 +169,4 @@ class CoMet:
self.indent(root)
+ if credit["role"].lower() in set(self.editor_synonyms):
+ ET.SubElement(root, "editor").text = str(credit["person"])
diff --git a/comictaggerlib/autotagmatchwindow.py b/comictaggerlib/autotagmatchwindow.py
index 4338176..9219f01 100644
--- a/comictaggerlib/autotagmatchwindow.py
+++ b/comictaggerlib/autotagmatchwindow.py
@@ -63,4 +63,3 @@ class AutoTagMatchWindow(QtWidgets.QDialog):
self.skipButton, QtWidgets.QDialogButtonBox.ActionRole)
- self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText(
- "Accept and Write Tags")
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText("Accept and Write Tags")
diff --git a/comictaggerlib/cli.py b/comictaggerlib/cli.py
index 688907d..dbd0c2e 100644
--- a/comictaggerlib/cli.py
+++ b/comictaggerlib/cli.py
@@ -293,7 +293,3 @@ def process_file_cli(filename, opts, settings, match_results):
if opts.raw:
- print((
- "{0}".format(
- str(
- ca.readRawCIX(),
- errors='ignore'))))
+ print(ca.read_raw_cix())
else:
2022-04-01 16:50:46 -07:00
|
|
|
self.cbxFilter.toggled.connect(self.filter_toggled)
|
2022-01-22 14:40:45 -08:00
|
|
|
|
Code cleanup
Remove no longer used google scripts
Remove convenience files from comicataggerlib and import comicapi directly
Add type-hints to facilitate auto-complete tools
Make PyQt5 code more compatible with PyQt6
Implement automatic tooling
isort and black for code formatting
Line length has been set to 120
flake8 for code standards with exceptions:
E203 - Whitespace before ':' - format compatiblity with black
E501 - Line too long - flake8 line limit cannot be set
E722 - Do not use bare except - fixing bare except statements is a
lot of overhead and there are already
many in the codebase
These changes, along with some manual fixes creates much more readable code.
See examples below:
diff --git a/comicapi/comet.py b/comicapi/comet.py
index d1741c5..52dc195 100644
--- a/comicapi/comet.py
+++ b/comicapi/comet.py
@@ -166,7 +166,2 @@ class CoMet:
- if credit['role'].lower() in set(self.editor_synonyms):
- ET.SubElement(
- root,
- 'editor').text = "{0}".format(
- credit['person'])
@@ -174,2 +169,4 @@ class CoMet:
self.indent(root)
+ if credit["role"].lower() in set(self.editor_synonyms):
+ ET.SubElement(root, "editor").text = str(credit["person"])
diff --git a/comictaggerlib/autotagmatchwindow.py b/comictaggerlib/autotagmatchwindow.py
index 4338176..9219f01 100644
--- a/comictaggerlib/autotagmatchwindow.py
+++ b/comictaggerlib/autotagmatchwindow.py
@@ -63,4 +63,3 @@ class AutoTagMatchWindow(QtWidgets.QDialog):
self.skipButton, QtWidgets.QDialogButtonBox.ActionRole)
- self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText(
- "Accept and Write Tags")
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText("Accept and Write Tags")
diff --git a/comictaggerlib/cli.py b/comictaggerlib/cli.py
index 688907d..dbd0c2e 100644
--- a/comictaggerlib/cli.py
+++ b/comictaggerlib/cli.py
@@ -293,7 +293,3 @@ def process_file_cli(filename, opts, settings, match_results):
if opts.raw:
- print((
- "{0}".format(
- str(
- ca.readRawCIX(),
- errors='ignore'))))
+ print(ca.read_raw_cix())
else:
2022-04-01 16:50:46 -07:00
|
|
|
self.update_buttons()
|
2015-02-12 14:57:46 -08:00
|
|
|
self.twList.selectRow(0)
|
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
def update_buttons(self) -> None:
|
2022-06-28 07:21:35 -07:00
|
|
|
enabled = bool(self.ct_search_results)
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2015-02-13 15:08:07 -08:00
|
|
|
self.btnRequery.setEnabled(enabled)
|
2022-06-28 07:21:35 -07:00
|
|
|
|
2022-11-18 15:18:41 -08:00
|
|
|
self.btnIssues.setEnabled(enabled)
|
|
|
|
self.btnAutoSelect.setEnabled(enabled)
|
2022-06-28 07:21:35 -07:00
|
|
|
|
Code cleanup
Remove no longer used google scripts
Remove convenience files from comicataggerlib and import comicapi directly
Add type-hints to facilitate auto-complete tools
Make PyQt5 code more compatible with PyQt6
Implement automatic tooling
isort and black for code formatting
Line length has been set to 120
flake8 for code standards with exceptions:
E203 - Whitespace before ':' - format compatiblity with black
E501 - Line too long - flake8 line limit cannot be set
E722 - Do not use bare except - fixing bare except statements is a
lot of overhead and there are already
many in the codebase
These changes, along with some manual fixes creates much more readable code.
See examples below:
diff --git a/comicapi/comet.py b/comicapi/comet.py
index d1741c5..52dc195 100644
--- a/comicapi/comet.py
+++ b/comicapi/comet.py
@@ -166,7 +166,2 @@ class CoMet:
- if credit['role'].lower() in set(self.editor_synonyms):
- ET.SubElement(
- root,
- 'editor').text = "{0}".format(
- credit['person'])
@@ -174,2 +169,4 @@ class CoMet:
self.indent(root)
+ if credit["role"].lower() in set(self.editor_synonyms):
+ ET.SubElement(root, "editor").text = str(credit["person"])
diff --git a/comictaggerlib/autotagmatchwindow.py b/comictaggerlib/autotagmatchwindow.py
index 4338176..9219f01 100644
--- a/comictaggerlib/autotagmatchwindow.py
+++ b/comictaggerlib/autotagmatchwindow.py
@@ -63,4 +63,3 @@ class AutoTagMatchWindow(QtWidgets.QDialog):
self.skipButton, QtWidgets.QDialogButtonBox.ActionRole)
- self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText(
- "Accept and Write Tags")
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText("Accept and Write Tags")
diff --git a/comictaggerlib/cli.py b/comictaggerlib/cli.py
index 688907d..dbd0c2e 100644
--- a/comictaggerlib/cli.py
+++ b/comictaggerlib/cli.py
@@ -293,7 +293,3 @@ def process_file_cli(filename, opts, settings, match_results):
if opts.raw:
- print((
- "{0}".format(
- str(
- ca.readRawCIX(),
- errors='ignore'))))
+ print(ca.read_raw_cix())
else:
2022-04-01 16:50:46 -07:00
|
|
|
self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setEnabled(enabled)
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
def requery(self) -> None:
|
Code cleanup
Remove no longer used google scripts
Remove convenience files from comicataggerlib and import comicapi directly
Add type-hints to facilitate auto-complete tools
Make PyQt5 code more compatible with PyQt6
Implement automatic tooling
isort and black for code formatting
Line length has been set to 120
flake8 for code standards with exceptions:
E203 - Whitespace before ':' - format compatiblity with black
E501 - Line too long - flake8 line limit cannot be set
E722 - Do not use bare except - fixing bare except statements is a
lot of overhead and there are already
many in the codebase
These changes, along with some manual fixes creates much more readable code.
See examples below:
diff --git a/comicapi/comet.py b/comicapi/comet.py
index d1741c5..52dc195 100644
--- a/comicapi/comet.py
+++ b/comicapi/comet.py
@@ -166,7 +166,2 @@ class CoMet:
- if credit['role'].lower() in set(self.editor_synonyms):
- ET.SubElement(
- root,
- 'editor').text = "{0}".format(
- credit['person'])
@@ -174,2 +169,4 @@ class CoMet:
self.indent(root)
+ if credit["role"].lower() in set(self.editor_synonyms):
+ ET.SubElement(root, "editor").text = str(credit["person"])
diff --git a/comictaggerlib/autotagmatchwindow.py b/comictaggerlib/autotagmatchwindow.py
index 4338176..9219f01 100644
--- a/comictaggerlib/autotagmatchwindow.py
+++ b/comictaggerlib/autotagmatchwindow.py
@@ -63,4 +63,3 @@ class AutoTagMatchWindow(QtWidgets.QDialog):
self.skipButton, QtWidgets.QDialogButtonBox.ActionRole)
- self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText(
- "Accept and Write Tags")
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText("Accept and Write Tags")
diff --git a/comictaggerlib/cli.py b/comictaggerlib/cli.py
index 688907d..dbd0c2e 100644
--- a/comictaggerlib/cli.py
+++ b/comictaggerlib/cli.py
@@ -293,7 +293,3 @@ def process_file_cli(filename, opts, settings, match_results):
if opts.raw:
- print((
- "{0}".format(
- str(
- ca.readRawCIX(),
- errors='ignore'))))
+ print(ca.read_raw_cix())
else:
2022-04-01 16:50:46 -07:00
|
|
|
self.perform_query(refresh=True)
|
2015-02-12 14:57:46 -08:00
|
|
|
self.twList.selectRow(0)
|
2022-01-22 15:00:22 -08:00
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
def filter_toggled(self) -> None:
|
2022-01-22 15:00:22 -08:00
|
|
|
self.use_filter = not self.use_filter
|
Code cleanup
Remove no longer used google scripts
Remove convenience files from comicataggerlib and import comicapi directly
Add type-hints to facilitate auto-complete tools
Make PyQt5 code more compatible with PyQt6
Implement automatic tooling
isort and black for code formatting
Line length has been set to 120
flake8 for code standards with exceptions:
E203 - Whitespace before ':' - format compatiblity with black
E501 - Line too long - flake8 line limit cannot be set
E722 - Do not use bare except - fixing bare except statements is a
lot of overhead and there are already
many in the codebase
These changes, along with some manual fixes creates much more readable code.
See examples below:
diff --git a/comicapi/comet.py b/comicapi/comet.py
index d1741c5..52dc195 100644
--- a/comicapi/comet.py
+++ b/comicapi/comet.py
@@ -166,7 +166,2 @@ class CoMet:
- if credit['role'].lower() in set(self.editor_synonyms):
- ET.SubElement(
- root,
- 'editor').text = "{0}".format(
- credit['person'])
@@ -174,2 +169,4 @@ class CoMet:
self.indent(root)
+ if credit["role"].lower() in set(self.editor_synonyms):
+ ET.SubElement(root, "editor").text = str(credit["person"])
diff --git a/comictaggerlib/autotagmatchwindow.py b/comictaggerlib/autotagmatchwindow.py
index 4338176..9219f01 100644
--- a/comictaggerlib/autotagmatchwindow.py
+++ b/comictaggerlib/autotagmatchwindow.py
@@ -63,4 +63,3 @@ class AutoTagMatchWindow(QtWidgets.QDialog):
self.skipButton, QtWidgets.QDialogButtonBox.ActionRole)
- self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText(
- "Accept and Write Tags")
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText("Accept and Write Tags")
diff --git a/comictaggerlib/cli.py b/comictaggerlib/cli.py
index 688907d..dbd0c2e 100644
--- a/comictaggerlib/cli.py
+++ b/comictaggerlib/cli.py
@@ -293,7 +293,3 @@ def process_file_cli(filename, opts, settings, match_results):
if opts.raw:
- print((
- "{0}".format(
- str(
- ca.readRawCIX(),
- errors='ignore'))))
+ print(ca.read_raw_cix())
else:
2022-04-01 16:50:46 -07:00
|
|
|
self.perform_query(refresh=False)
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
def auto_select(self) -> None:
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-11-18 15:18:41 -08:00
|
|
|
if self.comic_archive is None:
|
|
|
|
QtWidgets.QMessageBox.information(self, "Auto-Select", "You need to load a comic first!")
|
|
|
|
return
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-11-18 15:18:41 -08:00
|
|
|
if self.issue_number is None or self.issue_number == "":
|
|
|
|
QtWidgets.QMessageBox.information(self, "Auto-Select", "Can't auto-select without an issue number (yet!)")
|
|
|
|
return
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-11-18 15:18:41 -08:00
|
|
|
self.iddialog = IDProgressWindow(self)
|
|
|
|
self.iddialog.setModal(True)
|
|
|
|
self.iddialog.rejected.connect(self.identify_cancel)
|
|
|
|
self.iddialog.show()
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-12-06 00:20:01 -08:00
|
|
|
self.ii = IssueIdentifier(self.comic_archive, self.options, self.talker_api)
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-11-18 15:18:41 -08:00
|
|
|
md = GenericMetadata()
|
|
|
|
md.series = self.series_name
|
|
|
|
md.issue = self.issue_number
|
|
|
|
md.year = self.year
|
|
|
|
md.issue_count = self.issue_count
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-11-18 15:18:41 -08:00
|
|
|
self.ii.set_additional_metadata(md)
|
|
|
|
self.ii.only_use_additional_meta_data = True
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-11-18 15:18:41 -08:00
|
|
|
self.ii.cover_page_index = int(self.cover_index_list[0])
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-11-18 15:18:41 -08:00
|
|
|
self.id_thread = IdentifyThread(self.ii)
|
|
|
|
self.id_thread.identifyComplete.connect(self.identify_complete)
|
|
|
|
self.id_thread.identifyLogMsg.connect(self.log_id_output)
|
|
|
|
self.id_thread.identifyProgress.connect(self.identify_progress)
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-11-18 15:18:41 -08:00
|
|
|
self.id_thread.start()
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-11-18 15:18:41 -08:00
|
|
|
self.iddialog.exec()
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
def log_id_output(self, text: str) -> None:
|
|
|
|
if self.iddialog is not None:
|
2022-06-06 19:59:54 -07:00
|
|
|
print(text, end=" ") # noqa: T201
|
2022-05-17 13:57:04 -07:00
|
|
|
self.iddialog.textEdit.ensureCursorVisible()
|
|
|
|
self.iddialog.textEdit.insertPlainText(text)
|
|
|
|
|
|
|
|
def identify_progress(self, cur: int, total: int) -> None:
|
|
|
|
if self.iddialog is not None:
|
|
|
|
self.iddialog.progressBar.setMaximum(total)
|
|
|
|
self.iddialog.progressBar.setValue(cur)
|
|
|
|
|
|
|
|
def identify_cancel(self) -> None:
|
|
|
|
if self.ii is not None:
|
|
|
|
self.ii.cancel = True
|
|
|
|
|
|
|
|
def identify_complete(self) -> None:
|
2022-11-28 21:44:01 -08:00
|
|
|
if self.ii is not None and self.iddialog is not None and self.comic_archive is not None:
|
2022-05-17 13:57:04 -07:00
|
|
|
|
|
|
|
matches = self.ii.match_list
|
|
|
|
result = self.ii.search_result
|
|
|
|
|
|
|
|
found_match = None
|
|
|
|
choices = False
|
|
|
|
if result == self.ii.result_no_matches:
|
|
|
|
QtWidgets.QMessageBox.information(self, "Auto-Select Result", " No matches found :-(")
|
|
|
|
elif result == self.ii.result_found_match_but_bad_cover_score:
|
|
|
|
QtWidgets.QMessageBox.information(
|
|
|
|
self,
|
|
|
|
"Auto-Select Result",
|
2022-06-07 20:22:33 -07:00
|
|
|
" Found a match, but cover doesn't seem the same. Verify before committing!",
|
2022-05-17 13:57:04 -07:00
|
|
|
)
|
|
|
|
found_match = matches[0]
|
|
|
|
elif result == self.ii.result_found_match_but_not_first_page:
|
|
|
|
QtWidgets.QMessageBox.information(
|
|
|
|
self, "Auto-Select Result", " Found a match, but not with the first page of the archive."
|
|
|
|
)
|
|
|
|
found_match = matches[0]
|
|
|
|
elif result == self.ii.result_multiple_matches_with_bad_image_scores:
|
|
|
|
QtWidgets.QMessageBox.information(
|
|
|
|
self, "Auto-Select Result", " Found some possibilities, but no confidence. Proceed manually."
|
|
|
|
)
|
|
|
|
choices = True
|
|
|
|
elif result == self.ii.result_one_good_match:
|
|
|
|
found_match = matches[0]
|
|
|
|
elif result == self.ii.result_multiple_good_matches:
|
|
|
|
QtWidgets.QMessageBox.information(
|
|
|
|
self, "Auto-Select Result", " Found multiple likely matches. Please select."
|
|
|
|
)
|
|
|
|
choices = True
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
if choices:
|
2022-12-06 00:20:01 -08:00
|
|
|
selector = MatchSelectionWindow(
|
|
|
|
self, matches, self.comic_archive, talker_api=self.talker_api, options=self.options
|
|
|
|
)
|
2022-05-17 13:57:04 -07:00
|
|
|
selector.setModal(True)
|
|
|
|
selector.exec()
|
|
|
|
if selector.result():
|
|
|
|
# we should now have a list index
|
|
|
|
found_match = selector.current_match()
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
if found_match is not None:
|
|
|
|
self.iddialog.accept()
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-12-21 17:00:59 -08:00
|
|
|
self.series_id = utils.xlate(found_match["series_id"])
|
2022-05-17 13:57:04 -07:00
|
|
|
self.issue_number = found_match["issue_number"]
|
|
|
|
self.select_by_id()
|
|
|
|
self.show_issues()
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
def show_issues(self) -> None:
|
2022-12-21 17:00:59 -08:00
|
|
|
selector = IssueSelectionWindow(self, self.options, self.talker_api, self.series_id, self.issue_number)
|
2015-02-12 14:57:46 -08:00
|
|
|
title = ""
|
2022-06-28 07:21:35 -07:00
|
|
|
for record in self.ct_search_results:
|
2022-12-23 01:58:10 -08:00
|
|
|
if record.id == self.series_id:
|
|
|
|
title = record.name
|
|
|
|
title += " (" + str(record.start_year) + ")"
|
2015-02-12 14:57:46 -08:00
|
|
|
title += " - "
|
|
|
|
break
|
|
|
|
|
2015-02-13 15:08:07 -08:00
|
|
|
selector.setWindowTitle(title + "Select Issue")
|
|
|
|
selector.setModal(True)
|
Code cleanup
Remove no longer used google scripts
Remove convenience files from comicataggerlib and import comicapi directly
Add type-hints to facilitate auto-complete tools
Make PyQt5 code more compatible with PyQt6
Implement automatic tooling
isort and black for code formatting
Line length has been set to 120
flake8 for code standards with exceptions:
E203 - Whitespace before ':' - format compatiblity with black
E501 - Line too long - flake8 line limit cannot be set
E722 - Do not use bare except - fixing bare except statements is a
lot of overhead and there are already
many in the codebase
These changes, along with some manual fixes creates much more readable code.
See examples below:
diff --git a/comicapi/comet.py b/comicapi/comet.py
index d1741c5..52dc195 100644
--- a/comicapi/comet.py
+++ b/comicapi/comet.py
@@ -166,7 +166,2 @@ class CoMet:
- if credit['role'].lower() in set(self.editor_synonyms):
- ET.SubElement(
- root,
- 'editor').text = "{0}".format(
- credit['person'])
@@ -174,2 +169,4 @@ class CoMet:
self.indent(root)
+ if credit["role"].lower() in set(self.editor_synonyms):
+ ET.SubElement(root, "editor").text = str(credit["person"])
diff --git a/comictaggerlib/autotagmatchwindow.py b/comictaggerlib/autotagmatchwindow.py
index 4338176..9219f01 100644
--- a/comictaggerlib/autotagmatchwindow.py
+++ b/comictaggerlib/autotagmatchwindow.py
@@ -63,4 +63,3 @@ class AutoTagMatchWindow(QtWidgets.QDialog):
self.skipButton, QtWidgets.QDialogButtonBox.ActionRole)
- self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText(
- "Accept and Write Tags")
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText("Accept and Write Tags")
diff --git a/comictaggerlib/cli.py b/comictaggerlib/cli.py
index 688907d..dbd0c2e 100644
--- a/comictaggerlib/cli.py
+++ b/comictaggerlib/cli.py
@@ -293,7 +293,3 @@ def process_file_cli(filename, opts, settings, match_results):
if opts.raw:
- print((
- "{0}".format(
- str(
- ca.readRawCIX(),
- errors='ignore'))))
+ print(ca.read_raw_cix())
else:
2022-04-01 16:50:46 -07:00
|
|
|
selector.exec()
|
2015-02-12 14:57:46 -08:00
|
|
|
if selector.result():
|
2022-12-21 17:00:59 -08:00
|
|
|
# we should now have a series ID
|
2015-02-12 14:57:46 -08:00
|
|
|
self.issue_number = selector.issue_number
|
2022-10-29 16:15:05 -07:00
|
|
|
self.issue_id = selector.issue_id
|
2015-02-12 14:57:46 -08:00
|
|
|
self.accept()
|
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
def select_by_id(self) -> None:
|
2015-02-12 14:57:46 -08:00
|
|
|
for r in range(0, self.twList.rowCount()):
|
2022-12-21 17:00:59 -08:00
|
|
|
series_id = self.twList.item(r, 0).data(QtCore.Qt.ItemDataRole.UserRole)
|
|
|
|
if series_id == self.series_id:
|
2015-02-13 15:08:07 -08:00
|
|
|
self.twList.selectRow(r)
|
2015-02-12 14:57:46 -08:00
|
|
|
break
|
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
def perform_query(self, refresh: bool = False) -> None:
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-07-08 12:33:00 -07:00
|
|
|
self.search_thread = SearchThread(
|
2023-01-25 16:52:02 -08:00
|
|
|
self.talker_api, self.series_name, refresh, self.literal, self.options.talkers_series_match_search_thresh
|
2022-07-08 12:33:00 -07:00
|
|
|
)
|
Code cleanup
Remove no longer used google scripts
Remove convenience files from comicataggerlib and import comicapi directly
Add type-hints to facilitate auto-complete tools
Make PyQt5 code more compatible with PyQt6
Implement automatic tooling
isort and black for code formatting
Line length has been set to 120
flake8 for code standards with exceptions:
E203 - Whitespace before ':' - format compatiblity with black
E501 - Line too long - flake8 line limit cannot be set
E722 - Do not use bare except - fixing bare except statements is a
lot of overhead and there are already
many in the codebase
These changes, along with some manual fixes creates much more readable code.
See examples below:
diff --git a/comicapi/comet.py b/comicapi/comet.py
index d1741c5..52dc195 100644
--- a/comicapi/comet.py
+++ b/comicapi/comet.py
@@ -166,7 +166,2 @@ class CoMet:
- if credit['role'].lower() in set(self.editor_synonyms):
- ET.SubElement(
- root,
- 'editor').text = "{0}".format(
- credit['person'])
@@ -174,2 +169,4 @@ class CoMet:
self.indent(root)
+ if credit["role"].lower() in set(self.editor_synonyms):
+ ET.SubElement(root, "editor").text = str(credit["person"])
diff --git a/comictaggerlib/autotagmatchwindow.py b/comictaggerlib/autotagmatchwindow.py
index 4338176..9219f01 100644
--- a/comictaggerlib/autotagmatchwindow.py
+++ b/comictaggerlib/autotagmatchwindow.py
@@ -63,4 +63,3 @@ class AutoTagMatchWindow(QtWidgets.QDialog):
self.skipButton, QtWidgets.QDialogButtonBox.ActionRole)
- self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText(
- "Accept and Write Tags")
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText("Accept and Write Tags")
diff --git a/comictaggerlib/cli.py b/comictaggerlib/cli.py
index 688907d..dbd0c2e 100644
--- a/comictaggerlib/cli.py
+++ b/comictaggerlib/cli.py
@@ -293,7 +293,3 @@ def process_file_cli(filename, opts, settings, match_results):
if opts.raw:
- print((
- "{0}".format(
- str(
- ca.readRawCIX(),
- errors='ignore'))))
+ print(ca.read_raw_cix())
else:
2022-04-01 16:50:46 -07:00
|
|
|
self.search_thread.searchComplete.connect(self.search_complete)
|
|
|
|
self.search_thread.progressUpdate.connect(self.search_progress_update)
|
2015-02-12 14:57:46 -08:00
|
|
|
self.search_thread.start()
|
2022-11-03 16:32:35 -07:00
|
|
|
|
|
|
|
self.progdialog = QtWidgets.QProgressDialog("Searching Online", "Cancel", 0, 100, self)
|
|
|
|
self.progdialog.setWindowTitle("Online Search")
|
|
|
|
self.progdialog.canceled.connect(self.search_canceled)
|
|
|
|
self.progdialog.setModal(True)
|
|
|
|
self.progdialog.setMinimumDuration(300)
|
|
|
|
|
|
|
|
if refresh or self.search_thread.isRunning():
|
|
|
|
self.progdialog.exec()
|
|
|
|
else:
|
|
|
|
self.progdialog = None
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
def search_canceled(self) -> None:
|
|
|
|
if self.progdialog is not None:
|
|
|
|
logger.info("query cancelled")
|
|
|
|
if self.search_thread is not None:
|
|
|
|
self.search_thread.searchComplete.disconnect()
|
|
|
|
self.search_thread.progressUpdate.disconnect()
|
|
|
|
self.progdialog.canceled.disconnect()
|
|
|
|
self.progdialog.reject()
|
|
|
|
QtCore.QTimer.singleShot(200, self.close_me)
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
def close_me(self) -> None:
|
2015-02-12 14:57:46 -08:00
|
|
|
self.reject()
|
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
def search_progress_update(self, current: int, total: int) -> None:
|
|
|
|
if self.progdialog is not None:
|
|
|
|
self.progdialog.setMaximum(total)
|
|
|
|
self.progdialog.setValue(current + 1)
|
|
|
|
|
|
|
|
def search_complete(self) -> None:
|
|
|
|
if self.progdialog is not None:
|
|
|
|
self.progdialog.accept()
|
2022-12-06 00:20:01 -08:00
|
|
|
del self.progdialog
|
2022-11-03 16:32:35 -07:00
|
|
|
if self.search_thread is not None and self.search_thread.ct_error:
|
|
|
|
# TODO Currently still opens the window
|
|
|
|
QtWidgets.QMessageBox.critical(
|
|
|
|
self,
|
|
|
|
f"{self.search_thread.error_e.source} {self.search_thread.error_e.code_name} Error",
|
|
|
|
f"{self.search_thread.error_e}",
|
|
|
|
)
|
|
|
|
return
|
|
|
|
|
|
|
|
self.ct_search_results = self.search_thread.ct_search_results if self.search_thread is not None else []
|
|
|
|
# filter the publishers if enabled set
|
|
|
|
if self.use_filter:
|
|
|
|
try:
|
2022-12-15 20:10:35 -08:00
|
|
|
publisher_filter = {s.strip().casefold() for s in self.options.identifier_publisher_filter}
|
2022-11-03 16:32:35 -07:00
|
|
|
# use '' as publisher name if None
|
|
|
|
self.ct_search_results = list(
|
|
|
|
filter(
|
2022-12-23 01:58:10 -08:00
|
|
|
lambda d: ("" if d.publisher is None else str(d.publisher).casefold()) not in publisher_filter,
|
2022-06-28 07:21:35 -07:00
|
|
|
self.ct_search_results,
|
2022-05-17 13:57:04 -07:00
|
|
|
)
|
2022-11-03 16:32:35 -07:00
|
|
|
)
|
|
|
|
except Exception:
|
|
|
|
logger.exception("bad data error filtering publishers")
|
|
|
|
|
|
|
|
# pre sort the data - so that we can put exact matches first afterwards
|
|
|
|
# compare as str in case extra chars ie. '1976?'
|
|
|
|
# - missing (none) values being converted to 'None' - consistent with prior behaviour in v1.2.3
|
|
|
|
# sort by start_year if set
|
2023-01-25 11:10:58 -08:00
|
|
|
if self.options.talkers_sort_series_by_year:
|
2022-11-03 16:32:35 -07:00
|
|
|
try:
|
|
|
|
self.ct_search_results = sorted(
|
|
|
|
self.ct_search_results,
|
2022-12-23 01:58:10 -08:00
|
|
|
key=lambda i: (str(i.start_year), str(i.count_of_issues)),
|
2022-11-03 16:32:35 -07:00
|
|
|
reverse=True,
|
|
|
|
)
|
|
|
|
except Exception:
|
|
|
|
logger.exception("bad data error sorting results by start_year,count_of_issues")
|
|
|
|
else:
|
|
|
|
try:
|
|
|
|
self.ct_search_results = sorted(
|
2022-12-23 01:58:10 -08:00
|
|
|
self.ct_search_results, key=lambda i: str(i.count_of_issues), reverse=True
|
2022-11-03 16:32:35 -07:00
|
|
|
)
|
|
|
|
except Exception:
|
|
|
|
logger.exception("bad data error sorting results by count_of_issues")
|
|
|
|
|
|
|
|
# move sanitized matches to the front
|
2023-01-25 11:10:58 -08:00
|
|
|
if self.options.talkers_exact_series_matches_first:
|
2022-11-03 16:32:35 -07:00
|
|
|
try:
|
|
|
|
sanitized = utils.sanitize_title(self.series_name, False).casefold()
|
|
|
|
sanitized_no_articles = utils.sanitize_title(self.series_name, True).casefold()
|
|
|
|
|
2022-12-21 17:00:59 -08:00
|
|
|
deques: list[deque[ComicSeries]] = [deque(), deque(), deque()]
|
2022-11-03 16:32:35 -07:00
|
|
|
|
2022-12-21 17:00:59 -08:00
|
|
|
def categorize(result: ComicSeries) -> int:
|
2022-11-03 16:32:35 -07:00
|
|
|
# We don't remove anything on this one so that we only get exact matches
|
2022-12-23 01:58:10 -08:00
|
|
|
if utils.sanitize_title(result.name, True).casefold() == sanitized_no_articles:
|
2022-11-03 16:32:35 -07:00
|
|
|
return 0
|
|
|
|
|
|
|
|
# this ensures that 'The Joker' is near the top even if you search 'Joker'
|
2022-12-23 01:58:10 -08:00
|
|
|
if utils.sanitize_title(result.name, False).casefold() in sanitized:
|
2022-11-03 16:32:35 -07:00
|
|
|
return 1
|
|
|
|
return 2
|
|
|
|
|
|
|
|
for comic in self.ct_search_results:
|
|
|
|
deques[categorize(comic)].append(comic)
|
|
|
|
logger.info("Length: %d, %d, %d", len(deques[0]), len(deques[1]), len(deques[2]))
|
|
|
|
self.ct_search_results = list(itertools.chain.from_iterable(deques))
|
|
|
|
except Exception:
|
|
|
|
logger.exception("bad data error filtering exact/near matches")
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-11-03 16:32:35 -07:00
|
|
|
self.update_buttons()
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-11-03 16:32:35 -07:00
|
|
|
self.twList.setSortingEnabled(False)
|
2022-05-17 13:57:04 -07:00
|
|
|
|
2022-11-03 16:32:35 -07:00
|
|
|
self.twList.setRowCount(0)
|
2022-05-17 13:57:04 -07:00
|
|
|
|
2022-11-03 16:32:35 -07:00
|
|
|
row = 0
|
|
|
|
for record in self.ct_search_results:
|
|
|
|
self.twList.insertRow(row)
|
|
|
|
|
2022-12-23 01:58:10 -08:00
|
|
|
item_text = record.name
|
2022-11-03 16:32:35 -07:00
|
|
|
item = QtWidgets.QTableWidgetItem(item_text)
|
|
|
|
item.setData(QtCore.Qt.ItemDataRole.ToolTipRole, item_text)
|
2022-12-23 01:58:10 -08:00
|
|
|
item.setData(QtCore.Qt.ItemDataRole.UserRole, record.id)
|
2022-11-03 16:32:35 -07:00
|
|
|
item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled)
|
|
|
|
self.twList.setItem(row, 0, item)
|
|
|
|
|
2022-12-23 01:58:10 -08:00
|
|
|
item_text = str(record.start_year)
|
2022-11-03 16:32:35 -07:00
|
|
|
item = QtWidgets.QTableWidgetItem(item_text)
|
|
|
|
item.setData(QtCore.Qt.ItemDataRole.ToolTipRole, item_text)
|
|
|
|
item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled)
|
|
|
|
self.twList.setItem(row, 1, item)
|
|
|
|
|
2022-12-23 01:58:10 -08:00
|
|
|
item_text = str(record.count_of_issues)
|
2022-11-03 16:32:35 -07:00
|
|
|
item = QtWidgets.QTableWidgetItem(item_text)
|
|
|
|
item.setData(QtCore.Qt.ItemDataRole.ToolTipRole, item_text)
|
2022-12-23 01:58:10 -08:00
|
|
|
item.setData(QtCore.Qt.ItemDataRole.DisplayRole, record.count_of_issues)
|
2022-11-03 16:32:35 -07:00
|
|
|
item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled)
|
|
|
|
self.twList.setItem(row, 2, item)
|
|
|
|
|
2022-12-23 01:58:10 -08:00
|
|
|
if record.publisher is not None:
|
|
|
|
item_text = record.publisher
|
2022-05-17 13:57:04 -07:00
|
|
|
item.setData(QtCore.Qt.ItemDataRole.ToolTipRole, item_text)
|
|
|
|
item = QtWidgets.QTableWidgetItem(item_text)
|
|
|
|
item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled)
|
2022-11-03 16:32:35 -07:00
|
|
|
self.twList.setItem(row, 3, item)
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-11-03 16:32:35 -07:00
|
|
|
row += 1
|
2022-05-17 13:57:04 -07:00
|
|
|
|
2022-11-03 16:32:35 -07:00
|
|
|
self.twList.setSortingEnabled(True)
|
|
|
|
self.twList.selectRow(0)
|
|
|
|
self.twList.resizeColumnsToContents()
|
2022-11-28 15:28:47 -08:00
|
|
|
# Get the width of the issues, year and publisher columns
|
|
|
|
owidth = self.twList.columnWidth(1) + self.twList.columnWidth(2) + self.twList.columnWidth(3)
|
|
|
|
# Get the remaining width after they fill the tableWidget
|
2022-11-28 20:55:50 -08:00
|
|
|
rwidth = self.twList.contentsRect().width() - owidth
|
2022-11-28 15:28:47 -08:00
|
|
|
|
|
|
|
# Default the tableWidget to truncate series names
|
|
|
|
self.twList.setColumnWidth(0, rwidth)
|
2022-05-17 13:57:04 -07:00
|
|
|
|
2022-11-28 15:34:15 -08:00
|
|
|
# Resize row height so the whole series can still be seen
|
|
|
|
self.twList.resizeRowsToContents()
|
2022-05-17 13:57:04 -07:00
|
|
|
|
2022-07-18 12:17:13 -07:00
|
|
|
def showEvent(self, event: QtGui.QShowEvent) -> None:
|
2022-11-03 16:32:35 -07:00
|
|
|
self.perform_query()
|
2022-10-04 15:50:55 -07:00
|
|
|
if not self.ct_search_results:
|
2022-07-13 19:56:34 -07:00
|
|
|
QtCore.QCoreApplication.processEvents()
|
|
|
|
QtWidgets.QMessageBox.information(self, "Search Result", "No matches found!")
|
|
|
|
QtCore.QTimer.singleShot(200, self.close_me)
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-07-13 19:56:34 -07:00
|
|
|
elif self.immediate_autoselect:
|
|
|
|
# defer the immediate autoselect so this dialog has time to pop up
|
|
|
|
QtCore.QCoreApplication.processEvents()
|
|
|
|
QtCore.QTimer.singleShot(10, self.do_immediate_autoselect)
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
def do_immediate_autoselect(self) -> None:
|
2015-02-15 02:44:00 -08:00
|
|
|
self.immediate_autoselect = False
|
Code cleanup
Remove no longer used google scripts
Remove convenience files from comicataggerlib and import comicapi directly
Add type-hints to facilitate auto-complete tools
Make PyQt5 code more compatible with PyQt6
Implement automatic tooling
isort and black for code formatting
Line length has been set to 120
flake8 for code standards with exceptions:
E203 - Whitespace before ':' - format compatiblity with black
E501 - Line too long - flake8 line limit cannot be set
E722 - Do not use bare except - fixing bare except statements is a
lot of overhead and there are already
many in the codebase
These changes, along with some manual fixes creates much more readable code.
See examples below:
diff --git a/comicapi/comet.py b/comicapi/comet.py
index d1741c5..52dc195 100644
--- a/comicapi/comet.py
+++ b/comicapi/comet.py
@@ -166,7 +166,2 @@ class CoMet:
- if credit['role'].lower() in set(self.editor_synonyms):
- ET.SubElement(
- root,
- 'editor').text = "{0}".format(
- credit['person'])
@@ -174,2 +169,4 @@ class CoMet:
self.indent(root)
+ if credit["role"].lower() in set(self.editor_synonyms):
+ ET.SubElement(root, "editor").text = str(credit["person"])
diff --git a/comictaggerlib/autotagmatchwindow.py b/comictaggerlib/autotagmatchwindow.py
index 4338176..9219f01 100644
--- a/comictaggerlib/autotagmatchwindow.py
+++ b/comictaggerlib/autotagmatchwindow.py
@@ -63,4 +63,3 @@ class AutoTagMatchWindow(QtWidgets.QDialog):
self.skipButton, QtWidgets.QDialogButtonBox.ActionRole)
- self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setText(
- "Accept and Write Tags")
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText("Accept and Write Tags")
diff --git a/comictaggerlib/cli.py b/comictaggerlib/cli.py
index 688907d..dbd0c2e 100644
--- a/comictaggerlib/cli.py
+++ b/comictaggerlib/cli.py
@@ -293,7 +293,3 @@ def process_file_cli(filename, opts, settings, match_results):
if opts.raw:
- print((
- "{0}".format(
- str(
- ca.readRawCIX(),
- errors='ignore'))))
+ print(ca.read_raw_cix())
else:
2022-04-01 16:50:46 -07:00
|
|
|
self.auto_select()
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
def cell_double_clicked(self, r: int, c: int) -> None:
|
2022-11-18 15:18:41 -08:00
|
|
|
self.show_issues()
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-06-02 18:32:16 -07:00
|
|
|
def current_item_changed(self, curr: QtCore.QModelIndex | None, prev: QtCore.QModelIndex | None) -> None:
|
2015-02-12 14:57:46 -08:00
|
|
|
|
|
|
|
if curr is None:
|
|
|
|
return
|
|
|
|
if prev is not None and prev.row() == curr.row():
|
2015-02-15 02:44:00 -08:00
|
|
|
return
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-12-21 17:00:59 -08:00
|
|
|
self.series_id = self.twList.item(curr.row(), 0).data(QtCore.Qt.ItemDataRole.UserRole)
|
2022-01-22 15:00:22 -08:00
|
|
|
|
2022-12-21 17:00:59 -08:00
|
|
|
# list selection was changed, update the info on the series
|
2022-06-28 07:21:35 -07:00
|
|
|
for record in self.ct_search_results:
|
2022-12-23 01:58:10 -08:00
|
|
|
if record.id == self.series_id:
|
|
|
|
if record.description is None:
|
2015-02-15 02:44:00 -08:00
|
|
|
self.teDetails.setText("")
|
2015-02-12 14:57:46 -08:00
|
|
|
else:
|
2022-12-23 01:58:10 -08:00
|
|
|
self.teDetails.setText(record.description)
|
|
|
|
self.imageWidget.set_url(record.image_url)
|
2015-02-12 14:57:46 -08:00
|
|
|
break
|