mirror of
https://github.com/JDM170/SaveWizard
synced 2025-04-20 22:30:42 +07:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 28a54d14f0 | |||
| 34f38b5a59 | |||
| 33ce4d1148 | |||
| 4dcfe37c5b | |||
| 8a304075a1 | |||
| b313dcaa52 | |||
| 950ed7678f | |||
| ba0c03f051 | |||
|
|
d7b1e4322e | ||
|
|
d58996bd2f | ||
|
|
e3e91d9665 | ||
|
|
6094f785a5 | ||
|
|
5b5bc9f9d6 | ||
|
|
0d769cd254 | ||
|
|
9ae9b59f70 | ||
|
|
6ea831e87f | ||
|
|
4c2d7967e7 | ||
|
|
c9214aa17c | ||
|
|
4763f43a3d | ||
|
|
db6d09e7b3 |
24
.gitignore
vendored
Normal file
24
.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
## Ignoring PyCharm settings
|
||||
/.idea
|
||||
|
||||
## Ignoring Python complied files
|
||||
/__pycache__
|
||||
/parsing/__pycache__
|
||||
/choice/__pycache__
|
||||
/choice/form.py
|
||||
/main/__pycache__
|
||||
/main/form.py
|
||||
/second/__pycache__
|
||||
/second/form.py
|
||||
/config_editor/__pycache__
|
||||
/config_editor/form.py
|
||||
|
||||
## Ignoring UPX
|
||||
/upx
|
||||
|
||||
## Ignoring build from cx_Freeze
|
||||
/prog_build
|
||||
|
||||
## Ignoring build files from PyInstaller
|
||||
/build
|
||||
/dist
|
||||
18
README.md
18
README.md
@@ -1,20 +1,28 @@
|
||||
# SaveWizard
|
||||
|
||||
* Author of original "SaveWizard" script: DrEGZo
|
||||
* The original script is taken from here: <https://forum.truckersmp.com/index.php?/topic/55773-savewizard/>
|
||||
* To decrypt the file the utility is used: <https://github.com/ncs-sniper/SII_Decrypt/>
|
||||
* Original script is taken from here: <https://forum.truckersmp.com/index.php?/topic/55773-savewizard/> (access to the topic has been closed)
|
||||
* Utility to decrypt file: <https://github.com/ncs-sniper/SII_Decrypt/> (repo has been removed)
|
||||
|
||||
***
|
||||
|
||||
This program allows:
|
||||
Features:
|
||||
1. Decrypt file, if save file crypted
|
||||
2. Check for DLC to the save file
|
||||
3. Edit money, experience and loan limit
|
||||
4. Edit skills
|
||||
5. Unlock garages, visit cities, unlock dealers and agencies
|
||||
|
||||
**This functionality of the program is not final!**
|
||||
**This functionality of the program isn't final!**
|
||||
|
||||
***
|
||||
|
||||
#### Since the program is in development, I will not give up help and guidance on my errors in the code.
|
||||
Requirments to build project:
|
||||
* Python >=3.5.4
|
||||
* PyQt5 >=5.6.0
|
||||
* requests >=2.24.0
|
||||
* cx_Freeze >=6.0 (or PyInstaller >=3.6)
|
||||
|
||||
***
|
||||
|
||||
#### Since the program is in development, I won't give up help and guidance on my errors in the code.
|
||||
|
||||
BIN
SII_Decrypt.exe
Normal file
BIN
SII_Decrypt.exe
Normal file
Binary file not shown.
62
build.spec
Normal file
62
build.spec
Normal file
@@ -0,0 +1,62 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
|
||||
app = Analysis(
|
||||
['init_main_program.py'],
|
||||
pathex=['.'],
|
||||
datas=[
|
||||
('configs/ats', 'configs/ats'),
|
||||
('configs/ets2', 'configs/ets2')
|
||||
]
|
||||
)
|
||||
cfg = Analysis(
|
||||
['init_config_editor.py'],
|
||||
pathex=['.']
|
||||
)
|
||||
|
||||
MERGE(
|
||||
(app, 'SaveWizard', 'SaveWizard'),
|
||||
(cfg, 'SaveWizard_Config_Editor', 'SaveWizard_Config_Editor')
|
||||
)
|
||||
|
||||
app_pyz = PYZ(app.pure, app.zipped_data)
|
||||
cfg_pyz = PYZ(cfg.pure, cfg.zipped_data)
|
||||
|
||||
app_exe = EXE(
|
||||
app_pyz,
|
||||
app.scripts,
|
||||
[],
|
||||
exclude_binaries=True,
|
||||
name='SaveWizard',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
console=False
|
||||
)
|
||||
app_coll = COLLECT(
|
||||
app_exe,
|
||||
app.binaries,
|
||||
app.zipfiles,
|
||||
app.datas,
|
||||
strip=False,
|
||||
name='app_build'
|
||||
)
|
||||
|
||||
cfg_exe = EXE(
|
||||
cfg_pyz,
|
||||
cfg.scripts,
|
||||
[],
|
||||
exclude_binaries=True,
|
||||
name='SaveWizard_Config_Editor',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
console=False
|
||||
)
|
||||
cfg_coll = COLLECT(
|
||||
cfg_exe,
|
||||
cfg.binaries,
|
||||
cfg.zipfiles,
|
||||
cfg.datas,
|
||||
strip=False,
|
||||
name='cfg_build'
|
||||
)
|
||||
1
choice/__init__.py
Normal file
1
choice/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
# initialize module 'choice'
|
||||
107
choice/form.ui
Normal file
107
choice/form.ui
Normal file
@@ -0,0 +1,107 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<author>JDM170</author>
|
||||
<class>Choice</class>
|
||||
<widget class="QDialog" name="Choice">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>490</width>
|
||||
<height>130</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>490</width>
|
||||
<height>130</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>490</width>
|
||||
<height>130</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Select game</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="gridLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>471</width>
|
||||
<height>111</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="ets2_button">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>ETS2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="ats_button">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>ATS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>18</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Select the configs you want to use:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>DON'T USE CONFIGS FROM ANOTHER GAME INTENTIONALLY,
|
||||
YOU CAN DAMAGE THE GAME'S SAVE.</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>ats_button</tabstop>
|
||||
<tabstop>ets2_button</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
58
choice/script.py
Normal file
58
choice/script.py
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import QDialog, QMessageBox
|
||||
from ast import literal_eval
|
||||
from .form import Ui_Choice
|
||||
from main.script import MainWindow
|
||||
from parsing.script import check_remote_hashes, update_configs
|
||||
from statics import update_config_name
|
||||
|
||||
|
||||
class ChoiceWindow(QDialog, Ui_Choice):
|
||||
def __init__(self, parent=None):
|
||||
# Setup UI
|
||||
QDialog.__init__(self, parent, flags=Qt.Window)
|
||||
Ui_Choice.__init__(self)
|
||||
self.ui = Ui_Choice()
|
||||
self.ui.setupUi(self)
|
||||
|
||||
self.ui.ats_button.clicked.connect(self.button_clicked)
|
||||
self.ui.ets2_button.clicked.connect(self.button_clicked)
|
||||
|
||||
remember_data = {"answer_updates": True, "update_on_start": False}
|
||||
try:
|
||||
with open(update_config_name) as f:
|
||||
remember_data = literal_eval(f.read())
|
||||
except FileNotFoundError:
|
||||
with open(update_config_name, "w") as f:
|
||||
f.write(str(remember_data))
|
||||
|
||||
upd_list = check_remote_hashes()
|
||||
if upd_list and len(upd_list) > 0:
|
||||
answer = remember_data.get("answer_updates")
|
||||
if answer:
|
||||
box = QMessageBox(QMessageBox.Information, "Info",
|
||||
"Some configs have been updated. Do you want to update the local configs?")
|
||||
box.addButton("Yes", QMessageBox.YesRole) # 0
|
||||
box.addButton("Yes, remember that", QMessageBox.YesRole) # 1
|
||||
box.addButton("No", QMessageBox.NoRole) # 2
|
||||
box.addButton("No, remember that", QMessageBox.NoRole) # 3
|
||||
update_configs(box.exec(), upd_list)
|
||||
return
|
||||
upd_on_start = remember_data.get("update_on_start")
|
||||
if upd_on_start:
|
||||
update_configs(1, upd_list)
|
||||
|
||||
def button_clicked(self):
|
||||
sender = self.sender()
|
||||
if sender == self.ui.ats_button:
|
||||
selected = "ats"
|
||||
elif sender == self.ui.ets2_button:
|
||||
selected = "ets2"
|
||||
else:
|
||||
return
|
||||
self.close()
|
||||
win = MainWindow(selected)
|
||||
win.exec()
|
||||
1
compile_cx-freeze.bat
Normal file
1
compile_cx-freeze.bat
Normal file
@@ -0,0 +1 @@
|
||||
python setup.py build
|
||||
1
compile_pyinstaller.bat
Normal file
1
compile_pyinstaller.bat
Normal file
@@ -0,0 +1 @@
|
||||
pyinstaller build.spec --noupx
|
||||
1
config_editor/__init__.py
Normal file
1
config_editor/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
# initializing module 'config_editor'
|
||||
133
config_editor/form.ui
Normal file
133
config_editor/form.ui
Normal file
@@ -0,0 +1,133 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<author>JDM170</author>
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>504</width>
|
||||
<height>374</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>SaveWizard config editor</string>
|
||||
</property>
|
||||
<property name="dockOptions">
|
||||
<set>QMainWindow::AllowTabbedDocks</set>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<widget class="QTextEdit" name="textEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>501</width>
|
||||
<height>351</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Verdana</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>504</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="defaultUp">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="nativeMenuBar">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuOptions">
|
||||
<property name="title">
|
||||
<string>Options</string>
|
||||
</property>
|
||||
<addaction name="actionOpen"/>
|
||||
<addaction name="actionSave"/>
|
||||
<addaction name="actionSave_As"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionMD5"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionCloseFile"/>
|
||||
<addaction name="actionExit"/>
|
||||
</widget>
|
||||
<addaction name="menuOptions"/>
|
||||
</widget>
|
||||
<action name="actionOpen">
|
||||
<property name="text">
|
||||
<string>Open</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+O</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSave">
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+S</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSave_As">
|
||||
<property name="text">
|
||||
<string>Save As</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+Shift+S</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCloseFile">
|
||||
<property name="text">
|
||||
<string>Close file</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Closing current file</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+W</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExit">
|
||||
<property name="text">
|
||||
<string>Exit</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMD5">
|
||||
<property name="text">
|
||||
<string>Copy MD5</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
113
config_editor/script.py
Normal file
113
config_editor/script.py
Normal file
@@ -0,0 +1,113 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QResizeEvent, QCloseEvent, QClipboard
|
||||
from PyQt5.QtWidgets import QMainWindow, QFileDialog, QMessageBox, QApplication
|
||||
from ast import literal_eval
|
||||
from .form import Ui_MainWindow
|
||||
from dataIO import dataIO
|
||||
from util import generate_md5
|
||||
|
||||
|
||||
class EditorWindow(QMainWindow, Ui_MainWindow):
|
||||
def __init__(self, parent=None):
|
||||
QMainWindow.__init__(self, parent, flags=Qt.Window)
|
||||
Ui_MainWindow.__init__(self)
|
||||
self.ui = Ui_MainWindow()
|
||||
self.ui.setupUi(self)
|
||||
|
||||
self.file_path = ""
|
||||
self.win_title = self.tr("{}".format(self.windowTitle()))
|
||||
|
||||
self.ui.textEdit.document().contentsChanged.connect(self.content_changed)
|
||||
|
||||
for action, method in {
|
||||
self.ui.actionOpen: self.open_file,
|
||||
self.ui.actionSave: self.save_file,
|
||||
self.ui.actionSave_As: self.save_as,
|
||||
self.ui.actionMD5: self.copy_hash,
|
||||
self.ui.actionCloseFile: self.close_file,
|
||||
self.ui.actionExit: self.exit
|
||||
}.items():
|
||||
action.triggered.connect(method)
|
||||
|
||||
def resizeEvent(self, event: QResizeEvent):
|
||||
window = self.ui.centralwidget.geometry().getCoords()
|
||||
edit = self.ui.textEdit.geometry().getCoords()
|
||||
self.ui.textEdit.setGeometry(edit[0], edit[1],
|
||||
window[2], window[3]-(self.ui.menubar.size().height()-1))
|
||||
|
||||
def closeEvent(self, event: QCloseEvent):
|
||||
if self.maybe_save():
|
||||
event.accept()
|
||||
else:
|
||||
event.ignore()
|
||||
|
||||
def content_changed(self):
|
||||
self.setWindowModified(self.ui.textEdit.document().isModified())
|
||||
|
||||
def open_file(self):
|
||||
file_path, file_name = QFileDialog.getOpenFileName(parent=self,
|
||||
caption=self.tr("Choose config..."),
|
||||
filter=self.tr("*.json"))
|
||||
if file_path != "":
|
||||
self.file_path = file_path
|
||||
with open(file_path) as f:
|
||||
self.ui.textEdit.setPlainText(f.read())
|
||||
self.setWindowTitle(self.tr("[*]{} - {}".format(file_path, self.win_title)))
|
||||
self.ui.textEdit.document().setModified(False)
|
||||
self.setWindowModified(False)
|
||||
|
||||
def save_file(self):
|
||||
if self.file_path != "":
|
||||
data = literal_eval(self.ui.textEdit.toPlainText())
|
||||
ret = dataIO.save_json(self.file_path, data)
|
||||
if ret:
|
||||
self.ui.textEdit.document().setModified(False)
|
||||
self.setWindowModified(False)
|
||||
return ret
|
||||
|
||||
def save_as(self):
|
||||
file_path, file_name = QFileDialog.getSaveFileName(parent=self,
|
||||
caption=self.tr("Select position"),
|
||||
filter=self.tr("*.json"))
|
||||
file_data = literal_eval(self.ui.textEdit.toPlainText())
|
||||
ret = dataIO.save_json(file_path, file_data)
|
||||
if ret:
|
||||
self.file_path = file_path
|
||||
self.setWindowTitle(self.tr("[*]{} - {}".format(file_path, self.win_title)))
|
||||
self.ui.textEdit.document().setModified(False)
|
||||
self.setWindowModified(False)
|
||||
|
||||
def copy_hash(self):
|
||||
if self.maybe_save():
|
||||
result = generate_md5(self.file_path)
|
||||
clip = QApplication.clipboard()
|
||||
QClipboard.setText(clip, result)
|
||||
box = QMessageBox(QMessageBox.Information, "Information", "Hash successfully copied into your clipboard.")
|
||||
box.exec()
|
||||
|
||||
def close_file(self):
|
||||
if self.maybe_save():
|
||||
self.setWindowTitle(self.win_title)
|
||||
self.ui.textEdit.clear()
|
||||
self.file_path = ""
|
||||
|
||||
def exit(self):
|
||||
self.close()
|
||||
|
||||
def maybe_save(self):
|
||||
if not self.ui.textEdit.document().isModified():
|
||||
return True
|
||||
box = QMessageBox.warning(self,
|
||||
self.tr("App"),
|
||||
self.tr("The document has been modified.\nDo you want to save your changes?"),
|
||||
QMessageBox.Save | QMessageBox.Discard | QMessageBox.Cancel)
|
||||
if box == QMessageBox.Save:
|
||||
return self.save_file()
|
||||
elif box == QMessageBox.Discard:
|
||||
return True
|
||||
elif box == QMessageBox.Cancel:
|
||||
return False
|
||||
return True
|
||||
50
configs/ats/agencies.json
Normal file
50
configs/ats/agencies.json
Normal file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"arizona" : [
|
||||
"phoenix",
|
||||
"sierra_vista",
|
||||
"tucson"
|
||||
],
|
||||
"base" : [
|
||||
"bakersfield",
|
||||
"fresno",
|
||||
"los_angeles",
|
||||
"oxnard",
|
||||
"redding",
|
||||
"san_diego",
|
||||
"san_rafael",
|
||||
"santa_cruz",
|
||||
"stockton",
|
||||
"carson_city",
|
||||
"las_vegas"
|
||||
],
|
||||
"idaho" : [
|
||||
"boise",
|
||||
"coeur_dalene",
|
||||
"idaho_falls",
|
||||
"twin_falls"
|
||||
],
|
||||
"new_mexico" : [
|
||||
"carlsbad_nm",
|
||||
"farmington",
|
||||
"roswell",
|
||||
"santa_fe"
|
||||
],
|
||||
"oregon" : [
|
||||
"bend",
|
||||
"eugene",
|
||||
"ontario",
|
||||
"salem"
|
||||
],
|
||||
"utah" : [
|
||||
"moab",
|
||||
"salt_lake_city",
|
||||
"st_george"
|
||||
],
|
||||
"washington" : [
|
||||
"bellingham",
|
||||
"olympia",
|
||||
"seattle",
|
||||
"wenatchee",
|
||||
"yakima"
|
||||
]
|
||||
}
|
||||
49
configs/ats/dealers.json
Normal file
49
configs/ats/dealers.json
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"arizona" : [
|
||||
"flagstaff",
|
||||
"phoenix",
|
||||
"tucson",
|
||||
"yuma"
|
||||
],
|
||||
"base" : [
|
||||
"bakersfield",
|
||||
"los_angeles",
|
||||
"sacramento",
|
||||
"santa_cruz",
|
||||
"san_diego",
|
||||
"san_francisco"
|
||||
],
|
||||
"idaho" : [
|
||||
"boise",
|
||||
"idaho_falls",
|
||||
"twin_falls"
|
||||
],
|
||||
"new_mexico" : [
|
||||
"alamogordo",
|
||||
"albuquerque",
|
||||
"farmington",
|
||||
"hobbs"
|
||||
],
|
||||
"oregon" : [
|
||||
"eugene",
|
||||
"medford",
|
||||
"pendleton",
|
||||
"portland",
|
||||
"salem"
|
||||
],
|
||||
"utah" : [
|
||||
"ogden",
|
||||
"price",
|
||||
"provo",
|
||||
"salina",
|
||||
"salt_lake_city",
|
||||
"vernal"
|
||||
],
|
||||
"washington" : [
|
||||
"bellingham",
|
||||
"seattle",
|
||||
"spokane",
|
||||
"tacoma",
|
||||
"yakima"
|
||||
]
|
||||
}
|
||||
8
configs/ats/dlc.json
Normal file
8
configs/ats/dlc.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"arizona" : "company.volatile.aport_phx.phoenix",
|
||||
"idaho" : "company.volatile.du_farm.nampa",
|
||||
"new_mexico" : "company.volatile.aport_abq.albuquerque",
|
||||
"oregon" : "company.volatile.aport_pcc.portland",
|
||||
"utah" : "company.volatile.gal_oil_sit.price",
|
||||
"washington" : "company.volatile.port_sea.seattle"
|
||||
}
|
||||
117
configs/ets2/agencies.json
Normal file
117
configs/ets2/agencies.json
Normal file
@@ -0,0 +1,117 @@
|
||||
{
|
||||
"balticsea" : [
|
||||
"daugavpils",
|
||||
"helsinki",
|
||||
"kaliningrad",
|
||||
"kaunas",
|
||||
"klaipeda",
|
||||
"kouvola",
|
||||
"lahti",
|
||||
"parnu",
|
||||
"pori",
|
||||
"pskov",
|
||||
"riga",
|
||||
"tallinn",
|
||||
"turku",
|
||||
"vilnius"
|
||||
],
|
||||
"base" : [
|
||||
"aberdeen",
|
||||
"berlin",
|
||||
"bialystok",
|
||||
"birmingham",
|
||||
"bremen",
|
||||
"brno",
|
||||
"brussel",
|
||||
"calais",
|
||||
"debrecen",
|
||||
"dortmund",
|
||||
"dover",
|
||||
"dresden",
|
||||
"edinburgh",
|
||||
"frankfurt",
|
||||
"glasgow",
|
||||
"graz",
|
||||
"grohningen",
|
||||
"hamburg",
|
||||
"hannover",
|
||||
"innsbruck",
|
||||
"kassel",
|
||||
"klagenfurt",
|
||||
"koln",
|
||||
"kosice",
|
||||
"leipzig",
|
||||
"liege",
|
||||
"linz",
|
||||
"liverpool",
|
||||
"lodz",
|
||||
"london",
|
||||
"luxembourg",
|
||||
"manchester",
|
||||
"mannheim",
|
||||
"munchen",
|
||||
"newcastle",
|
||||
"nurnberg",
|
||||
"ostrava",
|
||||
"pecs",
|
||||
"plymouth",
|
||||
"poznan",
|
||||
"prague",
|
||||
"sheffield",
|
||||
"southampton",
|
||||
"stuttgart",
|
||||
"swansea",
|
||||
"szczecin",
|
||||
"wien",
|
||||
"zurich"
|
||||
],
|
||||
"blacksea" : [
|
||||
"bucuresti",
|
||||
"cluj_napoca",
|
||||
"iasi",
|
||||
"istanbul",
|
||||
"plovdiv",
|
||||
"sofia"
|
||||
],
|
||||
"east" : [
|
||||
"budapest",
|
||||
"gdansk",
|
||||
"krakow",
|
||||
"szeged",
|
||||
"warszava"
|
||||
],
|
||||
"france" : [
|
||||
"bordeaux",
|
||||
"clermont",
|
||||
"geneve",
|
||||
"larochelle",
|
||||
"lyon",
|
||||
"marseille",
|
||||
"metz",
|
||||
"paris",
|
||||
"reims",
|
||||
"rennes",
|
||||
"toulouse"
|
||||
],
|
||||
"italy" : [
|
||||
"bologna",
|
||||
"catania",
|
||||
"milano",
|
||||
"napoli",
|
||||
"pescara",
|
||||
"roma",
|
||||
"taranto",
|
||||
"venezia"
|
||||
],
|
||||
"scandinavia" : [
|
||||
"aalborg",
|
||||
"bergen",
|
||||
"helsingborg",
|
||||
"kobenhavn",
|
||||
"malmo",
|
||||
"odense",
|
||||
"oslo",
|
||||
"stavanger",
|
||||
"stockholm"
|
||||
]
|
||||
}
|
||||
114
configs/ets2/dealers.json
Normal file
114
configs/ets2/dealers.json
Normal file
@@ -0,0 +1,114 @@
|
||||
{
|
||||
"balticsea" : [
|
||||
"helsinki",
|
||||
"kaliningrad",
|
||||
"kaunas",
|
||||
"klaipeda",
|
||||
"lahti",
|
||||
"petersburg",
|
||||
"riga",
|
||||
"tallinn",
|
||||
"tartu",
|
||||
"turku",
|
||||
"vilnius"
|
||||
],
|
||||
"base" : [
|
||||
"aberdeen",
|
||||
"amsterdam",
|
||||
"berlin",
|
||||
"bern",
|
||||
"birmingham",
|
||||
"bratislava",
|
||||
"bremen",
|
||||
"brussel",
|
||||
"calais",
|
||||
"cardiff",
|
||||
"dortmund",
|
||||
"dortmund",
|
||||
"dresden",
|
||||
"dusseldorf",
|
||||
"edinburgh",
|
||||
"felixstowe",
|
||||
"frankfurt",
|
||||
"glasgow",
|
||||
"graz",
|
||||
"grimsby",
|
||||
"hamburg",
|
||||
"hannover",
|
||||
"leipzig",
|
||||
"lille",
|
||||
"london",
|
||||
"luxembourg",
|
||||
"manchester",
|
||||
"munchen",
|
||||
"newcastle",
|
||||
"nurnberg",
|
||||
"osnabruck",
|
||||
"plymouth",
|
||||
"prague",
|
||||
"rostock",
|
||||
"rotterdam",
|
||||
"salzburg",
|
||||
"strasbourg",
|
||||
"stuttgart",
|
||||
"szczecin",
|
||||
"wien",
|
||||
"wroclaw",
|
||||
"zurich"
|
||||
],
|
||||
"blacksea" : [
|
||||
"brasov",
|
||||
"bucuresti",
|
||||
"cluj_napoca",
|
||||
"constanta",
|
||||
"edirne",
|
||||
"galati",
|
||||
"iasi",
|
||||
"istanbul",
|
||||
"pitesti",
|
||||
"plovdiv",
|
||||
"sofia",
|
||||
"veliko_tarnovo"
|
||||
],
|
||||
"east" : [
|
||||
"budapest",
|
||||
"gdansk",
|
||||
"krakow",
|
||||
"szeged",
|
||||
"warszawa"
|
||||
],
|
||||
"france" : [
|
||||
"bordeaux",
|
||||
"bourges",
|
||||
"brest",
|
||||
"geneve",
|
||||
"lemans",
|
||||
"limoges",
|
||||
"lyon",
|
||||
"marseille",
|
||||
"nantes",
|
||||
"paris",
|
||||
"toulouse"
|
||||
],
|
||||
"italy" : [
|
||||
"bologna",
|
||||
"catania",
|
||||
"firenze",
|
||||
"milano",
|
||||
"napoli",
|
||||
"palermo",
|
||||
"roma",
|
||||
"taranto",
|
||||
"torino",
|
||||
"verona"
|
||||
],
|
||||
"scandinavia" : [
|
||||
"bergen",
|
||||
"goteborg",
|
||||
"kalmar",
|
||||
"kobenhavn",
|
||||
"linkoping",
|
||||
"oslo",
|
||||
"stockholm"
|
||||
]
|
||||
}
|
||||
8
configs/ets2/dlc.json
Normal file
8
configs/ets2/dlc.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"balticsea" : "company.volatile.polarislines.tallinn",
|
||||
"blacksea" : "company.volatile.bhv.galati",
|
||||
"east" : "company.volatile.quarry.katowice",
|
||||
"france" : "company.volatile.lisette_log.roscoff",
|
||||
"italy" : "company.volatile.marina_it.ancona",
|
||||
"scandinavia" : "company.volatile.sag_tre.oslo"
|
||||
}
|
||||
8
configs/version.cfg
Normal file
8
configs/version.cfg
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"ats_dlc": "c07eea9c3358aaea310ebf4808244082",
|
||||
"ats_agencies": "21a34efef91f93e3dde2eadb692d2e54",
|
||||
"ats_dealers": "88bc97c2276b198f80c885052b8ac1ab",
|
||||
"ets2_dlc": "efa15bc58f98eadbcae350f3eb583040",
|
||||
"ets2_agencies": "3d44d5c82db5e9c98adb61e36e6698fd",
|
||||
"ets2_dealers": "446d5a4f984c87aa8a99fa1d78431f26"
|
||||
}
|
||||
13
convert_ui_to_py.bat
Normal file
13
convert_ui_to_py.bat
Normal file
@@ -0,0 +1,13 @@
|
||||
cls
|
||||
@echo off
|
||||
title Form converter
|
||||
|
||||
:SETUP
|
||||
echo Enter form name to convert into .py (without .ui):
|
||||
echo Type 'exit' to exit
|
||||
set/p "name=> "
|
||||
if %name%==exit goto EXIT
|
||||
pyuic5 %name%.ui -o %name%.py
|
||||
goto SETUP
|
||||
|
||||
:EXIT
|
||||
39
dataIO.py
Normal file
39
dataIO.py
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from json import decoder, load, dump
|
||||
|
||||
|
||||
class DataIO:
|
||||
@staticmethod
|
||||
def _read_json(filename):
|
||||
with open(filename, encoding="utf-8") as f:
|
||||
data = load(f)
|
||||
return data
|
||||
|
||||
def is_valid_json(self, filename):
|
||||
"""Verifies if json file exists / is readable"""
|
||||
try:
|
||||
self._read_json(filename)
|
||||
return True
|
||||
except FileNotFoundError:
|
||||
return False
|
||||
except decoder.JSONDecodeError:
|
||||
return False
|
||||
|
||||
def load_json(self, filename):
|
||||
"""Loads json file"""
|
||||
return self._read_json(filename)
|
||||
|
||||
def save_json(self, filename, data):
|
||||
"""Atomically saves json file"""
|
||||
with open(filename, encoding="utf-8", mode="w") as f:
|
||||
dump(data, f, indent=4, separators=(",", " : "))
|
||||
try:
|
||||
self._read_json(filename)
|
||||
except decoder.JSONDecodeError:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
dataIO = DataIO()
|
||||
BIN
dlls/imageformats/qgif.dll
Normal file
BIN
dlls/imageformats/qgif.dll
Normal file
Binary file not shown.
BIN
dlls/imageformats/qicns.dll
Normal file
BIN
dlls/imageformats/qicns.dll
Normal file
Binary file not shown.
BIN
dlls/imageformats/qico.dll
Normal file
BIN
dlls/imageformats/qico.dll
Normal file
Binary file not shown.
BIN
dlls/imageformats/qjpeg.dll
Normal file
BIN
dlls/imageformats/qjpeg.dll
Normal file
Binary file not shown.
BIN
dlls/imageformats/qsvg.dll
Normal file
BIN
dlls/imageformats/qsvg.dll
Normal file
Binary file not shown.
BIN
dlls/imageformats/qtga.dll
Normal file
BIN
dlls/imageformats/qtga.dll
Normal file
Binary file not shown.
BIN
dlls/imageformats/qtiff.dll
Normal file
BIN
dlls/imageformats/qtiff.dll
Normal file
Binary file not shown.
BIN
dlls/imageformats/qwbmp.dll
Normal file
BIN
dlls/imageformats/qwbmp.dll
Normal file
Binary file not shown.
BIN
dlls/imageformats/qwebp.dll
Normal file
BIN
dlls/imageformats/qwebp.dll
Normal file
Binary file not shown.
BIN
dlls/platforms/qminimal.dll
Normal file
BIN
dlls/platforms/qminimal.dll
Normal file
Binary file not shown.
BIN
dlls/platforms/qoffscreen.dll
Normal file
BIN
dlls/platforms/qoffscreen.dll
Normal file
Binary file not shown.
BIN
dlls/platforms/qwebgl.dll
Normal file
BIN
dlls/platforms/qwebgl.dll
Normal file
Binary file not shown.
BIN
dlls/platforms/qwindows.dll
Normal file
BIN
dlls/platforms/qwindows.dll
Normal file
Binary file not shown.
BIN
dlls/styles/qwindowsvistastyle.dll
Normal file
BIN
dlls/styles/qwindowsvistastyle.dll
Normal file
Binary file not shown.
12
init_config_editor.py
Normal file
12
init_config_editor.py
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from sys import argv, exit
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
from config_editor.script import EditorWindow
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = QApplication(argv)
|
||||
win = EditorWindow()
|
||||
win.show()
|
||||
exit(app.exec())
|
||||
12
init_main_program.py
Normal file
12
init_main_program.py
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from sys import argv, exit
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
from choice.script import ChoiceWindow
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = QApplication(argv)
|
||||
win = ChoiceWindow()
|
||||
win.show()
|
||||
exit(app.exec())
|
||||
1
main/__init__.py
Normal file
1
main/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
# initialize module 'main'
|
||||
539
main/form.ui
Normal file
539
main/form.ui
Normal file
@@ -0,0 +1,539 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<author>JDM170</author>
|
||||
<class>MainWindow</class>
|
||||
<widget class="QDialog" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>360</width>
|
||||
<height>350</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>360</width>
|
||||
<height>350</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>360</width>
|
||||
<height>350</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>SaveWizard</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="gridLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>50</y>
|
||||
<width>341</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="basic_inf_layout">
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="money_edit">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QCheckBox" name="money_dont_change">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Don't change</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="xp_label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Experience:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="xp_edit">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QCheckBox" name="xp_dont_change">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Don't change</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="loan_limit_label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Loan limit:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="loan_limit_edit">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QCheckBox" name="loan_limit_dont_change">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Don't change</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="money_label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Money:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="path_button">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>161</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Choose save file...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="backup">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>310</y>
|
||||
<width>141</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Recover backup</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="dont_change_all_inf">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>80</x>
|
||||
<y>350</y>
|
||||
<width>211</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Don't save all changes in this form</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="gridLayoutWidget_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>140</y>
|
||||
<width>341</width>
|
||||
<height>161</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="skills_layout">
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="long_distance_edit">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="urgent_delivery_label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>13</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Urgent delivery:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QCheckBox" name="ecodriving_dont_change">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Don't change</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="adr_edit">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="urgent_delivery_edit">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QCheckBox" name="fragile_cargo_dont_change">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Don't change</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="ecodriving_edit">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QCheckBox" name="high_value_cargo_dont_change">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Don't change</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="fragile_cargo_edit">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QCheckBox" name="adr_dont_change">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Don't change</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QCheckBox" name="long_distance_dont_change">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Don't change</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="high_value_cargo_edit">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="high_value_cargo_label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>13</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>High value cargo:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="fragile_cargo_label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>13</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fragile cargo:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="ecodriving_label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>13</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Ecodriving:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QCheckBox" name="urgent_delivery_dont_change">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Don't change</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="long_distance_label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>13</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Long distance:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="adr_label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>13</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>ADR:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="apply">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>310</y>
|
||||
<width>141</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Apply changes</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="second_window">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>320</y>
|
||||
<width>41</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="chosen_cfgs">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>10</y>
|
||||
<width>141</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Chosen configs:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="cfg_button">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>180</x>
|
||||
<y>20</y>
|
||||
<width>21</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>path_button</tabstop>
|
||||
<tabstop>cfg_button</tabstop>
|
||||
<tabstop>money_edit</tabstop>
|
||||
<tabstop>money_dont_change</tabstop>
|
||||
<tabstop>xp_edit</tabstop>
|
||||
<tabstop>xp_dont_change</tabstop>
|
||||
<tabstop>loan_limit_edit</tabstop>
|
||||
<tabstop>loan_limit_dont_change</tabstop>
|
||||
<tabstop>adr_edit</tabstop>
|
||||
<tabstop>adr_dont_change</tabstop>
|
||||
<tabstop>long_distance_edit</tabstop>
|
||||
<tabstop>long_distance_dont_change</tabstop>
|
||||
<tabstop>high_value_cargo_edit</tabstop>
|
||||
<tabstop>high_value_cargo_dont_change</tabstop>
|
||||
<tabstop>fragile_cargo_edit</tabstop>
|
||||
<tabstop>fragile_cargo_dont_change</tabstop>
|
||||
<tabstop>urgent_delivery_edit</tabstop>
|
||||
<tabstop>urgent_delivery_dont_change</tabstop>
|
||||
<tabstop>ecodriving_edit</tabstop>
|
||||
<tabstop>ecodriving_dont_change</tabstop>
|
||||
<tabstop>backup</tabstop>
|
||||
<tabstop>second_window</tabstop>
|
||||
<tabstop>apply</tabstop>
|
||||
<tabstop>dont_change_all_inf</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
235
main/script.py
Normal file
235
main/script.py
Normal file
@@ -0,0 +1,235 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from os import system, remove
|
||||
from PyQt5.QtCore import Qt, QRegExp
|
||||
from PyQt5.QtGui import QRegExpValidator
|
||||
from PyQt5.QtWidgets import QDialog, QFileDialog
|
||||
from .form import Ui_MainWindow
|
||||
from util import *
|
||||
from dataIO import dataIO
|
||||
from second.script import SecondWindow
|
||||
|
||||
|
||||
class MainWindow(QDialog, Ui_MainWindow):
|
||||
def __init__(self, selected_game, parent=None):
|
||||
# Setup UI
|
||||
QDialog.__init__(self, parent, flags=Qt.Window)
|
||||
Ui_MainWindow.__init__(self)
|
||||
self.ui = Ui_MainWindow()
|
||||
self.ui.setupUi(self)
|
||||
|
||||
self.file_path = ""
|
||||
self.old_file = ""
|
||||
|
||||
self.selected_game = selected_game
|
||||
self.owns = {}
|
||||
self.dlc = {}
|
||||
|
||||
# Editing label to show what configs chosen
|
||||
self.chosen_cfg_text = self.ui.chosen_cfgs.text()
|
||||
self.ui.chosen_cfgs.setText("{} {}".format(self.chosen_cfg_text, selected_game.upper()))
|
||||
|
||||
# Storing edits with his checkboxes and file-lines
|
||||
self.basic_edits = {
|
||||
self.ui.money_edit: [self.ui.money_dont_change, "money_account:"],
|
||||
self.ui.xp_edit: [self.ui.xp_dont_change, "experience_points:"],
|
||||
self.ui.loan_limit_edit: [self.ui.loan_limit_dont_change, "loan_limit:"],
|
||||
}
|
||||
self.skill_edits = {
|
||||
self.ui.long_distance_edit: [self.ui.long_distance_dont_change, "long_dist:"],
|
||||
self.ui.high_value_cargo_edit: [self.ui.high_value_cargo_dont_change, "heavy:"],
|
||||
self.ui.fragile_cargo_edit: [self.ui.fragile_cargo_dont_change, "fragile:"],
|
||||
self.ui.urgent_delivery_edit: [self.ui.urgent_delivery_dont_change, "urgent:"],
|
||||
self.ui.ecodriving_edit: [self.ui.ecodriving_dont_change, "mechanical:"],
|
||||
}
|
||||
|
||||
# Setting up validators for edits
|
||||
basic_validator = QRegExpValidator(QRegExp("[0-9]{,9}"))
|
||||
for key in self.basic_edits.keys():
|
||||
key.setValidator(basic_validator)
|
||||
key.textEdited.connect(self.text_edited)
|
||||
|
||||
adr_validator_text = ""
|
||||
for i in range(6):
|
||||
adr_validator_text += r"\d[., ]?" if i != 5 else r"\d"
|
||||
self.ui.adr_edit.textEdited.connect(self.text_edited)
|
||||
self.ui.adr_edit.setValidator(QRegExpValidator(QRegExp(adr_validator_text)))
|
||||
skills_validator = QRegExpValidator(QRegExp("[0-6]{,1}"))
|
||||
for key in self.skill_edits.keys():
|
||||
key.setValidator(skills_validator)
|
||||
key.textEdited.connect(self.text_edited)
|
||||
|
||||
# Connecting buttons
|
||||
self.ui.path_button.clicked.connect(self.open_file_dialog)
|
||||
self.ui.cfg_button.clicked.connect(self.change_configs)
|
||||
self.ui.backup.clicked.connect(self.recover_backup)
|
||||
self.ui.second_window.clicked.connect(self.open_second_win)
|
||||
self.ui.apply.clicked.connect(self.apply_changes)
|
||||
|
||||
self.check_config()
|
||||
self.clear_fields()
|
||||
|
||||
def text_edited(self):
|
||||
sender = self.sender()
|
||||
if sender in self.basic_edits:
|
||||
self.basic_edits[sender][0].setChecked(False)
|
||||
if sender == self.ui.adr_edit:
|
||||
self.ui.adr_dont_change.setChecked(False)
|
||||
if sender in self.skill_edits:
|
||||
self.skill_edits[sender][0].setChecked(False)
|
||||
|
||||
@staticmethod
|
||||
def get_adr(value):
|
||||
bin_code = bin(int(value))[2:]
|
||||
bin_code = "0" * (6 - len(bin_code)) + bin_code
|
||||
r = []
|
||||
for i in bin_code:
|
||||
r.append(i)
|
||||
return r
|
||||
|
||||
def get_adr_from_line(self):
|
||||
adr_list = list(self.ui.adr_edit.text())
|
||||
for i in adr_list:
|
||||
if (i == " ") or (i == ",") or (i == "."):
|
||||
adr_list.remove(i)
|
||||
return adr_list
|
||||
|
||||
def check_config(self):
|
||||
cfg_path = "configs/{}/dlc.json".format(self.selected_game)
|
||||
if dataIO.is_valid_json(cfg_path) is False:
|
||||
self.owns = False
|
||||
show_message(QMessageBox.Warning, "Warning", "'dlc.json' from '{}' have errors or not found, "
|
||||
"functionality has been limited".format(self.selected_game))
|
||||
else:
|
||||
self.owns = {}
|
||||
self.dlc = dataIO.load_json(cfg_path)
|
||||
|
||||
def clear_fields(self):
|
||||
self.file_path = ""
|
||||
self.old_file = ""
|
||||
set_lines([])
|
||||
|
||||
if self.owns is not False:
|
||||
self.owns = {}
|
||||
|
||||
for key, value in self.basic_edits.items():
|
||||
key.setText("")
|
||||
value[0].setChecked(True)
|
||||
|
||||
self.ui.adr_edit.setText("")
|
||||
self.ui.adr_dont_change.setChecked(True)
|
||||
for key, value in self.skill_edits.items():
|
||||
key.setText("")
|
||||
value[0].setChecked(True)
|
||||
|
||||
self.ui.apply.setEnabled(False)
|
||||
self.ui.backup.setEnabled(False)
|
||||
self.ui.second_window.setEnabled(False)
|
||||
|
||||
def get_file_data(self, file):
|
||||
try:
|
||||
with open(file) as f:
|
||||
self.old_file = f.read()
|
||||
except UnicodeDecodeError:
|
||||
try:
|
||||
system("SII_Decrypt.exe --on_file -i \"{}\"".format(file))
|
||||
with open(file) as f:
|
||||
self.old_file = f.read()
|
||||
show_message(QMessageBox.Information, "Success", "File successfully decrypted.")
|
||||
except UnicodeDecodeError:
|
||||
show_message(QMessageBox.Critical, "Error", "Error to decrypt and open file. "
|
||||
"Try again.\nIf you still get error on this step,"
|
||||
"try to change \"uset g_save_format\" to 2, resave game "
|
||||
"and try again.")
|
||||
return
|
||||
set_lines(self.old_file.split("\n"))
|
||||
|
||||
if self.owns is not False:
|
||||
self.owns["base"] = True
|
||||
companies = get_array_items(search_line("companies:"))
|
||||
for key, value in self.dlc.items():
|
||||
if value in companies:
|
||||
self.owns[key] = True
|
||||
|
||||
for key, value in self.basic_edits.items():
|
||||
key.setText(get_value(search_line(value[1])))
|
||||
|
||||
adr = self.get_adr(get_value(search_line("adr:")))
|
||||
adr_list = ""
|
||||
for i in range(6):
|
||||
adr_list += adr[i] + "," if i != 5 else adr[i]
|
||||
self.ui.adr_edit.setText(adr_list)
|
||||
|
||||
for key, value in self.skill_edits.items():
|
||||
key.setText(get_value(search_line(value[1])))
|
||||
|
||||
self.ui.apply.setEnabled(True)
|
||||
self.ui.backup.setEnabled(True)
|
||||
self.ui.second_window.setEnabled(True)
|
||||
|
||||
def open_file_dialog(self):
|
||||
file_path, file_name = QFileDialog.getOpenFileName(parent=self,
|
||||
caption=self.tr("Choose your save file..."),
|
||||
filter=self.tr("game.sii"))
|
||||
self.clear_fields()
|
||||
if file_path != "":
|
||||
self.file_path = file_path
|
||||
self.get_file_data(file_path)
|
||||
else:
|
||||
return
|
||||
|
||||
def change_configs(self):
|
||||
box = QMessageBox(QMessageBox.Warning, "Warning", "Do you really want to load other configs?\n"
|
||||
"Your current changes won't be saved.")
|
||||
box.addButton("Yes", QMessageBox.YesRole)
|
||||
box.addButton("No", QMessageBox.NoRole)
|
||||
if box.exec() == 0:
|
||||
self.clear_fields()
|
||||
self.selected_game = "ets2" if self.selected_game == "ats" else "ats"
|
||||
self.ui.chosen_cfgs.setText("{} {}".format(self.chosen_cfg_text, self.selected_game.upper()))
|
||||
self.check_config()
|
||||
|
||||
def recover_backup(self):
|
||||
try:
|
||||
backup = self.file_path + ".swbak"
|
||||
f = open(backup)
|
||||
with open(self.file_path, "w") as g:
|
||||
g.write(f.read())
|
||||
f.close()
|
||||
remove(backup)
|
||||
show_message(QMessageBox.Information, "Success", "Backup successfully recovered.")
|
||||
self.get_file_data(self.file_path)
|
||||
except IOError:
|
||||
show_message(QMessageBox.Critical, "Error", "Backup not found.")
|
||||
|
||||
def open_second_win(self):
|
||||
second_win = SecondWindow(self.selected_game, self.owns, self)
|
||||
second_win.exec()
|
||||
|
||||
def apply_changes(self):
|
||||
if not self.ui.dont_change_all_inf.isChecked():
|
||||
for key, value in self.basic_edits.items():
|
||||
if value[0].isChecked() is False:
|
||||
set_value(search_line(value[1]), key.text())
|
||||
value[0].setChecked(True)
|
||||
if self.ui.adr_dont_change.isChecked() is False:
|
||||
adr_set = self.get_adr_from_line()
|
||||
if len(adr_set) < 6:
|
||||
show_message(QMessageBox.Critical, "Error", "ADR can't have less than 6 elements.")
|
||||
elif len(adr_set) > 6:
|
||||
show_message(QMessageBox.Critical, "Error", "ADR can't have more than 6 elements.")
|
||||
else:
|
||||
adr_new = int("".join(adr_set), 2)
|
||||
set_value(search_line("adr:"), str(adr_new))
|
||||
for key, value in self.skill_edits.items():
|
||||
if value[0].isChecked() is False:
|
||||
set_value(search_line(value[1]), key.text())
|
||||
value[0].setChecked(True)
|
||||
backup = self.file_path + ".swbak"
|
||||
with open(backup, "w") as f:
|
||||
f.write(self.old_file)
|
||||
with open(self.file_path, "w") as f:
|
||||
f.write("\n".join(get_lines()))
|
||||
show_message(QMessageBox.Information, "Success", "Changes successfully applied!")
|
||||
self.get_file_data(self.file_path)
|
||||
1
parsing/__init__.py
Normal file
1
parsing/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
# initialize module 'parsing'
|
||||
55
parsing/script.py
Normal file
55
parsing/script.py
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from requests import get
|
||||
from ast import literal_eval
|
||||
import os
|
||||
from statics import github_link, update_config_name
|
||||
from dataIO import dataIO
|
||||
from util import generate_md5
|
||||
|
||||
|
||||
def get_response_result(url):
|
||||
response = get(url)
|
||||
return response.status_code == 200, response
|
||||
|
||||
|
||||
def check_path(path):
|
||||
current_path = os.getcwd()
|
||||
for item in path.split("/"):
|
||||
current_path = os.path.join(current_path, item)
|
||||
if not os.path.exists(current_path):
|
||||
if item.find(".json") > 0:
|
||||
open(current_path, "w").close()
|
||||
else:
|
||||
os.mkdir(current_path)
|
||||
|
||||
|
||||
def check_remote_hashes():
|
||||
response_status, response = get_response_result(github_link + "configs/version.cfg")
|
||||
if response_status:
|
||||
remote_cfg = literal_eval(response.text)
|
||||
need_update = []
|
||||
for key, value in remote_cfg.items():
|
||||
path = key.split("_")
|
||||
path = "configs/{}/{}.json".format(path[0], path[1])
|
||||
if generate_md5(path) != value:
|
||||
need_update.append(path)
|
||||
return need_update
|
||||
return False
|
||||
|
||||
|
||||
def update_configs(is_save, cfg_list):
|
||||
if is_save in (0, 1):
|
||||
for cfg in cfg_list:
|
||||
check_path(cfg)
|
||||
response_status, response = get_response_result(github_link + cfg)
|
||||
if response_status:
|
||||
remote_cfg = literal_eval(response.text)
|
||||
if dataIO.is_valid_json(cfg) or os.path.exists(cfg):
|
||||
dataIO.save_json(cfg, remote_cfg)
|
||||
if is_save in (1, 3):
|
||||
text = str({"answer_updates": is_save == 3,
|
||||
"update_on_start": is_save == 1})
|
||||
with open(update_config_name, "w") as f:
|
||||
f.write(text)
|
||||
1
second/__init__.py
Normal file
1
second/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
# initialize module 'second'
|
||||
@@ -1,39 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<author>JDM170</author>
|
||||
<class>SecondWindow</class>
|
||||
<widget class="QDialog" name="SecondWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>660</width>
|
||||
<height>440</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>660</width>
|
||||
<height>400</height>
|
||||
<height>440</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>660</width>
|
||||
<height>400</height>
|
||||
<height>440</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Edit garages, cities and etc...</string>
|
||||
<string>Unlock garages, cities and etc...</string>
|
||||
</property>
|
||||
<property name="locale">
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
</property>
|
||||
<widget class="QWidget" name="gridLayoutWidget_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<y>20</y>
|
||||
<width>131</width>
|
||||
<height>191</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="garages_layout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QTextBrowser" name="garages_text">
|
||||
<property name="openLinks">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="garages_label">
|
||||
<property name="font">
|
||||
@@ -45,6 +50,12 @@
|
||||
<property name="text">
|
||||
<string>Owned garages:</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
@@ -60,38 +71,37 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QTextEdit" name="garages_text">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="acceptDrops">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="gridLayoutWidget_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>340</x>
|
||||
<y>10</y>
|
||||
<y>20</y>
|
||||
<width>131</width>
|
||||
<height>191</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="cities_layout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QTextBrowser" name="cities_text">
|
||||
<property name="openLinks">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="cities_analyze">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Analyze</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="cities_visited_label">
|
||||
<property name="font">
|
||||
@@ -103,6 +113,28 @@
|
||||
<property name="text">
|
||||
<string>Visited cities:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QTextEdit" name="cities_text">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="acceptDrops">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -111,9 +143,9 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>220</y>
|
||||
<y>250</y>
|
||||
<width>131</width>
|
||||
<height>171</height>
|
||||
<height>181</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="dealerships_layout">
|
||||
@@ -128,21 +160,27 @@
|
||||
<property name="text">
|
||||
<string>Dealerships:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QTextBrowser" name="dealerships_text"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="dealerships_analyze">
|
||||
<widget class="QTextEdit" name="dealerships_text">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Analyze</string>
|
||||
<property name="acceptDrops">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -152,9 +190,9 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>340</x>
|
||||
<y>220</y>
|
||||
<y>250</y>
|
||||
<width>131</width>
|
||||
<height>171</height>
|
||||
<height>181</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="agencies_layout">
|
||||
@@ -169,21 +207,27 @@
|
||||
<property name="text">
|
||||
<string>Agencies:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QTextBrowser" name="agencies_text"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="agencies_analyze">
|
||||
<widget class="QTextEdit" name="agencies_text">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
<pointsize>11</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Analyze</string>
|
||||
<property name="acceptDrops">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -195,7 +239,7 @@
|
||||
<x>320</x>
|
||||
<y>10</y>
|
||||
<width>20</width>
|
||||
<height>381</height>
|
||||
<height>420</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
@@ -206,7 +250,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>200</y>
|
||||
<y>230</y>
|
||||
<width>641</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
@@ -221,11 +265,11 @@
|
||||
<x>150</x>
|
||||
<y>10</y>
|
||||
<width>171</width>
|
||||
<height>107</height>
|
||||
<height>135</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="add_garage">
|
||||
<item row="2" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QPushButton" name="garage_add">
|
||||
<property name="font">
|
||||
<font>
|
||||
@@ -234,15 +278,22 @@
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
<string>Unlock</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLineEdit" name="garage_lineedit"/>
|
||||
<widget class="QLineEdit" name="garage_edit">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QPushButton" name="garage_unlock_all">
|
||||
<item row="4" column="0">
|
||||
<widget class="QPushButton" name="garage_add_all">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
@@ -265,6 +316,19 @@
|
||||
<property name="text">
|
||||
<string>Enter garage name:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QComboBox" name="garage_size">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -273,9 +337,9 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>480</x>
|
||||
<y>50</y>
|
||||
<y>60</y>
|
||||
<width>171</width>
|
||||
<height>107</height>
|
||||
<height>110</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="add_city">
|
||||
@@ -288,12 +352,19 @@
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
<string>Visit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLineEdit" name="city_lineedit"/>
|
||||
<widget class="QLineEdit" name="city_edit">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="city_label">
|
||||
@@ -306,10 +377,13 @@
|
||||
<property name="text">
|
||||
<string>Enter city name:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QPushButton" name="city_unlock_all">
|
||||
<widget class="QPushButton" name="city_add_all">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
@@ -327,14 +401,14 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<y>250</y>
|
||||
<y>290</y>
|
||||
<width>171</width>
|
||||
<height>107</height>
|
||||
<height>108</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="add_dealership">
|
||||
<layout class="QGridLayout" name="add_dealer">
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="dealership_add">
|
||||
<widget class="QPushButton" name="dealer_add">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
@@ -342,15 +416,22 @@
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
<string>Research</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLineEdit" name="dealership_lineedit"/>
|
||||
<widget class="QLineEdit" name="dealer_edit">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="dealership_label">
|
||||
<widget class="QLabel" name="dealer_label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
@@ -360,10 +441,13 @@
|
||||
<property name="text">
|
||||
<string>Enter dealership name:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QPushButton" name="dealership_unlock_all">
|
||||
<widget class="QPushButton" name="dealer_add_all">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
@@ -371,7 +455,7 @@
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Unlock all</string>
|
||||
<string>Research all</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -381,9 +465,9 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>480</x>
|
||||
<y>250</y>
|
||||
<y>290</y>
|
||||
<width>171</width>
|
||||
<height>107</height>
|
||||
<height>108</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="add_agency">
|
||||
@@ -396,13 +480,10 @@
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
<string>Research</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLineEdit" name="agency_lineedit"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="agency_label">
|
||||
<property name="font">
|
||||
@@ -414,10 +495,13 @@
|
||||
<property name="text">
|
||||
<string>Enter agency name:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QPushButton" name="agency_unlock_all">
|
||||
<widget class="QPushButton" name="agency_add_all">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
@@ -425,7 +509,17 @@
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Unlock all</string>
|
||||
<string>Research all</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLineEdit" name="agency_edit">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -435,7 +529,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<y>120</y>
|
||||
<y>150</y>
|
||||
<width>171</width>
|
||||
<height>80</height>
|
||||
</rect>
|
||||
@@ -452,10 +546,20 @@
|
||||
<property name="text">
|
||||
<string>Your headquarter:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLineEdit" name="headquarter_lineedit"/>
|
||||
<widget class="QLineEdit" name="headquarter_edit">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="headquarter_change">
|
||||
@@ -472,19 +576,29 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<zorder>gridLayoutWidget_4</zorder>
|
||||
<zorder>gridLayoutWidget_5</zorder>
|
||||
<zorder>gridLayoutWidget_2</zorder>
|
||||
<zorder>gridLayoutWidget_6</zorder>
|
||||
<zorder>v_line</zorder>
|
||||
<zorder>h_line</zorder>
|
||||
<zorder>gridLayoutWidget</zorder>
|
||||
<zorder>gridLayoutWidget_3</zorder>
|
||||
<zorder>gridLayoutWidget_7</zorder>
|
||||
<zorder>gridLayoutWidget_8</zorder>
|
||||
<zorder>garage_label</zorder>
|
||||
<zorder>gridLayoutWidget_9</zorder>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>garages_text</tabstop>
|
||||
<tabstop>garages_analyze</tabstop>
|
||||
<tabstop>garage_edit</tabstop>
|
||||
<tabstop>garage_size</tabstop>
|
||||
<tabstop>garage_add</tabstop>
|
||||
<tabstop>garage_add_all</tabstop>
|
||||
<tabstop>headquarter_edit</tabstop>
|
||||
<tabstop>headquarter_change</tabstop>
|
||||
<tabstop>cities_text</tabstop>
|
||||
<tabstop>city_edit</tabstop>
|
||||
<tabstop>city_add</tabstop>
|
||||
<tabstop>city_add_all</tabstop>
|
||||
<tabstop>dealerships_text</tabstop>
|
||||
<tabstop>dealer_edit</tabstop>
|
||||
<tabstop>dealer_add</tabstop>
|
||||
<tabstop>dealer_add_all</tabstop>
|
||||
<tabstop>agencies_text</tabstop>
|
||||
<tabstop>agency_edit</tabstop>
|
||||
<tabstop>agency_add</tabstop>
|
||||
<tabstop>agency_add_all</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
262
second/script.py
Normal file
262
second/script.py
Normal file
@@ -0,0 +1,262 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import QDialog
|
||||
from .form import Ui_SecondWindow
|
||||
from util import *
|
||||
from dataIO import dataIO
|
||||
|
||||
garages_stat = {
|
||||
"Small": [1, 1],
|
||||
"Medium": [2, 3],
|
||||
"Big": [3, 5]
|
||||
}
|
||||
|
||||
|
||||
class SecondWindow(QDialog, Ui_SecondWindow):
|
||||
def __init__(self, selected_game, owns_list, parent=None):
|
||||
# Setup UI
|
||||
QDialog.__init__(self, parent, flags=Qt.Window)
|
||||
Ui_SecondWindow.__init__(self)
|
||||
self.ui = Ui_SecondWindow()
|
||||
self.ui.setupUi(self)
|
||||
|
||||
self.owns = owns_list # From main window
|
||||
|
||||
# Checking files
|
||||
cfg_path = "configs/{}".format(selected_game)
|
||||
dealers_path = "{}/dealers.json".format(cfg_path)
|
||||
agencies_path = "{}/agencies.json".format(cfg_path)
|
||||
if dataIO.is_valid_json(dealers_path) is False:
|
||||
self.dealers = False
|
||||
self.ui.dealer_edit.setEnabled(False)
|
||||
self.ui.dealer_add.setEnabled(False)
|
||||
self.ui.dealer_add_all.setEnabled(False)
|
||||
show_message(QMessageBox.Warning, "Warning", "'dealers.json' from '{}' have errors or not found, dealers "
|
||||
"editing has been disabled".format(selected_game))
|
||||
else:
|
||||
self.dealers = []
|
||||
self.dealers_file = dataIO.load_json(dealers_path)
|
||||
|
||||
if dataIO.is_valid_json(agencies_path) is False:
|
||||
self.agencies = False
|
||||
self.ui.agency_edit.setEnabled(False)
|
||||
self.ui.agency_add.setEnabled(False)
|
||||
self.ui.agency_add_all.setEnabled(False)
|
||||
show_message(QMessageBox.Warning, "Warning", "'agencies.json' from '{}' have errors or not found, agencies "
|
||||
"editing has been disabled".format(selected_game))
|
||||
else:
|
||||
self.agencies = []
|
||||
self.agencies_file = dataIO.load_json(agencies_path)
|
||||
|
||||
self.ui.garage_size.addItem("Small")
|
||||
self.ui.garage_size.addItem("Medium")
|
||||
self.ui.garage_size.addItem("Big")
|
||||
|
||||
# Dealers and agencies properties
|
||||
self.da_array = {
|
||||
self.ui.dealer_add: [self.ui.dealer_edit, "unlocked_dealers:", "Dealership", self.dealers,
|
||||
self.check_dealers],
|
||||
self.ui.agency_add: [self.ui.agency_edit, "unlocked_recruitments:", "Recruitment agency",
|
||||
self.agencies, self.check_agencies],
|
||||
}
|
||||
|
||||
# Connecting buttons
|
||||
self.ui.garages_analyze.clicked.connect(self.check_garages)
|
||||
self.ui.garage_add.clicked.connect(self.add_garage)
|
||||
self.ui.garage_add_all.clicked.connect(self.add_all_garages)
|
||||
self.ui.headquarter_change.clicked.connect(self.change_headquarter)
|
||||
self.ui.city_add.clicked.connect(self.add_city)
|
||||
self.ui.city_add_all.clicked.connect(self.add_all_cities)
|
||||
self.ui.dealer_add.clicked.connect(self.da_clicked)
|
||||
self.ui.dealer_add_all.clicked.connect(self.add_all_dealers)
|
||||
self.ui.agency_add.clicked.connect(self.da_clicked)
|
||||
self.ui.agency_add_all.clicked.connect(self.add_all_agencies)
|
||||
|
||||
if self.owns:
|
||||
self.fill_list(self.dealers, self.dealers_file)
|
||||
self.fill_list(self.agencies, self.agencies_file)
|
||||
# Checking save-file
|
||||
self.check_cities()
|
||||
self.check_dealers()
|
||||
self.check_agencies()
|
||||
|
||||
@staticmethod
|
||||
def purchased_garages():
|
||||
garages = []
|
||||
for index in search_all_lines("garage : garage."):
|
||||
city = match(r"garage : garage.(.+) {$", get_lines(index)).group(1)
|
||||
if get_value(search_line("status:", start=index)) != "0":
|
||||
garages.append(city)
|
||||
return garages
|
||||
|
||||
@staticmethod
|
||||
def all_cities():
|
||||
cities = []
|
||||
for line in get_array_items(search_line("companies:")):
|
||||
city = match(r"company.volatile.[a-z0-9_]+[.]([a-z_]+)", line).group(1)
|
||||
if city not in cities:
|
||||
cities.append(city)
|
||||
return cities
|
||||
|
||||
def fill_list(self, array, file):
|
||||
if array is False:
|
||||
return
|
||||
for key in self.owns.keys():
|
||||
if key not in file:
|
||||
continue
|
||||
for value in file[key]:
|
||||
array.append(value)
|
||||
|
||||
def check_garage_size(self):
|
||||
stat = garages_stat[self.ui.garage_size.currentText()]
|
||||
return str(stat[0]), stat[1]
|
||||
|
||||
def check_garages(self):
|
||||
self.ui.garages_text.clear()
|
||||
garages = self.purchased_garages()
|
||||
for garage in garages:
|
||||
self.ui.garages_text.append(garage)
|
||||
self.ui.garages_text.scrollToAnchor(garages[0])
|
||||
|
||||
def add_garage(self):
|
||||
garage = self.ui.garage_edit.text().lower()
|
||||
if garage is "":
|
||||
show_message(QMessageBox.Critical, "Error", "Enter city name!")
|
||||
return
|
||||
self.ui.garage_edit.setText("")
|
||||
reg_garage = "garage." + garage
|
||||
current_status = search_line_in_unit("status:", reg_garage)
|
||||
if get_value(current_status) == "0":
|
||||
new_status, size = self.check_garage_size()
|
||||
set_value(current_status, new_status)
|
||||
vehicles_array = search_line_in_unit("vehicles:", reg_garage)
|
||||
drivers_array = search_line_in_unit("drivers:", reg_garage)
|
||||
for i in range(1, size+1):
|
||||
add_array_value(vehicles_array, "null")
|
||||
add_array_value(drivers_array+i, "null")
|
||||
show_message(QMessageBox.Information, "Success", "Garage in \"{}\" successfully unlocked.".format(garage))
|
||||
else:
|
||||
show_message(QMessageBox.Critical, "Error", "Garage in \"{}\" already unlocked.".format(garage))
|
||||
|
||||
def add_all_garages(self):
|
||||
new_status, size = self.check_garage_size()
|
||||
for item in get_array_items(search_line("garages:")):
|
||||
item = match(r"garage.(.+)$", item).group(1)
|
||||
current_garage = search_line("garage : garage."+item+" {")
|
||||
current_status = search_line("status:", start=current_garage)
|
||||
if get_value(current_status) == "0":
|
||||
set_value(current_status, new_status)
|
||||
vehicles_array = search_line("vehicles:", start=current_garage)
|
||||
drivers_array = search_line("drivers:", start=current_garage)
|
||||
for i in range(1, size+1):
|
||||
add_array_value(vehicles_array, "null")
|
||||
add_array_value(drivers_array+i, "null")
|
||||
show_message(QMessageBox.Information, "Success", "All garages successfully unlocked.")
|
||||
|
||||
def change_headquarter(self):
|
||||
hq = self.ui.headquarter_edit.text().lower()
|
||||
if hq is "":
|
||||
show_message(QMessageBox.Critical, "Error", "Enter city name!")
|
||||
return
|
||||
if get_value(search_line("hq_city:")) == hq:
|
||||
show_message(QMessageBox.Information, "Info", "Your headquarter is already in this city.")
|
||||
elif hq not in self.purchased_garages():
|
||||
show_message(QMessageBox.Critical, "Error", "You need a garage in \"{}\" to set headquarter.".format(hq))
|
||||
else:
|
||||
set_value(search_line("hq_city:"), hq)
|
||||
show_message(QMessageBox.Information, "Success", "Headquarter successfully set to \"{}\".".format(hq))
|
||||
|
||||
def check_cities(self):
|
||||
self.ui.headquarter_edit.setText(get_value(search_line("hq_city:")))
|
||||
self.ui.cities_text.clear()
|
||||
visited_cities = get_array_items(search_line("visited_cities:"))
|
||||
if not visited_cities:
|
||||
self.ui.cities_text.append("No cities visited yet.")
|
||||
return
|
||||
for city in visited_cities:
|
||||
self.ui.cities_text.append(city)
|
||||
self.ui.cities_text.scrollToAnchor(visited_cities[0])
|
||||
|
||||
def add_city(self):
|
||||
city = self.ui.city_edit.text().lower()
|
||||
if city is "":
|
||||
show_message(QMessageBox.Critical, "Error", "Enter city name!")
|
||||
return
|
||||
self.ui.city_edit.setText("")
|
||||
if city not in get_array_items(search_line("visited_cities:")):
|
||||
add_array_value(search_line("visited_cities:"), city)
|
||||
add_array_value(search_line("visited_cities_count:"), "1")
|
||||
show_message(QMessageBox.Information, "Success", "City \"{}\" successfully visited.".format(city))
|
||||
self.check_cities()
|
||||
else:
|
||||
show_message(QMessageBox.Critical, "Error", "You've already visited \"{}\".".format(city))
|
||||
|
||||
def add_all_cities(self):
|
||||
visited_cities = get_array_items(search_line("visited_cities:"))
|
||||
for city in self.all_cities():
|
||||
if city not in visited_cities:
|
||||
add_array_value(search_line("visited_cities:"), city)
|
||||
add_array_value(search_line("visited_cities_count:"), "1")
|
||||
show_message(QMessageBox.Information, "Success", "All cities successfully visited.")
|
||||
self.check_cities()
|
||||
|
||||
def check_dealers(self):
|
||||
self.ui.dealerships_text.clear()
|
||||
visited_dealers = get_array_items(search_line("unlocked_dealers:"))
|
||||
if not visited_dealers:
|
||||
self.ui.dealerships_text.append("No dealerships unlocked yet.")
|
||||
return
|
||||
for dealer in visited_dealers:
|
||||
self.ui.dealerships_text.append(dealer)
|
||||
self.ui.dealerships_text.scrollToAnchor(visited_dealers[0])
|
||||
|
||||
def add_all_dealers(self):
|
||||
all_cities = self.all_cities()
|
||||
visited_dealers = get_array_items(search_line("unlocked_dealers:"))
|
||||
for dealer in self.dealers:
|
||||
if dealer in all_cities and dealer not in visited_dealers:
|
||||
add_array_value(search_line("unlocked_dealers:"), dealer)
|
||||
show_message(QMessageBox.Information, "Success", "All dealerships unlocked.")
|
||||
self.check_dealers()
|
||||
|
||||
def check_agencies(self):
|
||||
self.ui.agencies_text.clear()
|
||||
visited_agencies = get_array_items(search_line("unlocked_recruitments:"))
|
||||
if not visited_agencies:
|
||||
self.ui.agencies_text.append("No recruitment agencies unlocked yet.")
|
||||
return
|
||||
for agency in visited_agencies:
|
||||
self.ui.agencies_text.append(agency)
|
||||
self.ui.agencies_text.scrollToAnchor(visited_agencies[0])
|
||||
|
||||
def add_all_agencies(self):
|
||||
all_cities = self.all_cities()
|
||||
visited_agencies = get_array_items(search_line("unlocked_recruitments:"))
|
||||
for agency in self.agencies:
|
||||
if agency in all_cities and agency not in visited_agencies:
|
||||
add_array_value(search_line("unlocked_recruitments:"), agency)
|
||||
show_message(QMessageBox.Information, "Success", "All recruitment agencies unlocked.")
|
||||
self.check_agencies()
|
||||
|
||||
def da_clicked(self):
|
||||
da_arr = self.da_array.get(self.sender())
|
||||
if da_arr is None:
|
||||
return
|
||||
edit, file_var, message_var = da_arr[0], da_arr[1], da_arr[2]
|
||||
city_element = edit.text().lower()
|
||||
if not city_element:
|
||||
show_message(QMessageBox.Critical, "Error", "Enter city name!")
|
||||
return
|
||||
edit.setText("")
|
||||
if city_element not in da_arr[3]:
|
||||
show_message(QMessageBox.Critical, "Error", "There is no {} in that city.".format(message_var.lower()))
|
||||
elif city_element in get_array_items(search_line(file_var)):
|
||||
show_message(QMessageBox.Information, "Info",
|
||||
"{} in \"{}\" is already unlocked.".format(message_var, city_element))
|
||||
else:
|
||||
add_array_value(search_line(file_var), city_element)
|
||||
show_message(QMessageBox.Information, "Success",
|
||||
"{} in \"{}\" successfully unlocked.".format(message_var, city_element))
|
||||
da_arr[4]()
|
||||
60
setup.py
Normal file
60
setup.py
Normal file
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from sys import platform
|
||||
from cx_Freeze import setup, Executable
|
||||
|
||||
base = None
|
||||
if platform == 'win32':
|
||||
base = 'Win32GUI'
|
||||
|
||||
executables = [
|
||||
Executable('init_main_program.py', targetName='SaveWizard.exe', base=base),
|
||||
Executable('init_config_editor.py', targetName='SaveWizard_Config_Editor.exe', base=base)
|
||||
]
|
||||
|
||||
excludes = ['html', 'pydoc_data', 'unittest', 'xml', 'pwd', 'shlex', 'platform', 'webbrowser', 'pydoc', 'tty',
|
||||
'inspect', 'doctest', 'plistlib', 'subprocess', 'bz2', '_strptime', 'dummy_threading']
|
||||
|
||||
includes = ['pkgutil', 'enum', 'queue', 'PyQt5.sip']
|
||||
|
||||
zip_include_packages = [
|
||||
# Stock modules
|
||||
'collections', 'encodings', 'importlib', 'json', 'hashlib', 'selectors', 'select', 'http', 'email', 'datetime',
|
||||
'calendar', 'urllib', 'posixpath', 'tempfile', 'shutil', 'copy', 'stringprep', 'socket', 'ast',
|
||||
# PyQt5
|
||||
'PyQt5',
|
||||
# Modules for parsing cfg's
|
||||
'requests', 'logging', 'certifi', 'chardet', 'idna', 'urllib3',
|
||||
# Self-written modules
|
||||
'parsing', 'choice', 'main', 'second', 'config_editor'
|
||||
]
|
||||
|
||||
include_files = [
|
||||
'dlls/imageformats',
|
||||
'dlls/platforms',
|
||||
'dlls/styles',
|
||||
'SII_Decrypt.exe',
|
||||
('configs/ats', 'configs/ats'),
|
||||
('configs/ets2', 'configs/ets2')
|
||||
]
|
||||
|
||||
options = {
|
||||
'build_exe': {
|
||||
'excludes': excludes,
|
||||
'includes': includes,
|
||||
'include_msvcr': True,
|
||||
'build_exe': 'prog_build',
|
||||
'include_files': include_files,
|
||||
'zip_include_packages': zip_include_packages,
|
||||
}
|
||||
}
|
||||
|
||||
setup(
|
||||
name='SaveWizard',
|
||||
version='1.3',
|
||||
description='For editing ETS2 sii files',
|
||||
executables=executables,
|
||||
options=options,
|
||||
requires=['PyQt5', 'requests'],
|
||||
)
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
python setup.py build
|
||||
@@ -1 +0,0 @@
|
||||
pyuic5 main_form.ui -o main_form.py
|
||||
@@ -1 +0,0 @@
|
||||
pyuic5 second_form.ui -o second_form.py
|
||||
108
src/funcs.py
108
src/funcs.py
@@ -1,108 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from PyQt5.QtWidgets import QMessageBox
|
||||
from re import search, match, sub
|
||||
|
||||
|
||||
class Functions:
|
||||
# TODO: My Functions
|
||||
@staticmethod
|
||||
def showMsgBox(title: str, text: str):
|
||||
box = QMessageBox()
|
||||
box.setWindowTitle(title)
|
||||
box.setText(text)
|
||||
box.exec_()
|
||||
return
|
||||
|
||||
# TODO: Default functions
|
||||
@staticmethod
|
||||
def getADR(value):
|
||||
bincode = bin(int(value))[2:]
|
||||
bincode = "0" * (6 - len(bincode)) + bincode
|
||||
r = []
|
||||
for i in bincode:
|
||||
r.append(i)
|
||||
return r
|
||||
|
||||
@staticmethod
|
||||
def searchline(lines, term, start=0, cancel=r"thisstringmustnotexist"):
|
||||
if search(term, lines[start]):
|
||||
return start
|
||||
start += 1
|
||||
while start <= len(lines) - 1:
|
||||
if search(term, lines[start]):
|
||||
return start
|
||||
if search(cancel, lines[start]):
|
||||
return None
|
||||
start += 1
|
||||
return None
|
||||
|
||||
def searchlineinunit(self, lines, term, unit):
|
||||
line = self.searchline(lines, " : " + unit + " {")
|
||||
return self.searchline(lines, term, start=line, cancel="}")
|
||||
|
||||
def searchalllines(self, lines, term):
|
||||
matches = []
|
||||
start = 0
|
||||
while self.searchline(lines, term, start=start + 1):
|
||||
start = self.searchline(lines, term, start=start + 1)
|
||||
matches.append(start)
|
||||
if matches is None:
|
||||
return None
|
||||
return matches
|
||||
|
||||
@staticmethod
|
||||
def getvalue(lines, line):
|
||||
return search(r": (.+)$", lines[line]).group(1)
|
||||
|
||||
@staticmethod
|
||||
def setvalue(lines, line, value):
|
||||
name = match(r"(.+):", lines[line]).group(1)
|
||||
lines[line] = name + ": " + value
|
||||
|
||||
@staticmethod
|
||||
def getunitname(lines, line):
|
||||
return search(r" : (.+) {$", lines[line]).group(1)
|
||||
|
||||
@staticmethod
|
||||
def getarraylength(lines, line):
|
||||
return int(search(r": ([0-9]+)$", lines[line]).group(1))
|
||||
|
||||
@staticmethod
|
||||
def getarrayvaluebyindex(lines, line, index):
|
||||
return search(r": (.+)$", lines[line + index + 1]).group(1)
|
||||
|
||||
def getarrayindexbyvalue(self, lines, line, value):
|
||||
count = 0
|
||||
for i in range(self.getarraylength(lines, line)):
|
||||
if self.getvalue(lines, line + count + 1) == value:
|
||||
return count
|
||||
count += 1
|
||||
return None
|
||||
|
||||
def getarrayitems(self, lines, line):
|
||||
items = []
|
||||
count = self.getarraylength(lines, line)
|
||||
for i in range(count):
|
||||
items.append(search(r": (.+)$", lines[line + i + 1]).group(1))
|
||||
if items is None:
|
||||
return None
|
||||
return items
|
||||
|
||||
def addarrayvalue(self, lines, line, value):
|
||||
count = self.getarraylength(lines, line)
|
||||
name = match(r"(.+):", lines[line]).group(1)
|
||||
lines[line] = name + ": " + str(count + 1)
|
||||
lines.insert(line + count + 1, name + "[" + str(count) + "]: " + value)
|
||||
|
||||
def removearrayvalue(self, lines, line, value):
|
||||
name = match(r"(.+):", lines[line]).group(1)
|
||||
del lines[line + 1 + self.getarrayindexbyvalue(lines, line, value)]
|
||||
lines[line] = name + ": " + str(self.getarraylength(lines, line) - 1)
|
||||
for i in range(self.getarraylength(lines, line)):
|
||||
lines[line + i + 1] = sub(r"\[[0-9]+\]", "[" + str(i) + "]", lines[line + i + 1])
|
||||
|
||||
def changearrayvalue(self, lines, line, index, value):
|
||||
line += index + 1
|
||||
self.setvalue(lines, line, value)
|
||||
270
src/main_form.py
270
src/main_form.py
@@ -1,270 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'main_form.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.6
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
class Ui_MainWindow(object):
|
||||
def setupUi(self, MainWindow):
|
||||
MainWindow.setObjectName("MainWindow")
|
||||
MainWindow.resize(380, 380)
|
||||
MainWindow.setMinimumSize(QtCore.QSize(380, 380))
|
||||
MainWindow.setMaximumSize(QtCore.QSize(380, 380))
|
||||
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||
self.centralwidget.setObjectName("centralwidget")
|
||||
self.apply = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.apply.setEnabled(False)
|
||||
self.apply.setGeometry(QtCore.QRect(220, 340, 151, 31))
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(12)
|
||||
self.apply.setFont(font)
|
||||
self.apply.setObjectName("apply")
|
||||
self.backup = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.backup.setEnabled(False)
|
||||
self.backup.setGeometry(QtCore.QRect(10, 340, 151, 31))
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(12)
|
||||
self.backup.setFont(font)
|
||||
self.backup.setObjectName("backup")
|
||||
self.path_button = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.path_button.setGeometry(QtCore.QRect(10, 10, 161, 31))
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(14)
|
||||
self.path_button.setFont(font)
|
||||
self.path_button.setObjectName("path_button")
|
||||
self.gridLayoutWidget = QtWidgets.QWidget(self.centralwidget)
|
||||
self.gridLayoutWidget.setGeometry(QtCore.QRect(10, 80, 361, 81))
|
||||
self.gridLayoutWidget.setObjectName("gridLayoutWidget")
|
||||
self.basic_inf_layout = QtWidgets.QGridLayout(self.gridLayoutWidget)
|
||||
self.basic_inf_layout.setContentsMargins(0, 0, 0, 0)
|
||||
self.basic_inf_layout.setObjectName("basic_inf_layout")
|
||||
self.money_lineedit = QtWidgets.QLineEdit(self.gridLayoutWidget)
|
||||
self.money_lineedit.setObjectName("money_lineedit")
|
||||
self.basic_inf_layout.addWidget(self.money_lineedit, 0, 1, 1, 1)
|
||||
self.money_dont_change = QtWidgets.QCheckBox(self.gridLayoutWidget)
|
||||
self.money_dont_change.setObjectName("money_dont_change")
|
||||
self.basic_inf_layout.addWidget(self.money_dont_change, 0, 2, 1, 1)
|
||||
self.xp_label = QtWidgets.QLabel(self.gridLayoutWidget)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(14)
|
||||
self.xp_label.setFont(font)
|
||||
self.xp_label.setObjectName("xp_label")
|
||||
self.basic_inf_layout.addWidget(self.xp_label, 1, 0, 1, 1)
|
||||
self.xp_lineedit = QtWidgets.QLineEdit(self.gridLayoutWidget)
|
||||
self.xp_lineedit.setObjectName("xp_lineedit")
|
||||
self.basic_inf_layout.addWidget(self.xp_lineedit, 1, 1, 1, 1)
|
||||
self.xp_dont_change = QtWidgets.QCheckBox(self.gridLayoutWidget)
|
||||
self.xp_dont_change.setObjectName("xp_dont_change")
|
||||
self.basic_inf_layout.addWidget(self.xp_dont_change, 1, 2, 1, 1)
|
||||
self.loan_limit_label = QtWidgets.QLabel(self.gridLayoutWidget)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(14)
|
||||
self.loan_limit_label.setFont(font)
|
||||
self.loan_limit_label.setObjectName("loan_limit_label")
|
||||
self.basic_inf_layout.addWidget(self.loan_limit_label, 2, 0, 1, 1)
|
||||
self.loan_limit_lineedit = QtWidgets.QLineEdit(self.gridLayoutWidget)
|
||||
self.loan_limit_lineedit.setObjectName("loan_limit_lineedit")
|
||||
self.basic_inf_layout.addWidget(self.loan_limit_lineedit, 2, 1, 1, 1)
|
||||
self.loan_limit_dont_change = QtWidgets.QCheckBox(self.gridLayoutWidget)
|
||||
self.loan_limit_dont_change.setObjectName("loan_limit_dont_change")
|
||||
self.basic_inf_layout.addWidget(self.loan_limit_dont_change, 2, 2, 1, 1)
|
||||
self.money_label = QtWidgets.QLabel(self.gridLayoutWidget)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(14)
|
||||
self.money_label.setFont(font)
|
||||
self.money_label.setObjectName("money_label")
|
||||
self.basic_inf_layout.addWidget(self.money_label, 0, 0, 1, 1)
|
||||
self.gridLayoutWidget_3 = QtWidgets.QWidget(self.centralwidget)
|
||||
self.gridLayoutWidget_3.setGeometry(QtCore.QRect(10, 168, 361, 161))
|
||||
self.gridLayoutWidget_3.setObjectName("gridLayoutWidget_3")
|
||||
self.skills_layout = QtWidgets.QGridLayout(self.gridLayoutWidget_3)
|
||||
self.skills_layout.setContentsMargins(0, 0, 0, 0)
|
||||
self.skills_layout.setObjectName("skills_layout")
|
||||
self.long_distance_lineedit = QtWidgets.QLineEdit(self.gridLayoutWidget_3)
|
||||
self.long_distance_lineedit.setObjectName("long_distance_lineedit")
|
||||
self.skills_layout.addWidget(self.long_distance_lineedit, 1, 1, 1, 1)
|
||||
self.urgent_delivery_label = QtWidgets.QLabel(self.gridLayoutWidget_3)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(13)
|
||||
self.urgent_delivery_label.setFont(font)
|
||||
self.urgent_delivery_label.setObjectName("urgent_delivery_label")
|
||||
self.skills_layout.addWidget(self.urgent_delivery_label, 4, 0, 1, 1)
|
||||
self.ecodriving_dont_change = QtWidgets.QCheckBox(self.gridLayoutWidget_3)
|
||||
self.ecodriving_dont_change.setObjectName("ecodriving_dont_change")
|
||||
self.skills_layout.addWidget(self.ecodriving_dont_change, 5, 2, 1, 1)
|
||||
self.adr_lineedit = QtWidgets.QLineEdit(self.gridLayoutWidget_3)
|
||||
self.adr_lineedit.setObjectName("adr_lineedit")
|
||||
self.skills_layout.addWidget(self.adr_lineedit, 0, 1, 1, 1)
|
||||
self.urgent_delivery_lineedit = QtWidgets.QLineEdit(self.gridLayoutWidget_3)
|
||||
self.urgent_delivery_lineedit.setObjectName("urgent_delivery_lineedit")
|
||||
self.skills_layout.addWidget(self.urgent_delivery_lineedit, 4, 1, 1, 1)
|
||||
self.fragile_cargo_dont_change = QtWidgets.QCheckBox(self.gridLayoutWidget_3)
|
||||
self.fragile_cargo_dont_change.setObjectName("fragile_cargo_dont_change")
|
||||
self.skills_layout.addWidget(self.fragile_cargo_dont_change, 3, 2, 1, 1)
|
||||
self.ecodriving_lineedit = QtWidgets.QLineEdit(self.gridLayoutWidget_3)
|
||||
self.ecodriving_lineedit.setObjectName("ecodriving_lineedit")
|
||||
self.skills_layout.addWidget(self.ecodriving_lineedit, 5, 1, 1, 1)
|
||||
self.high_value_cargo_dont_change = QtWidgets.QCheckBox(self.gridLayoutWidget_3)
|
||||
self.high_value_cargo_dont_change.setObjectName("high_value_cargo_dont_change")
|
||||
self.skills_layout.addWidget(self.high_value_cargo_dont_change, 2, 2, 1, 1)
|
||||
self.fragile_cargo_lineedit = QtWidgets.QLineEdit(self.gridLayoutWidget_3)
|
||||
self.fragile_cargo_lineedit.setObjectName("fragile_cargo_lineedit")
|
||||
self.skills_layout.addWidget(self.fragile_cargo_lineedit, 3, 1, 1, 1)
|
||||
self.adr_dont_change = QtWidgets.QCheckBox(self.gridLayoutWidget_3)
|
||||
self.adr_dont_change.setObjectName("adr_dont_change")
|
||||
self.skills_layout.addWidget(self.adr_dont_change, 0, 2, 1, 1)
|
||||
self.long_distance_dont_change = QtWidgets.QCheckBox(self.gridLayoutWidget_3)
|
||||
self.long_distance_dont_change.setObjectName("long_distance_dont_change")
|
||||
self.skills_layout.addWidget(self.long_distance_dont_change, 1, 2, 1, 1)
|
||||
self.high_value_cargo_lineedit = QtWidgets.QLineEdit(self.gridLayoutWidget_3)
|
||||
self.high_value_cargo_lineedit.setObjectName("high_value_cargo_lineedit")
|
||||
self.skills_layout.addWidget(self.high_value_cargo_lineedit, 2, 1, 1, 1)
|
||||
self.high_value_cargo_label = QtWidgets.QLabel(self.gridLayoutWidget_3)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(13)
|
||||
self.high_value_cargo_label.setFont(font)
|
||||
self.high_value_cargo_label.setObjectName("high_value_cargo_label")
|
||||
self.skills_layout.addWidget(self.high_value_cargo_label, 2, 0, 1, 1)
|
||||
self.fragile_cargo_label = QtWidgets.QLabel(self.gridLayoutWidget_3)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(13)
|
||||
self.fragile_cargo_label.setFont(font)
|
||||
self.fragile_cargo_label.setObjectName("fragile_cargo_label")
|
||||
self.skills_layout.addWidget(self.fragile_cargo_label, 3, 0, 1, 1)
|
||||
self.ecodriving_label = QtWidgets.QLabel(self.gridLayoutWidget_3)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(13)
|
||||
self.ecodriving_label.setFont(font)
|
||||
self.ecodriving_label.setObjectName("ecodriving_label")
|
||||
self.skills_layout.addWidget(self.ecodriving_label, 5, 0, 1, 1)
|
||||
self.urgent_delivery_dont_change = QtWidgets.QCheckBox(self.gridLayoutWidget_3)
|
||||
self.urgent_delivery_dont_change.setObjectName("urgent_delivery_dont_change")
|
||||
self.skills_layout.addWidget(self.urgent_delivery_dont_change, 4, 2, 1, 1)
|
||||
self.long_distance_label = QtWidgets.QLabel(self.gridLayoutWidget_3)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(13)
|
||||
self.long_distance_label.setFont(font)
|
||||
self.long_distance_label.setObjectName("long_distance_label")
|
||||
self.skills_layout.addWidget(self.long_distance_label, 1, 0, 1, 1)
|
||||
self.adr_label = QtWidgets.QLabel(self.gridLayoutWidget_3)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(13)
|
||||
self.adr_label.setFont(font)
|
||||
self.adr_label.setObjectName("adr_label")
|
||||
self.skills_layout.addWidget(self.adr_label, 0, 0, 1, 1)
|
||||
self.second_window = QtWidgets.QToolButton(self.centralwidget)
|
||||
self.second_window.setEnabled(False)
|
||||
self.second_window.setGeometry(QtCore.QRect(174, 348, 31, 21))
|
||||
self.second_window.setObjectName("second_window")
|
||||
self.owns_sc = QtWidgets.QCheckBox(self.centralwidget)
|
||||
self.owns_sc.setEnabled(False)
|
||||
self.owns_sc.setGeometry(QtCore.QRect(0, 50, 131, 16))
|
||||
palette = QtGui.QPalette()
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
|
||||
self.owns_sc.setPalette(palette)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(10)
|
||||
self.owns_sc.setFont(font)
|
||||
self.owns_sc.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||
self.owns_sc.setObjectName("owns_sc")
|
||||
self.owns_fr = QtWidgets.QCheckBox(self.centralwidget)
|
||||
self.owns_fr.setEnabled(False)
|
||||
self.owns_fr.setGeometry(QtCore.QRect(160, 50, 101, 16))
|
||||
palette = QtGui.QPalette()
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
|
||||
self.owns_fr.setPalette(palette)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(10)
|
||||
self.owns_fr.setFont(font)
|
||||
self.owns_fr.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||
self.owns_fr.setCheckable(True)
|
||||
self.owns_fr.setObjectName("owns_fr")
|
||||
self.owns_it = QtWidgets.QCheckBox(self.centralwidget)
|
||||
self.owns_it.setEnabled(False)
|
||||
self.owns_it.setGeometry(QtCore.QRect(280, 50, 91, 16))
|
||||
palette = QtGui.QPalette()
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
|
||||
brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
|
||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
||||
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
|
||||
self.owns_it.setPalette(palette)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(10)
|
||||
self.owns_it.setFont(font)
|
||||
self.owns_it.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||
self.owns_it.setCheckable(True)
|
||||
self.owns_it.setObjectName("owns_it")
|
||||
MainWindow.setCentralWidget(self.centralwidget)
|
||||
|
||||
self.retranslateUi(MainWindow)
|
||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||
|
||||
def retranslateUi(self, MainWindow):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
MainWindow.setWindowTitle(_translate("MainWindow", "SaveWizard"))
|
||||
self.apply.setText(_translate("MainWindow", "Apply changes"))
|
||||
self.backup.setText(_translate("MainWindow", "Recover backup"))
|
||||
self.path_button.setText(_translate("MainWindow", "Choose save file..."))
|
||||
self.money_dont_change.setText(_translate("MainWindow", "Don\'t change"))
|
||||
self.xp_label.setText(_translate("MainWindow", "Experience:"))
|
||||
self.xp_dont_change.setText(_translate("MainWindow", "Don\'t change"))
|
||||
self.loan_limit_label.setText(_translate("MainWindow", "Loan limit:"))
|
||||
self.loan_limit_dont_change.setText(_translate("MainWindow", "Don\'t change"))
|
||||
self.money_label.setText(_translate("MainWindow", "Money:"))
|
||||
self.urgent_delivery_label.setText(_translate("MainWindow", "Urgent delivery:"))
|
||||
self.ecodriving_dont_change.setText(_translate("MainWindow", "Don\'t change"))
|
||||
self.fragile_cargo_dont_change.setText(_translate("MainWindow", "Don\'t change"))
|
||||
self.high_value_cargo_dont_change.setText(_translate("MainWindow", "Don\'t change"))
|
||||
self.adr_dont_change.setText(_translate("MainWindow", "Don\'t change"))
|
||||
self.long_distance_dont_change.setText(_translate("MainWindow", "Don\'t change"))
|
||||
self.high_value_cargo_label.setText(_translate("MainWindow", "High value cargo:"))
|
||||
self.fragile_cargo_label.setText(_translate("MainWindow", "Fragile cargo:"))
|
||||
self.ecodriving_label.setText(_translate("MainWindow", "Ecodriving:"))
|
||||
self.urgent_delivery_dont_change.setText(_translate("MainWindow", "Don\'t change"))
|
||||
self.long_distance_label.setText(_translate("MainWindow", "Long distance:"))
|
||||
self.adr_label.setText(_translate("MainWindow", "ADR:"))
|
||||
self.second_window.setText(_translate("MainWindow", "..."))
|
||||
self.owns_sc.setText(_translate("MainWindow", "Owns Scandinavia?"))
|
||||
self.owns_fr.setText(_translate("MainWindow", "Owns France?"))
|
||||
self.owns_it.setText(_translate("MainWindow", "Owns Italia?"))
|
||||
|
||||
535
src/main_form.ui
535
src/main_form.ui
@@ -1,535 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>380</width>
|
||||
<height>380</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>380</width>
|
||||
<height>380</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>380</width>
|
||||
<height>380</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>SaveWizard</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<widget class="QPushButton" name="apply">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>220</x>
|
||||
<y>340</y>
|
||||
<width>151</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Apply changes</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="backup">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>340</y>
|
||||
<width>151</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Recover backup</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="path_button">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>161</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Choose save file...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="gridLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>80</y>
|
||||
<width>361</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="basic_inf_layout">
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="money_lineedit"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QCheckBox" name="money_dont_change">
|
||||
<property name="text">
|
||||
<string>Don't change</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="xp_label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Experience:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="xp_lineedit"/>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QCheckBox" name="xp_dont_change">
|
||||
<property name="text">
|
||||
<string>Don't change</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="loan_limit_label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Loan limit:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="loan_limit_lineedit"/>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QCheckBox" name="loan_limit_dont_change">
|
||||
<property name="text">
|
||||
<string>Don't change</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="money_label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Money:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="gridLayoutWidget_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>168</y>
|
||||
<width>361</width>
|
||||
<height>161</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="skills_layout">
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="long_distance_lineedit"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="urgent_delivery_label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>13</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Urgent delivery:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QCheckBox" name="ecodriving_dont_change">
|
||||
<property name="text">
|
||||
<string>Don't change</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="adr_lineedit"/>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="urgent_delivery_lineedit"/>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QCheckBox" name="fragile_cargo_dont_change">
|
||||
<property name="text">
|
||||
<string>Don't change</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="ecodriving_lineedit"/>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QCheckBox" name="high_value_cargo_dont_change">
|
||||
<property name="text">
|
||||
<string>Don't change</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="fragile_cargo_lineedit"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QCheckBox" name="adr_dont_change">
|
||||
<property name="text">
|
||||
<string>Don't change</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QCheckBox" name="long_distance_dont_change">
|
||||
<property name="text">
|
||||
<string>Don't change</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="high_value_cargo_lineedit"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="high_value_cargo_label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>13</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>High value cargo:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="fragile_cargo_label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>13</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fragile cargo:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="ecodriving_label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>13</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Ecodriving:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QCheckBox" name="urgent_delivery_dont_change">
|
||||
<property name="text">
|
||||
<string>Don't change</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="long_distance_label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>13</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Long distance:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="adr_label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>13</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>ADR:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="second_window">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>174</x>
|
||||
<y>348</y>
|
||||
<width>31</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="owns_sc">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>50</y>
|
||||
<width>131</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Owns Scandinavia?</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="owns_fr">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>50</y>
|
||||
<width>101</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Owns France?</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="owns_it">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>280</x>
|
||||
<y>50</y>
|
||||
<width>91</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Owns Italia?</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -1,279 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from PyQt5.QtWidgets import QMainWindow
|
||||
from funcs import *
|
||||
from main_form import *
|
||||
from wsgiref.validate import validator
|
||||
|
||||
|
||||
class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
# TODO: Constructor
|
||||
def __init__(self, parent=None):
|
||||
QMainWindow.__init__(self, parent)
|
||||
Ui_MainWindow.__init__(self)
|
||||
self.ui = Ui_MainWindow()
|
||||
self.ui.setupUi(self)
|
||||
self.funcs = Functions()
|
||||
#
|
||||
self.file_path = ""
|
||||
self.oldfile = ""
|
||||
self.lines = ""
|
||||
self.ownsSC = False
|
||||
self.ownsFR = False
|
||||
self.ownsIT = False
|
||||
self.ownsATS = False
|
||||
#
|
||||
self.ui.path_button.clicked.connect(self.openSave)
|
||||
self.ui.apply.clicked.connect(self.applyChanges)
|
||||
self.ui.backup.clicked.connect(self.recoverBackup)
|
||||
self.ui.second_window.clicked.connect(self.openSecondWin)
|
||||
#
|
||||
from PyQt5.QtCore import QRegExp
|
||||
from PyQt5.QtGui import QRegExpValidator
|
||||
rx_inf = QRegExp("[0-9]{1,9}")
|
||||
validator_inf = QRegExpValidator(rx_inf)
|
||||
self.ui.money_lineedit.setValidator(validator_inf)
|
||||
self.ui.xp_lineedit.setValidator(validator_inf)
|
||||
self.ui.loan_limit_lineedit.setValidator(validator_inf)
|
||||
#
|
||||
rx_skill = QRegExp("[0-6]{1,1}")
|
||||
validator_skill = QRegExpValidator(rx_skill)
|
||||
self.ui.long_distance_lineedit.setValidator(validator_skill)
|
||||
self.ui.high_value_cargo_lineedit.setValidator(validator_skill)
|
||||
self.ui.fragile_cargo_lineedit.setValidator(validator_skill)
|
||||
self.ui.urgent_delivery_lineedit.setValidator(validator_skill)
|
||||
self.ui.ecodriving_lineedit.setValidator(validator_skill)
|
||||
|
||||
# TODO: Custom functions
|
||||
def openSecondWin(self):
|
||||
from second_script import SecondWindow
|
||||
sec_win = SecondWindow(self.ownsSC, self.ownsFR, self.ownsIT, self.ownsATS, self.lines, self)
|
||||
sec_win.show()
|
||||
|
||||
def getADRfromLineedit(self):
|
||||
adr_list = list(self.ui.adr_lineedit.text())
|
||||
i = 0
|
||||
for x in adr_list:
|
||||
if (adr_list[i] == ",") or (adr_list[i] == ".") or (adr_list[i] == " "):
|
||||
del adr_list[i]
|
||||
i += 1
|
||||
else:
|
||||
i += 1
|
||||
return adr_list
|
||||
|
||||
def returnLines(self, lines):
|
||||
self.lines = lines
|
||||
return
|
||||
|
||||
# TODO: Program functions
|
||||
def openSave(self):
|
||||
from PyQt5.QtWidgets import QFileDialog
|
||||
file, _ = QFileDialog.getOpenFileName(parent=self,
|
||||
caption=self.tr("Choose your file..."),
|
||||
filter=self.tr("game.sii"), # ;;Save file (*.sii)
|
||||
initialFilter=self.tr("game.sii"))
|
||||
self.reopen_file()
|
||||
if file == "":
|
||||
return
|
||||
self.file_path = file
|
||||
self.checkSaveFile(self.file_path)
|
||||
|
||||
def checkSaveFile(self, file):
|
||||
try:
|
||||
with open(file, "r") as f:
|
||||
self.oldfile = f.read()
|
||||
except UnicodeDecodeError:
|
||||
try:
|
||||
from os import system
|
||||
system("SII_Decrypt.exe --on_file -i \"{}\"".format(file))
|
||||
with open(file, "r") as f:
|
||||
self.oldfile = f.read()
|
||||
self.funcs.showMsgBox("Success", "File successfully decrypted.")
|
||||
except UnicodeDecodeError:
|
||||
self.funcs.showMsgBox("Error", "Error to decrypt and open file. Try again.")
|
||||
return
|
||||
self.lines = self.oldfile.split("\n")
|
||||
for i in self.lines:
|
||||
if "company.volatile.sag_tre.oslo" in i:
|
||||
self.ownsSC = True
|
||||
self.ui.owns_sc.setChecked(True)
|
||||
if "company.volatile.lisette_log.roscoff" in i:
|
||||
self.ownsFR = True
|
||||
self.ui.owns_fr.setChecked(True)
|
||||
if "company.volatile.marina_it.ancona" in i:
|
||||
self.ownsIT = True
|
||||
self.ui.owns_it.setChecked(True)
|
||||
if "company.volatile.gal_oil_gst.oakland" in i:
|
||||
self.ownsATS = True
|
||||
self.checkAcc()
|
||||
self.ui.apply.setEnabled(True)
|
||||
self.ui.backup.setEnabled(True)
|
||||
self.ui.second_window.setEnabled(True)
|
||||
|
||||
def checkAcc(self):
|
||||
self.ui.money_lineedit.setText(str(self.funcs.getvalue(self.lines,
|
||||
self.funcs.searchline(self.lines, "money_account:"))))
|
||||
self.ui.xp_lineedit.setText(str(self.funcs.getvalue(self.lines,
|
||||
self.funcs.searchline(self.lines, "experience_points:"))))
|
||||
self.ui.loan_limit_lineedit.setText(str(self.funcs.getvalue(self.lines,
|
||||
self.funcs.searchline(self.lines, "loan_limit:"))))
|
||||
#
|
||||
adr = self.funcs.getADR(self.funcs.getvalue(self.lines, self.funcs.searchline(self.lines, "adr:")))
|
||||
adr_list = ""
|
||||
for i in range(6):
|
||||
if i != 5:
|
||||
elem = adr[i] + ","
|
||||
else:
|
||||
elem = adr[i]
|
||||
adr_list += elem
|
||||
self.ui.adr_lineedit.setText(adr_list)
|
||||
#
|
||||
self.ui.long_distance_lineedit.setText(str(self.funcs.getvalue(self.lines,
|
||||
self.funcs.searchline(self.lines, "long_dist:"))))
|
||||
self.ui.high_value_cargo_lineedit.setText(str(self.funcs.getvalue(self.lines,
|
||||
self.funcs.searchline(self.lines, "heavy:"))))
|
||||
self.ui.fragile_cargo_lineedit.setText(str(self.funcs.getvalue(self.lines,
|
||||
self.funcs.searchline(self.lines, "fragile:"))))
|
||||
self.ui.urgent_delivery_lineedit.setText(str(self.funcs.getvalue(self.lines,
|
||||
self.funcs.searchline(self.lines, "urgent:"))))
|
||||
self.ui.ecodriving_lineedit.setText(str(self.funcs.getvalue(self.lines,
|
||||
self.funcs.searchline(self.lines, "mechanical:"))))
|
||||
|
||||
def applyChanges(self):
|
||||
self.applyChanges_1()
|
||||
self.applyChanges_2()
|
||||
backup = self.file_path + ".swbak"
|
||||
with open(backup, "w") as f:
|
||||
f.write(self.oldfile)
|
||||
with open(self.file_path, "w") as f:
|
||||
f.write("\n".join(self.lines))
|
||||
self.funcs.showMsgBox("Success", "Changes successfully applied!")
|
||||
self.checkSaveFile(self.file_path)
|
||||
return
|
||||
|
||||
def applyChanges_1(self):
|
||||
if not self.ui.money_dont_change.isChecked():
|
||||
self.funcs.setvalue(self.lines,
|
||||
self.funcs.searchline(self.lines, "money_account:"),
|
||||
str(self.ui.money_lineedit.text()))
|
||||
#
|
||||
if not self.ui.xp_dont_change.isChecked():
|
||||
self.funcs.setvalue(self.lines,
|
||||
self.funcs.searchline(self.lines, "experience_points:"),
|
||||
str(self.ui.xp_lineedit.text()))
|
||||
#
|
||||
if not self.ui.loan_limit_dont_change.isChecked():
|
||||
self.funcs.setvalue(self.lines,
|
||||
self.funcs.searchline(self.lines, "loan_limit:"),
|
||||
str(self.ui.loan_limit_lineedit.text()))
|
||||
#
|
||||
self.ui.money_dont_change.setChecked(False)
|
||||
self.ui.xp_dont_change.setChecked(False)
|
||||
self.ui.loan_limit_dont_change.setChecked(False)
|
||||
|
||||
def applyChanges_2(self):
|
||||
if not self.ui.adr_dont_change.isChecked():
|
||||
adrset = self.getADRfromLineedit()
|
||||
if len(adrset) > 6:
|
||||
self.funcs.showMsgBox("Error", "ADR can't have more than 6 elements.")
|
||||
else:
|
||||
adrnew = int("".join(adrset), 2)
|
||||
self.funcs.setvalue(self.lines,
|
||||
self.funcs.searchline(self.lines, "adr:"),
|
||||
str(adrnew))
|
||||
#
|
||||
if not self.ui.long_distance_dont_change.isChecked():
|
||||
self.funcs.setvalue(self.lines,
|
||||
self.funcs.searchline(self.lines, "long_dist:"),
|
||||
str(self.ui.long_distance_lineedit.text()))
|
||||
#
|
||||
if not self.ui.high_value_cargo_dont_change.isChecked():
|
||||
self.funcs.setvalue(self.lines,
|
||||
self.funcs.searchline(self.lines, "heavy:"),
|
||||
str(self.ui.high_value_cargo_lineedit.text()))
|
||||
#
|
||||
if not self.ui.fragile_cargo_dont_change.isChecked():
|
||||
self.funcs.setvalue(self.lines,
|
||||
self.funcs.searchline(self.lines, "fragile:"),
|
||||
str(self.ui.fragile_cargo_lineedit.text()))
|
||||
#
|
||||
if not self.ui.urgent_delivery_dont_change.isChecked():
|
||||
self.funcs.setvalue(self.lines,
|
||||
self.funcs.searchline(self.lines, "urgent:"),
|
||||
str(self.ui.urgent_delivery_lineedit.text()))
|
||||
#
|
||||
if not self.ui.ecodriving_dont_change.isChecked():
|
||||
self.funcs.setvalue(self.lines,
|
||||
self.funcs.searchline(self.lines, "mechanical:"),
|
||||
str(self.ui.ecodriving_lineedit.text()))
|
||||
#
|
||||
self.ui.adr_dont_change.setChecked(False)
|
||||
self.ui.long_distance_dont_change.setChecked(False)
|
||||
self.ui.high_value_cargo_dont_change.setChecked(False)
|
||||
self.ui.fragile_cargo_dont_change.setChecked(False)
|
||||
self.ui.urgent_delivery_dont_change.setChecked(False)
|
||||
self.ui.ecodriving_dont_change.setChecked(False)
|
||||
|
||||
def recoverBackup(self):
|
||||
backup = self.file_path + ".swbak"
|
||||
try:
|
||||
f = open(backup, "r")
|
||||
with open(self.file_path, "w") as g:
|
||||
g.write(f.read())
|
||||
f.close()
|
||||
from os import remove
|
||||
remove(backup)
|
||||
self.funcs.showMsgBox("Success", "Backup successfully recovered.")
|
||||
self.checkSaveFile(self.file_path)
|
||||
return
|
||||
except:
|
||||
self.funcs.showMsgBox("Error", "Backup not found.")
|
||||
return
|
||||
|
||||
def reopen_file(self):
|
||||
self.file_path = ""
|
||||
self.oldfile = ""
|
||||
self.lines = ""
|
||||
#
|
||||
self.ownsSC = False
|
||||
self.ownsFR = False
|
||||
self.ownsIT = False
|
||||
self.ui.owns_sc.setChecked(False)
|
||||
self.ui.owns_fr.setChecked(False)
|
||||
self.ui.owns_it.setChecked(False)
|
||||
self.ownsATS = False
|
||||
#
|
||||
self.ui.money_lineedit.setText("")
|
||||
self.ui.money_dont_change.setChecked(False)
|
||||
self.ui.xp_lineedit.setText("")
|
||||
self.ui.xp_dont_change.setChecked(False)
|
||||
self.ui.loan_limit_lineedit.setText("")
|
||||
self.ui.loan_limit_dont_change.setChecked(False)
|
||||
#
|
||||
self.ui.adr_lineedit.setText("")
|
||||
self.ui.adr_dont_change.setChecked(False)
|
||||
self.ui.long_distance_lineedit.setText("")
|
||||
self.ui.long_distance_dont_change.setChecked(False)
|
||||
self.ui.high_value_cargo_lineedit.setText("")
|
||||
self.ui.high_value_cargo_dont_change.setChecked(False)
|
||||
self.ui.fragile_cargo_lineedit.setText("")
|
||||
self.ui.fragile_cargo_dont_change.setChecked(False)
|
||||
self.ui.urgent_delivery_lineedit.setText("")
|
||||
self.ui.urgent_delivery_dont_change.setChecked(False)
|
||||
self.ui.ecodriving_lineedit.setText("")
|
||||
self.ui.ecodriving_dont_change.setChecked(False)
|
||||
#
|
||||
self.ui.apply.setEnabled(False)
|
||||
self.ui.backup.setEnabled(False)
|
||||
self.ui.second_window.setEnabled(False)
|
||||
return
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
from sys import argv, exit
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
app = QApplication(argv)
|
||||
win = MainWindow()
|
||||
win.show()
|
||||
exit(app.exec_())
|
||||
@@ -1,304 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'second_form.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.6
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
class Ui_SecondWindow(object):
|
||||
def setupUi(self, SecondWindow):
|
||||
SecondWindow.setObjectName("SecondWindow")
|
||||
SecondWindow.setMinimumSize(QtCore.QSize(660, 400))
|
||||
SecondWindow.setMaximumSize(QtCore.QSize(660, 400))
|
||||
self.gridLayoutWidget_4 = QtWidgets.QWidget(SecondWindow)
|
||||
self.gridLayoutWidget_4.setGeometry(QtCore.QRect(10, 10, 131, 191))
|
||||
self.gridLayoutWidget_4.setObjectName("gridLayoutWidget_4")
|
||||
self.garages_layout = QtWidgets.QGridLayout(self.gridLayoutWidget_4)
|
||||
self.garages_layout.setContentsMargins(0, 0, 0, 0)
|
||||
self.garages_layout.setObjectName("garages_layout")
|
||||
self.garages_text = QtWidgets.QTextBrowser(self.gridLayoutWidget_4)
|
||||
self.garages_text.setOpenLinks(False)
|
||||
self.garages_text.setObjectName("garages_text")
|
||||
self.garages_layout.addWidget(self.garages_text, 1, 0, 1, 1)
|
||||
self.garages_label = QtWidgets.QLabel(self.gridLayoutWidget_4)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(14)
|
||||
self.garages_label.setFont(font)
|
||||
self.garages_label.setObjectName("garages_label")
|
||||
self.garages_layout.addWidget(self.garages_label, 0, 0, 1, 1)
|
||||
self.garages_analyze = QtWidgets.QPushButton(self.gridLayoutWidget_4)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(10)
|
||||
self.garages_analyze.setFont(font)
|
||||
self.garages_analyze.setObjectName("garages_analyze")
|
||||
self.garages_layout.addWidget(self.garages_analyze, 2, 0, 1, 1)
|
||||
self.gridLayoutWidget_5 = QtWidgets.QWidget(SecondWindow)
|
||||
self.gridLayoutWidget_5.setGeometry(QtCore.QRect(340, 10, 131, 191))
|
||||
self.gridLayoutWidget_5.setObjectName("gridLayoutWidget_5")
|
||||
self.cities_layout = QtWidgets.QGridLayout(self.gridLayoutWidget_5)
|
||||
self.cities_layout.setContentsMargins(0, 0, 0, 0)
|
||||
self.cities_layout.setObjectName("cities_layout")
|
||||
self.cities_text = QtWidgets.QTextBrowser(self.gridLayoutWidget_5)
|
||||
self.cities_text.setOpenLinks(False)
|
||||
self.cities_text.setObjectName("cities_text")
|
||||
self.cities_layout.addWidget(self.cities_text, 1, 0, 1, 1)
|
||||
self.cities_analyze = QtWidgets.QPushButton(self.gridLayoutWidget_5)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(10)
|
||||
self.cities_analyze.setFont(font)
|
||||
self.cities_analyze.setObjectName("cities_analyze")
|
||||
self.cities_layout.addWidget(self.cities_analyze, 2, 0, 1, 1)
|
||||
self.cities_visited_label = QtWidgets.QLabel(self.gridLayoutWidget_5)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(14)
|
||||
self.cities_visited_label.setFont(font)
|
||||
self.cities_visited_label.setObjectName("cities_visited_label")
|
||||
self.cities_layout.addWidget(self.cities_visited_label, 0, 0, 1, 1)
|
||||
self.gridLayoutWidget_2 = QtWidgets.QWidget(SecondWindow)
|
||||
self.gridLayoutWidget_2.setGeometry(QtCore.QRect(10, 220, 131, 171))
|
||||
self.gridLayoutWidget_2.setObjectName("gridLayoutWidget_2")
|
||||
self.dealerships_layout = QtWidgets.QGridLayout(self.gridLayoutWidget_2)
|
||||
self.dealerships_layout.setContentsMargins(0, 0, 0, 0)
|
||||
self.dealerships_layout.setObjectName("dealerships_layout")
|
||||
self.dealerships_label = QtWidgets.QLabel(self.gridLayoutWidget_2)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(14)
|
||||
self.dealerships_label.setFont(font)
|
||||
self.dealerships_label.setObjectName("dealerships_label")
|
||||
self.dealerships_layout.addWidget(self.dealerships_label, 0, 0, 1, 1)
|
||||
self.dealerships_text = QtWidgets.QTextBrowser(self.gridLayoutWidget_2)
|
||||
self.dealerships_text.setObjectName("dealerships_text")
|
||||
self.dealerships_layout.addWidget(self.dealerships_text, 1, 0, 1, 1)
|
||||
self.dealerships_analyze = QtWidgets.QPushButton(self.gridLayoutWidget_2)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(10)
|
||||
self.dealerships_analyze.setFont(font)
|
||||
self.dealerships_analyze.setObjectName("dealerships_analyze")
|
||||
self.dealerships_layout.addWidget(self.dealerships_analyze, 2, 0, 1, 1)
|
||||
self.gridLayoutWidget_6 = QtWidgets.QWidget(SecondWindow)
|
||||
self.gridLayoutWidget_6.setGeometry(QtCore.QRect(340, 220, 131, 171))
|
||||
self.gridLayoutWidget_6.setObjectName("gridLayoutWidget_6")
|
||||
self.agencies_layout = QtWidgets.QGridLayout(self.gridLayoutWidget_6)
|
||||
self.agencies_layout.setContentsMargins(0, 0, 0, 0)
|
||||
self.agencies_layout.setObjectName("agencies_layout")
|
||||
self.agencies_label = QtWidgets.QLabel(self.gridLayoutWidget_6)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(14)
|
||||
self.agencies_label.setFont(font)
|
||||
self.agencies_label.setObjectName("agencies_label")
|
||||
self.agencies_layout.addWidget(self.agencies_label, 0, 0, 1, 1)
|
||||
self.agencies_text = QtWidgets.QTextBrowser(self.gridLayoutWidget_6)
|
||||
self.agencies_text.setObjectName("agencies_text")
|
||||
self.agencies_layout.addWidget(self.agencies_text, 1, 0, 1, 1)
|
||||
self.agencies_analyze = QtWidgets.QPushButton(self.gridLayoutWidget_6)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(10)
|
||||
self.agencies_analyze.setFont(font)
|
||||
self.agencies_analyze.setObjectName("agencies_analyze")
|
||||
self.agencies_layout.addWidget(self.agencies_analyze, 2, 0, 1, 1)
|
||||
self.v_line = QtWidgets.QFrame(SecondWindow)
|
||||
self.v_line.setGeometry(QtCore.QRect(320, 10, 20, 381))
|
||||
self.v_line.setFrameShape(QtWidgets.QFrame.VLine)
|
||||
self.v_line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||
self.v_line.setObjectName("v_line")
|
||||
self.h_line = QtWidgets.QFrame(SecondWindow)
|
||||
self.h_line.setGeometry(QtCore.QRect(10, 200, 641, 16))
|
||||
self.h_line.setFrameShape(QtWidgets.QFrame.HLine)
|
||||
self.h_line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||
self.h_line.setObjectName("h_line")
|
||||
self.gridLayoutWidget = QtWidgets.QWidget(SecondWindow)
|
||||
self.gridLayoutWidget.setGeometry(QtCore.QRect(150, 10, 171, 107))
|
||||
self.gridLayoutWidget.setObjectName("gridLayoutWidget")
|
||||
self.add_garage = QtWidgets.QGridLayout(self.gridLayoutWidget)
|
||||
self.add_garage.setContentsMargins(0, 0, 0, 0)
|
||||
self.add_garage.setObjectName("add_garage")
|
||||
self.garage_add = QtWidgets.QPushButton(self.gridLayoutWidget)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(10)
|
||||
self.garage_add.setFont(font)
|
||||
self.garage_add.setObjectName("garage_add")
|
||||
self.add_garage.addWidget(self.garage_add, 2, 0, 1, 1)
|
||||
self.garage_lineedit = QtWidgets.QLineEdit(self.gridLayoutWidget)
|
||||
self.garage_lineedit.setObjectName("garage_lineedit")
|
||||
self.add_garage.addWidget(self.garage_lineedit, 1, 0, 1, 1)
|
||||
self.garage_unlock_all = QtWidgets.QPushButton(self.gridLayoutWidget)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(10)
|
||||
self.garage_unlock_all.setFont(font)
|
||||
self.garage_unlock_all.setObjectName("garage_unlock_all")
|
||||
self.add_garage.addWidget(self.garage_unlock_all, 3, 0, 1, 1)
|
||||
self.garage_label = QtWidgets.QLabel(self.gridLayoutWidget)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(14)
|
||||
self.garage_label.setFont(font)
|
||||
self.garage_label.setObjectName("garage_label")
|
||||
self.add_garage.addWidget(self.garage_label, 0, 0, 1, 1)
|
||||
self.gridLayoutWidget_3 = QtWidgets.QWidget(SecondWindow)
|
||||
self.gridLayoutWidget_3.setGeometry(QtCore.QRect(480, 50, 171, 107))
|
||||
self.gridLayoutWidget_3.setObjectName("gridLayoutWidget_3")
|
||||
self.add_city = QtWidgets.QGridLayout(self.gridLayoutWidget_3)
|
||||
self.add_city.setContentsMargins(0, 0, 0, 0)
|
||||
self.add_city.setObjectName("add_city")
|
||||
self.city_add = QtWidgets.QPushButton(self.gridLayoutWidget_3)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(10)
|
||||
self.city_add.setFont(font)
|
||||
self.city_add.setObjectName("city_add")
|
||||
self.add_city.addWidget(self.city_add, 2, 0, 1, 1)
|
||||
self.city_lineedit = QtWidgets.QLineEdit(self.gridLayoutWidget_3)
|
||||
self.city_lineedit.setObjectName("city_lineedit")
|
||||
self.add_city.addWidget(self.city_lineedit, 1, 0, 1, 1)
|
||||
self.city_label = QtWidgets.QLabel(self.gridLayoutWidget_3)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(14)
|
||||
self.city_label.setFont(font)
|
||||
self.city_label.setObjectName("city_label")
|
||||
self.add_city.addWidget(self.city_label, 0, 0, 1, 1)
|
||||
self.city_unlock_all = QtWidgets.QPushButton(self.gridLayoutWidget_3)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(10)
|
||||
self.city_unlock_all.setFont(font)
|
||||
self.city_unlock_all.setObjectName("city_unlock_all")
|
||||
self.add_city.addWidget(self.city_unlock_all, 3, 0, 1, 1)
|
||||
self.gridLayoutWidget_7 = QtWidgets.QWidget(SecondWindow)
|
||||
self.gridLayoutWidget_7.setGeometry(QtCore.QRect(150, 250, 171, 107))
|
||||
self.gridLayoutWidget_7.setObjectName("gridLayoutWidget_7")
|
||||
self.add_dealership = QtWidgets.QGridLayout(self.gridLayoutWidget_7)
|
||||
self.add_dealership.setContentsMargins(0, 0, 0, 0)
|
||||
self.add_dealership.setObjectName("add_dealership")
|
||||
self.dealership_add = QtWidgets.QPushButton(self.gridLayoutWidget_7)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(10)
|
||||
self.dealership_add.setFont(font)
|
||||
self.dealership_add.setObjectName("dealership_add")
|
||||
self.add_dealership.addWidget(self.dealership_add, 2, 0, 1, 1)
|
||||
self.dealership_lineedit = QtWidgets.QLineEdit(self.gridLayoutWidget_7)
|
||||
self.dealership_lineedit.setObjectName("dealership_lineedit")
|
||||
self.add_dealership.addWidget(self.dealership_lineedit, 1, 0, 1, 1)
|
||||
self.dealership_label = QtWidgets.QLabel(self.gridLayoutWidget_7)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(14)
|
||||
self.dealership_label.setFont(font)
|
||||
self.dealership_label.setObjectName("dealership_label")
|
||||
self.add_dealership.addWidget(self.dealership_label, 0, 0, 1, 1)
|
||||
self.dealership_unlock_all = QtWidgets.QPushButton(self.gridLayoutWidget_7)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(10)
|
||||
self.dealership_unlock_all.setFont(font)
|
||||
self.dealership_unlock_all.setObjectName("dealership_unlock_all")
|
||||
self.add_dealership.addWidget(self.dealership_unlock_all, 3, 0, 1, 1)
|
||||
self.gridLayoutWidget_8 = QtWidgets.QWidget(SecondWindow)
|
||||
self.gridLayoutWidget_8.setGeometry(QtCore.QRect(480, 250, 171, 107))
|
||||
self.gridLayoutWidget_8.setObjectName("gridLayoutWidget_8")
|
||||
self.add_agency = QtWidgets.QGridLayout(self.gridLayoutWidget_8)
|
||||
self.add_agency.setContentsMargins(0, 0, 0, 0)
|
||||
self.add_agency.setObjectName("add_agency")
|
||||
self.agency_add = QtWidgets.QPushButton(self.gridLayoutWidget_8)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(10)
|
||||
self.agency_add.setFont(font)
|
||||
self.agency_add.setObjectName("agency_add")
|
||||
self.add_agency.addWidget(self.agency_add, 2, 0, 1, 1)
|
||||
self.agency_lineedit = QtWidgets.QLineEdit(self.gridLayoutWidget_8)
|
||||
self.agency_lineedit.setObjectName("agency_lineedit")
|
||||
self.add_agency.addWidget(self.agency_lineedit, 1, 0, 1, 1)
|
||||
self.agency_label = QtWidgets.QLabel(self.gridLayoutWidget_8)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(14)
|
||||
self.agency_label.setFont(font)
|
||||
self.agency_label.setObjectName("agency_label")
|
||||
self.add_agency.addWidget(self.agency_label, 0, 0, 1, 1)
|
||||
self.agency_unlock_all = QtWidgets.QPushButton(self.gridLayoutWidget_8)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(10)
|
||||
self.agency_unlock_all.setFont(font)
|
||||
self.agency_unlock_all.setObjectName("agency_unlock_all")
|
||||
self.add_agency.addWidget(self.agency_unlock_all, 3, 0, 1, 1)
|
||||
self.gridLayoutWidget_9 = QtWidgets.QWidget(SecondWindow)
|
||||
self.gridLayoutWidget_9.setGeometry(QtCore.QRect(150, 120, 171, 80))
|
||||
self.gridLayoutWidget_9.setObjectName("gridLayoutWidget_9")
|
||||
self.headquarter_layout = QtWidgets.QGridLayout(self.gridLayoutWidget_9)
|
||||
self.headquarter_layout.setContentsMargins(0, 0, 0, 0)
|
||||
self.headquarter_layout.setObjectName("headquarter_layout")
|
||||
self.headquarter_label = QtWidgets.QLabel(self.gridLayoutWidget_9)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(14)
|
||||
self.headquarter_label.setFont(font)
|
||||
self.headquarter_label.setObjectName("headquarter_label")
|
||||
self.headquarter_layout.addWidget(self.headquarter_label, 0, 0, 1, 1)
|
||||
self.headquarter_lineedit = QtWidgets.QLineEdit(self.gridLayoutWidget_9)
|
||||
self.headquarter_lineedit.setObjectName("headquarter_lineedit")
|
||||
self.headquarter_layout.addWidget(self.headquarter_lineedit, 1, 0, 1, 1)
|
||||
self.headquarter_change = QtWidgets.QPushButton(self.gridLayoutWidget_9)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Times New Roman")
|
||||
font.setPointSize(10)
|
||||
self.headquarter_change.setFont(font)
|
||||
self.headquarter_change.setObjectName("headquarter_change")
|
||||
self.headquarter_layout.addWidget(self.headquarter_change, 2, 0, 1, 1)
|
||||
self.gridLayoutWidget_4.raise_()
|
||||
self.gridLayoutWidget_5.raise_()
|
||||
self.gridLayoutWidget_2.raise_()
|
||||
self.gridLayoutWidget_6.raise_()
|
||||
self.v_line.raise_()
|
||||
self.h_line.raise_()
|
||||
self.gridLayoutWidget.raise_()
|
||||
self.gridLayoutWidget_3.raise_()
|
||||
self.gridLayoutWidget_7.raise_()
|
||||
self.gridLayoutWidget_8.raise_()
|
||||
self.garage_label.raise_()
|
||||
self.gridLayoutWidget_9.raise_()
|
||||
|
||||
self.retranslateUi(SecondWindow)
|
||||
QtCore.QMetaObject.connectSlotsByName(SecondWindow)
|
||||
|
||||
def retranslateUi(self, SecondWindow):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
SecondWindow.setWindowTitle(_translate("SecondWindow", "Edit garages, cities and etc..."))
|
||||
self.garages_label.setText(_translate("SecondWindow", "Owned garages:"))
|
||||
self.garages_analyze.setText(_translate("SecondWindow", "Analyze"))
|
||||
self.cities_analyze.setText(_translate("SecondWindow", "Analyze"))
|
||||
self.cities_visited_label.setText(_translate("SecondWindow", "Visited cities:"))
|
||||
self.dealerships_label.setText(_translate("SecondWindow", "Dealerships:"))
|
||||
self.dealerships_analyze.setText(_translate("SecondWindow", "Analyze"))
|
||||
self.agencies_label.setText(_translate("SecondWindow", "Agencies:"))
|
||||
self.agencies_analyze.setText(_translate("SecondWindow", "Analyze"))
|
||||
self.garage_add.setText(_translate("SecondWindow", "Add"))
|
||||
self.garage_unlock_all.setText(_translate("SecondWindow", "Unlock all"))
|
||||
self.garage_label.setText(_translate("SecondWindow", "Enter garage name:"))
|
||||
self.city_add.setText(_translate("SecondWindow", "Add"))
|
||||
self.city_label.setText(_translate("SecondWindow", "Enter city name:"))
|
||||
self.city_unlock_all.setText(_translate("SecondWindow", "Visit all"))
|
||||
self.dealership_add.setText(_translate("SecondWindow", "Add"))
|
||||
self.dealership_label.setText(_translate("SecondWindow", "Enter dealership name:"))
|
||||
self.dealership_unlock_all.setText(_translate("SecondWindow", "Unlock all"))
|
||||
self.agency_add.setText(_translate("SecondWindow", "Add"))
|
||||
self.agency_label.setText(_translate("SecondWindow", "Enter agency name:"))
|
||||
self.agency_unlock_all.setText(_translate("SecondWindow", "Unlock all"))
|
||||
self.headquarter_label.setText(_translate("SecondWindow", "Your headquarter:"))
|
||||
self.headquarter_change.setText(_translate("SecondWindow", "Change"))
|
||||
|
||||
@@ -1,294 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from funcs import *
|
||||
from second_form import *
|
||||
from PyQt5.QtWidgets import QDialog
|
||||
|
||||
|
||||
class SecondWindow(QDialog, Ui_SecondWindow):
|
||||
# TODO: Constructor
|
||||
def __init__(self, ownsSC, ownsFR, ownsIT, ownsATS, lines, parent=None):
|
||||
QDialog.__init__(self, parent)
|
||||
Ui_SecondWindow.__init__(self)
|
||||
self.ui = Ui_SecondWindow()
|
||||
self.ui.setupUi(self)
|
||||
#
|
||||
self.funcs = Functions()
|
||||
self.lines = lines
|
||||
self.ownsSC = ownsSC
|
||||
self.ownsFR = ownsFR
|
||||
self.ownsIT = ownsIT
|
||||
self.ownsATS = ownsATS
|
||||
#
|
||||
self.dealersets2 = ["aberdeen", "amsterdam", "berlin", "bern", "birmingham", "bratislava", "bremen", "brussel",
|
||||
"budapest", "calais", "cardiff", "dortmund", "dortmund", "dresden", "dusseldorf", "edinburgh",
|
||||
"felixstowe", "frankfurt", "gdansk", "glasgow", "graz", "grimsby", "hamburg", "hannover", "krakow",
|
||||
"leipzig", "lille", "london", "luxembourg", "manchester", "munchen", "newcastle", "nurnberg",
|
||||
"osnabruck", "plymouth", "prague", "rostock", "rotterdam", "salzburg", "strasbourg", "stuttgart",
|
||||
"szczecin", "szeged", "warszawa", "wien", "wroclaw", "zurich"] # Default dealers
|
||||
self.dealersets2_sc = ["bergen", "goteborg", "kalmar", "kobenhavn", "linkoping", "oslo", "stockholm"] # SC dealers
|
||||
self.dealersets2_fr = ["bordeaux", "bourges", "brest", "geneve", "lemans", "limoges", "lyon", "marseille", "nantes",
|
||||
"paris", "toulouse"] # FR dealers
|
||||
self.dealersets2_it = ["bologna", "catania", "firenze", "milano", "napoli", "palermo", "roma", "taranto", "torino",
|
||||
"verona"] # IT dealers
|
||||
#
|
||||
self.agenciesets2 = ["aberdeen", "berlin", "bialystok", "birmingham", "bremen", "brno",
|
||||
"brussel", "budapest", "calais", "debrecen", "dortmund", "dover", "dresden", "edinburgh",
|
||||
"frankfurt", "gdansk", "glasgow", "graz", "grohningen", "hamburg", "hannover", "innsbruck", "kassel",
|
||||
"klagenfurt", "koln", "kosice", "krakow", "leipzig", "liege", "linz", "liverpool", "lodz", "london",
|
||||
"luxembourg", "manchester", "mannheim", "munchen", "newcastle", "nurnberg", "ostrava", "pecs",
|
||||
"plymouth", "poznan", "prague", "sheffield", "southampton", "stuttgart", "swansea", "szczecin",
|
||||
"szeged", "warszava", "wien", "zurich"] # Default agnecies
|
||||
self.agenciesets2_sc = ["aalborg", "bergen", "helsingborg", "kobenhavn", "malmo", "odense", "oslo", "stavanger",
|
||||
"stockholm"] # SC agencies
|
||||
self.agenciesets2_fr = ["bordeaux", "clermont", "geneve", "larochelle", "lyon", "marseille", "metz", "paris", "reims",
|
||||
"rennes", "toulouse"] # FR agencies
|
||||
self.agenciesets2_it = ["bologna", "catania", "milano", "napoli", "pescara", "roma", "taranto", "venezia"] # IT agencies
|
||||
#
|
||||
self.dealersats = ["elko", "reno", "bakersfield", "phoenix", "flagstaff", "los_angeles", "albuquerque", "hobbs"]
|
||||
self.agenciesats = ["redding", "san_rafael", "stockton", "fresno", "santa_cruz", "bakersfield", "oxnard",
|
||||
"los_angeles", "san_diego", "carson_city", "las_vegas", "phoenix", "tucson", "sierra_vista",
|
||||
"farmington", "santa_fe", "roswell", "carlsbad_nm"]
|
||||
#
|
||||
self.ui.garages_analyze.clicked.connect(self.checkGarages)
|
||||
self.ui.garage_add.clicked.connect(self.addGarage)
|
||||
self.ui.garage_unlock_all.clicked.connect(self.addAllGarages)
|
||||
self.ui.headquarter_change.clicked.connect(self.changeHQ)
|
||||
self.ui.cities_analyze.clicked.connect(self.checkCities)
|
||||
self.ui.city_add.clicked.connect(self.addCity)
|
||||
self.ui.city_unlock_all.clicked.connect(self.addAllCities)
|
||||
self.ui.dealerships_analyze.clicked.connect(self.checkDealers)
|
||||
self.ui.dealership_add.clicked.connect(self.addDealership)
|
||||
self.ui.dealership_unlock_all.clicked.connect(self.addAllDealership)
|
||||
self.ui.agencies_analyze.clicked.connect(self.checkAgencies)
|
||||
self.ui.agency_add.clicked.connect(self.addAgency)
|
||||
self.ui.agency_unlock_all.clicked.connect(self.addAllAgency)
|
||||
|
||||
# TODO: Default functions
|
||||
def purchasedgarages(self):
|
||||
purchased_garages = []
|
||||
i = 0
|
||||
try:
|
||||
while True:
|
||||
while "garage : " not in self.lines[i]:
|
||||
i += 1
|
||||
city = match(r"garage : garage.(.+) {$", self.lines[i]).group(1)
|
||||
while "status:" not in self.lines[i]:
|
||||
i += 1
|
||||
if "0" not in self.lines[i]:
|
||||
purchased_garages.append(city)
|
||||
except:
|
||||
pass
|
||||
return purchased_garages
|
||||
|
||||
def cities(self):
|
||||
cities = []
|
||||
line = self.funcs.searchline(self.lines, "companies\[")
|
||||
while "companies[" in self.lines[line]:
|
||||
city = match(r" companies\[[0-9]+\]: company.volatile.[a-z0-9_]+[.]([a-z_]+)", self.lines[line]).group(1)
|
||||
if city not in cities:
|
||||
cities.append(city)
|
||||
line += 1
|
||||
return cities
|
||||
|
||||
# TODO: Program functions
|
||||
def checkGarages(self):
|
||||
self.ui.garages_text.clear()
|
||||
for e in self.purchasedgarages():
|
||||
self.ui.garages_text.append(e)
|
||||
hq = self.funcs.getvalue(self.lines, self.funcs.searchline(self.lines, "hq_city:"))
|
||||
self.ui.headquarter_lineedit.setText(hq)
|
||||
|
||||
def checkCities(self):
|
||||
self.ui.cities_text.clear()
|
||||
for i in self.funcs.getarrayitems(self.lines,
|
||||
self.funcs.searchline(self.lines, "visited_cities:")):
|
||||
self.ui.cities_text.append(i)
|
||||
if not self.funcs.getarrayitems(self.lines,
|
||||
self.funcs.searchline(self.lines, "visited_cities:")):
|
||||
self.ui.cities_text.append("No cities visited yet.")
|
||||
|
||||
def checkDealers(self):
|
||||
if self.ownsSC:
|
||||
self.dealersets2 += self.dealersets2_sc
|
||||
if self.ownsFR:
|
||||
self.dealersets2 += self.dealersets2_fr
|
||||
if self.ownsIT:
|
||||
self.dealersets2 += self.dealersets2_it
|
||||
self.ui.dealerships_text.clear()
|
||||
for i in self.funcs.getarrayitems(self.lines,
|
||||
self.funcs.searchline(self.lines, "unlocked_dealers:")):
|
||||
self.ui.dealerships_text.append(i)
|
||||
if not self.funcs.getarrayitems(self.lines,
|
||||
self.funcs.searchline(self.lines, "unlocked_dealers:")):
|
||||
self.ui.dealerships_text.append("No dealerships unlocked yet.")
|
||||
|
||||
def checkAgencies(self):
|
||||
if self.ownsSC:
|
||||
self.agenciesets2 += self.agenciesets2_sc
|
||||
if self.ownsFR:
|
||||
self.agenciesets2 += self.agenciesets2_fr
|
||||
if self.ownsIT:
|
||||
self.agenciesets2 += self.agenciesets2_it
|
||||
self.ui.agencies_text.clear()
|
||||
for i in self.funcs.getarrayitems(self.lines,
|
||||
self.funcs.searchline(self.lines, "unlocked_recruitments:")):
|
||||
self.ui.agencies_text.append(i)
|
||||
if not self.funcs.getarrayitems(self.lines,
|
||||
self.funcs.searchline(self.lines, "unlocked_recruitments:")):
|
||||
self.ui.agencies_text.append("No recruitment agencies unlocked yet.")
|
||||
|
||||
def addGarage(self):
|
||||
garage = str(self.ui.garage_lineedit.text()).lower()
|
||||
self.ui.garage_lineedit.setText("")
|
||||
if int(self.funcs.getvalue(self.lines,
|
||||
self.funcs.searchlineinunit(self.lines, "status:", "garage." + garage))) != 0:
|
||||
self.funcs.showMsgBox("Error", "Garage in \"{}\" already unlocked".format(garage))
|
||||
else:
|
||||
self.funcs.setvalue(self.lines,
|
||||
self.funcs.searchlineinunit(self.lines, "status:", "garage." + garage),
|
||||
"6")
|
||||
self.funcs.addarrayvalue(self.lines,
|
||||
self.funcs.searchlineinunit(self.lines, "vehicles:", "garage." + garage),
|
||||
"null")
|
||||
self.funcs.addarrayvalue(self.lines,
|
||||
self.funcs.searchlineinunit(self.lines, "drivers:", "garage." + garage),
|
||||
"null")
|
||||
self.funcs.showMsgBox("Success", "Garage in \"{}\" successfully unlocked.".format(garage))
|
||||
self.checkGarages()
|
||||
|
||||
def addAllGarages(self):
|
||||
line = 0
|
||||
try:
|
||||
while True:
|
||||
line = self.funcs.searchline(self.lines, "garage : garage.", start=line)
|
||||
if int(self.funcs.getvalue(self.lines, self.searchlineinunit("status:",
|
||||
self.funcs.getunitname(self.lines, line)))) == 0:
|
||||
self.funcs.setvalue(self.lines,
|
||||
self.funcs.searchlineinunit(self.lines, "status:",
|
||||
self.funcs.getunitname(self.lines, line)),
|
||||
"6")
|
||||
self.funcs.addarrayvalue(self.lines,
|
||||
self.funcs.searchlineinunit(self.lines, "vehicles:",
|
||||
self.funcs.getunitname(self.lines, line)),
|
||||
"null")
|
||||
self.funcs.addarrayvalue(self.lines,
|
||||
self.funcs.searchlineinunit(self.lines, "drivers:",
|
||||
self.funcs.getunitname(self.lines, line)),
|
||||
"null")
|
||||
line += 1
|
||||
except:
|
||||
pass
|
||||
self.funcs.showMsgBox("Success", "All garages successfully unlocked.")
|
||||
self.checkGarages()
|
||||
|
||||
def addCity(self):
|
||||
city = str(self.ui.city_lineedit.text()).lower()
|
||||
self.ui.city_lineedit.setText("")
|
||||
if city in self.funcs.getarrayitems(self.lines,
|
||||
self.funcs.searchline(self.lines, "visited_cities:")):
|
||||
self.funcs.showMsgBox("Error", "You already visited \"{}\"".format(city))
|
||||
else:
|
||||
self.funcs.addarrayvalue(self.lines,
|
||||
self.funcs.searchline(self.lines, "visited_cities:"),
|
||||
city)
|
||||
self.funcs.addarrayvalue(self.lines,
|
||||
self.funcs.searchline(self.lines, "visited_cities_count:"),
|
||||
"1")
|
||||
self.funcs.showMsgBox("Success", "City \"{}\" successfully visited.".format(city))
|
||||
self.checkCities()
|
||||
|
||||
def addAllCities(self):
|
||||
for city in self.cities():
|
||||
if city not in self.funcs.getarrayitems(self.lines,
|
||||
self.funcs.searchline(self.lines, "visited_cities:")):
|
||||
self.funcs.addarrayvalue(self.lines,
|
||||
self.funcs.searchline(self.lines, "visited_cities:"),
|
||||
city)
|
||||
self.funcs.addarrayvalue(self.lines,
|
||||
self.funcs.searchline(self.lines, "visited_cities_count:"),
|
||||
"1")
|
||||
self.funcs.showMsgBox("Success", "All cities successfully visited.")
|
||||
self.checkCities()
|
||||
|
||||
def addDealership(self):
|
||||
dealer = str(self.ui.dealership_lineedit.text()).lower()
|
||||
self.ui.dealership_lineedit.setText("")
|
||||
if (not self.ownsATS and dealer not in self.dealersets2) or (self.ownsATS and dealer not in self.dealersats):
|
||||
self.funcs.showMsgBox("Error", "There is no dealership in that city.")
|
||||
elif dealer in self.funcs.getarrayitems(self.lines, self.funcs.searchline(self.lines, "unlocked_dealers:")):
|
||||
self.funcs.showMsgBox("Error", "Dealership is already unlocked.")
|
||||
else:
|
||||
self.funcs.addarrayvalue(self.lines,
|
||||
self.funcs.searchline(self.lines, "unlocked_dealers:"),
|
||||
dealer)
|
||||
self.funcs.showMsgBox("Success", "Dealership in \"{}\" successfully unlocked.".format(dealer))
|
||||
self.checkDealers()
|
||||
|
||||
def addAllDealership(self):
|
||||
if not self.ownsATS:
|
||||
for dealer in self.dealersets2:
|
||||
if dealer in self.cities() and dealer not in self.funcs.getarrayitems(
|
||||
self.lines, self.funcs.searchline(self.lines, "unlocked_dealers:")):
|
||||
self.funcs.addarrayvalue(self.lines,
|
||||
self.funcs.searchline(self.lines, "unlocked_dealers:"),
|
||||
dealer)
|
||||
else:
|
||||
for dealer in self.dealersats:
|
||||
if dealer in self.cities() and dealer not in self.funcs.getarrayitems(
|
||||
self.lines, self.funcs.searchline(self.lines, "unlocked_dealers:")):
|
||||
self.funcs.addarrayvalue(self.lines,
|
||||
self.funcs.searchline(self.lines, "unlocked_dealers:"),
|
||||
dealer)
|
||||
self.funcs.showMsgBox("Success", "All dealerships unlocked.")
|
||||
self.checkDealers()
|
||||
|
||||
def addAgency(self):
|
||||
agency = str(self.ui.agency_lineedit.text()).lower()
|
||||
self.ui.agency_lineedit.setText("")
|
||||
if (not self.ownsATS and agency not in self.agenciesets2) or (self.ownsATS and agency not in self.agenciesats):
|
||||
self.funcs.showMsgBox("Error", "There is no recruitment agency in that city.")
|
||||
elif agency in self.funcs.getarrayitems(self.lines,
|
||||
self.funcs.searchline(self.lines, "unlocked_recruitments:")):
|
||||
self.funcs.showMsgBox("Error", "Recruitment agency is already unlocked.")
|
||||
else:
|
||||
self.funcs.addarrayvalue(self.lines,
|
||||
self.funcs.searchline(self.lines, "unlocked_recruitments:"),
|
||||
agency)
|
||||
self.funcs.showMsgBox("Success", "Recruitment agency in \"{}\" successfully unlocked.".format(agency))
|
||||
self.checkAgencies()
|
||||
|
||||
def addAllAgency(self):
|
||||
if not self.ownsATS:
|
||||
for agency in self.agenciesets2:
|
||||
if agency in self.cities() and agency not in self.funcs.getarrayitems(
|
||||
self.lines, self.funcs.searchline(self.lines, "unlocked_recruitments:")):
|
||||
self.funcs.addarrayvalue(self.lines,
|
||||
self.funcs.searchline(self.lines, "unlocked_recruitments:"),
|
||||
agency)
|
||||
else:
|
||||
for agency in self.agenciesats:
|
||||
if agency in self.cities() and agency not in self.funcs.getarrayitems(
|
||||
self.lines, self.funcs.searchline(self.lines, "unlocked_recruitments:")):
|
||||
self.funcs.addarrayvalue(self.lines,
|
||||
self.funcs.searchline(self.lines, "unlocked_recruitments:"),
|
||||
agency)
|
||||
self.funcs.showMsgBox("Success", "All recruitment agencies unlocked.")
|
||||
self.checkAgencies()
|
||||
|
||||
def changeHQ(self):
|
||||
hq = str(self.ui.headquarter_lineedit.text()).lower()
|
||||
if self.funcs.getvalue(self.lines, self.funcs.searchline(self.lines, "hq_city:")) == hq:
|
||||
self.funcs.showMsgBox("Error", "Your headquarter is already in this city")
|
||||
elif hq not in self.purchasedgarages():
|
||||
self.funcs.showMsgBox("Error", "You need to own the garage in this city.")
|
||||
else:
|
||||
self.funcs.setvalue(self.lines, self.funcs.searchline(self.lines, "hq_city:"), hq)
|
||||
self.funcs.showMsgBox("Success", "Headquarter successfully set to \"{}\".".format(hq))
|
||||
|
||||
# TODO: send self.lines to MainWindow()
|
||||
def closeEvent(self, event):
|
||||
from main_script import MainWindow
|
||||
mainw = MainWindow()
|
||||
mainw.returnLines(self.lines)
|
||||
35
src/setup.py
35
src/setup.py
@@ -1,35 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from cx_Freeze import setup, Executable
|
||||
|
||||
executables = [Executable('main_script.py',
|
||||
targetName="SaveWizard.exe",
|
||||
base="Win32GUI")]
|
||||
|
||||
excludes = ['email', 'html', 'http', 'logging', 'pydoc_data', 'unittest', 'urllib', 'xml', 'tempfile', 'select', 'datetime',
|
||||
'hashlib', 'shlex', 'shutil', 'socket', 'platform', 'webbrowser', 'pydoc', 'selectors', 'tty', 'inspect', 'doctest',
|
||||
'plistlib', 'calendar', 'subprocess', 'copy', 'bz2', 'stringprep', 'unicodedata', 'posixpath', 'dummy_threading',
|
||||
'_strptime', 'pwd']
|
||||
|
||||
zip_include_packages = ['collections', 'encodings', 'importlib', 'PyQt5', 'sip', 'wsgiref']
|
||||
|
||||
include_files = ['SII_Decrypt.exe']
|
||||
|
||||
options = {
|
||||
'build_exe': {
|
||||
'include_msvcr': True,
|
||||
'excludes': excludes,
|
||||
'zip_include_packages': zip_include_packages,
|
||||
'include_files': include_files,
|
||||
'build_exe': 'stable_build'
|
||||
}
|
||||
}
|
||||
|
||||
setup(
|
||||
name="SaveWizard",
|
||||
version="1.0",
|
||||
description="For editing ETS2 sii files",
|
||||
executables=executables,
|
||||
options=options
|
||||
)
|
||||
6
statics.py
Normal file
6
statics.py
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
update_config_name = "update.cfg"
|
||||
github_link = "https://raw.githubusercontent.com/JDM170/SaveWizard/master/"
|
||||
hash_chunk_size = 4096
|
||||
142
util.py
Normal file
142
util.py
Normal file
@@ -0,0 +1,142 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# from re import search, match, sub
|
||||
from re import search, match
|
||||
from PyQt5.QtWidgets import QMessageBox
|
||||
from hashlib import md5
|
||||
from statics import hash_chunk_size
|
||||
|
||||
lines = []
|
||||
|
||||
|
||||
# Custom functions
|
||||
def set_lines(new_lines):
|
||||
global lines
|
||||
lines = new_lines
|
||||
|
||||
|
||||
def get_lines(index=None):
|
||||
global lines
|
||||
if index is not None:
|
||||
return lines[index]
|
||||
return lines
|
||||
|
||||
|
||||
def show_message(icon, title, text):
|
||||
box = QMessageBox(icon, title, text, QMessageBox.Ok)
|
||||
box.exec()
|
||||
|
||||
|
||||
def generate_md5(fn):
|
||||
try:
|
||||
hash_md5 = md5()
|
||||
with open(fn, "rb") as f:
|
||||
for chunk in iter(lambda: f.read(hash_chunk_size), b""):
|
||||
hash_md5.update(chunk)
|
||||
return hash_md5.hexdigest()
|
||||
except FileNotFoundError:
|
||||
return False
|
||||
|
||||
|
||||
# Stock functions
|
||||
def search_line(term, start=0, cancel=r"this_string_must_not_exist"):
|
||||
global lines
|
||||
if search(term, lines[start]):
|
||||
return start
|
||||
start += 1
|
||||
while start <= len(lines) - 1:
|
||||
if search(term, lines[start]):
|
||||
return start
|
||||
if search(cancel, lines[start]):
|
||||
return None
|
||||
start += 1
|
||||
return None
|
||||
|
||||
|
||||
def search_line_in_unit(term, unit):
|
||||
global lines
|
||||
line = search_line(" : " + unit + " {")
|
||||
return search_line(term, start=line, cancel="}")
|
||||
|
||||
|
||||
def search_all_lines(term):
|
||||
global lines
|
||||
matches = []
|
||||
line = 0
|
||||
while search_line(term, start=line + 1):
|
||||
line = search_line(term, start=line + 1)
|
||||
matches.append(line)
|
||||
if matches is None:
|
||||
return None
|
||||
return matches
|
||||
|
||||
|
||||
def get_value(line):
|
||||
global lines
|
||||
return search(r": (.+)$", lines[line]).group(1)
|
||||
|
||||
|
||||
def set_value(line, value):
|
||||
global lines
|
||||
name = match(r"(.+):", lines[line]).group(1)
|
||||
lines[line] = name + ": " + value
|
||||
|
||||
|
||||
# def get_unit_name(line):
|
||||
# global lines
|
||||
# return search(r" : (.+) {$", lines[line]).group(1)
|
||||
|
||||
|
||||
def get_array_length(line):
|
||||
global lines
|
||||
return int(search(r": ([0-9]+)$", lines[line]).group(1))
|
||||
|
||||
|
||||
# def get_array_value_by_index(line, index):
|
||||
# global lines
|
||||
# return search(r": (.+)$", lines[line + index + 1]).group(1)
|
||||
#
|
||||
#
|
||||
# def get_array_index_by_value(line, value):
|
||||
# global lines
|
||||
# count = 0
|
||||
# for i in range(get_array_length(line)):
|
||||
# if get_value(line + count + 1) == value:
|
||||
# return count
|
||||
# count += 1
|
||||
# return None
|
||||
|
||||
|
||||
def get_array_items(line):
|
||||
global lines
|
||||
items = []
|
||||
for i in range(get_array_length(line)):
|
||||
items.append(search(r": (.+)$", lines[line + i + 1]).group(1))
|
||||
if items is None:
|
||||
return None
|
||||
return items
|
||||
|
||||
|
||||
def add_array_value(line, value):
|
||||
global lines
|
||||
name = match(r"(.+):", lines[line]).group(1)
|
||||
count = get_array_length(line)
|
||||
lines[line] = name + ": " + str(count + 1)
|
||||
lines.insert(line + count + 1, name + "[" + str(count) + "]: " + value)
|
||||
|
||||
|
||||
# def remove_array_value(line, value):
|
||||
# global lines
|
||||
# name = match(r"(.+):", lines[line]).group(1)
|
||||
# del lines[line + 1 + get_array_index_by_value(line, value)]
|
||||
# count = get_array_length(line)
|
||||
# lines[line] = name + ": " + str(count - 1)
|
||||
# for i in range(count):
|
||||
# lines[line + i + 1] = sub(r"\[[0-9]+]", "[" + str(i) + "]", lines[line + i + 1])
|
||||
#
|
||||
#
|
||||
# def change_array_value(line, index, value):
|
||||
# global lines
|
||||
# line += index + 1
|
||||
# set_value(line, value)
|
||||
Reference in New Issue
Block a user