mirror of
https://github.com/283375/arcaea-offline-pyside-ui.git
synced 2025-04-11 05:30:17 +00:00
feat: SmartRTE csv export
This commit is contained in:
parent
dd647d6963
commit
01457f3559
@ -143,6 +143,26 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QPushButton" name="exportSmartRteB30Button">
|
||||
<property name="text">
|
||||
<string>exportSmartRteB30Button</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>exportSmartRteB30.description</string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
@ -121,6 +121,18 @@ class Ui_TabDb_Manage(object):
|
||||
|
||||
self.formLayout.setWidget(6, QFormLayout.FieldRole, self.label_8)
|
||||
|
||||
self.exportSmartRteB30Button = QPushButton(TabDb_Manage)
|
||||
self.exportSmartRteB30Button.setObjectName(u"exportSmartRteB30Button")
|
||||
|
||||
self.formLayout.setWidget(10, QFormLayout.LabelRole, self.exportSmartRteB30Button)
|
||||
|
||||
self.label_9 = QLabel(TabDb_Manage)
|
||||
self.label_9.setObjectName(u"label_9")
|
||||
self.label_9.setOpenExternalLinks(True)
|
||||
self.label_9.setTextInteractionFlags(Qt.LinksAccessibleByKeyboard|Qt.LinksAccessibleByMouse)
|
||||
|
||||
self.formLayout.setWidget(10, QFormLayout.FieldRole, self.label_9)
|
||||
|
||||
|
||||
self.retranslateUi(TabDb_Manage)
|
||||
|
||||
@ -144,6 +156,8 @@ class Ui_TabDb_Manage(object):
|
||||
self.label_7.setText(QCoreApplication.translate("TabDb_Manage", u"importApk.description", None))
|
||||
self.importOnlineButton.setText(QCoreApplication.translate("TabDb_Manage", u"importOnlineButton", None))
|
||||
self.label_8.setText(QCoreApplication.translate("TabDb_Manage", u"importOnline.description", None))
|
||||
self.exportSmartRteB30Button.setText(QCoreApplication.translate("TabDb_Manage", u"exportSmartRteB30Button", None))
|
||||
self.label_9.setText(QCoreApplication.translate("TabDb_Manage", u"exportSmartRteB30.description", None))
|
||||
pass
|
||||
# retranslateUi
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
import csv
|
||||
import json
|
||||
import logging
|
||||
import traceback
|
||||
@ -13,6 +14,7 @@ from arcaea_offline.external.arcaea import (
|
||||
)
|
||||
from arcaea_offline.external.arcaea.common import ArcaeaParser
|
||||
from arcaea_offline.external.arcsong import ArcsongDbParser
|
||||
from arcaea_offline.external.smartrte import SmartRteB30CsvConverter
|
||||
from arcaea_offline.models import Difficulty, Pack, Song
|
||||
from PySide6.QtCore import QDir, Slot
|
||||
from PySide6.QtWidgets import QFileDialog, QMessageBox, QWidget
|
||||
@ -232,3 +234,27 @@ class TabDb_Manage(Ui_TabDb_Manage, QWidget):
|
||||
)
|
||||
with open(exportLocation, "w", encoding="utf-8") as f:
|
||||
f.write(content)
|
||||
|
||||
@Slot()
|
||||
def on_exportSmartRteB30Button_clicked(self):
|
||||
try:
|
||||
with Database().sessionmaker() as session:
|
||||
converter = SmartRteB30CsvConverter(session)
|
||||
csvRows = converter.rows()
|
||||
|
||||
exportLocation, _filter = QFileDialog.getSaveFileName(
|
||||
self,
|
||||
"Export CSV file",
|
||||
QDir.current().filePath("smartrte_scores.csv"),
|
||||
"CSV (*.csv);;*",
|
||||
)
|
||||
with open(exportLocation, "w", encoding="utf-8", newline="") as f:
|
||||
csvWriter = csv.writer(f)
|
||||
csvWriter.writerows(csvRows)
|
||||
|
||||
QMessageBox.information(self, None, "OK")
|
||||
except Exception as e:
|
||||
logging.exception("Export SmartRTE csv error:")
|
||||
QMessageBox.critical(
|
||||
self, "Export Error", "\n".join(traceback.format_exception(e))
|
||||
)
|
||||
|
@ -726,6 +726,16 @@ validation</translation>
|
||||
<source>importOnline.description</source>
|
||||
<translation>Import scores from the result of Arcaea Online API</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../designer/tabs/tabDb/tabDb_Manage.ui" line="149"/>
|
||||
<source>exportSmartRteB30Button</source>
|
||||
<translation>Export Scores (CSV, SmartRTE B30)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../designer/tabs/tabDb/tabDb_Manage.ui" line="156"/>
|
||||
<source>exportSmartRteB30.description</source>
|
||||
<translation>Export all your scores to <a href="https://smartrte.github.io/b30gen.html">smartrte.github.io</a> compatible CSV file</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>TabOcrDisabled</name>
|
||||
|
@ -725,6 +725,16 @@
|
||||
<source>importOnline.description</source>
|
||||
<translation>从 Arcaea Online 的 API 结果导入分数</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../designer/tabs/tabDb/tabDb_Manage.ui" line="149"/>
|
||||
<source>exportSmartRteB30Button</source>
|
||||
<translation>导出分数(CSV,SmartRTE B30)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../designer/tabs/tabDb/tabDb_Manage.ui" line="156"/>
|
||||
<source>exportSmartRteB30.description</source>
|
||||
<translation>将所有分数导出为兼容 <a href="https://smartrte.github.io/b30gen.html">smartrte.github.io</a> 的 CSV 文件</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>TabOcrDisabled</name>
|
||||
|
Loading…
x
Reference in New Issue
Block a user