2015-02-21 18:30:32 -08:00
|
|
|
"""A PyQT4 dialog to enter app settings"""
|
2022-06-02 18:32:16 -07:00
|
|
|
#
|
2023-02-16 17:23:13 -08:00
|
|
|
# Copyright 2012-2014 ComicTagger Authors
|
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-12 16:12:43 -08:00
|
|
|
|
2022-06-02 11:23:53 -07:00
|
|
|
import html
|
2022-04-04 18:59:26 -07:00
|
|
|
import logging
|
2012-11-12 16:12:43 -08:00
|
|
|
import os
|
2022-07-09 22:27:45 -07:00
|
|
|
import pathlib
|
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
|
|
|
import platform
|
2023-06-09 16:20:00 -07:00
|
|
|
from typing import Any, cast
|
2015-02-13 15:08:07 -08:00
|
|
|
|
2022-12-14 23:13:53 -08:00
|
|
|
import settngs
|
2018-09-19 13:05:39 -07:00
|
|
|
from PyQt5 import QtCore, QtGui, QtWidgets, uic
|
2012-11-12 16:12:43 -08:00
|
|
|
|
2023-02-13 17:32:56 -08:00
|
|
|
import comictaggerlib.ui.talkeruigenerator
|
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 import utils
|
2022-04-18 18:44:20 -07:00
|
|
|
from comicapi.genericmetadata import md_test
|
2023-02-23 10:36:57 -08:00
|
|
|
from comictaggerlib import ctsettings
|
2023-06-09 16:20:00 -07:00
|
|
|
from comictaggerlib.ctsettings import ct_ns
|
2022-11-25 15:47:05 -08:00
|
|
|
from comictaggerlib.ctversion import version
|
2022-11-23 22:16:46 -08:00
|
|
|
from comictaggerlib.filerenamer import FileRenamer, Replacement, Replacements
|
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.imagefetcher import ImageFetcher
|
2022-10-25 21:48:01 -07:00
|
|
|
from comictaggerlib.ui import ui_path
|
2022-06-28 07:21:35 -07:00
|
|
|
from comictalker.comiccacher import ComicCacher
|
2023-02-09 19:33:10 -08:00
|
|
|
from comictalker.comictalker import ComicTalker
|
2015-02-13 15:08:07 -08:00
|
|
|
|
2022-04-04 18:59:26 -07:00
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
2012-11-12 16:12:43 -08:00
|
|
|
windowsRarHelp = """
|
2022-07-10 15:21:15 -07:00
|
|
|
<html><head/><body><p>To write to CBR/RAR archives,
|
|
|
|
you will need to have the tools from
|
|
|
|
<span style=" text-decoration: underline; color:#0000ff;">
|
|
|
|
<a href="http://www.win-rar.com/download.html">WINRar</a></span>
|
|
|
|
installed. (ComicTagger only uses the command-line rar tool.)
|
|
|
|
</p></body></html>
|
2012-11-12 16:12:43 -08:00
|
|
|
"""
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2012-11-12 16:12:43 -08:00
|
|
|
linuxRarHelp = """
|
2022-07-10 15:21:15 -07:00
|
|
|
<html><head/><body><p>To write to CBR/RAR archives,
|
|
|
|
you will need to have the shareware rar tool from RARLab installed.
|
|
|
|
Your package manager should have rar (e.g. "apt-get install rar"). If not, download it
|
|
|
|
<span style=" text-decoration: underline; color:#0000ff;">
|
|
|
|
<a href="https://www.rarlab.com/download.htm">here</a></span>,
|
|
|
|
and install in your path. </p></body></html>
|
|
|
|
"""
|
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
|
|
|
|
2012-11-12 16:12:43 -08:00
|
|
|
macRarHelp = """
|
2022-07-10 15:21:15 -07:00
|
|
|
<html><head/><body><p>To write to CBR/RAR archives,
|
|
|
|
you will need the rar tool. The easiest way to get this is
|
|
|
|
to install <span style=" text-decoration: underline; color:#0000ff;">
|
|
|
|
<a href="https://brew.sh/">homebrew</a></span>.
|
|
|
|
</p>Once homebrew is installed, run: <b>brew install caskroom/cask/rar</b></body></html>
|
2018-09-19 13:05:39 -07:00
|
|
|
"""
|
|
|
|
|
2022-04-18 18:59:17 -07:00
|
|
|
|
2022-04-29 23:27:58 -07:00
|
|
|
template_tooltip = """
|
2022-06-02 11:23:53 -07:00
|
|
|
The template for the new filename. Uses python format strings https://docs.python.org/3/library/string.html#format-string-syntax
|
2022-04-18 18:59:17 -07:00
|
|
|
Accepts the following variables:
|
2022-06-02 11:23:53 -07:00
|
|
|
{is_empty} (boolean)
|
|
|
|
{tag_origin} (string)
|
|
|
|
{series} (string)
|
|
|
|
{issue} (string)
|
|
|
|
{title} (string)
|
|
|
|
{publisher} (string)
|
|
|
|
{month} (integer)
|
|
|
|
{year} (integer)
|
|
|
|
{day} (integer)
|
|
|
|
{issue_count} (integer)
|
|
|
|
{volume} (integer)
|
|
|
|
{genre} (string)
|
|
|
|
{language} (string)
|
|
|
|
{comments} (string)
|
|
|
|
{volume_count} (integer)
|
2022-06-23 13:08:09 -07:00
|
|
|
{critical_rating} (float)
|
2022-06-02 11:23:53 -07:00
|
|
|
{country} (string)
|
|
|
|
{alternate_series} (string)
|
|
|
|
{alternate_number} (string)
|
|
|
|
{alternate_count} (integer)
|
|
|
|
{imprint} (string)
|
|
|
|
{notes} (string)
|
|
|
|
{web_link} (string)
|
|
|
|
{format} (string)
|
|
|
|
{manga} (string)
|
|
|
|
{black_and_white} (boolean)
|
|
|
|
{page_count} (integer)
|
|
|
|
{maturity_rating} (string)
|
|
|
|
{story_arc} (string)
|
|
|
|
{series_group} (string)
|
|
|
|
{scan_info} (string)
|
|
|
|
{characters} (string)
|
|
|
|
{teams} (string)
|
|
|
|
{locations} (string)
|
|
|
|
{credits} (list of dict({'role': string, 'person': string, 'primary': boolean}))
|
|
|
|
{writer} (string)
|
|
|
|
{penciller} (string)
|
|
|
|
{inker} (string)
|
|
|
|
{colorist} (string)
|
|
|
|
{letterer} (string)
|
|
|
|
{cover artist} (string)
|
|
|
|
{editor} (string)
|
|
|
|
{tags} (list of str)
|
2022-07-18 12:17:13 -07:00
|
|
|
{pages} (list of dict({'Image': string(int), 'Type': string, 'Bookmark': string, 'DoublePage': boolean}))
|
2022-04-18 18:59:17 -07:00
|
|
|
|
|
|
|
CoMet-only items:
|
2022-06-02 11:23:53 -07:00
|
|
|
{price} (float)
|
|
|
|
{is_version_of} (string)
|
|
|
|
{rights} (string)
|
|
|
|
{identifier} (string)
|
|
|
|
{last_mark} (string)
|
|
|
|
{cover_image} (string)
|
2022-04-18 18:59:17 -07:00
|
|
|
|
|
|
|
Examples:
|
|
|
|
|
|
|
|
{series} {issue} ({year})
|
|
|
|
Spider-Geddon 1 (2018)
|
|
|
|
|
|
|
|
{series} #{issue} - {title}
|
|
|
|
Spider-Geddon #1 - New Players; Check In
|
|
|
|
"""
|
|
|
|
|
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
|
|
|
class SettingsWindow(QtWidgets.QDialog):
|
2023-02-09 19:33:10 -08:00
|
|
|
def __init__(
|
2023-06-09 16:20:00 -07:00
|
|
|
self, parent: QtWidgets.QWidget, config: settngs.Config[ct_ns], talkers: dict[str, ComicTalker]
|
2023-02-09 19:33:10 -08: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)
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-10-25 21:48:01 -07:00
|
|
|
uic.loadUi(ui_path / "settingswindow.ui", self)
|
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.WindowContextHelpButtonHint)
|
|
|
|
)
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2023-01-31 20:21:39 -08:00
|
|
|
self.config = config
|
2023-02-10 17:18:56 -08:00
|
|
|
self.talkers = talkers
|
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.name = "Settings"
|
|
|
|
|
2015-02-12 14:57:46 -08:00
|
|
|
if platform.system() == "Windows":
|
2015-02-13 15:08:07 -08:00
|
|
|
self.lblRarHelp.setText(windowsRarHelp)
|
2015-02-12 14:57:46 -08:00
|
|
|
|
|
|
|
elif platform.system() == "Linux":
|
2015-02-13 15:08:07 -08:00
|
|
|
self.lblRarHelp.setText(linuxRarHelp)
|
2015-02-12 14:57:46 -08:00
|
|
|
|
|
|
|
elif platform.system() == "Darwin":
|
2018-09-19 13:05:39 -07:00
|
|
|
self.leRarExePath.setReadOnly(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
|
|
|
|
2015-02-13 15:08:07 -08:00
|
|
|
self.lblRarHelp.setText(macRarHelp)
|
2015-02-12 14:57:46 -08:00
|
|
|
self.name = "Preferences"
|
|
|
|
|
|
|
|
self.setWindowTitle("ComicTagger " + self.name)
|
2022-07-01 16:22:01 -07:00
|
|
|
self.lblDefaultSettings.setText("Revert to default " + self.name.casefold())
|
2015-02-13 15:08:07 -08:00
|
|
|
self.btnResetSettings.setText("Default " + self.name)
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-07-08 12:33:00 -07:00
|
|
|
nmit_tip = """<html>The <b>Name Match Ratio Threshold: Auto-Identify</b> is for eliminating automatic
|
|
|
|
search matches that are too long compared to your series name search. The lower
|
2015-02-12 14:57:46 -08:00
|
|
|
it is, the more likely to have a good match, but each search will take longer and
|
2022-07-08 12:33:00 -07:00
|
|
|
use more bandwidth. Too high, and only the very closest matches will be explored.</html>"""
|
|
|
|
nmst_tip = """<html>The <b>Name Match Ratio Threshold: Search</b> is for reducing the total
|
|
|
|
number of results that are returned from a search. The lower it is, the more pages will
|
|
|
|
be returned (max 5 pages or 500 results)</html>"""
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-07-08 12:33:00 -07:00
|
|
|
self.sbNameMatchIdentifyThresh.setToolTip(nmit_tip)
|
|
|
|
self.sbNameMatchSearchThresh.setToolTip(nmst_tip)
|
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
|
|
|
pbl_tip = """<html>
|
2022-01-22 15:00:22 -08:00
|
|
|
The <b>Publisher Filter</b> is for eliminating automatic matches to certain publishers
|
2015-02-12 14:57:46 -08:00
|
|
|
that you know are incorrect. Useful for avoiding international re-prints with same
|
|
|
|
covers or series names. Enter publisher names separated by commas.
|
|
|
|
</html>"""
|
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.tePublisherFilter.setToolTip(pbl_tip)
|
2015-02-12 14:57:46 -08:00
|
|
|
|
|
|
|
validator = QtGui.QIntValidator(1, 4, self)
|
|
|
|
self.leIssueNumPadding.setValidator(validator)
|
|
|
|
|
2022-06-02 11:23:53 -07:00
|
|
|
self.leRenameTemplate.setToolTip(f"<pre>{html.escape(template_tooltip)}</pre>")
|
2022-06-02 18:32:16 -07:00
|
|
|
self.rename_error: Exception | None = None
|
2023-02-04 11:34:49 -08:00
|
|
|
|
2023-02-17 17:15:46 -08:00
|
|
|
self.sources: dict = comictaggerlib.ui.talkeruigenerator.generate_source_option_tabs(
|
2023-02-19 15:33:22 -08:00
|
|
|
self.tComicTalkers, self.config, self.talkers
|
2023-02-17 17:15:46 -08:00
|
|
|
)
|
2023-02-04 11:34:49 -08:00
|
|
|
self.connect_signals()
|
|
|
|
self.settings_to_form()
|
2022-04-18 22:46:46 -07:00
|
|
|
self.rename_test()
|
2022-07-09 22:27:45 -07:00
|
|
|
self.dir_test()
|
2023-02-13 17:32:56 -08:00
|
|
|
|
|
|
|
# Set General as start tab
|
|
|
|
self.tabWidget.setCurrentIndex(0)
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2023-02-04 11:34:49 -08:00
|
|
|
def connect_signals(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.btnBrowseRar.clicked.connect(self.select_rar)
|
|
|
|
self.btnClearCache.clicked.connect(self.clear_cache)
|
|
|
|
self.btnResetSettings.clicked.connect(self.reset_settings)
|
2022-04-18 18:44:20 -07:00
|
|
|
self.btnTemplateHelp.clicked.connect(self.show_template_help)
|
2022-07-09 22:27:45 -07:00
|
|
|
self.cbxMoveFiles.clicked.connect(self.dir_test)
|
|
|
|
self.leDirectory.textEdited.connect(self.dir_test)
|
2022-04-29 16:37:44 -07:00
|
|
|
self.cbxComplicatedParser.clicked.connect(self.switch_parser)
|
2022-04-18 18:44:20 -07:00
|
|
|
|
2022-11-23 22:16:46 -08:00
|
|
|
self.btnAddLiteralReplacement.clicked.connect(self.addLiteralReplacement)
|
|
|
|
self.btnAddValueReplacement.clicked.connect(self.addValueReplacement)
|
|
|
|
self.btnRemoveLiteralReplacement.clicked.connect(self.removeLiteralReplacement)
|
|
|
|
self.btnRemoveValueReplacement.clicked.connect(self.removeValueReplacement)
|
|
|
|
|
|
|
|
self.leRenameTemplate.textEdited.connect(self.rename_test)
|
|
|
|
self.cbxMoveFiles.clicked.connect(self.rename_test)
|
|
|
|
self.cbxRenameStrict.clicked.connect(self.rename_test)
|
|
|
|
self.cbxSmartCleanup.clicked.connect(self.rename_test)
|
|
|
|
self.cbxChangeExtension.clicked.connect(self.rename_test)
|
|
|
|
self.leIssueNumPadding.textEdited.connect(self.rename_test)
|
|
|
|
self.twLiteralReplacements.cellChanged.connect(self.rename_test)
|
|
|
|
self.twValueReplacements.cellChanged.connect(self.rename_test)
|
|
|
|
|
2023-02-04 11:34:49 -08:00
|
|
|
def disconnect_signals(self) -> None:
|
|
|
|
self.btnAddLiteralReplacement.clicked.disconnect()
|
|
|
|
self.btnAddValueReplacement.clicked.disconnect()
|
|
|
|
self.btnBrowseRar.clicked.disconnect()
|
|
|
|
self.btnClearCache.clicked.disconnect()
|
|
|
|
self.btnRemoveLiteralReplacement.clicked.disconnect()
|
|
|
|
self.btnRemoveValueReplacement.clicked.disconnect()
|
|
|
|
self.btnResetSettings.clicked.disconnect()
|
|
|
|
self.btnTemplateHelp.clicked.disconnect()
|
|
|
|
self.cbxChangeExtension.clicked.disconnect()
|
|
|
|
self.cbxComplicatedParser.clicked.disconnect()
|
|
|
|
self.cbxMoveFiles.clicked.disconnect()
|
|
|
|
self.cbxRenameStrict.clicked.disconnect()
|
|
|
|
self.cbxSmartCleanup.clicked.disconnect()
|
|
|
|
self.leDirectory.textEdited.disconnect()
|
|
|
|
self.leIssueNumPadding.textEdited.disconnect()
|
|
|
|
self.leRenameTemplate.textEdited.disconnect()
|
|
|
|
self.twLiteralReplacements.cellChanged.disconnect()
|
|
|
|
self.twValueReplacements.cellChanged.disconnect()
|
|
|
|
|
2022-11-23 22:16:46 -08:00
|
|
|
def addLiteralReplacement(self) -> None:
|
|
|
|
self.insertRow(self.twLiteralReplacements, self.twLiteralReplacements.rowCount(), Replacement("", "", False))
|
|
|
|
|
|
|
|
def addValueReplacement(self) -> None:
|
|
|
|
self.insertRow(self.twValueReplacements, self.twValueReplacements.rowCount(), Replacement("", "", False))
|
|
|
|
|
|
|
|
def removeLiteralReplacement(self) -> None:
|
|
|
|
if self.twLiteralReplacements.currentRow() >= 0:
|
|
|
|
self.twLiteralReplacements.removeRow(self.twLiteralReplacements.currentRow())
|
|
|
|
|
|
|
|
def removeValueReplacement(self) -> None:
|
|
|
|
if self.twValueReplacements.currentRow() >= 0:
|
|
|
|
self.twValueReplacements.removeRow(self.twValueReplacements.currentRow())
|
|
|
|
|
|
|
|
def insertRow(self, table: QtWidgets.QTableWidget, row: int, replacement: Replacement) -> None:
|
|
|
|
find, replace, strict_only = replacement
|
|
|
|
table.insertRow(row)
|
|
|
|
table.setItem(row, 0, QtWidgets.QTableWidgetItem(find))
|
|
|
|
table.setItem(row, 1, QtWidgets.QTableWidgetItem(replace))
|
|
|
|
tmp = QtWidgets.QTableWidgetItem()
|
|
|
|
if strict_only:
|
|
|
|
tmp.setCheckState(QtCore.Qt.Checked)
|
|
|
|
else:
|
|
|
|
tmp.setCheckState(QtCore.Qt.Unchecked)
|
|
|
|
table.setItem(row, 2, tmp)
|
|
|
|
|
|
|
|
def rename_test(self, *args: Any, **kwargs: Any) -> None:
|
2022-07-09 22:27:45 -07:00
|
|
|
self._rename_test(self.leRenameTemplate.text())
|
2022-04-18 22:46:46 -07:00
|
|
|
|
2022-07-09 22:27:45 -07:00
|
|
|
def dir_test(self) -> None:
|
|
|
|
self.lblDir.setText(
|
2022-11-23 22:16:46 -08:00
|
|
|
str(pathlib.Path(self.leDirectory.text().strip()).resolve()) if self.cbxMoveFiles.isChecked() else ""
|
2022-07-09 22:27:45 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
def _rename_test(self, template: str) -> None:
|
2022-11-23 22:16:46 -08:00
|
|
|
fr = FileRenamer(
|
|
|
|
md_test,
|
|
|
|
platform="universal" if self.cbxRenameStrict.isChecked() else "auto",
|
2023-02-04 11:34:49 -08:00
|
|
|
replacements=self.get_replacements(),
|
2022-11-23 22:16:46 -08:00
|
|
|
)
|
2022-04-29 23:27:58 -07:00
|
|
|
fr.move = self.cbxMoveFiles.isChecked()
|
2022-04-18 18:59:17 -07:00
|
|
|
fr.set_template(template)
|
|
|
|
fr.set_issue_zero_padding(int(self.leIssueNumPadding.text()))
|
|
|
|
fr.set_smart_cleanup(self.cbxSmartCleanup.isChecked())
|
|
|
|
try:
|
|
|
|
self.lblRenameTest.setText(fr.determine_name(".cbz"))
|
|
|
|
self.rename_error = None
|
|
|
|
except Exception as e:
|
|
|
|
self.rename_error = e
|
|
|
|
self.lblRenameTest.setText(str(e))
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
def switch_parser(self) -> None:
|
2022-04-29 16:37:44 -07:00
|
|
|
complicated = self.cbxComplicatedParser.isChecked()
|
|
|
|
|
|
|
|
self.cbxRemoveC2C.setEnabled(complicated)
|
|
|
|
self.cbxRemoveFCBD.setEnabled(complicated)
|
|
|
|
self.cbxRemovePublisher.setEnabled(complicated)
|
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
def settings_to_form(self) -> None:
|
2023-02-04 11:34:49 -08:00
|
|
|
self.disconnect_signals()
|
2015-02-12 14:57:46 -08:00
|
|
|
# Copy values from settings to form
|
2023-02-09 19:33:10 -08:00
|
|
|
if "archiver" in self.config[1] and "rar" in self.config[1]["archiver"].v:
|
|
|
|
self.leRarExePath.setText(getattr(self.config[0], self.config[1]["archiver"].v["rar"].internal_name))
|
2023-01-31 00:01:50 -08:00
|
|
|
else:
|
|
|
|
self.leRarExePath.setEnabled(False)
|
2023-01-31 20:21:39 -08:00
|
|
|
self.sbNameMatchIdentifyThresh.setValue(self.config[0].identifier_series_match_identify_thresh)
|
2023-02-18 09:16:56 -08:00
|
|
|
self.sbNameMatchSearchThresh.setValue(self.config[0].identifier_series_match_search_thresh)
|
2023-01-31 20:21:39 -08:00
|
|
|
self.tePublisherFilter.setPlainText("\n".join(self.config[0].identifier_publisher_filter))
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2023-01-31 20:21:39 -08:00
|
|
|
self.cbxCheckForNewVersion.setChecked(self.config[0].general_check_for_new_version)
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2023-01-31 20:21:39 -08:00
|
|
|
self.cbxComplicatedParser.setChecked(self.config[0].filename_complicated_parser)
|
|
|
|
self.cbxRemoveC2C.setChecked(self.config[0].filename_remove_c2c)
|
|
|
|
self.cbxRemoveFCBD.setChecked(self.config[0].filename_remove_fcbd)
|
|
|
|
self.cbxRemovePublisher.setChecked(self.config[0].filename_remove_publisher)
|
2022-04-29 16:37:44 -07:00
|
|
|
self.switch_parser()
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2023-02-18 09:16:56 -08:00
|
|
|
self.cbxClearFormBeforePopulating.setChecked(self.config[0].identifier_clear_form_before_populating)
|
|
|
|
self.cbxUseFilter.setChecked(self.config[0].identifier_always_use_publisher_filter)
|
|
|
|
self.cbxSortByYear.setChecked(self.config[0].identifier_sort_series_by_year)
|
|
|
|
self.cbxExactMatches.setChecked(self.config[0].identifier_exact_series_matches_first)
|
2023-01-31 20:21:39 -08:00
|
|
|
|
|
|
|
self.cbxAssumeLoneCreditIsPrimary.setChecked(self.config[0].cbl_assume_lone_credit_is_primary)
|
|
|
|
self.cbxCopyCharactersToTags.setChecked(self.config[0].cbl_copy_characters_to_tags)
|
|
|
|
self.cbxCopyTeamsToTags.setChecked(self.config[0].cbl_copy_teams_to_tags)
|
|
|
|
self.cbxCopyLocationsToTags.setChecked(self.config[0].cbl_copy_locations_to_tags)
|
|
|
|
self.cbxCopyStoryArcsToTags.setChecked(self.config[0].cbl_copy_storyarcs_to_tags)
|
|
|
|
self.cbxCopyNotesToComments.setChecked(self.config[0].cbl_copy_notes_to_comments)
|
|
|
|
self.cbxCopyWebLinkToComments.setChecked(self.config[0].cbl_copy_weblink_to_comments)
|
|
|
|
self.cbxApplyCBLTransformOnCVIMport.setChecked(self.config[0].cbl_apply_transform_on_import)
|
|
|
|
self.cbxApplyCBLTransformOnBatchOperation.setChecked(self.config[0].cbl_apply_transform_on_bulk_operation)
|
|
|
|
|
|
|
|
self.leRenameTemplate.setText(self.config[0].rename_template)
|
|
|
|
self.leIssueNumPadding.setText(str(self.config[0].rename_issue_number_padding))
|
|
|
|
self.cbxSmartCleanup.setChecked(self.config[0].rename_use_smart_string_cleanup)
|
|
|
|
self.cbxChangeExtension.setChecked(self.config[0].rename_set_extension_based_on_archive)
|
|
|
|
self.cbxMoveFiles.setChecked(self.config[0].rename_move_to_dir)
|
|
|
|
self.leDirectory.setText(self.config[0].rename_dir)
|
|
|
|
self.cbxRenameStrict.setChecked(self.config[0].rename_strict)
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-11-23 22:16:46 -08:00
|
|
|
for table, replacments in zip(
|
2023-01-31 20:21:39 -08:00
|
|
|
(self.twLiteralReplacements, self.twValueReplacements), self.config[0].rename_replacements
|
2022-11-23 22:16:46 -08:00
|
|
|
):
|
|
|
|
table.clearContents()
|
|
|
|
for i in reversed(range(table.rowCount())):
|
|
|
|
table.removeRow(i)
|
|
|
|
for row, replacement in enumerate(replacments):
|
|
|
|
self.insertRow(table, row, replacement)
|
2023-02-17 17:15:46 -08:00
|
|
|
|
|
|
|
# Set talker values
|
|
|
|
comictaggerlib.ui.talkeruigenerator.settings_to_talker_form(self.sources, self.config)
|
|
|
|
|
2023-02-04 11:34:49 -08:00
|
|
|
self.connect_signals()
|
2022-11-23 22:16:46 -08:00
|
|
|
|
2023-02-04 11:34:49 -08:00
|
|
|
def get_replacements(self) -> Replacements:
|
2022-11-23 22:16:46 -08:00
|
|
|
literal_replacements = []
|
|
|
|
value_replacements = []
|
|
|
|
for row in range(self.twLiteralReplacements.rowCount()):
|
|
|
|
if self.twLiteralReplacements.item(row, 0).text():
|
|
|
|
literal_replacements.append(
|
|
|
|
Replacement(
|
|
|
|
self.twLiteralReplacements.item(row, 0).text(),
|
|
|
|
self.twLiteralReplacements.item(row, 1).text(),
|
|
|
|
self.twLiteralReplacements.item(row, 2).checkState() == QtCore.Qt.Checked,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
for row in range(self.twValueReplacements.rowCount()):
|
|
|
|
if self.twValueReplacements.item(row, 0).text():
|
|
|
|
value_replacements.append(
|
|
|
|
Replacement(
|
|
|
|
self.twValueReplacements.item(row, 0).text(),
|
|
|
|
self.twValueReplacements.item(row, 1).text(),
|
|
|
|
self.twValueReplacements.item(row, 2).checkState() == QtCore.Qt.Checked,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
return Replacements(literal_replacements, value_replacements)
|
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
def accept(self) -> None:
|
2022-04-18 22:46:46 -07:00
|
|
|
self.rename_test()
|
2022-04-18 18:59:17 -07:00
|
|
|
if self.rename_error is not None:
|
2022-07-27 23:24:34 -07:00
|
|
|
if isinstance(self.rename_error, ValueError):
|
2023-01-31 20:21:39 -08:00
|
|
|
logger.exception("Invalid format string: %s", self.config[0].rename_template)
|
2022-07-27 23:24:34 -07:00
|
|
|
QtWidgets.QMessageBox.critical(
|
|
|
|
self,
|
|
|
|
"Invalid format string!",
|
|
|
|
"Your rename template is invalid!"
|
|
|
|
f"<br/><br/>{self.rename_error}<br/><br/>"
|
|
|
|
"Please consult the template help in the "
|
|
|
|
"settings and the documentation on the format at "
|
|
|
|
"<a href='https://docs.python.org/3/library/string.html#format-string-syntax'>"
|
|
|
|
"https://docs.python.org/3/library/string.html#format-string-syntax</a>",
|
|
|
|
)
|
|
|
|
return
|
|
|
|
else:
|
|
|
|
logger.exception(
|
2023-01-31 20:21:39 -08:00
|
|
|
"Formatter failure: %s metadata: %s", self.config[0].rename_template, self.renamer.metadata
|
2022-07-27 23:24:34 -07:00
|
|
|
)
|
|
|
|
QtWidgets.QMessageBox.critical(
|
|
|
|
self,
|
|
|
|
"The formatter had an issue!",
|
|
|
|
"The formatter has experienced an unexpected error!"
|
|
|
|
f"<br/><br/>{type(self.rename_error).__name__}: {self.rename_error}<br/><br/>"
|
|
|
|
"Please open an issue at "
|
|
|
|
"<a href='https://github.com/comictagger/comictagger'>"
|
|
|
|
"https://github.com/comictagger/comictagger</a>",
|
|
|
|
)
|
2022-04-18 18:44:20 -07:00
|
|
|
|
2015-02-12 14:57:46 -08:00
|
|
|
# Copy values from form to settings and save
|
2023-02-09 19:33:10 -08:00
|
|
|
if "archiver" in self.config[1] and "rar" in self.config[1]["archiver"].v:
|
|
|
|
setattr(self.config[0], self.config[1]["archiver"].v["rar"].internal_name, str(self.leRarExePath.text()))
|
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
|
|
|
|
2023-01-31 00:01:50 -08:00
|
|
|
# make sure rar program is now in the path for the rar class
|
2023-06-09 16:20:00 -07:00
|
|
|
if self.config[0].archiver_rar: # type: ignore[attr-defined]
|
2023-01-31 00:01:50 -08:00
|
|
|
utils.add_to_path(os.path.dirname(str(self.leRarExePath.text())))
|
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
|
|
|
|
2015-02-12 14:57:46 -08:00
|
|
|
if not str(self.leIssueNumPadding.text()).isdigit():
|
|
|
|
self.leIssueNumPadding.setText("0")
|
|
|
|
|
2023-01-31 20:21:39 -08:00
|
|
|
self.config[0].general_check_for_new_version = self.cbxCheckForNewVersion.isChecked()
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2023-01-31 20:21:39 -08:00
|
|
|
self.config[0].identifier_series_match_identify_thresh = self.sbNameMatchIdentifyThresh.value()
|
2023-02-18 09:16:56 -08:00
|
|
|
self.config[0].identifier_series_match_search_thresh = self.sbNameMatchSearchThresh.value()
|
Convert ComicIssue into GenericMetadata
I could not find a good reason for ComicIssue to exist other than that
it had more attributes than GenericMetadata, so it has been replaced.
New attributes for GenericMetadata:
series_id: a string uniquely identifying the series to tag_origin
series_aliases: alternate series names that are not the canonical name
title_aliases: alternate issue titles that are not the canonical name
alternate_images: a list of urls to alternate cover images
Updated attributes for GenericMetadata:
genre -> genres: str -> list[str]
comments -> description: str -> str
story_arc -> story_arcs: str -> list[str]
series_group -> series_groups: str -> list[str]
character -> characters: str -> list[str]
team -> teams: str -> list[str]
location -> locations: str -> list[str]
tag_origin -> tag_origin: str -> TagOrigin (tuple[str, str])
ComicSeries has been relocated to the ComicAPI package, currently has no
usage within ComicAPI.
CreditMetadata has been renamed to Credit and has replaced Credit from
ComicTalker.
fetch_series has been added to ComicTalker, this is currently only used
in the GUI when a series is selected and does not already contain the
needed fields, this function should always be cached.
A new split function has been added to ComicAPI, all uses of split on
single characters have been updated to use this
cleanup_html and the corresponding setting are now only used in
ComicTagger proper, for display we want any html directly from the
upstream. When applying the metadata we then strip the description of
any html.
A new conversion has been added to the MetadataFormatter:
j: joins any lists into a string with ', '. Note this is a valid
operation on strings as well, it will add ', ' in between every
character.
parse_settings now assigns the given ComicTaggerPaths object to the
result ensuring that the correct path is always used.
2023-08-02 09:00:04 -07:00
|
|
|
self.config[0].identifier_publisher_filter = utils.split(self.tePublisherFilter.toPlainText(), "\n")
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2023-01-31 20:21:39 -08:00
|
|
|
self.config[0].filename_complicated_parser = self.cbxComplicatedParser.isChecked()
|
|
|
|
self.config[0].filename_remove_c2c = self.cbxRemoveC2C.isChecked()
|
|
|
|
self.config[0].filename_remove_fcbd = self.cbxRemoveFCBD.isChecked()
|
|
|
|
self.config[0].filename_remove_publisher = self.cbxRemovePublisher.isChecked()
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2023-02-18 09:16:56 -08:00
|
|
|
self.config[0].identifier_clear_form_before_populating = self.cbxClearFormBeforePopulating.isChecked()
|
|
|
|
self.config[0].identifier_always_use_publisher_filter = self.cbxUseFilter.isChecked()
|
|
|
|
self.config[0].identifier_sort_series_by_year = self.cbxSortByYear.isChecked()
|
|
|
|
self.config[0].identifier_exact_series_matches_first = self.cbxExactMatches.isChecked()
|
2023-01-31 20:21:39 -08:00
|
|
|
|
|
|
|
self.config[0].cbl_assume_lone_credit_is_primary = self.cbxAssumeLoneCreditIsPrimary.isChecked()
|
|
|
|
self.config[0].cbl_copy_characters_to_tags = self.cbxCopyCharactersToTags.isChecked()
|
|
|
|
self.config[0].cbl_copy_teams_to_tags = self.cbxCopyTeamsToTags.isChecked()
|
|
|
|
self.config[0].cbl_copy_locations_to_tags = self.cbxCopyLocationsToTags.isChecked()
|
|
|
|
self.config[0].cbl_copy_storyarcs_to_tags = self.cbxCopyStoryArcsToTags.isChecked()
|
|
|
|
self.config[0].cbl_copy_notes_to_comments = self.cbxCopyNotesToComments.isChecked()
|
|
|
|
self.config[0].cbl_copy_weblink_to_comments = self.cbxCopyWebLinkToComments.isChecked()
|
|
|
|
self.config[0].cbl_apply_transform_on_import = self.cbxApplyCBLTransformOnCVIMport.isChecked()
|
|
|
|
self.config[0].cbl_apply_transform_on_bulk_operation = self.cbxApplyCBLTransformOnBatchOperation.isChecked()
|
|
|
|
|
|
|
|
self.config[0].rename_template = str(self.leRenameTemplate.text())
|
|
|
|
self.config[0].rename_issue_number_padding = int(self.leIssueNumPadding.text())
|
|
|
|
self.config[0].rename_use_smart_string_cleanup = self.cbxSmartCleanup.isChecked()
|
|
|
|
self.config[0].rename_set_extension_based_on_archive = self.cbxChangeExtension.isChecked()
|
|
|
|
self.config[0].rename_move_to_dir = self.cbxMoveFiles.isChecked()
|
|
|
|
self.config[0].rename_dir = self.leDirectory.text()
|
|
|
|
|
|
|
|
self.config[0].rename_strict = self.cbxRenameStrict.isChecked()
|
2023-02-04 11:34:49 -08:00
|
|
|
self.config[0].rename_replacements = self.get_replacements()
|
2023-01-31 20:21:39 -08:00
|
|
|
|
2023-02-19 15:33:22 -08:00
|
|
|
# Read settings from talker tabs
|
|
|
|
comictaggerlib.ui.talkeruigenerator.form_settings_to_config(self.sources, self.config)
|
2023-02-10 17:18:56 -08:00
|
|
|
|
2023-02-09 19:33:10 -08:00
|
|
|
self.update_talkers_config()
|
|
|
|
|
2023-01-31 20:21:39 -08:00
|
|
|
settngs.save_file(self.config, self.config[0].runtime_config.user_config_dir / "settings.json")
|
|
|
|
self.parent().config = self.config
|
2018-09-19 13:05:39 -07:00
|
|
|
QtWidgets.QDialog.accept(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
|
|
|
|
2023-02-09 19:33:10 -08:00
|
|
|
def update_talkers_config(self) -> None:
|
2023-02-23 10:36:57 -08:00
|
|
|
ctsettings.talkers = self.talkers
|
|
|
|
self.config = ctsettings.plugin.validate_talker_settings(self.config)
|
|
|
|
del ctsettings.talkers
|
2023-02-09 19:33:10 -08:00
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
def select_rar(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.select_file(self.leRarExePath, "RAR")
|
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
def clear_cache(self) -> None:
|
2023-01-31 20:21:39 -08:00
|
|
|
ImageFetcher(self.config[0].runtime_config.user_cache_dir).clear_cache()
|
|
|
|
ComicCacher(self.config[0].runtime_config.user_cache_dir, version).clear_cache()
|
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
|
|
|
QtWidgets.QMessageBox.information(self, self.name, "Cache has been cleared.")
|
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
def reset_settings(self) -> None:
|
2023-06-09 16:20:00 -07:00
|
|
|
self.config = cast(settngs.Config[ct_ns], settngs.get_namespace(settngs.defaults(self.config[1])))
|
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.settings_to_form()
|
|
|
|
QtWidgets.QMessageBox.information(self, self.name, self.name + " have been returned to default values.")
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
def select_file(self, control: QtWidgets.QLineEdit, name: str) -> None:
|
2018-09-19 13:05:39 -07:00
|
|
|
dialog = QtWidgets.QFileDialog(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
|
|
|
dialog.setFileMode(QtWidgets.QFileDialog.FileMode.ExistingFile)
|
2015-02-12 14:57:46 -08:00
|
|
|
|
|
|
|
if platform.system() == "Windows":
|
|
|
|
if name == "RAR":
|
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
|
|
|
flt = "Rar Program (Rar.exe)"
|
2015-02-12 14:57:46 -08:00
|
|
|
else:
|
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
|
|
|
flt = "Libraries (*.dll)"
|
|
|
|
dialog.setNameFilter(flt)
|
2015-02-12 14:57:46 -08:00
|
|
|
else:
|
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
|
|
|
dialog.setFilter(QtCore.QDir.Filter.Files)
|
2015-02-12 14:57:46 -08:00
|
|
|
|
|
|
|
dialog.setDirectory(os.path.dirname(str(control.text())))
|
2018-09-19 13:05:39 -07:00
|
|
|
if name == "RAR":
|
2022-11-23 22:16:46 -08:00
|
|
|
dialog.setWindowTitle(f"Find {name} program")
|
2018-09-19 13:05:39 -07:00
|
|
|
else:
|
2022-11-23 22:16:46 -08:00
|
|
|
dialog.setWindowTitle(f"Find {name} library")
|
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
|
|
|
|
|
|
|
if dialog.exec():
|
|
|
|
file_list = dialog.selectedFiles()
|
|
|
|
control.setText(str(file_list[0]))
|
2015-02-12 14:57:46 -08:00
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
def show_rename_tab(self) -> None:
|
2015-02-12 14:57:46 -08:00
|
|
|
self.tabWidget.setCurrentIndex(5)
|
2022-04-18 18:44:20 -07:00
|
|
|
|
2022-05-17 13:57:04 -07:00
|
|
|
def show_template_help(self) -> None:
|
2022-04-18 18:44:20 -07:00
|
|
|
template_help_win = TemplateHelpWindow(self)
|
|
|
|
template_help_win.setModal(False)
|
|
|
|
template_help_win.show()
|
|
|
|
|
|
|
|
|
|
|
|
class TemplateHelpWindow(QtWidgets.QDialog):
|
2022-05-17 13:57:04 -07:00
|
|
|
def __init__(self, parent: QtWidgets.QWidget) -> None:
|
2022-06-02 18:32:16 -07:00
|
|
|
super().__init__(parent)
|
2022-04-18 18:44:20 -07:00
|
|
|
|
2022-10-25 21:48:01 -07:00
|
|
|
uic.loadUi(ui_path / "TemplateHelp.ui", self)
|