def resort_all(self, event): dialog = ProgressDialog(self, 'Resorting objects') dialog.set_task_number(len(self.panels)) for panel in self.panels: dialog.task_started(panel.type) panel.resort_objects() dialog.done()
def reload_mods(self, initial=False, progress=True): ''' This method clears the currently loaded mod list and reloads every mod in the mods directory. Should be used as rarely as possible due to long execution time''' dialog = ProgressDialog(self, 'Loading mods', show=progress) self.mods = [] notified = False mod_headers = {} # First, let's read the headers of all the mods for mod in get_mod_list(): path = os.path.join('mods', mod) mod_headers[path] = decode_mod_headers(path) dialog.set_task_number(len(mod_headers)) # Now, let's verify the checksums of all the mods and update if needed core_checksum = str(self.core_dataset.checksum()) for mod, headers in mod_headers.items(): if 'meta' in headers: continue # Verify only core files for now if headers['checksum'] != core_checksum: if not notified: notified = True print 'Updating mods...' self.info_dialog( 'DFMM has detected a change in your core files. The patches defined in your mods will be re-rolled. Depending on the number and size of your mods, this may take several minutes. Watch the console window for possible notifications about changes that cannot be applied to the new files.', 'Core files changed') print 'Processing mod "%s"...' % mod mod = decode_mod(mod, self.core_dataset) encode_mod(mod, overwrite=True) if notified: print 'Done updating mods.' # First, process the normal mods. This makes them available for the # metamods to reference for path, headers in mod_headers.items(): if 'meta' not in headers: dialog.task_started(label=headers['name']) self.load_normal_mod(path) # Then, the metamods for path, headers in mod_headers.items(): if 'meta' in headers: dialog.task_started(label=headers['name']) self.load_metamod(path, headers) dialog.done() self.update_mod_list() self.update_title()
def reload_mods(self, initial=False, progress=True): ''' This method clears the currently loaded mod list and reloads every mod in the mods directory. Should be used as rarely as possible due to long execution time''' dialog = ProgressDialog(self, 'Loading mods', show=progress) self.mods = [] notified = False mod_headers = {} # First, let's read the headers of all the mods for mod in get_mod_list(): path = os.path.join('mods', mod) mod_headers[path] = decode_mod_headers(path) dialog.set_task_number(len(mod_headers)) # Now, let's verify the checksums of all the mods and update if needed core_checksum = str(self.core_dataset.checksum()) for mod, headers in mod_headers.items(): if 'meta' in headers: continue # Verify only core files for now if headers['checksum'] != core_checksum: if not notified: notified = True print 'Updating mods...' self.info_dialog('DFMM has detected a change in your core files. The patches defined in your mods will be re-rolled. Depending on the number and size of your mods, this may take several minutes. Watch the console window for possible notifications about changes that cannot be applied to the new files.', 'Core files changed') print 'Processing mod "%s"...' % mod mod = decode_mod(mod, self.core_dataset) encode_mod(mod, overwrite=True) if notified: print 'Done updating mods.' # First, process the normal mods. This makes them available for the # metamods to reference for path, headers in mod_headers.items(): if 'meta' not in headers: dialog.task_started(label=headers['name']) self.load_normal_mod(path) # Then, the metamods for path, headers in mod_headers.items(): if 'meta' in headers: dialog.task_started(label=headers['name']) self.load_metamod(path, headers) dialog.done() self.update_mod_list() self.update_title()