Compare commits
1 Commits
4622f61057
...
07faf6bd11
Author | SHA1 | Date |
---|---|---|
magical | 07faf6bd11 |
20
GUI.py
20
GUI.py
|
@ -231,23 +231,19 @@ def main_window(debug):
|
||||||
fileName = str()
|
fileName = str()
|
||||||
finishGenerating = False
|
finishGenerating = False
|
||||||
oldNum = str()
|
oldNum = str()
|
||||||
while True:
|
|
||||||
(event, values) = window.read()
|
(event, values) = window.read()
|
||||||
if event == ui.WINDOW_CLOSED:
|
if event == ui.WINDOW_CLOSED:
|
||||||
break
|
pass
|
||||||
|
|
||||||
elif event == 'Num':
|
elif 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):
|
||||||
if x < len(values['Num']):
|
if x < len(values['Num']) or values['Num'][x] not in '0123456789':
|
||||||
if values['Num'][x] not in '0123456789':
|
|
||||||
window['Num'].update(oldNum)
|
window['Num'].update(oldNum)
|
||||||
break
|
|
||||||
else:
|
|
||||||
oldNum = values['Num']
|
|
||||||
|
|
||||||
elif event == 'Generate':
|
oldNum = values['Num']
|
||||||
|
# continue
|
||||||
|
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')
|
||||||
|
@ -272,12 +268,11 @@ def main_window(debug):
|
||||||
window['Num'].update(disabled=True)
|
window['Num'].update(disabled=True)
|
||||||
window['Patch'].update(disabled=True)
|
window['Patch'].update(disabled=True)
|
||||||
window['Generate'].update(disabled=True)
|
window['Generate'].update(disabled=True)
|
||||||
|
|
||||||
if generating:
|
if 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()
|
||||||
|
# continue
|
||||||
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')
|
||||||
|
@ -304,5 +299,6 @@ def main_window(debug):
|
||||||
window['Patch'].update(disabled=False)
|
window['Patch'].update(disabled=False)
|
||||||
window['Generate'].update(disabled=False)
|
window['Generate'].update(disabled=False)
|
||||||
finishGenerating = False
|
finishGenerating = False
|
||||||
|
# continue
|
||||||
window.close()
|
window.close()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue