text
stringlengths 0
93.6k
|
---|
def show_reload_warning():
|
"""
|
Runs a pop up window that asks user if it's okay to reset editing progress
|
:return: Ok or Cancel input from popup window
|
"""
|
popup = sg.PopupOKCancel('Doing this will reset your editing progress, continue?')
|
return popup
|
def show_missing_key_warning():
|
"""
|
Runs a pop up window telling the user to set keys
|
:return: Ok or Cancel input from popup window
|
"""
|
popup = sg.popup(f"Amiibo encryption key(s) are missing.\nThese keys are for encrypting/decrypting amiibo.\
|
\nYou can get them by searching for them on the internet.\nPlease select keys using Settings > Select Key",
|
title="Missing Key!")
|
return popup
|
def reload_window(window, sections, column_key, update):
|
"""
|
Reloads the window
|
:param sg.Window window: old window
|
:param list[Section()] sections: list of section objects
|
:param str column_key: key for column
|
:param bool update: whether or not it should be updated
|
:return: newly created window
|
"""
|
window1 = create_window(sections, column_key, update, window.CurrentLocation(), window.size)
|
window.close()
|
return window1
|
def create_layout_from_sections(sections):
|
"""
|
Creates GUI objects from section list
|
:param list[Section()] sections: list of section objects
|
:return: List of lists of gui widgets, last key index used
|
"""
|
output = []
|
# key index 0 is reserved for menu items
|
key_index = 1
|
for section in sections:
|
layout, new_index = section.get_widget(key_index)
|
output += layout
|
key_index = new_index
|
return output, key_index - 1
|
def main():
|
if os.path.isfile(os.path.join(os.getcwd(), "update.exe")):
|
os.remove(os.path.join(os.getcwd(), "update.exe"))
|
column_key = "COLUMN"
|
version_number = "1.7.0"
|
# initializes the config class
|
config = Config()
|
update = Updater(version_number, config)
|
sg.theme(config.get_color())
|
# if keys don't exist, tell the user
|
if config.read_keys() is None:
|
sg.popup(
|
'Key files not present!\nPlease select key(s) using Settings > Select Key(s)')
|
# if regions don't exist, tell the user
|
if config.get_region_path() is None:
|
sg.popup('Region file not present! Please put a regions.txt or regions.json in the resources folder.')
|
# If an update is found, prompt user if they want to update
|
updatePopUp = update.check_for_update()
|
# needed for implicit sum manager, only gets set if json type is loaded
|
implicit_sums = None
|
# temp reads regions into class
|
try:
|
if config.get_region_type() == 'txt':
|
sections = parse.load_from_txt(config.get_region_path())
|
elif config.get_region_type() == 'json':
|
sections, implicit_sums = parse.load_from_json(config.get_region_path())
|
else:
|
sg.popup("No region could be loaded")
|
exit()
|
except FileNotFoundError:
|
sg.popup("Regions file could not be found, please check your config.")
|
exit()
|
# saves config
|
config.save_config()
|
# impossible for sections to not be loaded when this is reached
|
# noinspection PyUnboundLocalVariable
|
window = create_window(sections, column_key, updatePopUp)
|
# initialize amiibo file variable
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.