(location, test_window=False)
| 53 | return None |
| 54 | |
| 55 | def make_window(location, test_window=False): |
| 56 | title_font = sg.user_settings_get_entry('-title font-', 'Courier 8') |
| 57 | title = sg.user_settings_get_entry('-title-', '') |
| 58 | main_number_font = sg.user_settings_get_entry('-main number font-', 'Courier 70') |
| 59 | |
| 60 | if not test_window: |
| 61 | theme = sg.user_settings_get_entry('-theme-', THEME) |
| 62 | sg.theme(theme) |
| 63 | |
| 64 | alpha = sg.user_settings_get_entry('-alpha-', ALPHA) |
| 65 | |
| 66 | # ------------------- Window Layout ------------------- |
| 67 | # If this is a test window (for choosing theme), then uses some extra Text Elements to display theme info |
| 68 | # and also enables events for the elements to make the window easy to close |
| 69 | if test_window: |
| 70 | top_elements = [[sg.Text(title, size=(20, 1), font=title_font, justification='c', k='-TITLE-', enable_events=True)], |
| 71 | [sg.Text('Click to close', font=title_font, enable_events=True)], |
| 72 | [sg.Text('This is theme', font=title_font, enable_events=True)], |
| 73 | [sg.Text(sg.theme(), font=title_font, enable_events=True)]] |
| 74 | right_click_menu = [[''], ['Exit',]] |
| 75 | else: |
| 76 | top_elements = [[sg.Text(title, size=(20, 1), font=title_font, justification='c', k='-TITLE-')]] |
| 77 | right_click_menu = [[''], ['Choose Date','Choose Title', 'Edit Me', 'Change Theme', 'Save Location', 'Refresh', 'Show Refresh Info', 'Hide Refresh Info', 'Set Title Font', 'Set Main Font','Alpha', [str(x) for x in range(1, 11)], 'Exit', ]] |
| 78 | |
| 79 | |
| 80 | layout = top_elements + \ |
| 81 | [[sg.Text('0', size=main_info_size, font=main_number_font, k='-MAIN INFO-', justification='c', enable_events=test_window)], |
| 82 | [sg.pin(sg.Text(size=(15, 2), font=refresh_font, k='-REFRESHED-', justification='c', visible=sg.user_settings_get_entry('-show refresh-', True)))]] |
| 83 | |
| 84 | try: |
| 85 | window = sg.Window('Day Number', layout, location=location, no_titlebar=True, grab_anywhere=True, margins=(0, 0), element_justification='c', element_padding=(0, 0), alpha_channel=alpha, finalize=True, right_click_menu=right_click_menu, right_click_menu_tearoff=False, keep_on_top=True) |
| 86 | except Exception as e: |
| 87 | if sg.popup_yes_no('Error creating your window', e, 'These are your current settings:', sg.user_settings(), 'Do you want to delete your settings file?') == 'Yes': |
| 88 | sg.user_settings_delete_filename() |
| 89 | sg.popup('Settings deleted.','Please restart your program') |
| 90 | exit() |
| 91 | window = None |
| 92 | |
| 93 | return window |
| 94 | |
| 95 | def main(location): |
| 96 | loc = sg.user_settings_get_entry('-location-', location) |
no outgoing calls
no test coverage detected