mirror of
https://github.com/283375/arcaea-offline-pyside-ui.git
synced 2025-07-01 12:26:26 +00:00
feat: OCR score date source (#9)
* New settings entries * Choose `birthTime`/`lastModified` for OCR score date source if the image EXIF fails
This commit is contained in:
48
ui/implements/components/ocrQueueOptionsDialog.py
Normal file
48
ui/implements/components/ocrQueueOptionsDialog.py
Normal file
@ -0,0 +1,48 @@
|
||||
from PySide6.QtCore import Signal
|
||||
from PySide6.QtWidgets import QButtonGroup, QDialog
|
||||
|
||||
from ui.designer.components.ocrQueueOptionsDialog_ui import Ui_OcrQueueOptionsDialog
|
||||
from ui.extends.shared.settings import Settings
|
||||
|
||||
|
||||
class OcrQueueOptionsDialog(QDialog, Ui_OcrQueueOptionsDialog):
|
||||
iccOptionsChanged = Signal(int)
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super(OcrQueueOptionsDialog, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
|
||||
self.iccOptionButtonGroup = QButtonGroup(self)
|
||||
self.iccOptionButtonGroup.buttonToggled.connect(
|
||||
lambda: self.iccOptionsChanged.emit(self.iccOptionButtonGroup.checkedId())
|
||||
)
|
||||
self.iccOptionButtonGroup.addButton(self.iccUseQtRadioButton, 0)
|
||||
self.iccOptionButtonGroup.addButton(self.iccUsePILRadioButton, 1)
|
||||
self.iccOptionButtonGroup.addButton(self.iccTryFixRadioButton, 2)
|
||||
|
||||
self.scoreDateSourceButtonGroup = QButtonGroup(self)
|
||||
self.scoreDateSourceButtonGroup.addButton(
|
||||
self.dateUseCreationDateRadioButton, 0
|
||||
)
|
||||
self.scoreDateSourceButtonGroup.addButton(self.dateUseModifyDateRadioButton, 1)
|
||||
self.scoreDateSourceButtonGroup.buttonClicked.connect(
|
||||
self.on_scoreDateSourceButtonGroup_buttonClicked
|
||||
)
|
||||
|
||||
self.settings = Settings()
|
||||
self.settings.updated.connect(self.syncCheckboxesFromSettings)
|
||||
self.syncCheckboxesFromSettings()
|
||||
|
||||
def syncCheckboxesFromSettings(self):
|
||||
scoreDateSource = self.settings.scoreDateSource()
|
||||
if scoreDateSource == "lastModified":
|
||||
self.dateUseModifyDateRadioButton.setChecked(True)
|
||||
else:
|
||||
self.dateUseCreationDateRadioButton.setChecked(True)
|
||||
|
||||
def on_scoreDateSourceButtonGroup_buttonClicked(self, button):
|
||||
buttonId = self.scoreDateSourceButtonGroup.id(button)
|
||||
if buttonId == 1:
|
||||
self.settings.setScoreDateSource("lastModified")
|
||||
else:
|
||||
self.settings.setScoreDateSource("birthTime")
|
Reference in New Issue
Block a user