v2 finished selective (boss or level) music select

This commit is contained in:
Timothy GFO 2023-11-30 21:43:04 -04:00
parent 51372dfecb
commit da65552076
2 changed files with 34 additions and 35 deletions

View file

@ -23,6 +23,7 @@ To use it just launch the executable file (if available for your os) or type "py
If you have any issues make a gitlab issue. There may be bugs. If you have any issues make a gitlab issue. There may be bugs.
## Roadmap ## Roadmap
* improve the single-song actions to make them more persistant
* modify restore_ogmusic so it is able to restore only the last change. Maybe config files will be needed for this. * modify restore_ogmusic so it is able to restore only the last change. Maybe config files will be needed for this.
* make it so that if "you press apply music and then replace song" it checks for that and doesn't allow the "replaced song" to be reverted back to original. * make it so that if "you press apply music and then replace song" it checks for that and doesn't allow the "replaced song" to be reverted back to original.
* "now playing" text * "now playing" text

View file

@ -75,7 +75,7 @@ def get_original_songs(megamaker_folder):
window.write_event_value('-THREAD DONE-', True) window.write_event_value('-THREAD DONE-', True)
return True return True
app_version = "v1.3" app_version = "v2.0"
def check_if_new_version(): def check_if_new_version():
response = requests.get("https://gitlab.com/api/v4/projects/51771052/repository/tags") response = requests.get("https://gitlab.com/api/v4/projects/51771052/repository/tags")
newest_version = response.json()[0]["name"] newest_version = response.json()[0]["name"]
@ -297,7 +297,7 @@ title = [
change_all = [ change_all = [
[sg.Button("Mute All"), sg.Button("Apply Music"), sg.Button("Restore Music")], [sg.Button("Mute All"), sg.Button("Apply Music"), sg.Button("Restore Music")],
[sg.Button("Apply as Boss Music"), sg.Button("Apply as Level Music"), sg.Button("Mute Level Music"), sg.Button("Mute Boss Music")] [sg.Checkbox("Boss Music", default=True, key="-BOSS-"), sg.Checkbox("Level Music", default=True, key="-LEVEL-")]
] ]
change_one = [ change_one = [
@ -326,8 +326,11 @@ while True:
window.set_icon(icon) window.set_icon(icon)
window.refresh() window.refresh()
if event in (sg.WINDOW_CLOSED,"Exit"): if event in (sg.WINDOW_CLOSED,"Exit"):
sg.user_settings_set_entry('-INPUT_NSF-', values['-IN-']) try:
sg.user_settings_set_entry('-MEGAMAKER_FOLDER-', values['-OUT-']) sg.user_settings_set_entry('-INPUT_NSF-', values['-IN-'])
sg.user_settings_set_entry('-MEGAMAKER_FOLDER-', values['-OUT-'])
except TypeError:
pass
break break
window.Element('_IMAGE_').UpdateAnimation(gif, time_between_frames=100) window.Element('_IMAGE_').UpdateAnimation(gif, time_between_frames=100)
if running: if running:
@ -347,23 +350,18 @@ while True:
if event == "About": if event == "About":
sg.popup(how_to_use) sg.popup(how_to_use)
if event == "Mute All": if event == "Mute All":
create_mute_file(mute_nsf) if values["-BOSS-"] == True or values["-LEVEL-"] == True:
if not nsf_changer(os.path.join(os.path.dirname(__file__), "mmm_nsf_changer_mute.nsf"), values["-OUT-"]): if values["-BOSS-"] == True and values["-LEVEL-"] == True:
restore_ogmusic(values["-OUT-"]) whitelist = []
if not nsf_changer(os.path.join(os.path.dirname(__file__), "mmm_nsf_changer_mute.nsf"), values["-OUT-"]): elif values["-BOSS-"] == True:
sg.popup_error("MegaMaker folder is not valid or definitions are out of date.") whitelist = boss_music()
if event == "Mute Boss Music": elif values["-LEVEL-"] == True:
create_mute_file(mute_nsf) whitelist = level_music()
if not nsf_changer(os.path.join(os.path.dirname(__file__), "mmm_nsf_changer_mute.nsf"), values["-OUT-"], whitelist=boss_music()): create_mute_file(mute_nsf)
restore_ogmusic(values["-OUT-"]) if not nsf_changer(os.path.join(os.path.dirname(__file__), "mmm_nsf_changer_mute.nsf"), values["-OUT-"], whitelist=whitelist):
if not nsf_changer(os.path.join(os.path.dirname(__file__), "mmm_nsf_changer_mute.nsf"), values["-OUT-"], whitelist=boss_music()): restore_ogmusic(values["-OUT-"])
sg.popup_error("MegaMaker folder is not valid or definitions are out of date.") if not nsf_changer(os.path.join(os.path.dirname(__file__), "mmm_nsf_changer_mute.nsf"), values["-OUT-"], whitelist=whitelist):
if event == "Mute Level Music": sg.popup_error("MegaMaker folder is not valid or definitions are out of date.")
create_mute_file(mute_nsf)
if not nsf_changer(os.path.join(os.path.dirname(__file__), "mmm_nsf_changer_mute.nsf"), values["-OUT-"], whitelist=level_music()):
restore_ogmusic(values["-OUT-"])
if not nsf_changer(os.path.join(os.path.dirname(__file__), "mmm_nsf_changer_mute.nsf"), values["-OUT-"], whitelist=level_music()):
sg.popup_error("MegaMaker folder is not valid or definitions are out of date.")
if event == "Replace Song": if event == "Replace Song":
if values["-DROPDOWN-"] == "": if values["-DROPDOWN-"] == "":
sg.popup_error('Please select which Output NSF File to replace. If not, use "Replace *All* NSF Music".') sg.popup_error('Please select which Output NSF File to replace. If not, use "Replace *All* NSF Music".')
@ -379,24 +377,24 @@ while True:
else: else:
window["-LAST-CHANGED-"].update("") window["-LAST-CHANGED-"].update("")
if event == "Apply Music": if event == "Apply Music":
if not nsf_changer(values["-IN-"], values["-OUT-"]): if values["-BOSS-"] == True or values["-LEVEL-"] == True:
restore_ogmusic(values["-OUT-"]) if values["-BOSS-"] == True and values["-LEVEL-"] == True:
if not nsf_changer(values["-IN-"], values["-OUT-"]): whitelist = []
sg.popup_error("MegaMaker folder is not valid or definitions out of date.") elif values["-BOSS-"] == True:
whitelist = boss_music()
elif values["-LEVEL-"] == True:
whitelist = level_music()
if not nsf_changer(values["-IN-"], values["-OUT-"], whitelist=whitelist):
restore_ogmusic(values["-OUT-"])
if not nsf_changer(values["-IN-"], values["-OUT-"], whitelist=whitelist):
sg.popup_error("MegaMaker folder is not valid or definitions out of date.")
else:
sg.popup("None of the checkboxes are active.")
if event == "Restore Music": # Needs testing if event == "Restore Music": # Needs testing
# sg.popup_error("DOESNT WORK EITHER HAHAHAHAHAHAA") # sg.popup_error("DOESNT WORK EITHER HAHAHAHAHAHAA")
if not restore_ogmusic(values["-OUT-"]): if not restore_ogmusic(values["-OUT-"]):
sg.popup_error("Already Restored or wrong Mega Man Maker folder.") sg.popup_error("Already Restored or wrong Mega Man Maker folder.")
if event == "Apply as Boss Music":
if not nsf_changer(values["-IN-"], values["-OUT-"], whitelist=boss_music()):
restore_ogmusic(values["-OUT-"])
if not nsf_changer(values["-IN-"], values["-OUT-"], whitelist=boss_music()):
sg.popup_error("MegaMaker folder is not valid or definitions out of date.")
if event == "Apply as Level Music":
if not nsf_changer(values["-IN-"], values["-OUT-"], whitelist=level_music()):
restore_ogmusic(values["-OUT-"])
if not nsf_changer(values["-IN-"], values["-OUT-"], whitelist=level_music()):
sg.popup_error("MegaMaker folder is not valid or definitions out of date.")
if event == "Download and Restore Music": if event == "Download and Restore Music":
sg.popup_yes_no("WARNING: This will erase all custom songs.\nDo you want to continue?", location=window.current_location()) sg.popup_yes_no("WARNING: This will erase all custom songs.\nDo you want to continue?", location=window.current_location())
window["-LAST-CHANGED-"].update("") window["-LAST-CHANGED-"].update("")