Dataset Viewer
Auto-converted to Parquet
text
stringlengths
1
93.6k
# <FILESEP>
from utils import region_parse as parse
import FreeSimpleGUI as sg
from utils.virtual_amiibo_file import VirtualAmiiboFile, JSONVirtualAmiiboFile, InvalidAmiiboDump, AmiiboHMACTagError, AmiiboHMACDataError, InvalidMiiSizeError
from utils.updater import Updater
from utils.config import Config
import os
from tkinter import filedialog
from windows import template
from copy import deepcopy
from windows import hexview
from utils.section_manager import ImplicitSumManager
from windows import about
from windows import metadata_transplant
from windows import initialize
from windows import theme
import ctypes
myappid = u'sae.editor.sae.1.7.0' # arbitrary string
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
def get_menu_def(update_available: bool, amiibo_loaded: bool, ryujinx: bool = False):
"""
Creates menu definition for window
:param bool update_available: If update is available or not
:param bool amiibo_loaded: If amiibo has been loaded or not
:param bool ryujinx: if loaded amiibo is ryujinx json
:return: tuple of menu
"""
if amiibo_loaded:
file_tab = ['&File', ['&Open (CTRL+O)', '&Save', 'Save &As (CTRL+S)', 'Copy &Values', '---', '&Metadata Transplant', '&View Hex']]
mii_tab = ["&Mii", ["&Dump Mii", "&Load Mii"]]
if ryujinx:
file_tab = ['&File', ['&Open (CTRL+O)', '&Save', 'Save &As (CTRL+S)', 'Copy &Values', '---', '&Metadata Transplant', '!&View Hex']]
mii_tab = ["!&Mii", ["&Dump Mii", "&Load Mii"]]
else:
file_tab = ['&File', ['&Open (CTRL+O)', '!&Save', '!Save &As (CTRL+S)', '!Copy &Values', '---', '&Metadata Transplant', '!&View Hex']]
mii_tab = ["!&Mii", ["&Dump Mii", "&Load Mii"]]
template_tab = ['&Template', ['&Create', '&Edit', '&Load (CTRL+L)']]
if update_available:
settings_tab = ['&Settings', ['Select &Key(s)', 'Select &Regions', '---', '&Update', '&Change Theme', '&About']]
else:
settings_tab = ['&Settings', ['Select &Key(s)', 'Select &Regions', '---', '!&Update', '&Change Theme', '&About']]
return file_tab, mii_tab, template_tab, settings_tab
def create_window(sections, column_key, update, location=None, size=None):
"""
Creates the window of the application
:param List[Sections] sections: list of section objects
:param str column_key: key for column
:param bool update: whether or not an update is available
:param Tuple(int, int) location: window location to use
:param Tuple(int, int) size: window size to use
:return: window object
"""
section_layout, last_key = create_layout_from_sections(sections)
menu_def = get_menu_def(update, False)
layout = [[sg.Menu(menu_def)],
[sg.Text("The amiibo's personality is: None", key="PERSONALITY")],
[sg.Column(section_layout, size=(None, 180), scrollable=True, vertical_scroll_only=True,
element_justification='left', key=column_key, expand_x=True, expand_y=True)],
[sg.Button("Load", key="LOAD_AMIIBO", enable_events=True),
sg.Button("Save", key="SAVE_AMIIBO", enable_events=True, disabled=True),
sg.Checkbox("Shuffle SN", key="SHUFFLE_SN", default=False)]]
if location is not None:
window = sg.Window("Smash Amiibo Editor", layout, resizable=True, location=location, size=size, icon="SAE.ico")
else:
window = sg.Window("Smash Amiibo Editor", layout, resizable=True, icon="SAE.ico")
window.finalize()
# adds event to spin widgets
# disables all options until bin is loaded
for i in range(1, last_key+1):
window[str(i)].bind('<KeyPress>', '')
try:
window[str(i)].update(disabled=True)
# deals with bit numbers not having disabled property
except TypeError:
pass
# for windows Control works, for MacOS change to Command
# hot key for opening
window.bind('<Control-o>', "Open (CTRL+O)")
# hot key for loading template
window.bind('<Control-l>', "Load (CTRL+L)")
# hot key for saving gets set when an amiibo is loaded
# needed or else window will be super small (because of menu items?)
window.set_min_size((700, 500))
return window
End of preview. Expand in Data Studio
Downloads last month
76