()
| 85 | |
| 86 | |
| 87 | def main(): |
| 88 | window = make_window() |
| 89 | |
| 90 | while True: |
| 91 | event, values = window.read(timeout=1000) # Not needed but handy while debugging |
| 92 | # print(event, values) |
| 93 | if event in (sg.WIN_CLOSE_ATTEMPTED_EVENT, 'Exit', sg.WIN_CLOSED): |
| 94 | if event != sg.WIN_CLOSED: |
| 95 | if sg.user_settings_get_entry('-auto save location-', True): |
| 96 | print('saving locatoin', window.current_location()) |
| 97 | sg.user_settings_set_entry('-window location-', window.current_location()) |
| 98 | break |
| 99 | if event in launcher_buttons: |
| 100 | action = window[event].metadata |
| 101 | if isinstance(action, str): |
| 102 | if action.endswith(('.py', '.pyw')): |
| 103 | sg.execute_py_file(action) |
| 104 | else: |
| 105 | sg.execute_command_subprocess(action) |
| 106 | elif callable(action): |
| 107 | action() |
| 108 | if event == 'Edit Me': |
| 109 | sg.execute_editor(__file__) |
| 110 | elif event == 'Version': |
| 111 | sg.popup_scrolled(sg.get_versions()) |
| 112 | elif event == 'Settings': |
| 113 | settings(window) |
| 114 | window.close() |
| 115 | window = make_window() |
| 116 | elif event == sg.SYMBOL_DOWN_ARROWHEAD: |
| 117 | window['-BUTTON COL-'].update(visible=False) |
| 118 | window['-MINIMIZED COL-'].update(visible=True) |
| 119 | elif event == '-MINIMIZED IMAGE-': |
| 120 | window['-BUTTON COL-'].update(visible=True) |
| 121 | window['-MINIMIZED COL-'].update(visible=False) |
| 122 | window.close() |
| 123 | |
| 124 | |
| 125 | if __name__ == '__main__': |
no test coverage detected