fix the GUI

i was a little hasty with the first attempt. this one has been tested
and actually works
master
magical 2024-02-05 19:28:00 -08:00
parent ad6cf68969
commit a49f9dde32
1 changed files with 6 additions and 6 deletions

12
GUI.py
View File

@ -40,7 +40,7 @@ def fileHash(fileName):
return hash & 0xFFFFFFFF return hash & 0xFFFFFFFF
def rando_thread(window = None, values = None): def rando_thread(window = None, values = None):
global failedgen, randoerror, generating, fileName, basegame, failedgen, randoerror, generating, finishGenerating global fileName, basegame, failedgen, randoerror, generating, finishGenerating
values.update({ values.update({
'Difficulty': int(values.get('Difficulty')) }) 'Difficulty': int(values.get('Difficulty')) })
if values['Num']: if values['Num']:
@ -78,7 +78,7 @@ def rando_thread(window = None, values = None):
def main_window(debug): def main_window(debug):
global fileName, finishGenerating, basegame, finishGenerating global fileName, basegame, generating, finishGenerating
itemPool = [ itemPool = [
[ [
ui.Text('Charge Beam'), ui.Text('Charge Beam'),
@ -236,7 +236,7 @@ def main_window(debug):
if event == ui.WINDOW_CLOSED: if event == ui.WINDOW_CLOSED:
break break
elif event == 'Num': if event == 'Num':
if len(values['Num']) > 3: if len(values['Num']) > 3:
window['Num'].update(oldNum) window['Num'].update(oldNum)
for x in range(4): for x in range(4):
@ -247,7 +247,7 @@ def main_window(debug):
else: else:
oldNum = values['Num'] oldNum = values['Num']
elif event == 'Generate': if event == 'Generate':
basegame = ui.popup_get_file('Choose base game', no_titlebar=True, file_types=[('GBA File', '*.gba')], history=True, history_setting_filename=os.path.join('.', 'settings.json')) basegame = ui.popup_get_file('Choose base game', no_titlebar=True, file_types=[('GBA File', '*.gba')], history=True, history_setting_filename=os.path.join('.', 'settings.json'))
if basegame == '': if basegame == '':
ui.popup('Please select a Metroid Fusion (U) rom.', title='No source rom selected') ui.popup('Please select a Metroid Fusion (U) rom.', title='No source rom selected')
@ -273,11 +273,11 @@ def main_window(debug):
window['Patch'].update(disabled=True) window['Patch'].update(disabled=True)
window['Generate'].update(disabled=True) window['Generate'].update(disabled=True)
if generating: while generating:
ui.popup_animated(ui.DEFAULT_BASE64_LOADING_GIF, 'Generating game, please wait...', time_between_frames=20) ui.popup_animated(ui.DEFAULT_BASE64_LOADING_GIF, 'Generating game, please wait...', time_between_frames=20)
window.Refresh() window.Refresh()
elif finishGenerating: if finishGenerating:
ui.popup_animated(None) ui.popup_animated(None)
if failedgen: if failedgen:
ui.popup('Could not generate a game with the current settings. Try changing your settings.', title='Metroid Fusion Open Randomizer') ui.popup('Could not generate a game with the current settings. Try changing your settings.', title='Metroid Fusion Open Randomizer')