mirror of
https://github.com/283375/arcaea-offline-pyside-ui.git
synced 2025-04-17 16:20:18 +00:00
wip: arcaea-offline-ocr==0.1.0
ui changes
This commit is contained in:
parent
6dbb7cbfef
commit
8b6f64e041
@ -24,45 +24,37 @@
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>deviceSelector.title</string>
|
||||
<string>options.title</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="deviceUseAutoFactorCheckBox">
|
||||
<widget class="QCheckBox" name="options_usePresetCheckBox">
|
||||
<property name="text">
|
||||
<string>deviceSelector.useAutoFactor</string>
|
||||
<string>options.usePreset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="deviceSizesV2CheckBox">
|
||||
<property name="text">
|
||||
<string notr="true">SizesV2</string>
|
||||
<widget class="QComboBox" name="options_presetComboBox">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="FileSelector" name="deviceFileSelector" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="DevicesComboBox" name="deviceComboBox"/>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="horizontalWidget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<widget class="QWidget" name="options_preciseControlWidget" native="true">
|
||||
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,1,0">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@ -75,24 +67,22 @@
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_6">
|
||||
<property name="title">
|
||||
<string>knnModelSelector.title</string>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>options.rois</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="FileSelector" name="knnModelSelector" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="deviceDependenciesStackedWidget">
|
||||
<item row="0" column="1">
|
||||
<widget class="QStackedWidget" name="options_roisStackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="deviceV1">
|
||||
<widget class="QWidget" name="page">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
@ -107,20 +97,11 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="title">
|
||||
<string>tesseractSelector.title</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="FileSelector" name="tesseractFileSelector" native="true"/>
|
||||
<widget class="QComboBox" name="options_roisComboBox"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="deviceV2">
|
||||
<widget class="QWidget" name="page_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
@ -135,19 +116,145 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_5">
|
||||
<property name="title">
|
||||
<string>phashDatabaseSelector.title</string>
|
||||
<widget class="FileSelector" name="options_roisCustomSelector" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>options.masker</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QCheckBox" name="options_roisUseCustomCheckBox">
|
||||
<property name="text">
|
||||
<string>options.useCustom</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QCheckBox" name="options_maskerUseCustomCheckBox">
|
||||
<property name="text">
|
||||
<string>options.useCustom</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QStackedWidget" name="options_maskerStackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_3">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<widget class="FileSelector" name="phashDatabaseSelector" native="true"/>
|
||||
<widget class="QComboBox" name="options_maskerComboBox"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_4">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="FileSelector" name="options_maskerCustomSelector" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>dependencies.title</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout" columnstretch="0,0,0,0,1">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>dependencies.knnModel</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="dependencies_knnModelStatusLabel">
|
||||
<property name="text">
|
||||
<string notr="true">...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="dependencies_phashDatabaseStatusLabel">
|
||||
<property name="text">
|
||||
<string notr="true">...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="FileSelector" name="dependencies_phashDatabaseSelector" native="true"/>
|
||||
</item>
|
||||
<item row="0" column="1" rowspan="2">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="FileSelector" name="dependencies_knnModelSelector" native="true"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>dependencies.phashDatabase</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3" rowspan="2">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@ -178,12 +285,24 @@
|
||||
<header>ui.implements.components.ocrQueue</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>DevicesComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>ui.implements.components.devicesComboBox</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>options_usePresetCheckBox</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>options_presetComboBox</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>82</x>
|
||||
<y>111</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>82</x>
|
||||
<y>175</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
@ -15,11 +15,11 @@ from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
|
||||
QFont, QFontDatabase, QGradient, QIcon,
|
||||
QImage, QKeySequence, QLinearGradient, QPainter,
|
||||
QPalette, QPixmap, QRadialGradient, QTransform)
|
||||
from PySide6.QtWidgets import (QApplication, QCheckBox, QGroupBox, QHBoxLayout,
|
||||
from PySide6.QtWidgets import (QApplication, QCheckBox, QComboBox, QFrame,
|
||||
QGridLayout, QGroupBox, QHBoxLayout, QLabel,
|
||||
QPushButton, QSizePolicy, QStackedWidget, QVBoxLayout,
|
||||
QWidget)
|
||||
|
||||
from ui.implements.components.devicesComboBox import DevicesComboBox
|
||||
from ui.implements.components.fileSelector import FileSelector
|
||||
from ui.implements.components.ocrQueue import OcrQueue
|
||||
|
||||
@ -38,117 +38,191 @@ class Ui_TabOcr_Device(object):
|
||||
|
||||
self.groupBox = QGroupBox(TabOcr_Device)
|
||||
self.groupBox.setObjectName(u"groupBox")
|
||||
self.verticalLayout = QVBoxLayout(self.groupBox)
|
||||
self.verticalLayout.setObjectName(u"verticalLayout")
|
||||
self.horizontalLayout = QHBoxLayout()
|
||||
self.horizontalLayout = QHBoxLayout(self.groupBox)
|
||||
self.horizontalLayout.setObjectName(u"horizontalLayout")
|
||||
self.deviceUseAutoFactorCheckBox = QCheckBox(self.groupBox)
|
||||
self.deviceUseAutoFactorCheckBox.setObjectName(u"deviceUseAutoFactorCheckBox")
|
||||
self.verticalLayout = QVBoxLayout()
|
||||
self.verticalLayout.setObjectName(u"verticalLayout")
|
||||
self.options_usePresetCheckBox = QCheckBox(self.groupBox)
|
||||
self.options_usePresetCheckBox.setObjectName(u"options_usePresetCheckBox")
|
||||
|
||||
self.horizontalLayout.addWidget(self.deviceUseAutoFactorCheckBox)
|
||||
self.verticalLayout.addWidget(self.options_usePresetCheckBox)
|
||||
|
||||
self.deviceSizesV2CheckBox = QCheckBox(self.groupBox)
|
||||
self.deviceSizesV2CheckBox.setObjectName(u"deviceSizesV2CheckBox")
|
||||
self.deviceSizesV2CheckBox.setText(u"SizesV2")
|
||||
self.options_presetComboBox = QComboBox(self.groupBox)
|
||||
self.options_presetComboBox.setObjectName(u"options_presetComboBox")
|
||||
self.options_presetComboBox.setEnabled(False)
|
||||
|
||||
self.horizontalLayout.addWidget(self.deviceSizesV2CheckBox)
|
||||
self.verticalLayout.addWidget(self.options_presetComboBox)
|
||||
|
||||
|
||||
self.verticalLayout.addLayout(self.horizontalLayout)
|
||||
self.horizontalLayout.addLayout(self.verticalLayout)
|
||||
|
||||
self.deviceFileSelector = FileSelector(self.groupBox)
|
||||
self.deviceFileSelector.setObjectName(u"deviceFileSelector")
|
||||
self.line_3 = QFrame(self.groupBox)
|
||||
self.line_3.setObjectName(u"line_3")
|
||||
self.line_3.setFrameShape(QFrame.VLine)
|
||||
self.line_3.setFrameShadow(QFrame.Sunken)
|
||||
|
||||
self.verticalLayout.addWidget(self.deviceFileSelector)
|
||||
self.horizontalLayout.addWidget(self.line_3)
|
||||
|
||||
self.deviceComboBox = DevicesComboBox(self.groupBox)
|
||||
self.deviceComboBox.setObjectName(u"deviceComboBox")
|
||||
self.options_preciseControlWidget = QWidget(self.groupBox)
|
||||
self.options_preciseControlWidget.setObjectName(u"options_preciseControlWidget")
|
||||
self.gridLayout_2 = QGridLayout(self.options_preciseControlWidget)
|
||||
self.gridLayout_2.setObjectName(u"gridLayout_2")
|
||||
self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||
self.label = QLabel(self.options_preciseControlWidget)
|
||||
self.label.setObjectName(u"label")
|
||||
self.label.setAlignment(Qt.AlignRight|Qt.AlignTrailing|Qt.AlignVCenter)
|
||||
|
||||
self.verticalLayout.addWidget(self.deviceComboBox)
|
||||
self.gridLayout_2.addWidget(self.label, 0, 0, 1, 1)
|
||||
|
||||
self.options_roisStackedWidget = QStackedWidget(self.options_preciseControlWidget)
|
||||
self.options_roisStackedWidget.setObjectName(u"options_roisStackedWidget")
|
||||
self.page = QWidget()
|
||||
self.page.setObjectName(u"page")
|
||||
self.verticalLayout_2 = QVBoxLayout(self.page)
|
||||
self.verticalLayout_2.setObjectName(u"verticalLayout_2")
|
||||
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||
self.options_roisComboBox = QComboBox(self.page)
|
||||
self.options_roisComboBox.setObjectName(u"options_roisComboBox")
|
||||
|
||||
self.verticalLayout_2.addWidget(self.options_roisComboBox)
|
||||
|
||||
self.options_roisStackedWidget.addWidget(self.page)
|
||||
self.page_2 = QWidget()
|
||||
self.page_2.setObjectName(u"page_2")
|
||||
self.verticalLayout_4 = QVBoxLayout(self.page_2)
|
||||
self.verticalLayout_4.setObjectName(u"verticalLayout_4")
|
||||
self.verticalLayout_4.setContentsMargins(0, 0, 0, 0)
|
||||
self.options_roisCustomSelector = FileSelector(self.page_2)
|
||||
self.options_roisCustomSelector.setObjectName(u"options_roisCustomSelector")
|
||||
|
||||
self.verticalLayout_4.addWidget(self.options_roisCustomSelector)
|
||||
|
||||
self.options_roisStackedWidget.addWidget(self.page_2)
|
||||
|
||||
self.gridLayout_2.addWidget(self.options_roisStackedWidget, 0, 1, 1, 1)
|
||||
|
||||
self.label_2 = QLabel(self.options_preciseControlWidget)
|
||||
self.label_2.setObjectName(u"label_2")
|
||||
self.label_2.setAlignment(Qt.AlignRight|Qt.AlignTrailing|Qt.AlignVCenter)
|
||||
|
||||
self.gridLayout_2.addWidget(self.label_2, 1, 0, 1, 1)
|
||||
|
||||
self.options_roisUseCustomCheckBox = QCheckBox(self.options_preciseControlWidget)
|
||||
self.options_roisUseCustomCheckBox.setObjectName(u"options_roisUseCustomCheckBox")
|
||||
|
||||
self.gridLayout_2.addWidget(self.options_roisUseCustomCheckBox, 0, 2, 1, 1)
|
||||
|
||||
self.options_maskerUseCustomCheckBox = QCheckBox(self.options_preciseControlWidget)
|
||||
self.options_maskerUseCustomCheckBox.setObjectName(u"options_maskerUseCustomCheckBox")
|
||||
|
||||
self.gridLayout_2.addWidget(self.options_maskerUseCustomCheckBox, 1, 2, 1, 1)
|
||||
|
||||
self.options_maskerStackedWidget = QStackedWidget(self.options_preciseControlWidget)
|
||||
self.options_maskerStackedWidget.setObjectName(u"options_maskerStackedWidget")
|
||||
self.page_3 = QWidget()
|
||||
self.page_3.setObjectName(u"page_3")
|
||||
self.verticalLayout_5 = QVBoxLayout(self.page_3)
|
||||
self.verticalLayout_5.setObjectName(u"verticalLayout_5")
|
||||
self.verticalLayout_5.setContentsMargins(0, 0, 0, 0)
|
||||
self.options_maskerComboBox = QComboBox(self.page_3)
|
||||
self.options_maskerComboBox.setObjectName(u"options_maskerComboBox")
|
||||
|
||||
self.verticalLayout_5.addWidget(self.options_maskerComboBox)
|
||||
|
||||
self.options_maskerStackedWidget.addWidget(self.page_3)
|
||||
self.page_4 = QWidget()
|
||||
self.page_4.setObjectName(u"page_4")
|
||||
self.verticalLayout_6 = QVBoxLayout(self.page_4)
|
||||
self.verticalLayout_6.setObjectName(u"verticalLayout_6")
|
||||
self.verticalLayout_6.setContentsMargins(0, 0, 0, 0)
|
||||
self.options_maskerCustomSelector = FileSelector(self.page_4)
|
||||
self.options_maskerCustomSelector.setObjectName(u"options_maskerCustomSelector")
|
||||
|
||||
self.verticalLayout_6.addWidget(self.options_maskerCustomSelector)
|
||||
|
||||
self.options_maskerStackedWidget.addWidget(self.page_4)
|
||||
|
||||
self.gridLayout_2.addWidget(self.options_maskerStackedWidget, 1, 1, 1, 1)
|
||||
|
||||
self.gridLayout_2.setColumnStretch(1, 1)
|
||||
|
||||
self.horizontalLayout.addWidget(self.options_preciseControlWidget)
|
||||
|
||||
|
||||
self.verticalLayout_3.addWidget(self.groupBox)
|
||||
|
||||
self.horizontalWidget = QWidget(TabOcr_Device)
|
||||
self.horizontalWidget.setObjectName(u"horizontalWidget")
|
||||
sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Maximum)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.horizontalWidget.sizePolicy().hasHeightForWidth())
|
||||
self.horizontalWidget.setSizePolicy(sizePolicy)
|
||||
self.horizontalLayout_2 = QHBoxLayout(self.horizontalWidget)
|
||||
self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
|
||||
self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||
self.groupBox_6 = QGroupBox(self.horizontalWidget)
|
||||
self.groupBox_6.setObjectName(u"groupBox_6")
|
||||
self.verticalLayout_6 = QVBoxLayout(self.groupBox_6)
|
||||
self.verticalLayout_6.setObjectName(u"verticalLayout_6")
|
||||
self.knnModelSelector = FileSelector(self.groupBox_6)
|
||||
self.knnModelSelector.setObjectName(u"knnModelSelector")
|
||||
self.groupBox_2 = QGroupBox(TabOcr_Device)
|
||||
self.groupBox_2.setObjectName(u"groupBox_2")
|
||||
self.gridLayout = QGridLayout(self.groupBox_2)
|
||||
self.gridLayout.setObjectName(u"gridLayout")
|
||||
self.label_3 = QLabel(self.groupBox_2)
|
||||
self.label_3.setObjectName(u"label_3")
|
||||
self.label_3.setAlignment(Qt.AlignRight|Qt.AlignTrailing|Qt.AlignVCenter)
|
||||
|
||||
self.verticalLayout_6.addWidget(self.knnModelSelector)
|
||||
self.gridLayout.addWidget(self.label_3, 0, 0, 1, 1)
|
||||
|
||||
self.dependencies_knnModelStatusLabel = QLabel(self.groupBox_2)
|
||||
self.dependencies_knnModelStatusLabel.setObjectName(u"dependencies_knnModelStatusLabel")
|
||||
self.dependencies_knnModelStatusLabel.setText(u"...")
|
||||
|
||||
self.horizontalLayout_2.addWidget(self.groupBox_6)
|
||||
self.gridLayout.addWidget(self.dependencies_knnModelStatusLabel, 0, 2, 1, 1)
|
||||
|
||||
self.deviceDependenciesStackedWidget = QStackedWidget(self.horizontalWidget)
|
||||
self.deviceDependenciesStackedWidget.setObjectName(u"deviceDependenciesStackedWidget")
|
||||
self.deviceV1 = QWidget()
|
||||
self.deviceV1.setObjectName(u"deviceV1")
|
||||
self.verticalLayout_2 = QVBoxLayout(self.deviceV1)
|
||||
self.verticalLayout_2.setObjectName(u"verticalLayout_2")
|
||||
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||
self.groupBox_4 = QGroupBox(self.deviceV1)
|
||||
self.groupBox_4.setObjectName(u"groupBox_4")
|
||||
self.verticalLayout_5 = QVBoxLayout(self.groupBox_4)
|
||||
self.verticalLayout_5.setObjectName(u"verticalLayout_5")
|
||||
self.tesseractFileSelector = FileSelector(self.groupBox_4)
|
||||
self.tesseractFileSelector.setObjectName(u"tesseractFileSelector")
|
||||
self.dependencies_phashDatabaseStatusLabel = QLabel(self.groupBox_2)
|
||||
self.dependencies_phashDatabaseStatusLabel.setObjectName(u"dependencies_phashDatabaseStatusLabel")
|
||||
self.dependencies_phashDatabaseStatusLabel.setText(u"...")
|
||||
|
||||
self.verticalLayout_5.addWidget(self.tesseractFileSelector)
|
||||
self.gridLayout.addWidget(self.dependencies_phashDatabaseStatusLabel, 1, 2, 1, 1)
|
||||
|
||||
self.dependencies_phashDatabaseSelector = FileSelector(self.groupBox_2)
|
||||
self.dependencies_phashDatabaseSelector.setObjectName(u"dependencies_phashDatabaseSelector")
|
||||
|
||||
self.verticalLayout_2.addWidget(self.groupBox_4)
|
||||
self.gridLayout.addWidget(self.dependencies_phashDatabaseSelector, 1, 4, 1, 1)
|
||||
|
||||
self.deviceDependenciesStackedWidget.addWidget(self.deviceV1)
|
||||
self.deviceV2 = QWidget()
|
||||
self.deviceV2.setObjectName(u"deviceV2")
|
||||
self.verticalLayout_4 = QVBoxLayout(self.deviceV2)
|
||||
self.verticalLayout_4.setObjectName(u"verticalLayout_4")
|
||||
self.verticalLayout_4.setContentsMargins(0, 0, 0, 0)
|
||||
self.groupBox_5 = QGroupBox(self.deviceV2)
|
||||
self.groupBox_5.setObjectName(u"groupBox_5")
|
||||
self.verticalLayout_7 = QVBoxLayout(self.groupBox_5)
|
||||
self.verticalLayout_7.setObjectName(u"verticalLayout_7")
|
||||
self.phashDatabaseSelector = FileSelector(self.groupBox_5)
|
||||
self.phashDatabaseSelector.setObjectName(u"phashDatabaseSelector")
|
||||
self.line = QFrame(self.groupBox_2)
|
||||
self.line.setObjectName(u"line")
|
||||
self.line.setFrameShape(QFrame.VLine)
|
||||
self.line.setFrameShadow(QFrame.Sunken)
|
||||
|
||||
self.verticalLayout_7.addWidget(self.phashDatabaseSelector)
|
||||
self.gridLayout.addWidget(self.line, 0, 1, 2, 1)
|
||||
|
||||
self.dependencies_knnModelSelector = FileSelector(self.groupBox_2)
|
||||
self.dependencies_knnModelSelector.setObjectName(u"dependencies_knnModelSelector")
|
||||
|
||||
self.verticalLayout_4.addWidget(self.groupBox_5)
|
||||
self.gridLayout.addWidget(self.dependencies_knnModelSelector, 0, 4, 1, 1)
|
||||
|
||||
self.deviceDependenciesStackedWidget.addWidget(self.deviceV2)
|
||||
self.label_4 = QLabel(self.groupBox_2)
|
||||
self.label_4.setObjectName(u"label_4")
|
||||
self.label_4.setAlignment(Qt.AlignRight|Qt.AlignTrailing|Qt.AlignVCenter)
|
||||
|
||||
self.horizontalLayout_2.addWidget(self.deviceDependenciesStackedWidget)
|
||||
self.gridLayout.addWidget(self.label_4, 1, 0, 1, 1)
|
||||
|
||||
self.line_2 = QFrame(self.groupBox_2)
|
||||
self.line_2.setObjectName(u"line_2")
|
||||
self.line_2.setFrameShape(QFrame.VLine)
|
||||
self.line_2.setFrameShadow(QFrame.Sunken)
|
||||
|
||||
self.verticalLayout_3.addWidget(self.horizontalWidget)
|
||||
self.gridLayout.addWidget(self.line_2, 0, 3, 2, 1)
|
||||
|
||||
self.gridLayout.setColumnStretch(4, 1)
|
||||
|
||||
self.verticalLayout_3.addWidget(self.groupBox_2)
|
||||
|
||||
self.ocrQueue = OcrQueue(TabOcr_Device)
|
||||
self.ocrQueue.setObjectName(u"ocrQueue")
|
||||
sizePolicy1 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding)
|
||||
sizePolicy1.setHorizontalStretch(0)
|
||||
sizePolicy1.setVerticalStretch(0)
|
||||
sizePolicy1.setHeightForWidth(self.ocrQueue.sizePolicy().hasHeightForWidth())
|
||||
self.ocrQueue.setSizePolicy(sizePolicy1)
|
||||
sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.ocrQueue.sizePolicy().hasHeightForWidth())
|
||||
self.ocrQueue.setSizePolicy(sizePolicy)
|
||||
|
||||
self.verticalLayout_3.addWidget(self.ocrQueue)
|
||||
|
||||
|
||||
self.retranslateUi(TabOcr_Device)
|
||||
self.options_usePresetCheckBox.toggled.connect(self.options_presetComboBox.setEnabled)
|
||||
|
||||
self.deviceDependenciesStackedWidget.setCurrentIndex(0)
|
||||
self.options_roisStackedWidget.setCurrentIndex(0)
|
||||
self.options_maskerStackedWidget.setCurrentIndex(0)
|
||||
|
||||
|
||||
QMetaObject.connectSlotsByName(TabOcr_Device)
|
||||
@ -156,11 +230,15 @@ class Ui_TabOcr_Device(object):
|
||||
|
||||
def retranslateUi(self, TabOcr_Device):
|
||||
self.openWizardButton.setText(QCoreApplication.translate("TabOcr_Device", u"openWizardButton", None))
|
||||
self.groupBox.setTitle(QCoreApplication.translate("TabOcr_Device", u"deviceSelector.title", None))
|
||||
self.deviceUseAutoFactorCheckBox.setText(QCoreApplication.translate("TabOcr_Device", u"deviceSelector.useAutoFactor", None))
|
||||
self.groupBox_6.setTitle(QCoreApplication.translate("TabOcr_Device", u"knnModelSelector.title", None))
|
||||
self.groupBox_4.setTitle(QCoreApplication.translate("TabOcr_Device", u"tesseractSelector.title", None))
|
||||
self.groupBox_5.setTitle(QCoreApplication.translate("TabOcr_Device", u"phashDatabaseSelector.title", None))
|
||||
self.groupBox.setTitle(QCoreApplication.translate("TabOcr_Device", u"options.title", None))
|
||||
self.options_usePresetCheckBox.setText(QCoreApplication.translate("TabOcr_Device", u"options.usePreset", None))
|
||||
self.label.setText(QCoreApplication.translate("TabOcr_Device", u"options.rois", None))
|
||||
self.label_2.setText(QCoreApplication.translate("TabOcr_Device", u"options.masker", None))
|
||||
self.options_roisUseCustomCheckBox.setText(QCoreApplication.translate("TabOcr_Device", u"options.useCustom", None))
|
||||
self.options_maskerUseCustomCheckBox.setText(QCoreApplication.translate("TabOcr_Device", u"options.useCustom", None))
|
||||
self.groupBox_2.setTitle(QCoreApplication.translate("TabOcr_Device", u"dependencies.title", None))
|
||||
self.label_3.setText(QCoreApplication.translate("TabOcr_Device", u"dependencies.knnModel", None))
|
||||
self.label_4.setText(QCoreApplication.translate("TabOcr_Device", u"dependencies.phashDatabase", None))
|
||||
pass
|
||||
# retranslateUi
|
||||
|
||||
|
@ -1,31 +1,21 @@
|
||||
import logging
|
||||
|
||||
import cv2
|
||||
|
||||
# from arcaea_offline_ocr_device_creation_wizard.implements.wizard import Wizard
|
||||
from arcaea_offline_ocr.device.v1.definition import DeviceV1
|
||||
from arcaea_offline_ocr.device.v2.definition import DeviceV2
|
||||
from arcaea_offline_ocr.phash_db import ImagePHashDatabase
|
||||
from arcaea_offline_ocr.sift_db import SIFTDatabase
|
||||
from arcaea_offline_ocr.phash_db import ImagePhashDatabase
|
||||
from PySide6.QtCore import Qt, Slot
|
||||
from PySide6.QtWidgets import QApplication, QFileDialog, QWidget
|
||||
|
||||
from ui.designer.tabs.tabOcr.tabOcr_Device_ui import Ui_TabOcr_Device
|
||||
from ui.extends.components.ocrQueue import OcrQueueModel
|
||||
from ui.extends.shared.language import LanguageChangeEventFilter
|
||||
from ui.extends.shared.settings import (
|
||||
DEVICES_JSON_FILE,
|
||||
KNN_MODEL_FILE,
|
||||
PHASH_DATABASE_FILE,
|
||||
TESSERACT_FILE,
|
||||
Settings,
|
||||
)
|
||||
from ui.extends.shared.settings import KNN_MODEL_FILE, PHASH_DATABASE_FILE
|
||||
from ui.extends.tabs.tabOcr.tabOcr_Device import (
|
||||
ScoreConverter,
|
||||
TabDeviceV2AutoRoisOcrRunnable,
|
||||
TabDeviceV2OcrRunnable,
|
||||
)
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -38,17 +28,36 @@ class TabOcr_Device(Ui_TabOcr_Device, QWidget):
|
||||
self.languageChangeEventFilter = LanguageChangeEventFilter(self)
|
||||
self.installEventFilter(self.languageChangeEventFilter)
|
||||
|
||||
self.deviceFileSelector.filesSelected.connect(self.deviceFileSelected)
|
||||
self.knnModelSelector.filesSelected.connect(self.knnModelFileSelected)
|
||||
self.phashDatabaseSelector.filesSelected.connect(self.phashDatabaseFileSelected)
|
||||
# connect options checkBoxes & comboBoxes
|
||||
self.options_roisUseCustomCheckBox.toggled.connect(
|
||||
lambda useCustom: self.options_roisStackedWidget.setCurrentIndex(
|
||||
1 if useCustom else 0
|
||||
)
|
||||
)
|
||||
self.options_maskerUseCustomCheckBox.toggled.connect(
|
||||
lambda useCustom: self.options_maskerStackedWidget.setCurrentIndex(
|
||||
1 if useCustom else 0
|
||||
)
|
||||
)
|
||||
self.options_usePresetCheckBox.toggled.connect(self.options_setUsePreset)
|
||||
|
||||
self.options_presetComboBox.currentIndexChanged.connect(
|
||||
self.options_presetSelected
|
||||
)
|
||||
# fill option values
|
||||
self.options_fillComboBoxes()
|
||||
|
||||
self.dependencies_knnModelSelector.filesSelected.connect(self.knnModelSelected)
|
||||
self.dependencies_phashDatabaseSelector.filesSelected.connect(
|
||||
self.phashDatabaseSelected
|
||||
)
|
||||
|
||||
logger.info("Applying settings...")
|
||||
self.deviceFileSelector.connectSettings(DEVICES_JSON_FILE)
|
||||
self.knnModelSelector.connectSettings(KNN_MODEL_FILE)
|
||||
self.tesseractFileSelector.connectSettings(TESSERACT_FILE)
|
||||
self.phashDatabaseSelector.connectSettings(PHASH_DATABASE_FILE)
|
||||
settings = Settings()
|
||||
self.deviceComboBox.selectDevice(settings.deviceUuid())
|
||||
self.dependencies_knnModelSelector.connectSettings(KNN_MODEL_FILE)
|
||||
self.dependencies_phashDatabaseSelector.connectSettings(PHASH_DATABASE_FILE)
|
||||
|
||||
self.options_usePresetCheckBox.setChecked(True)
|
||||
self.options_usePresetCheckBox.setEnabled(False)
|
||||
|
||||
self.ocrQueueModel = OcrQueueModel(self)
|
||||
self.ocrQueue.setModel(self.ocrQueueModel)
|
||||
@ -60,43 +69,70 @@ class TabOcr_Device(Ui_TabOcr_Device, QWidget):
|
||||
# wizard.open()
|
||||
pass
|
||||
|
||||
@Slot()
|
||||
def on_deviceUseAutoFactorCheckBox_stateChanged(self):
|
||||
checkState = self.deviceUseAutoFactorCheckBox.checkState()
|
||||
if checkState == Qt.CheckState.Checked:
|
||||
self.deviceDependenciesStackedWidget.setCurrentIndex(1)
|
||||
self.deviceComboBox.setCurrentIndex(-1)
|
||||
self.deviceFileSelector.setEnabled(False)
|
||||
self.deviceComboBox.setEnabled(False)
|
||||
else:
|
||||
self.deviceFileSelector.setEnabled(True)
|
||||
self.deviceComboBox.setEnabled(True)
|
||||
@Slot(bool)
|
||||
def options_setUsePreset(self, usePreset: bool):
|
||||
self.options_roisUseCustomCheckBox.setChecked(not usePreset)
|
||||
self.options_maskerUseCustomCheckBox.setChecked(not usePreset)
|
||||
self.options_preciseControlWidget.setEnabled(not usePreset)
|
||||
if not usePreset:
|
||||
self.options_presetComboBox.setCurrentIndex(-1)
|
||||
|
||||
@Slot()
|
||||
def on_deviceComboBox_currentIndexChanged(self):
|
||||
self.changeDeviceDepStackedWidget()
|
||||
@Slot(int)
|
||||
def options_presetSelected(self, index: int):
|
||||
if index < 0:
|
||||
self.options_roisComboBox.setCurrentIndex(-1)
|
||||
self.options_maskerComboBox.setCurrentIndex(-1)
|
||||
|
||||
def changeDeviceDepStackedWidget(self):
|
||||
device = self.deviceComboBox.currentData()
|
||||
if isinstance(device, (DeviceV1, DeviceV2)):
|
||||
self.deviceDependenciesStackedWidget.setCurrentIndex(device.version - 1)
|
||||
autoTypeString = self.options_presetComboBox.currentData()
|
||||
roisAutoTypeIndex = self.options_roisComboBox.findData(autoTypeString)
|
||||
maskerAutoTypeIndex = self.options_maskerComboBox.findData(autoTypeString)
|
||||
self.options_roisComboBox.setCurrentIndex(roisAutoTypeIndex)
|
||||
self.options_maskerComboBox.setCurrentIndex(maskerAutoTypeIndex)
|
||||
|
||||
def deviceFileSelected(self):
|
||||
if selectedFiles := self.deviceFileSelector.selectedFiles():
|
||||
file = selectedFiles[0]
|
||||
self.deviceComboBox.loadDevicesJson(file)
|
||||
def options_fillComboBoxes(self):
|
||||
self.options_roisComboBox.addItem("RoisAutoT1", "AutoT1")
|
||||
self.options_roisComboBox.addItem("RoisAutoT2", "AutoT2")
|
||||
self.options_roisComboBox.setCurrentIndex(-1)
|
||||
|
||||
def knnModelFileSelected(self):
|
||||
if selectedFiles := self.knnModelSelector.selectedFiles():
|
||||
self.knnModel = cv2.ml.KNearest.load(selectedFiles[0])
|
||||
self.options_maskerComboBox.addItem("MaskerAutoT1", "AutoT1")
|
||||
self.options_maskerComboBox.addItem("MaskerAutoT2", "AutoT2")
|
||||
self.options_maskerComboBox.setCurrentIndex(-1)
|
||||
|
||||
def phashDatabaseFileSelected(self):
|
||||
if selectedFiles := self.phashDatabaseSelector.selectedFiles():
|
||||
self.phashDatabase = ImagePHashDatabase(selectedFiles[0])
|
||||
self.options_presetComboBox.addItem("AutoT1 (ver <= 4.7.2)", "AutoT1")
|
||||
self.options_presetComboBox.addItem("AutoT2 (ver >= 5.0.0)", "AutoT2")
|
||||
self.options_presetComboBox.setCurrentIndex(1)
|
||||
|
||||
def knnModelSelected(self):
|
||||
try:
|
||||
knnModelFile = self.dependencies_knnModelSelector.selectedFiles()[0]
|
||||
self.knnModel = cv2.ml.KNearest.load(knnModelFile)
|
||||
self.dependencies_knnModelStatusLabel.setText(
|
||||
f'<font color="green">OK</font>, varCount {self.knnModel.getVarCount()}'
|
||||
)
|
||||
except Exception:
|
||||
logger.exception("Error loading knn model:")
|
||||
self.dependencies_knnModelStatusLabel.setText(
|
||||
'<font color="red">Error</font>'
|
||||
)
|
||||
|
||||
def phashDatabaseSelected(self):
|
||||
try:
|
||||
phashDbFile = self.dependencies_phashDatabaseSelector.selectedFiles()[0]
|
||||
self.phashDatabase = ImagePhashDatabase(phashDbFile)
|
||||
self.dependencies_phashDatabaseStatusLabel.setText(
|
||||
f'<font color="green">OK</font>, '
|
||||
f"J{len(self.phashDatabase.jacket_hashes)} "
|
||||
f"PI{len(self.phashDatabase.partner_icon_hashes)}"
|
||||
)
|
||||
except Exception:
|
||||
logger.exception("Error loading phash database:")
|
||||
self.dependencies_phashDatabaseStatusLabel.setText(
|
||||
'<font color="red">Error</font>'
|
||||
)
|
||||
|
||||
@Slot()
|
||||
def on_ocr_addImageButton_clicked(self):
|
||||
files, _filter = QFileDialog.getOpenFileNames(
|
||||
files, _ = QFileDialog.getOpenFileNames(
|
||||
self, None, "", "Image Files (*.png *.jpg *.jpeg *.bmp *.webp);;*"
|
||||
)
|
||||
filesNum = len(files)
|
||||
|
@ -787,28 +787,44 @@ validation</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../designer/tabs/tabOcr/tabOcr_Device.ui" line="27"/>
|
||||
<source>deviceSelector.title</source>
|
||||
<translation>Select Device</translation>
|
||||
<source>options.title</source>
|
||||
<translation>Options</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../designer/tabs/tabOcr/tabOcr_Device.ui" line="35"/>
|
||||
<source>deviceSelector.useAutoFactor</source>
|
||||
<translation>Auto calculate factor</translation>
|
||||
<source>options.usePreset</source>
|
||||
<translation>Use preset</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../designer/tabs/tabOcr/tabOcr_Device.ui" line="81"/>
|
||||
<source>knnModelSelector.title</source>
|
||||
<translation>Select KNearest Model</translation>
|
||||
<location filename="../../designer/tabs/tabOcr/tabOcr_Device.ui" line="73"/>
|
||||
<source>options.rois</source>
|
||||
<translation>Rois</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../designer/tabs/tabOcr/tabOcr_Device.ui" line="112"/>
|
||||
<source>tesseractSelector.title</source>
|
||||
<translation>Select tesseract Path</translation>
|
||||
<location filename="../../designer/tabs/tabOcr/tabOcr_Device.ui" line="128"/>
|
||||
<source>options.masker</source>
|
||||
<translation>Masker</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../designer/tabs/tabOcr/tabOcr_Device.ui" line="140"/>
|
||||
<source>phashDatabaseSelector.title</source>
|
||||
<translation>Select Image PHash Database</translation>
|
||||
<location filename="../../designer/tabs/tabOcr/tabOcr_Device.ui" line="138"/>
|
||||
<location filename="../../designer/tabs/tabOcr/tabOcr_Device.ui" line="145"/>
|
||||
<source>options.useCustom</source>
|
||||
<translation>Use custom options</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../designer/tabs/tabOcr/tabOcr_Device.ui" line="203"/>
|
||||
<source>dependencies.title</source>
|
||||
<translation>OCR Dependencies</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../designer/tabs/tabOcr/tabOcr_Device.ui" line="209"/>
|
||||
<source>dependencies.knnModel</source>
|
||||
<translation>KNearest model</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../designer/tabs/tabOcr/tabOcr_Device.ui" line="246"/>
|
||||
<source>dependencies.phashDatabase</source>
|
||||
<translation>Image pHash database</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
@ -786,28 +786,44 @@
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../designer/tabs/tabOcr/tabOcr_Device.ui" line="27"/>
|
||||
<source>deviceSelector.title</source>
|
||||
<translation>选择设备</translation>
|
||||
<source>options.title</source>
|
||||
<translation>选项</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../designer/tabs/tabOcr/tabOcr_Device.ui" line="35"/>
|
||||
<source>deviceSelector.useAutoFactor</source>
|
||||
<translation>自动计算 factor</translation>
|
||||
<source>options.usePreset</source>
|
||||
<translation>使用预设</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../designer/tabs/tabOcr/tabOcr_Device.ui" line="81"/>
|
||||
<source>knnModelSelector.title</source>
|
||||
<translation>选择 KNearest 模型</translation>
|
||||
<location filename="../../designer/tabs/tabOcr/tabOcr_Device.ui" line="73"/>
|
||||
<source>options.rois</source>
|
||||
<translation>定位器</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../designer/tabs/tabOcr/tabOcr_Device.ui" line="112"/>
|
||||
<source>tesseractSelector.title</source>
|
||||
<translation>选择 tesseract 路径</translation>
|
||||
<location filename="../../designer/tabs/tabOcr/tabOcr_Device.ui" line="128"/>
|
||||
<source>options.masker</source>
|
||||
<translation>遮罩器</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../designer/tabs/tabOcr/tabOcr_Device.ui" line="140"/>
|
||||
<source>phashDatabaseSelector.title</source>
|
||||
<translation>选择图像 PHash 数据库</translation>
|
||||
<location filename="../../designer/tabs/tabOcr/tabOcr_Device.ui" line="138"/>
|
||||
<location filename="../../designer/tabs/tabOcr/tabOcr_Device.ui" line="145"/>
|
||||
<source>options.useCustom</source>
|
||||
<translation>使用自定义设置</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../designer/tabs/tabOcr/tabOcr_Device.ui" line="203"/>
|
||||
<source>dependencies.title</source>
|
||||
<translation>OCR 依赖</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../designer/tabs/tabOcr/tabOcr_Device.ui" line="209"/>
|
||||
<source>dependencies.knnModel</source>
|
||||
<translation>KNearest 模型</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../designer/tabs/tabOcr/tabOcr_Device.ui" line="246"/>
|
||||
<source>dependencies.phashDatabase</source>
|
||||
<translation>图像 pHash 数据库</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
Loading…
x
Reference in New Issue
Block a user