Merge pull request #4100 from PySimpleGUI/Dev-latest

Dev latest
This commit is contained in:
PySimpleGUI 2021-03-23 16:09:50 -04:00 committed by GitHub
commit d5a56ef035
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -30,7 +30,7 @@ def choose_theme(location):
[sg.Listbox(values=sg.theme_list(), size=(20, 20), key='-LIST-', enable_events=True)], [sg.Listbox(values=sg.theme_list(), size=(20, 20), key='-LIST-', enable_events=True)],
[sg.OK(), sg.Cancel()]] [sg.OK(), sg.Cancel()]]
window = sg.Window('Look and Feel Browser', layout, location=location) window = sg.Window('Look and Feel Browser', layout, location=location, keep_on_top=True)
old_theme = sg.theme() old_theme = sg.theme()
while True: # Event Loop while True: # Event Loop
event, values = window.read() event, values = window.read()
@ -39,7 +39,7 @@ def choose_theme(location):
sg.theme(values['-LIST-'][0]) sg.theme(values['-LIST-'][0])
test_window=make_window(location=(location[0]-200, location[1]), test_window=True) test_window=make_window(location=(location[0]-200, location[1]), test_window=True)
test_window.read(close=True) test_window.read(close=True)
if sg.popup_yes_no(f'Do you want to keep {values["-LIST-"]}?', location=location) == 'Yes': if sg.popup_yes_no(f'Do you want to keep {values["-LIST-"]}?', location=location, keep_on_top=True) == 'Yes':
break break
window.close() window.close()
@ -71,7 +71,7 @@ def make_window(location, test_window=False):
layout += [[sg.pin(sg.Text(size=(15,2), font=refresh_font, k='-REFRESHED-', justification='c', visible=sg.user_settings_get_entry('-show refresh-', True)))]] layout += [[sg.pin(sg.Text(size=(15,2), font=refresh_font, k='-REFRESHED-', justification='c', visible=sg.user_settings_get_entry('-show refresh-', True)))]]
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) 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, keep_on_top=True)
return window return window
@ -98,12 +98,12 @@ def main(location):
if event == 'Edit Me': if event == 'Edit Me':
sg.execute_editor(__file__) sg.execute_editor(__file__)
elif event == 'Choose Date': elif event == 'Choose Date':
new_start = sg.popup_get_date(location=window.current_location()) new_start = sg.popup_get_date(location=window.current_location(), keep_on_top=True)
if new_start is not None: if new_start is not None:
start_date = datetime.datetime(new_start[2], new_start[0], new_start[1]) start_date = datetime.datetime(new_start[2], new_start[0], new_start[1])
sg.user_settings_set_entry('-start date-', new_start) sg.user_settings_set_entry('-start date-', new_start)
elif event == 'Choose Title': elif event == 'Choose Title':
new_title = sg.popup_get_text('Choose a title for your date', location=window.current_location()) new_title = sg.popup_get_text('Choose a title for your date', location=window.current_location(), keep_on_top=True)
if new_title is not None: if new_title is not None:
window['-TITLE-'].update(new_title) window['-TITLE-'].update(new_title)
sg.user_settings_set_entry('-title-', new_title) sg.user_settings_set_entry('-title-', new_title)

View File

@ -33,7 +33,7 @@ def main():
sg.user_settings_set_entry('-last filename chosen1-', values['-COMBO1-']) sg.user_settings_set_entry('-last filename chosen1-', values['-COMBO1-'])
sg.user_settings_set_entry('-filenames2-', list(set(sg.user_settings_get_entry('-filenames2-', []) + [values['-COMBO2-'],]))) sg.user_settings_set_entry('-filenames2-', list(set(sg.user_settings_get_entry('-filenames2-', []) + [values['-COMBO2-'],])))
sg.user_settings_set_entry('-last filename chosen2-', values['-COMBO2-']) sg.user_settings_set_entry('-last filename chosen2-', values['-COMBO2-'])
sg.execute_command_subprocess(sg.pysimplegui_user_settings.get('-editor program-', None), 'diff',values['-COMBO1-'], values['-COMBO2-']) sg.execute_command_subprocess(sg.pysimplegui_user_settings.get('-editor program-', None), 'diff', '"' +values['-COMBO1-']+'"' , '"' +values['-COMBO2-']+'"' )
# sg.popup(f"You chose {values['-COMBO1-']} and {values['-COMBO2-']}") # sg.popup(f"You chose {values['-COMBO1-']} and {values['-COMBO2-']}")
elif event == '-CLEAR1-': elif event == '-CLEAR1-':
sg.user_settings_set_entry('-filenames1-', []) sg.user_settings_set_entry('-filenames1-', [])