mirror of
https://github.com/283375/arcaea-offline-pyside-ui.git
synced 2025-07-01 20:36:26 +00:00
init
This commit is contained in:
33
ui/implements/tabs/tabInputScore.py
Normal file
33
ui/implements/tabs/tabInputScore.py
Normal file
@ -0,0 +1,33 @@
|
||||
import traceback
|
||||
|
||||
from arcaea_offline.database import Database
|
||||
from PySide6.QtCore import QCoreApplication, QModelIndex
|
||||
from PySide6.QtWidgets import QMessageBox, QWidget
|
||||
|
||||
from ui.designer.tabs.tabInputScore_ui import Ui_TabInputScore
|
||||
|
||||
|
||||
class TabInputScore(Ui_TabInputScore, QWidget):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.setupUi(self)
|
||||
|
||||
self.chartSelector.valueChanged.connect(self.updateScoreEditorChart)
|
||||
self.scoreEditor.accepted.connect(self.commit)
|
||||
|
||||
def updateScoreEditorChart(self):
|
||||
chart = self.chartSelector.value()
|
||||
self.scoreEditor.setChart(chart)
|
||||
|
||||
def commit(self):
|
||||
try:
|
||||
Database().insert_score(self.scoreEditor.value())
|
||||
self.scoreEditor.reset()
|
||||
except Exception as e:
|
||||
QMessageBox.critical(
|
||||
self,
|
||||
# fmt: off
|
||||
QCoreApplication.translate("General", "tracebackFormatExceptionOnly.title"),
|
||||
QCoreApplication.translate("General", "tracebackFormatExceptionOnly.content").format(traceback.format_exception_only(e))
|
||||
# fmt: on
|
||||
)
|
Reference in New Issue
Block a user