mirror of
https://github.com/283375/arcaea-offline-pyside-ui.git
synced 2025-07-01 12:26:26 +00:00
refactor: moving ui.extends
to core
* Settings and Singletons moved
This commit is contained in:
@ -2,9 +2,9 @@ from PySide6.QtCore import QDir, QFileInfo, Qt, Signal, Slot
|
||||
from PySide6.QtGui import QDragEnterEvent, QDragLeaveEvent, QDropEvent
|
||||
from PySide6.QtWidgets import QFileDialog, QWidget
|
||||
|
||||
from core.settings import settings
|
||||
from ui.designer.components.fileSelector_ui import Ui_FileSelector
|
||||
from ui.extends.shared.language import LanguageChangeEventFilter
|
||||
from ui.extends.shared.settings import Settings
|
||||
|
||||
|
||||
class FileSelector(Ui_FileSelector, QWidget):
|
||||
@ -122,13 +122,13 @@ class FileSelector(Ui_FileSelector, QWidget):
|
||||
if self.__selectedFiles:
|
||||
return
|
||||
|
||||
if value := Settings().value(self.settingsKey):
|
||||
if value := settings.value(self.settingsKey):
|
||||
self.selectFile(value)
|
||||
|
||||
Settings().updated.connect(self.settingsUpdated)
|
||||
settings.updated.connect(self.settingsUpdated)
|
||||
|
||||
def disconnectSettings(self):
|
||||
Settings().updated.disconnect(self.settingsUpdated)
|
||||
settings.updated.disconnect(self.settingsUpdated)
|
||||
self.settingsKey = None
|
||||
|
||||
def settingsUpdated(self, key: str):
|
||||
@ -139,4 +139,4 @@ class FileSelector(Ui_FileSelector, QWidget):
|
||||
if self.__selectedFiles:
|
||||
return
|
||||
|
||||
self.selectFile(Settings().value(self.settingsKey))
|
||||
self.selectFile(settings.value(self.settingsKey))
|
||||
|
@ -1,8 +1,8 @@
|
||||
from PySide6.QtCore import Signal
|
||||
from PySide6.QtWidgets import QButtonGroup, QDialog
|
||||
|
||||
from core.settings import SettingsKeys, SettingsValues, settings
|
||||
from ui.designer.components.ocrQueueOptionsDialog_ui import Ui_OcrQueueOptionsDialog
|
||||
from ui.extends.shared.settings import Settings
|
||||
|
||||
|
||||
class OcrQueueOptionsDialog(QDialog, Ui_OcrQueueOptionsDialog):
|
||||
@ -29,13 +29,12 @@ class OcrQueueOptionsDialog(QDialog, Ui_OcrQueueOptionsDialog):
|
||||
self.on_scoreDateSourceButtonGroup_buttonClicked
|
||||
)
|
||||
|
||||
self.settings = Settings()
|
||||
self.settings.updated.connect(self.syncCheckboxesFromSettings)
|
||||
settings.updated.connect(self.syncCheckboxesFromSettings)
|
||||
self.syncCheckboxesFromSettings()
|
||||
|
||||
def syncCheckboxesFromSettings(self):
|
||||
scoreDateSource = self.settings.scoreDateSource()
|
||||
if scoreDateSource == "lastModified":
|
||||
scoreDateSource = settings.stringValue(SettingsKeys.Ocr.DateSource)
|
||||
if scoreDateSource == SettingsValues.Ocr.DateSource.FileLastModified:
|
||||
self.dateUseModifyDateRadioButton.setChecked(True)
|
||||
else:
|
||||
self.dateUseCreationDateRadioButton.setChecked(True)
|
||||
@ -43,6 +42,8 @@ class OcrQueueOptionsDialog(QDialog, Ui_OcrQueueOptionsDialog):
|
||||
def on_scoreDateSourceButtonGroup_buttonClicked(self, button):
|
||||
buttonId = self.scoreDateSourceButtonGroup.id(button)
|
||||
if buttonId == 1:
|
||||
self.settings.setScoreDateSource("lastModified")
|
||||
value = SettingsValues.Ocr.DateSource.FileLastModified
|
||||
else:
|
||||
self.settings.setScoreDateSource("birthTime")
|
||||
value = SettingsValues.Ocr.DateSource.FileCreated
|
||||
|
||||
settings.setValue(SettingsKeys.Ocr.DateSource, value)
|
||||
|
Reference in New Issue
Block a user