Fix adding files to GUI via running ComicTagger with more filenames

Add flake8-print to ensure all logging uses the logging package
This commit is contained in:
Timmy Welch 2022-06-06 19:59:54 -07:00
parent 04409a55c7
commit 470b5c0a17
6 changed files with 8 additions and 7 deletions

View File

@ -2,3 +2,5 @@
max-line-length = 120
extend-ignore = E203, E501, A003
extend-exclude = venv, scripts, build, dist
per-file-ignores =
comictaggerlib/cli.py: T20

View File

@ -36,7 +36,7 @@ repos:
rev: 4.0.1
hooks:
- id: flake8
additional_dependencies: [flake8-encodings, flake8-warnings, flake8-builtins, flake8-eradicate, flake8-length]
additional_dependencies: [flake8-encodings, flake8-warnings, flake8-builtins, flake8-eradicate, flake8-length, flake8-print]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.960
hooks:

View File

@ -235,7 +235,7 @@ class FileSelectionList(QtWidgets.QWidget):
def get_current_list_row(self, path: str) -> int:
for r in range(self.twList.rowCount()):
ca = cast(ComicArchive, self.get_archive_by_row(r))
if ca.path == path:
if str(ca.path) == path:
return r
return -1

View File

@ -138,7 +138,7 @@ def ctmain() -> None:
SETTINGS.cv_api_key = opts.cv_api_key
SETTINGS.save()
if opts.only_set_cv_key:
print("Key set")
print("Key set") # noqa: T201
return
ComicVineTalker.api_key = SETTINGS.cv_api_key
@ -161,8 +161,7 @@ def ctmain() -> None:
if not qt_available and not opts.no_gui:
opts.no_gui = True
print("PyQt5 is not available. ComicTagger is limited to command-line mode.")
logger.info("PyQt5 is not available. ComicTagger is limited to command-line mode.")
logger.warn("PyQt5 is not available. ComicTagger is limited to command-line mode.")
if opts.no_gui:
try:

View File

@ -91,7 +91,7 @@ class TaggerWindow(QtWidgets.QMainWindow):
socket.connectToServer(settings.install_id)
alive = socket.waitForConnected(3000)
if alive:
print(f"Another application with key [{settings.install_id}] is already running")
logger.setLevel(logging.INFO)
logger.info("Another application with key [%s] is already running", settings.install_id)
# send file list to other instance
if file_list:

View File

@ -209,7 +209,7 @@ class VolumeSelectionWindow(QtWidgets.QDialog):
def log_id_output(self, text: str) -> None:
if self.iddialog is not None:
print(text, end=" ")
print(text, end=" ") # noqa: T201
self.iddialog.textEdit.ensureCursorVisible()
self.iddialog.textEdit.insertPlainText(text)