impr: TabOverview describe label

This commit is contained in:
283375 2023-09-23 17:50:16 +08:00
parent a9bef5d4d6
commit ce44a21be5
Signed by: 283375
SSH Key Fingerprint: SHA256:UcX0qg6ZOSDOeieKPGokA5h7soykG61nz2uxuQgVLSk
4 changed files with 17 additions and 17 deletions

View File

@ -20,7 +20,7 @@
<item>
<widget class="QLabel" name="databaseDescribeLabel">
<property name="text">
<string extracomment="This database now have {} packs, {} songs, {} difficulties, {} chart info ({} complete) and {} scores.">databaseDescribeLabel {} {} {} {} {} {}</string>
<string notr="true" extracomment="This database now have {} packs, {} songs, {} difficulties, {} chart info ({} complete) and {} scores.">...</string>
</property>
</widget>
</item>

View File

@ -33,6 +33,7 @@ class Ui_TabOverview(object):
self.databaseDescribeLabel = QLabel(TabOverview)
self.databaseDescribeLabel.setObjectName(u"databaseDescribeLabel")
self.databaseDescribeLabel.setText(u"...")
self.verticalLayout.addWidget(self.databaseDescribeLabel)
@ -108,7 +109,6 @@ class Ui_TabOverview(object):
# setupUi
def retranslateUi(self, TabOverview):
self.databaseDescribeLabel.setText(QCoreApplication.translate("TabOverview", u"databaseDescribeLabel {} {} {} {} {} {}", None))
pass
# retranslateUi

View File

@ -1,4 +1,5 @@
from arcaea_offline.database import Database
from PySide6.QtCore import QCoreApplication
from PySide6.QtGui import QShowEvent
from PySide6.QtWidgets import QWidget
@ -15,8 +16,6 @@ class TabOverview(Ui_TabOverview, QWidget):
self.installEventFilter(self.languageChangeEventFilter)
self.db = Database()
# self.db.register_update_hook(self.updateOverview)
# self.updateOverview()
def showEvent(self, event: QShowEvent) -> None:
self.updateOverview()
@ -25,18 +24,19 @@ class TabOverview(Ui_TabOverview, QWidget):
def updateOverview(self):
b30 = self.db.get_b30() or 0.00
self.b30Label.setText(str(f"{b30:.3f}"))
self.retranslateUi(self)
self.databaseDescribeLabel.setText(
self.describeFormatString.format(
self.db.count_packs(),
self.db.count_songs(),
self.db.count_difficulties(),
self.db.count_chart_infos(),
self.db.count_complete_chart_infos(),
self.db.count_scores(),
)
)
def retranslateUi(self, *args):
super().retranslateUi(self)
db = Database()
describeText = self.databaseDescribeLabel.text()
describeText = describeText.format(
db.count_packs(),
db.count_songs(),
db.count_difficulties(),
db.count_chart_infos(),
db.count_complete_chart_infos(),
db.count_scores(),
)
self.databaseDescribeLabel.setText(describeText)
# fmt: off
self.describeFormatString = QCoreApplication.translate("TabOverview", "databaseDescribeLabel {} {} {} {} {} {}")
# fmt: on

View File

@ -752,7 +752,7 @@ validation</translation>
<location filename="../../designer/tabs/tabOverview.ui" line="23"/>
<source>databaseDescribeLabel {} {} {} {} {} {}</source>
<extracomment>This database now have {} packs, {} songs, {} difficulties, {} chart info ({} complete) and {} scores.</extracomment>
<translation>This database now have {} packs, {} songs, {} difficulties, {} chart info ({} complete) and {} scores.</translation>
<translation>There are {} packs, {} songs, {} difficulties, {} chart info ({} complete) and {} scores in database.</translation>
</message>
</context>
<context>