def __init__(self, parent): super().__init__(parent) self.setupUi(self) self.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.FramelessWindowHint) self.setModal(True) self.parent = parent self.oldPos = self.pos() self.init_handlers() self.message = None self.collection = get_collection_data() self.playsets = self.playset_check() self.modList, self.game_data, self.dlc_load, self.playset = prep_data( paradox_folder, list(self.playsets.items())[0]) self.grid = self.gridLayout self.grid.setSpacing(10) self.buttons = {} self.generator = copy.copy(self.modList) self.checkboxes = [] self.string = self.StringsList.text().split('.') self.PlaysetsList.view().parentWidget().setStyleSheet( "background: #5abe41;") self.borders = { 'blue': 'border: 3px solid #05B8CC;', 'green': 'border: 3px solid #5abe41;', 'gray': 'border: 3px solid gray' } self.switch = { True: { 'act_switcher': lambda: self.ActivationSwticherButton.setText(self.string[0]), 'reversing': lambda: self.ReverseSortingButton.setText('Z-A') }, False: { 'act_switcher': lambda: self.ActivationSwticherButton.setText(self.string[1]), 'reversing': lambda: self.ReverseSortingButton.setText('A-Z') } } self.switch[ self.ActivationSwticherButton.isChecked()]['act_switcher']() self.switch[self.ReverseSortingButton.isChecked()]['reversing']() self.check_enabling_status() self.paint_elements()
def __init__(self, parent): super().__init__(parent) self.setupUi(self) self.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.FramelessWindowHint) self.setModal(True) self.parent = parent self.oldPos = self.pos() self.init_handlers() self.message = None self.string = self.StringsList.text().split('.') self.collection = get_collection_data() self.set_collection_name() self.gridLayout.setSpacing(15) self.buttons = {} self.row_index = 0 self.OptionsListComboBox.view().parentWidget().setStyleSheet("background: #05B8CC;") self.borders = { 'blue': 'border: 3px solid #05B8CC;', 'green': 'border: 3px solid #5abe41;', 'gray': 'border: 3px solid gray' } self.paint_elements()
def update_localisation_files_version(self, localisation_files): localisation_files = copy(localisation_files) mod_path = get_mods_from_playset( 'get_mod_path', localisation_files[0].mod_name)[0][0].replace('/', '\\') mod_properties, files_for_compare = localisation_files[0], [] start, new_files, log = False, False, False archive = [file for file in listdir(mod_path) if '.zip' in file] if archive: open_zip_file(f'{mod_path}\\{archive[0]}') original_files = scan_for_files(mod_path) for original_file_path in copy(original_files): for localisation_file in localisation_files: localisation_file_path = localisation_file.original_file_path.rsplit( '\\', 2) del localisation_file_path[-2] localisation_file_path = '\\'.join(localisation_file_path) if original_file_path in localisation_file_path: files_for_compare.append( (f'{mod_path}\\{original_file_path}', localisation_file)) original_files.remove(original_file_path) localisation_files.remove(localisation_file) break for files_pair in files_for_compare: log = update_translation(files_pair, 'internal_way') if start is False and log is not False: start = True if original_files: # На случай, если в локализации отсутствуют актуальные для мода файлы start, new_files = True, True for original_file_path in original_files: parser_main(mod_path, mod_properties.mod_id, original_file_path) collection_append(mod_properties.mod_id, mod_properties.hash_key, mod_properties.mod_name) if localisation_files: # На случай, если в локализации имеются неактуальные для мода файлы start, new_files = True, True for localisation_file in localisation_files: remove_data_from_collection( collection_path, (localisation_file.original_file_path, ), 'file') rmtree( localisation_file.original_file_path.rsplit('\\', 1)[0].replace( '\\', '/')) if archive: remove_unpacked_files(mod_path) self.findChild(QtWidgets.QDialog).close() if start is True: call_success_message(self, 'mod_was_updated') if new_files: self.collection = get_collection_data() self.paint_elements() else: call_success_message(self, 'all_files_are_up_to_date')