mirror of
https://github.com/JDM170/SaveWizard
synced 2025-04-20 22:30:42 +07:00
Small update of second form
Signed-off-by: JDM170 <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
@@ -5,7 +5,10 @@ block_cipher = None
|
|||||||
a = Analysis(['__init__.py'],
|
a = Analysis(['__init__.py'],
|
||||||
pathex=['.'],
|
pathex=['.'],
|
||||||
binaries=[],
|
binaries=[],
|
||||||
datas=[],
|
datas=[
|
||||||
|
('ats_configs', 'ats_configs'),
|
||||||
|
('ets2_configs', 'ets2_configs')
|
||||||
|
],
|
||||||
hiddenimports=[],
|
hiddenimports=[],
|
||||||
hookspath=[],
|
hookspath=[],
|
||||||
runtime_hooks=[],
|
runtime_hooks=[],
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
pythonqt setup.py build
|
python setup.py build
|
||||||
|
|||||||
@@ -8,6 +8,12 @@ from .form import Ui_SecondWindow
|
|||||||
from util import *
|
from util import *
|
||||||
from dataIO import dataIO
|
from dataIO import dataIO
|
||||||
|
|
||||||
|
garages_stat = {
|
||||||
|
"Small": [1, 1],
|
||||||
|
"Medium": [2, 3],
|
||||||
|
"Big": [3, 5]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class SecondWindow(QDialog, Ui_SecondWindow):
|
class SecondWindow(QDialog, Ui_SecondWindow):
|
||||||
def __init__(self, owns_list, parent=None):
|
def __init__(self, owns_list, parent=None):
|
||||||
@@ -35,7 +41,7 @@ class SecondWindow(QDialog, Ui_SecondWindow):
|
|||||||
self.ui.agency_edit.setEnabled(False)
|
self.ui.agency_edit.setEnabled(False)
|
||||||
self.ui.agency_add.setEnabled(False)
|
self.ui.agency_add.setEnabled(False)
|
||||||
self.ui.agency_add_all.setEnabled(False)
|
self.ui.agency_add_all.setEnabled(False)
|
||||||
show_message(QMessageBox.Warning, "Warning", "'agencies.json' not found, agencies editing has been"
|
show_message(QMessageBox.Warning, "Warning", "'agencies.json' not found, agencies editing has been "
|
||||||
"disabled")
|
"disabled")
|
||||||
else:
|
else:
|
||||||
self.agencies = []
|
self.agencies = []
|
||||||
@@ -57,8 +63,10 @@ class SecondWindow(QDialog, Ui_SecondWindow):
|
|||||||
self.ui.agency_add.clicked.connect(self.add_agency)
|
self.ui.agency_add.clicked.connect(self.add_agency)
|
||||||
self.ui.agency_add_all.clicked.connect(self.add_all_agencies)
|
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
|
# Checking save-file
|
||||||
self.initialize_arrays()
|
|
||||||
self.check_cities()
|
self.check_cities()
|
||||||
self.check_dealers()
|
self.check_dealers()
|
||||||
self.check_agencies()
|
self.check_agencies()
|
||||||
@@ -81,31 +89,18 @@ class SecondWindow(QDialog, Ui_SecondWindow):
|
|||||||
cities.append(city)
|
cities.append(city)
|
||||||
return cities
|
return cities
|
||||||
|
|
||||||
def initialize_arrays(self):
|
def fill_list(self, array, file):
|
||||||
if self.owns is False:
|
if array is False:
|
||||||
return
|
return
|
||||||
for key in self.owns.keys():
|
for key in self.owns.keys():
|
||||||
if self.dealers is not False and key in self.dealers_file:
|
if key not in file:
|
||||||
for value in self.dealers_file[key]:
|
continue
|
||||||
self.dealers.append(value)
|
for value in file[key]:
|
||||||
if self.agencies is not False and key in self.agencies_file:
|
array.append(value)
|
||||||
for value in self.agencies_file[key]:
|
|
||||||
self.agencies.append(value)
|
|
||||||
|
|
||||||
def check_garage_size(self):
|
def check_garage_size(self):
|
||||||
text = self.ui.garage_size.currentText()
|
stat = garages_stat[self.ui.garage_size.currentText()]
|
||||||
status = 0
|
return str(stat[0]), stat[1]
|
||||||
size = 0
|
|
||||||
if text == "Small":
|
|
||||||
status = 1
|
|
||||||
size = 1
|
|
||||||
elif text == "Medium":
|
|
||||||
status = 2
|
|
||||||
size = 3
|
|
||||||
elif text == "Big":
|
|
||||||
status = 3
|
|
||||||
size = 5
|
|
||||||
return str(status), size
|
|
||||||
|
|
||||||
def check_garages(self):
|
def check_garages(self):
|
||||||
self.ui.garages_text.clear()
|
self.ui.garages_text.clear()
|
||||||
@@ -130,7 +125,7 @@ class SecondWindow(QDialog, Ui_SecondWindow):
|
|||||||
add_array_value(drivers_array+i, "null")
|
add_array_value(drivers_array+i, "null")
|
||||||
show_message(QMessageBox.Information, "Success", "Garage in \"{}\" successfully unlocked.".format(garage))
|
show_message(QMessageBox.Information, "Success", "Garage in \"{}\" successfully unlocked.".format(garage))
|
||||||
else:
|
else:
|
||||||
show_message(QMessageBox.Warning, "Warning", "Garage in \"{}\" already unlocked.".format(garage))
|
show_message(QMessageBox.Critical, "Error", "Garage in \"{}\" already unlocked.".format(garage))
|
||||||
|
|
||||||
def add_all_garages(self):
|
def add_all_garages(self):
|
||||||
new_status, size = self.check_garage_size()
|
new_status, size = self.check_garage_size()
|
||||||
@@ -153,7 +148,7 @@ class SecondWindow(QDialog, Ui_SecondWindow):
|
|||||||
show_message(QMessageBox.Critical, "Error", "Enter a name for the city.")
|
show_message(QMessageBox.Critical, "Error", "Enter a name for the city.")
|
||||||
return
|
return
|
||||||
if get_value(search_line("hq_city:")) == hq:
|
if get_value(search_line("hq_city:")) == hq:
|
||||||
show_message(QMessageBox.Critical, "Error", "Your headquarter is already in this city")
|
show_message(QMessageBox.Information, "Info", "Your headquarter is already in this city")
|
||||||
elif hq not in self.purchased_garages():
|
elif hq not in self.purchased_garages():
|
||||||
show_message(QMessageBox.Critical, "Error", "You need to own the garage in this city.")
|
show_message(QMessageBox.Critical, "Error", "You need to own the garage in this city.")
|
||||||
else:
|
else:
|
||||||
@@ -179,7 +174,7 @@ class SecondWindow(QDialog, Ui_SecondWindow):
|
|||||||
if city not in get_array_items(search_line("visited_cities:")):
|
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:"), city)
|
||||||
add_array_value(search_line("visited_cities_count:"), "1")
|
add_array_value(search_line("visited_cities_count:"), "1")
|
||||||
show_message(QMessageBox.Warning, "Success", "City \"{}\" successfully visited.".format(city))
|
show_message(QMessageBox.Information, "Success", "City \"{}\" successfully visited.".format(city))
|
||||||
self.check_cities()
|
self.check_cities()
|
||||||
else:
|
else:
|
||||||
show_message(QMessageBox.Critical, "Error", "You already visited \"{}\".".format(city))
|
show_message(QMessageBox.Critical, "Error", "You already visited \"{}\".".format(city))
|
||||||
@@ -211,7 +206,7 @@ class SecondWindow(QDialog, Ui_SecondWindow):
|
|||||||
if dealer not in self.dealers:
|
if dealer not in self.dealers:
|
||||||
show_message(QMessageBox.Critical, "Error", "There is no dealership in that city.")
|
show_message(QMessageBox.Critical, "Error", "There is no dealership in that city.")
|
||||||
elif dealer in get_array_items(search_line("unlocked_dealers:")):
|
elif dealer in get_array_items(search_line("unlocked_dealers:")):
|
||||||
show_message(QMessageBox.Critical, "Error", "This dealership already unlocked.")
|
show_message(QMessageBox.Information, "Info", "This dealership already unlocked.")
|
||||||
else:
|
else:
|
||||||
add_array_value(search_line("unlocked_dealers:"), dealer)
|
add_array_value(search_line("unlocked_dealers:"), dealer)
|
||||||
show_message(QMessageBox.Information, "Success", "Dealership in \"{}\" successfully unlocked."
|
show_message(QMessageBox.Information, "Success", "Dealership in \"{}\" successfully unlocked."
|
||||||
@@ -245,7 +240,7 @@ class SecondWindow(QDialog, Ui_SecondWindow):
|
|||||||
if agency not in self.agencies:
|
if agency not in self.agencies:
|
||||||
show_message(QMessageBox.Critical, "Error", "There is no recruitment agency in that city.")
|
show_message(QMessageBox.Critical, "Error", "There is no recruitment agency in that city.")
|
||||||
elif agency in get_array_items(search_line("unlocked_recruitments:")):
|
elif agency in get_array_items(search_line("unlocked_recruitments:")):
|
||||||
show_message(QMessageBox.Critical, "Error", "Recruitment agency is already unlocked.")
|
show_message(QMessageBox.Information, "Info", "Recruitment agency is already unlocked.")
|
||||||
else:
|
else:
|
||||||
add_array_value(search_line("unlocked_recruitments:"), agency)
|
add_array_value(search_line("unlocked_recruitments:"), agency)
|
||||||
show_message(QMessageBox.Information, "Success", "Recruitment agency in \"{}\" successfully unlocked."
|
show_message(QMessageBox.Information, "Success", "Recruitment agency in \"{}\" successfully unlocked."
|
||||||
|
|||||||
2
setup.py
2
setup.py
@@ -22,7 +22,7 @@ options = {
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='SaveWizard',
|
name='SaveWizard',
|
||||||
version='1.1',
|
version='1.1.1',
|
||||||
description='For editing ETS2 sii files',
|
description='For editing ETS2 sii files',
|
||||||
executables=executables,
|
executables=executables,
|
||||||
options=options,
|
options=options,
|
||||||
|
|||||||
Reference in New Issue
Block a user