mirror of
https://github.com/JDM170/SaveWizard
synced 2025-04-20 22:30:42 +07:00
First commit
This commit is contained in:
19
README.md
Normal file
19
README.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# SaveWizard
|
||||
|
||||
* Author of original "SaveWizard" script: DrEGZo
|
||||
* The original script is taken from here: <https://forum.truckersmp.com/index.php?/topic/55773-savewizard/>
|
||||
|
||||
***
|
||||
|
||||
This program allows:
|
||||
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!**
|
||||
|
||||
***
|
||||
|
||||
#### Since the program is in development, I will not give up help and guidance on my errors in the code.
|
||||
BIN
src/SII_Decrypt.exe
Normal file
BIN
src/SII_Decrypt.exe
Normal file
Binary file not shown.
1
src/compile_python_code.bat
Normal file
1
src/compile_python_code.bat
Normal file
@@ -0,0 +1 @@
|
||||
python setup.py build
|
||||
1
src/convert_main_form_ui_to_py.bat
Normal file
1
src/convert_main_form_ui_to_py.bat
Normal file
@@ -0,0 +1 @@
|
||||
pyuic5 main_form.ui -o main_form.py
|
||||
1
src/convert_second_form_ui_to_py.bat
Normal file
1
src/convert_second_form_ui_to_py.bat
Normal file
@@ -0,0 +1 @@
|
||||
pyuic5 second_form.ui -o second_form.py
|
||||
108
src/funcs.py
Normal file
108
src/funcs.py
Normal file
@@ -0,0 +1,108 @@
|
||||
#!/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
Normal file
270
src/main_form.py
Normal file
@@ -0,0 +1,270 @@
|
||||
# -*- 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
Normal file
535
src/main_form.ui
Normal file
@@ -0,0 +1,535 @@
|
||||
<?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>
|
||||
279
src/main_script.py
Normal file
279
src/main_script.py
Normal file
@@ -0,0 +1,279 @@
|
||||
#!/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_())
|
||||
304
src/second_form.py
Normal file
304
src/second_form.py
Normal file
@@ -0,0 +1,304 @@
|
||||
# -*- 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"))
|
||||
|
||||
490
src/second_form.ui
Normal file
490
src/second_form.ui
Normal file
@@ -0,0 +1,490 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SecondWindow</class>
|
||||
<widget class="QDialog" name="SecondWindow">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>660</width>
|
||||
<height>400</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>660</width>
|
||||
<height>400</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Edit garages, cities and etc...</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="gridLayoutWidget_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</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">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Owned garages:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="garages_analyze">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Analyze</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="gridLayoutWidget_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>340</x>
|
||||
<y>10</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">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Visited cities:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="gridLayoutWidget_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>220</y>
|
||||
<width>131</width>
|
||||
<height>171</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="dealerships_layout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="dealerships_label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Dealerships:</string>
|
||||
</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">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Analyze</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="gridLayoutWidget_6">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>340</x>
|
||||
<y>220</y>
|
||||
<width>131</width>
|
||||
<height>171</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="agencies_layout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="agencies_label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Agencies:</string>
|
||||
</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">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Analyze</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="Line" name="v_line">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>320</x>
|
||||
<y>10</y>
|
||||
<width>20</width>
|
||||
<height>381</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="h_line">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>200</y>
|
||||
<width>641</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="gridLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<y>10</y>
|
||||
<width>171</width>
|
||||
<height>107</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="add_garage">
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="garage_add">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLineEdit" name="garage_lineedit"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QPushButton" name="garage_unlock_all">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Unlock all</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="garage_label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enter garage name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="gridLayoutWidget_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>480</x>
|
||||
<y>50</y>
|
||||
<width>171</width>
|
||||
<height>107</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="add_city">
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="city_add">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLineEdit" name="city_lineedit"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="city_label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enter city name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QPushButton" name="city_unlock_all">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Visit all</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="gridLayoutWidget_7">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<y>250</y>
|
||||
<width>171</width>
|
||||
<height>107</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="add_dealership">
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="dealership_add">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLineEdit" name="dealership_lineedit"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="dealership_label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enter dealership name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QPushButton" name="dealership_unlock_all">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Unlock all</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="gridLayoutWidget_8">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>480</x>
|
||||
<y>250</y>
|
||||
<width>171</width>
|
||||
<height>107</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="add_agency">
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="agency_add">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add</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">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enter agency name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QPushButton" name="agency_unlock_all">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Unlock all</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="gridLayoutWidget_9">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<y>120</y>
|
||||
<width>171</width>
|
||||
<height>80</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="headquarter_layout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="headquarter_label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Your headquarter:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLineEdit" name="headquarter_lineedit"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="headquarter_change">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Times New Roman</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Change</string>
|
||||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
294
src/second_script.py
Normal file
294
src/second_script.py
Normal file
@@ -0,0 +1,294 @@
|
||||
#!/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
Normal file
35
src/setup.py
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/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
|
||||
)
|
||||
Reference in New Issue
Block a user