diff --git a/init_main_program.py b/init_main_program.py index 345300d..136df37 100644 --- a/init_main_program.py +++ b/init_main_program.py @@ -3,10 +3,10 @@ from sys import argv, exit from PyQt5.QtWidgets import QApplication -from module_choice.script import ChoiceWindow +from module_main.script import MainWindow if __name__ == '__main__': app = QApplication(argv) - win = ChoiceWindow() + win = MainWindow() win.show() exit(app.exec()) diff --git a/module_main/form.ui b/module_main/form.ui index cf8630e..989d979 100644 --- a/module_main/form.ui +++ b/module_main/form.ui @@ -177,16 +177,16 @@ - 10 + 130 310 - 141 + 111 31 Times New Roman - 12 + 11 @@ -194,12 +194,15 @@ + + false + 80 350 211 - 31 + 21 @@ -211,6 +214,9 @@ Don't save all changes in this form + + false + @@ -446,16 +452,16 @@ - 210 + 250 310 - 141 + 101 31 Times New Roman - 12 + 11 @@ -468,49 +474,24 @@ - 160 - 320 - 41 - 21 - - - - ... - - - - - - 210 - 10 - 141 + 10 + 310 + 111 31 - - Chosen configs: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - 180 - 20 - 21 - 21 - + + + 11 + - ... + Unlock garages path_button - cfg_button money_edit money_dont_change xp_edit @@ -529,8 +510,8 @@ urgent_delivery_dont_change ecodriving_edit ecodriving_dont_change - backup second_window + backup apply dont_change_all_inf diff --git a/module_main/script.py b/module_main/script.py index 0cfcf5b..335d7db 100644 --- a/module_main/script.py +++ b/module_main/script.py @@ -14,7 +14,7 @@ from module_second.script import SecondWindow class MainWindow(QDialog, Ui_MainWindow): - def __init__(self, selected_game, parent=None): + def __init__(self, parent=None): # Setup UI QDialog.__init__(self, parent, flags=Qt.Window) Ui_MainWindow.__init__(self) @@ -24,14 +24,10 @@ class MainWindow(QDialog, Ui_MainWindow): self.file_path = "" self.old_file = "" - self.selected_game = selected_game + self.selected_game = "" self.owns = {} self.dlc = {} - # Editing label to show what configs chosen - self.chosen_cfg_text = self.ui.chosen_cfgs.text() - self.ui.chosen_cfgs.setText("{} {}".format(self.chosen_cfg_text, selected_game.upper())) - # Storing edits with his checkboxes and file-lines self.basic_edits = { self.ui.money_edit: [self.ui.money_dont_change, "money_account:"], @@ -64,12 +60,10 @@ class MainWindow(QDialog, Ui_MainWindow): # Connecting buttons self.ui.path_button.clicked.connect(self.open_file_dialog) - self.ui.cfg_button.clicked.connect(self.change_configs) self.ui.backup.clicked.connect(self.recover_backup) self.ui.second_window.clicked.connect(self.open_second_win) self.ui.apply.clicked.connect(self.apply_changes) - self.check_config() self.clear_form_data() def text_edited(self): @@ -112,9 +106,6 @@ class MainWindow(QDialog, Ui_MainWindow): self.old_file = "" util.set_lines([]) - if self.owns is not False: - self.owns = {} - for key, value in self.basic_edits.items(): key.setText("") value[0].setChecked(True) @@ -141,6 +132,12 @@ class MainWindow(QDialog, Ui_MainWindow): self.old_file = f.read() util.set_lines(self.old_file.split("\n")) + if util.search_line("company.volatile.eurogoodies.magdeburg"): + self.selected_game = "ets2" + else: + self.selected_game = "ats" + self.check_config() + if self.owns is not False: self.owns["base"] = True companies = util.get_array_items(util.search_line("companies:")) @@ -175,17 +172,6 @@ class MainWindow(QDialog, Ui_MainWindow): else: return - def change_configs(self): - box = QMessageBox(QMessageBox.Warning, "Warning", "Do you really want to load other configs?\n" - "Your current changes won't be saved.") - box.addButton("Yes", QMessageBox.YesRole) - box.addButton("No", QMessageBox.NoRole) - if box.exec() == 0: - self.clear_form_data() - self.selected_game = "ets2" if self.selected_game == "ats" else "ats" - self.ui.chosen_cfgs.setText("{} {}".format(self.chosen_cfg_text, self.selected_game.upper())) - self.check_config() - def recover_backup(self): backup_path = self.file_path + ".swbak" if not isfile(backup_path):