mirror of
https://github.com/283375/arcaea-offline-pyside-ui.git
synced 2025-07-01 12:26:26 +00:00
feat: TabTools_InfoLookup
play rating calculate
This commit is contained in:
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>665</width>
|
<width>665</width>
|
||||||
<height>570</height>
|
<height>574</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -689,6 +689,66 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_6">
|
||||||
|
<property name="title">
|
||||||
|
<string>playRatingCalculate</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="playRatingCalculateScoreLineEdit">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>150</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="inputMask">
|
||||||
|
<string notr="true">B9'999'999;_</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="playRatingCalculateResultLabel">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
@ -16,8 +16,8 @@ from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
|
|||||||
QImage, QKeySequence, QLinearGradient, QPainter,
|
QImage, QKeySequence, QLinearGradient, QPainter,
|
||||||
QPalette, QPixmap, QRadialGradient, QTransform)
|
QPalette, QPixmap, QRadialGradient, QTransform)
|
||||||
from PySide6.QtWidgets import (QApplication, QComboBox, QFrame, QGridLayout,
|
from PySide6.QtWidgets import (QApplication, QComboBox, QFrame, QGridLayout,
|
||||||
QGroupBox, QHBoxLayout, QLabel, QSizePolicy,
|
QGroupBox, QHBoxLayout, QLabel, QLineEdit,
|
||||||
QVBoxLayout, QWidget)
|
QSizePolicy, QSpacerItem, QVBoxLayout, QWidget)
|
||||||
|
|
||||||
from ui.implements.components.ratingClassSelector import RatingClassSelector
|
from ui.implements.components.ratingClassSelector import RatingClassSelector
|
||||||
from ui.implements.components.songIdSelector import SongIdSelector
|
from ui.implements.components.songIdSelector import SongIdSelector
|
||||||
@ -26,7 +26,7 @@ class Ui_TabTools_InfoLookup(object):
|
|||||||
def setupUi(self, TabTools_InfoLookup):
|
def setupUi(self, TabTools_InfoLookup):
|
||||||
if not TabTools_InfoLookup.objectName():
|
if not TabTools_InfoLookup.objectName():
|
||||||
TabTools_InfoLookup.setObjectName(u"TabTools_InfoLookup")
|
TabTools_InfoLookup.setObjectName(u"TabTools_InfoLookup")
|
||||||
TabTools_InfoLookup.resize(665, 570)
|
TabTools_InfoLookup.resize(665, 574)
|
||||||
TabTools_InfoLookup.setWindowTitle(u"TabTools_InfoLookup")
|
TabTools_InfoLookup.setWindowTitle(u"TabTools_InfoLookup")
|
||||||
self.verticalLayout = QVBoxLayout(TabTools_InfoLookup)
|
self.verticalLayout = QVBoxLayout(TabTools_InfoLookup)
|
||||||
self.verticalLayout.setObjectName(u"verticalLayout")
|
self.verticalLayout.setObjectName(u"verticalLayout")
|
||||||
@ -500,6 +500,40 @@ class Ui_TabTools_InfoLookup(object):
|
|||||||
|
|
||||||
self.verticalLayout.addWidget(self.groupBox_2)
|
self.verticalLayout.addWidget(self.groupBox_2)
|
||||||
|
|
||||||
|
self.groupBox_6 = QGroupBox(TabTools_InfoLookup)
|
||||||
|
self.groupBox_6.setObjectName(u"groupBox_6")
|
||||||
|
self.horizontalLayout_5 = QHBoxLayout(self.groupBox_6)
|
||||||
|
self.horizontalLayout_5.setObjectName(u"horizontalLayout_5")
|
||||||
|
self.playRatingCalculateScoreLineEdit = QLineEdit(self.groupBox_6)
|
||||||
|
self.playRatingCalculateScoreLineEdit.setObjectName(u"playRatingCalculateScoreLineEdit")
|
||||||
|
self.playRatingCalculateScoreLineEdit.setMinimumSize(QSize(100, 0))
|
||||||
|
self.playRatingCalculateScoreLineEdit.setMaximumSize(QSize(150, 16777215))
|
||||||
|
self.playRatingCalculateScoreLineEdit.setInputMask(u"B9'999'999;_")
|
||||||
|
|
||||||
|
self.horizontalLayout_5.addWidget(self.playRatingCalculateScoreLineEdit)
|
||||||
|
|
||||||
|
self.label = QLabel(self.groupBox_6)
|
||||||
|
self.label.setObjectName(u"label")
|
||||||
|
self.label.setText(u">")
|
||||||
|
|
||||||
|
self.horizontalLayout_5.addWidget(self.label)
|
||||||
|
|
||||||
|
self.playRatingCalculateResultLabel = QLabel(self.groupBox_6)
|
||||||
|
self.playRatingCalculateResultLabel.setObjectName(u"playRatingCalculateResultLabel")
|
||||||
|
font = QFont()
|
||||||
|
font.setBold(True)
|
||||||
|
self.playRatingCalculateResultLabel.setFont(font)
|
||||||
|
self.playRatingCalculateResultLabel.setText(u"...")
|
||||||
|
|
||||||
|
self.horizontalLayout_5.addWidget(self.playRatingCalculateResultLabel)
|
||||||
|
|
||||||
|
self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
||||||
|
|
||||||
|
self.horizontalLayout_5.addItem(self.horizontalSpacer)
|
||||||
|
|
||||||
|
|
||||||
|
self.verticalLayout.addWidget(self.groupBox_6)
|
||||||
|
|
||||||
|
|
||||||
self.retranslateUi(TabTools_InfoLookup)
|
self.retranslateUi(TabTools_InfoLookup)
|
||||||
|
|
||||||
@ -540,6 +574,7 @@ class Ui_TabTools_InfoLookup(object):
|
|||||||
self.label_26.setText(QCoreApplication.translate("TabTools_InfoLookup", u"difficulty.jacketDesigner", None))
|
self.label_26.setText(QCoreApplication.translate("TabTools_InfoLookup", u"difficulty.jacketDesigner", None))
|
||||||
self.label_42.setText(QCoreApplication.translate("TabTools_InfoLookup", u"difficulty.jacketNight", None))
|
self.label_42.setText(QCoreApplication.translate("TabTools_InfoLookup", u"difficulty.jacketNight", None))
|
||||||
self.label_29.setText(QCoreApplication.translate("TabTools_InfoLookup", u"difficulty.title", None))
|
self.label_29.setText(QCoreApplication.translate("TabTools_InfoLookup", u"difficulty.title", None))
|
||||||
|
self.groupBox_6.setTitle(QCoreApplication.translate("TabTools_InfoLookup", u"playRatingCalculate", None))
|
||||||
pass
|
pass
|
||||||
# retranslateUi
|
# retranslateUi
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
|
from arcaea_offline.calculate import calculate_play_rating
|
||||||
from arcaea_offline.database import Database
|
from arcaea_offline.database import Database
|
||||||
from PySide6.QtCore import QDateTime
|
from PySide6.QtCore import QDateTime
|
||||||
from PySide6.QtWidgets import QVBoxLayout, QWidget
|
from PySide6.QtWidgets import QVBoxLayout, QWidget
|
||||||
@ -26,6 +27,16 @@ class TabTools_InfoLookup(Ui_TabTools_InfoLookup, QWidget):
|
|||||||
self.ratingClassSelector.valueChanged.connect(self.updateDifficultyLabels)
|
self.ratingClassSelector.valueChanged.connect(self.updateDifficultyLabels)
|
||||||
self.ratingClassSelector.valueChanged.connect(self.updateChartInfoLabels)
|
self.ratingClassSelector.valueChanged.connect(self.updateChartInfoLabels)
|
||||||
|
|
||||||
|
self.songIdSelector.valueChanged.connect(
|
||||||
|
self.updatePlayRatingCalculateResultLabel
|
||||||
|
)
|
||||||
|
self.ratingClassSelector.valueChanged.connect(
|
||||||
|
self.updatePlayRatingCalculateResultLabel
|
||||||
|
)
|
||||||
|
self.playRatingCalculateScoreLineEdit.textChanged.connect(
|
||||||
|
self.updatePlayRatingCalculateResultLabel
|
||||||
|
)
|
||||||
|
|
||||||
self.langSelectComboBox.addItem("En - English [en]", "en")
|
self.langSelectComboBox.addItem("En - English [en]", "en")
|
||||||
self.langSelectComboBox.addItem("あ - Japanese [ja]", "ja")
|
self.langSelectComboBox.addItem("あ - Japanese [ja]", "ja")
|
||||||
self.langSelectComboBox.addItem("한 - Korean [ko]", "ko")
|
self.langSelectComboBox.addItem("한 - Korean [ko]", "ko")
|
||||||
@ -193,7 +204,38 @@ class TabTools_InfoLookup(Ui_TabTools_InfoLookup, QWidget):
|
|||||||
|
|
||||||
chartInfo = self.db.get_chart_info(songId, ratingClass)
|
chartInfo = self.db.get_chart_info(songId, ratingClass)
|
||||||
|
|
||||||
|
if not chartInfo:
|
||||||
|
self.resetChartInfoLabels()
|
||||||
|
return
|
||||||
|
|
||||||
self.chartConstantLabel.setText(str(chartInfo.constant / 10))
|
self.chartConstantLabel.setText(str(chartInfo.constant / 10))
|
||||||
self.chartNotesLabel.setText(
|
self.chartNotesLabel.setText(
|
||||||
str(chartInfo.notes) if chartInfo.notes is not None else "-"
|
str(chartInfo.notes) if chartInfo.notes is not None else "-"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def resetPlayRatingCalculateResultLabel(self):
|
||||||
|
self.playRatingCalculateResultLabel.setText("...")
|
||||||
|
|
||||||
|
def updatePlayRatingCalculateResultLabel(self):
|
||||||
|
songId = self.songIdSelector.songId()
|
||||||
|
ratingClass = self.ratingClassSelector.value()
|
||||||
|
|
||||||
|
if not songId or ratingClass is None:
|
||||||
|
self.resetPlayRatingCalculateResultLabel()
|
||||||
|
return
|
||||||
|
|
||||||
|
chartInfo = self.db.get_chart_info(songId, ratingClass)
|
||||||
|
|
||||||
|
if not chartInfo or not chartInfo.constant:
|
||||||
|
self.resetPlayRatingCalculateResultLabel()
|
||||||
|
return
|
||||||
|
|
||||||
|
if scoreText := self.playRatingCalculateScoreLineEdit.text().replace("'", ""):
|
||||||
|
score = int(scoreText)
|
||||||
|
|
||||||
|
self.playRatingCalculateResultLabel.setText(
|
||||||
|
f"{calculate_play_rating(chartInfo.constant / 10, score):.3f}"
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
self.resetPlayRatingCalculateResultLabel()
|
||||||
|
return
|
||||||
|
@ -1040,7 +1040,7 @@ validation</translation>
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../../designer/tabs/tabTools/tabTools_InfoLookup.ui" line="695"/>
|
<location filename="../../designer/tabs/tabTools/tabTools_InfoLookup.ui" line="695"/>
|
||||||
<source>playRatingCalculate</source>
|
<source>playRatingCalculate</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>Calculate Play Rating</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
|
@ -1039,7 +1039,7 @@
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../../designer/tabs/tabTools/tabTools_InfoLookup.ui" line="695"/>
|
<location filename="../../designer/tabs/tabTools/tabTools_InfoLookup.ui" line="695"/>
|
||||||
<source>playRatingCalculate</source>
|
<source>playRatingCalculate</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>计算单曲 PTT</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
|
Reference in New Issue
Block a user