text stringlengths 0 93.6k |
|---|
# Get the current value from the bin |
# We check for if the value is a percentage, mainly |
# because having all of the values is very crowded. |
if type(section) == parse.percentage: |
current_val = section.get_value_from_bin(amiibo) |
# Check if the section has the type of `ImplicitSum` separately, |
# because it does not contain any method for getting the value. |
elif type(section) == parse.ImplicitSum: |
# If it does, we have to get the value by name |
current_val = values[section.name] |
else: |
continue |
# Add to the output. |
output += f"{section}: {current_val}\n" |
# Set the user's clipboard to the output after the loop finishes |
sg.clipboard_set(output) |
case 'Select Regions': |
# write regions path to file and reinstate window |
regions = filedialog.askopenfilename(filetypes=(('Any Region', '*.json;*.txt'),)) |
if regions == '': |
continue |
reloadwarn = show_reload_warning() |
if reloadwarn == 'OK': |
config.write_region_path(regions) |
config.save_config() |
if config.get_region_type() == 'txt': |
sections = parse.load_from_txt(config.get_region_path()) |
implicit_sums = None |
elif config.get_region_type() == 'json': |
sections, implicit_sums = parse.load_from_json(config.get_region_path()) |
implicit_sum_manager = ImplicitSumManager(implicit_sums, sections) |
window = reload_window(window, sections, column_key, updatePopUp) |
else: |
continue |
case 'Select Key(s)': |
# write keys path to file |
keys = filedialog.askopenfilenames(filetypes=(('BIN files', '*.bin'),)) |
if keys == '': |
continue |
config.write_key_paths(*keys) |
config.save_config() |
case "Dump Mii": |
# Open a popup for the user to pick a dump destination, and then dump the mii |
path = filedialog.asksaveasfilename(defaultextension='.bin', filetypes=(('BIN files', '*.bin'),)) |
if path == "": |
continue |
amiibo.dump_mii(path) |
case "Load Mii": |
mii_path = filedialog.askopenfilename(filetypes=(('BIN files', '*.bin'),)) |
if mii_path == "": |
continue |
# Attempt to set the Mii, and present a popup if the mii size is wrong |
try: |
amiibo.set_mii(mii_path) |
except InvalidMiiSizeError: |
sg.popup("Mii Dump Too Large!", title='Incorrect Mii Dump!') |
continue |
# Update the sections for the Mii name change |
for section in sections: |
section.update("LOAD_AMIIBO", window, amiibo, None) |
case "Update": |
config.set_update(True) |
release = update.get_release() |
assets = update.get_assets(release) |
update.update(assets) |
config.save_config() |
case "About": |
about.open_about_window(version_number) |
case "Change Theme": |
warning = theme.open_theme_window(config, show_reload_warning) |
if warning == "OK": |
window = reload_window(window, sections, column_key, updatePopUp) |
case "View Hex": |
if amiibo is None: |
pass |
hexview.show_hex(amiibo.get_data()) |
case "Load (CTRL+L)": |
selected_template = template.run_load_window() |
if selected_template is not None: |
template_values, template_name = selected_template |
for signature in template_values: |
for section in sections: |
if section.get_signature() == signature: |
try: |
section.update("TEMPLATE", window, amiibo, template_values[signature]) |
except (KeyError, IndexError, ValueError): |
continue |
# updated implicitly encoded sums |
implicit_sum_manager.update(event, window, amiibo) |
case "Edit": |
template.run_edit_window(sections, amiibo) |
case "Create": |
template.run_create_window(deepcopy(sections), amiibo) |
case "Metadata Transplant": |
if config.read_keys() is None: |
show_missing_key_warning() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.