mirror of
https://github.com/283375/arcaea-offline-pyside-ui.git
synced 2025-07-01 12:26:26 +00:00
change logging format to %
This commit is contained in:
@ -140,7 +140,11 @@ class OcrQueueModel(QAbstractListModel):
|
||||
return True
|
||||
else:
|
||||
logger.warning(
|
||||
f"{repr(self)} setData at row {index.row()} with role {role} and value {value} rejected."
|
||||
"%r setData at row %d with role %d and value %s rejected!",
|
||||
self,
|
||||
index.row(),
|
||||
role,
|
||||
value,
|
||||
)
|
||||
return False
|
||||
|
||||
@ -150,7 +154,7 @@ class OcrQueueModel(QAbstractListModel):
|
||||
|
||||
@iccOption.setter
|
||||
def iccOption(self, opt: IccOption):
|
||||
logger.debug(f"ICC option changed to {opt}")
|
||||
logger.debug("ICC option changed to %s", opt)
|
||||
self.__iccOption = opt
|
||||
|
||||
@overload
|
||||
@ -159,8 +163,7 @@ class OcrQueueModel(QAbstractListModel):
|
||||
image: str,
|
||||
runnable: OcrRunnable = None,
|
||||
process_func: Callable[[Optional[str], QImage, Any], Score] = None,
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
@overload
|
||||
def addItem(
|
||||
@ -168,8 +171,7 @@ class OcrQueueModel(QAbstractListModel):
|
||||
image: QImage,
|
||||
runnable: OcrRunnable = None,
|
||||
process_func: Callable[[Optional[str], QImage, Any], Score] = None,
|
||||
):
|
||||
...
|
||||
): ...
|
||||
|
||||
def addItem(
|
||||
self,
|
||||
@ -179,7 +181,7 @@ class OcrQueueModel(QAbstractListModel):
|
||||
):
|
||||
if isinstance(image, str):
|
||||
if image in self.imagePaths or not QFileInfo(image).exists():
|
||||
logger.warning(f"Attempting to add an invalid file {image}")
|
||||
logger.warning("Attempting to add an invalid file %s", image)
|
||||
return
|
||||
imagePath = image
|
||||
if self.iccOption == IccOption.TryFix:
|
||||
@ -223,7 +225,7 @@ class OcrQueueModel(QAbstractListModel):
|
||||
index = self.index(row, 0)
|
||||
imagePath: str = index.data(self.ImagePathRole)
|
||||
qImage: QImage = index.data(self.ImageQImageRole)
|
||||
logger.debug(f"update request: {result}@row{row}")
|
||||
logger.debug("update request: %r@row%d", result, row)
|
||||
processOcrResultFunc = index.data(self.ProcessOcrResultFuncRole)
|
||||
|
||||
chart, scoreInsert = processOcrResultFunc(imagePath, qImage, result)
|
||||
@ -294,8 +296,8 @@ class OcrQueueModel(QAbstractListModel):
|
||||
self.__items.pop(row)
|
||||
self.endRemoveRows()
|
||||
return
|
||||
except Exception as e:
|
||||
logger.exception(f"Error accepting {repr(item)}")
|
||||
except Exception:
|
||||
logger.exception("Error accepting %r", item)
|
||||
return
|
||||
|
||||
def acceptItems(self, __rows: list[int], ignoreValidate: bool = False):
|
||||
|
@ -28,7 +28,9 @@ class DbScoreTableModel(DbTableModel):
|
||||
QCoreApplication.translate("DbScoreTableModel", "horizontalHeader.id"),
|
||||
QCoreApplication.translate("DbScoreTableModel", "horizontalHeader.chart"),
|
||||
QCoreApplication.translate("DbScoreTableModel", "horizontalHeader.score"),
|
||||
QCoreApplication.translate("DbScoreTableModel", "horizontalHeader.potential"),
|
||||
QCoreApplication.translate(
|
||||
"DbScoreTableModel", "horizontalHeader.potential"
|
||||
),
|
||||
# fmt: on
|
||||
]
|
||||
|
||||
@ -154,7 +156,7 @@ class DbScoreTableModel(DbTableModel):
|
||||
self.syncDb()
|
||||
return True
|
||||
except Exception:
|
||||
logger.exception(f"Table[Score]: Cannot remove row {row}")
|
||||
logger.exception("Table[Score]: Cannot remove row %s", row)
|
||||
return False
|
||||
|
||||
def removeRow(self, row: int, parent=...):
|
||||
|
@ -6,10 +6,10 @@ from arcaea_offline_ocr.b30.chieri.v4.ocr import ChieriBotV4Ocr
|
||||
from arcaea_offline_ocr.b30.shared import B30OcrResultItem
|
||||
from PySide6.QtGui import QImage
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
from ui.extends.components.ocrQueue import OcrRunnable
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ChieriV4OcrRunnable(OcrRunnable):
|
||||
def __init__(self, ocr: ChieriBotV4Ocr, component):
|
||||
|
@ -41,7 +41,7 @@ class AndrealExecuteRunnable(QRunnable):
|
||||
self.signals.completed.emit(self.jsonPath, imageBytes)
|
||||
except Exception as e:
|
||||
imageBytes = None
|
||||
logger.exception(f"{self.__class__.__name__} error")
|
||||
logger.exception("%s error", self.__class__.__name__)
|
||||
self.signals.error.emit(self.jsonPath, str(e))
|
||||
finally:
|
||||
os.unlink(self.jsonPath)
|
||||
@ -84,7 +84,10 @@ class AndrealHelper(QObject):
|
||||
|
||||
def request(self, jsonPath: str, arguments: list[str]):
|
||||
logger.debug(
|
||||
f"{self.__class__.__name__} received request {jsonPath=} {arguments=}"
|
||||
"%s received request jsonPath=%r arguments=%r",
|
||||
self.__class__.__name__,
|
||||
jsonPath,
|
||||
arguments,
|
||||
)
|
||||
runnable = AndrealExecuteRunnable(self.andrealExecutable, jsonPath, arguments)
|
||||
runnable.signals.error.connect(self.error)
|
||||
|
Reference in New Issue
Block a user