Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
[0.0.1.0] init
Browse files Browse the repository at this point in the history
  • Loading branch information
intervisionlord committed Aug 7, 2022
0 parents commit 0f78a6f
Show file tree
Hide file tree
Showing 7 changed files with 595 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Builder/builder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import zipfile
import yaml
import os

def getconfig():
try:
with open('./config.yaml', 'r') as confFile:
conf = yaml.full_load(confFile)
except FileNotFoundError:
print('File not found')
return conf

def zipOutput():
with zipfile.ZipFile('SSE.zip', 'w',
compression=zipfile.ZIP_DEFLATED,
compresslevel=9) as zipArch:
zipArch.write('SSE.exe')


conf = getconfig()
paramsStr = '--' + ' --'.join(conf['params'])
plugins = conf['plugins']
icon = conf['main']['icon']

if __name__ == '__main__':
os.system(f'nuitka {paramsStr} --plugin-enable={plugins} --windows-icon-from-ico={icon} ../SSE.py')
zipOutput()
13 changes: 13 additions & 0 deletions Builder/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
main:
version: '0.0.1.0'
author: 'intervision'
authorlink: 'https://github.com/intervisionlord'
icon: '../imgs/SSE_Icon.png'

plugins: qt-plugins

params:
- windows-disable-console
- onefile
- standalone
- remove-output
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<center>
<img src="https://i.imgur.com/DWfMCT7.png" width="256" height="256">
</center>

# Stationeers Save Editor
## Описание
Позволяет редактировать некоторые параметры сохранения игры.

На данный момент можно поменять название игрового мира, кол-во дней с момента начала игры и возможность использования исследований.

### Версия 0.0.1.0

## Интерфейс
<center>
<img src = "https://i.imgur.com/KDF3Ztf.png">
</center>
68 changes: 68 additions & 0 deletions SSE.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
from datetime import datetime
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QApplication, QMessageBox, QMainWindow
import xml.etree.ElementTree as ET
from shutil import copytree
import time
import sys
import gui
from os import environ, path, listdir

class MainForm(QMainWindow, gui.Ui_mainWindow):
def __init__(self):
super().__init__()
self.setupUi(self)
self.setWindowIcon(QIcon('imgs/SSE_icon.png'))
self.savesLabel.setText(self.getPaths()[0])
self.savesCombo.currentIndexChanged.connect(self.saveChangeSig)
self.saveButton.clicked.connect(self.rewriteSave)

def getPaths(self):
self.myDocsPath = environ.get('USERPROFILE')
self.savesPath = f'{self.myDocsPath}\\Documents\\My Games\\Stationeers\\saves'
self.savesFile = f'{self.savesPath}\\{self.savesCombo.currentText()}\\world.xml'
return self.savesPath, self.savesFile


def getXMLRoot(self):
xmlTree = ET.parse(self.savesFile)
rootNode = xmlTree.getroot()
return xmlTree, rootNode

def saveChangeSig(self):
self.dateModifLabel.setText(time.ctime(path.getmtime(self.getPaths()[1])))
rootNode = self.getXMLRoot()[1]
for element in rootNode:
if str(element.tag) == 'ResearchKey':
self.researchCombo.setCurrentText(element.text)
elif str(element.tag) == 'DaysPast':
self.daysPastText.setText(element.text)
elif str(element.tag) == 'WorldName':
self.worldNameText.setText(element.text)

def rewriteSave(self):
xmlTree = self.getXMLRoot()[0]
xmlTree.find('.//ResearchKey').text = self.researchCombo.currentText()
xmlTree.find('.//DaysPast').text = self.daysPastText.text()
dateformat = '%Y_%m_%d_%H_%M_%S'
if self.backupCheck.isChecked():
copytree(f'{self.getPaths()[0]}\\{self.savesCombo.currentText()}',
f'{self.getPaths()[0]}\\{self.savesCombo.currentText()}_{datetime.now().strftime(dateformat)}')
xmlTree.write(f'{self.savesFile}')
msgbox('Save File modified!')

def msgbox(mText):
mBox = QMessageBox()
mBox.setWindowTitle('Info')
mBox.setText(mText)
mBox.setIcon(QMessageBox.Information)
popupWindow = mBox.exec_()

if __name__ == '__main__':
app = QApplication(sys.argv)
form = MainForm()
form.show()
for i in (listdir(form.savesPath)):
if path.isdir(f'{form.savesPath}\\{i}'):
form.savesCombo.addItem(str(i))
app.exec()
Loading

0 comments on commit 0f78a6f

Please sign in to comment.