diff --git a/README.md b/README.md index a34c433..58d024e 100644 --- a/README.md +++ b/README.md @@ -46,10 +46,6 @@ There is also a nice .deb file available on the [Releases](https://github.com/rr Check out the [Releases](https://github.com/rrooij/sd3save_editor/releases) page. It will contain a Windows binary. -# Limitations - -Only the first save entry is editable. - # Warning Backup your save before messing with it! diff --git a/sd3save_editor/gui/mainwindow.py b/sd3save_editor/gui/mainwindow.py index f7dddb1..2bb7b61 100644 --- a/sd3save_editor/gui/mainwindow.py +++ b/sd3save_editor/gui/mainwindow.py @@ -97,7 +97,7 @@ def initFileOpenEvents(self): def setTableData(self): self.ui.storageTableWidget.blockSignals(True) - items = save.read_all_storage_items_amount(self.saveData) + items = save.read_all_storage_items_amount(self.saveData, self.saveIndex) self.ui.storageTableWidget.setRowCount(len(items)) for idx, item in enumerate(items): itemNameWidget = QTableWidgetItem(item[0]) @@ -117,6 +117,20 @@ def initChangeNameInput(self): self.ui.c2NameLineEdit.setMaxLength(6) self.ui.c3NameLineEdit.setMaxLength(6) + def initSaveEntryComboBox(self): + self.ui.saveIndexComboBox.clear() + for x in range(0, 3): + if self.saveData[x]: + self.ui.saveIndexComboBox.addItem("Save entry {}".format(x + 1), x) + + self.ui.saveIndexComboBox.activated.connect(self.saveEntryChanged) + + def saveEntryChanged(self, index): + saveIndex = self.ui.saveIndexComboBox.itemData(index) + self.saveIndex = saveIndex + self.initData() + self.setTableData() + def initComboBox(self): self.ui.locationComboBox.addItems(game_data.parse_locations_json()) self.ui.tracksComboBox.addItems(game_data.parse_tracks_json()) @@ -133,7 +147,8 @@ def saveFormValues(self): try: self.saveGuiData() save.write_storage_item_amounts(self.saveData, - self.editedStorageItems) + self.editedStorageItems, + self.saveIndex) save.write_save(self.filename, self.saveData) QMessageBox.information(self, "Succesfully saved", "Succesfully saved") @@ -157,5 +172,6 @@ def openFileDialog(self): self.initData() self.setTableData() self.initSaveEvent() + self.initSaveEntryComboBox() except Exception as ex: QMessageBox.warning(self, "Can't open Seiken3 save", str(ex)) diff --git a/sd3save_editor/gui/mainwindow.ui b/sd3save_editor/gui/mainwindow.ui index d1a7153..1d1ab71 100644 --- a/sd3save_editor/gui/mainwindow.ui +++ b/sd3save_editor/gui/mainwindow.ui @@ -15,7 +15,7 @@ - + 0 @@ -25,53 +25,53 @@ General - + QFormLayout::AllNonFixedFieldsGrow - + Location - + - + Luc - + 677215 - + Playing track - + - + Playing time - + seconds @@ -354,7 +354,7 @@ - + false @@ -364,6 +364,20 @@ + + + + + + Save Entry + + + + + + + + @@ -372,7 +386,7 @@ 0 0 800 - 19 + 20 diff --git a/sd3save_editor/gui/mainwindow_ui.py b/sd3save_editor/gui/mainwindow_ui.py index d69e626..15ae5d7 100644 --- a/sd3save_editor/gui/mainwindow_ui.py +++ b/sd3save_editor/gui/mainwindow_ui.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'mainwindow.ui' # -# Created by: PyQt5 UI code generator 5.8.2 +# Created by: PyQt5 UI code generator 5.9.2 # # WARNING! All changes made in this file will be lost! @@ -27,31 +27,31 @@ def setupUi(self, MainWindow): self.formLayout.setObjectName("formLayout") self.locationLabel = QtWidgets.QLabel(self.tab) self.locationLabel.setObjectName("locationLabel") - self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.locationLabel) + self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.locationLabel) self.locationComboBox = QtWidgets.QComboBox(self.tab) self.locationComboBox.setObjectName("locationComboBox") - self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.locationComboBox) + self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.locationComboBox) self.labelLuc = QtWidgets.QLabel(self.tab) self.labelLuc.setObjectName("labelLuc") - self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.labelLuc) + self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.labelLuc) self.spinBoxLuc = QtWidgets.QSpinBox(self.tab) self.spinBoxLuc.setMaximum(677215) self.spinBoxLuc.setObjectName("spinBoxLuc") - self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.spinBoxLuc) + self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.spinBoxLuc) self.label = QtWidgets.QLabel(self.tab) self.label.setObjectName("label") - self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label) + self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.label) self.tracksComboBox = QtWidgets.QComboBox(self.tab) self.tracksComboBox.setObjectName("tracksComboBox") - self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.tracksComboBox) + self.formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.tracksComboBox) self.label_2 = QtWidgets.QLabel(self.tab) self.label_2.setObjectName("label_2") - self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.label_2) + self.formLayout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.label_2) self.secondsSpinBox = QtWidgets.QSpinBox(self.tab) self.secondsSpinBox.setMaximum(2147483647) self.secondsSpinBox.setObjectName("secondsSpinBox") - self.formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.secondsSpinBox) - self.gridLayout_2.addLayout(self.formLayout, 0, 0, 1, 1) + self.formLayout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.secondsSpinBox) + self.gridLayout_2.addLayout(self.formLayout, 1, 0, 1, 1) self.tabsOverview.addTab(self.tab, "") self.tab_2 = QtWidgets.QWidget() self.tab_2.setObjectName("tab_2") @@ -198,14 +198,23 @@ def setupUi(self, MainWindow): self.storageTableWidget.horizontalHeader().setStretchLastSection(True) self.gridLayout_6.addWidget(self.storageTableWidget, 0, 0, 1, 1) self.tabsOverview.addTab(self.tab_5, "") - self.gridLayout.addWidget(self.tabsOverview, 0, 0, 1, 1) + self.gridLayout.addWidget(self.tabsOverview, 3, 0, 1, 1) self.saveButton = QtWidgets.QPushButton(self.centralwidget) self.saveButton.setEnabled(False) self.saveButton.setObjectName("saveButton") - self.gridLayout.addWidget(self.saveButton, 1, 0, 1, 1, QtCore.Qt.AlignRight) + self.gridLayout.addWidget(self.saveButton, 4, 0, 1, 1, QtCore.Qt.AlignRight) + self.formLayout_2 = QtWidgets.QFormLayout() + self.formLayout_2.setObjectName("formLayout_2") + self.saveEntryLabel = QtWidgets.QLabel(self.centralwidget) + self.saveEntryLabel.setObjectName("saveEntryLabel") + self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.saveEntryLabel) + self.saveIndexComboBox = QtWidgets.QComboBox(self.centralwidget) + self.saveIndexComboBox.setObjectName("saveIndexComboBox") + self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.saveIndexComboBox) + self.gridLayout.addLayout(self.formLayout_2, 1, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) - self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 19)) + self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 20)) self.menubar.setObjectName("menubar") self.menuFile = QtWidgets.QMenu(self.menubar) self.menuFile.setObjectName("menuFile") @@ -259,6 +268,7 @@ def retranslateUi(self, MainWindow): item.setText(_translate("MainWindow", "Amount")) self.tabsOverview.setTabText(self.tabsOverview.indexOf(self.tab_5), _translate("MainWindow", "Item Storage")) self.saveButton.setText(_translate("MainWindow", "Save")) + self.saveEntryLabel.setText(_translate("MainWindow", "Save Entry")) self.menuFile.setTitle(_translate("MainWindow", "File")) self.actionOpen.setText(_translate("MainWindow", "Open")) self.actionOpen.setShortcut(_translate("MainWindow", "Ctrl+O"))