Skip to content

Commit eb2f26d

Browse files
authored
Merge pull request PySimpleGUI#5326 from PySimpleGUI/Dev-latest
Release 4.59.0
2 parents d32497b + 3261ec1 commit eb2f26d

File tree

6 files changed

+110
-36
lines changed

6 files changed

+110
-36
lines changed

PySimpleGUI.py

Lines changed: 43 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
#!/usr/bin/python3
22

3-
version = __version__ = "4.58.0.2 Unreleased"
3+
version = __version__ = "4.59.0 Released 5-Apr-2022"
44

55
_change_log = """
6-
Changelog since 4.58.0 released to PyPI on 4-Apr-2022
6+
Changelog since 4.59.0 released to PyPI on 5-Apr-2022
77

8-
4.58.0.1
9-
Removed ttk theme from the test harness. Forgot that I had changed it for testing.
10-
4.58.0.2
11-
Fixed bug where disabled state was not corretly saved in update methods, causing events to not be generated (Thank you Jason, again!)
8+
129
"""
1310

1411
__version__ = version.split()[0] # For PEP 396 and PEP 345
@@ -522,6 +519,7 @@ def running_replit():
522519
DEFAULT_TABLE_SELECT_MODE = TABLE_SELECT_MODE_EXTENDED
523520
TABLE_CLICKED_INDICATOR = '+CLICKED+' # Part of the tuple returned as an event when a Table element has click events enabled
524521
DEFAULT_MODAL_WINDOWS_ENABLED = True
522+
DEFAULT_MODAL_WINDOWS_FORCED = False
525523

526524
TAB_LOCATION_TOP = 'top'
527525
TAB_LOCATION_TOP_LEFT = 'topleft'
@@ -11108,7 +11106,8 @@ def make_modal(self):
1110811106
return
1110911107

1111011108
# if modal windows have been disabled globally
11111-
if not DEFAULT_MODAL_WINDOWS_ENABLED:
11109+
if not DEFAULT_MODAL_WINDOWS_ENABLED and not DEFAULT_MODAL_WINDOWS_FORCED:
11110+
# if not DEFAULT_MODAL_WINDOWS_ENABLED:
1111211111
return
1111311112

1111411113
try:
@@ -16332,7 +16331,7 @@ def StartupTK(window):
1633216331
window.TKroot.protocol("WM_DESTROY_WINDOW", window._OnClosingCallback)
1633316332
window.TKroot.protocol("WM_DELETE_WINDOW", window._OnClosingCallback)
1633416333

16335-
if window.modal:
16334+
if window.modal or DEFAULT_MODAL_WINDOWS_FORCED:
1633616335
window.make_modal()
1633716336

1633816337
# window.TKroot.bind("<Configure>", window._config_callback)
@@ -17090,7 +17089,7 @@ def set_options(icon=None, button_color=None, element_size=(None, None), button_
1709017089
window_location=(None, None), error_button_color=(None, None), tooltip_time=None, tooltip_font=None, use_ttk_buttons=None, ttk_theme=None,
1709117090
suppress_error_popups=None, suppress_raise_key_errors=None, suppress_key_guessing=None,warn_button_key_duplicates=False, enable_treeview_869_patch=None,
1709217091
enable_mac_notitlebar_patch=None, use_custom_titlebar=None, titlebar_background_color=None, titlebar_text_color=None, titlebar_font=None,
17093-
titlebar_icon=None, user_settings_path=None, pysimplegui_settings_path=None, pysimplegui_settings_filename=None, keep_on_top=None, dpi_awareness=None, scaling=None, disable_modal_windows=None, tooltip_offset=(None, None)):
17092+
titlebar_icon=None, user_settings_path=None, pysimplegui_settings_path=None, pysimplegui_settings_filename=None, keep_on_top=None, dpi_awareness=None, scaling=None, disable_modal_windows=None, force_modal_windows=None, tooltip_offset=(None, None)):
1709417093
"""
1709517094
:param icon: Can be either a filename or Base64 value. For Windows if filename, it MUST be ICO format. For Linux, must NOT be ICO. Most portable is to use a Base64 of a PNG file. This works universally across all OS's
1709617095
:type icon: bytes | str
@@ -17198,8 +17197,10 @@ def set_options(icon=None, button_color=None, element_size=(None, None), button_
1719817197
:type dpi_awareness: (bool)
1719917198
:param scaling: Sets the default scaling for all windows including popups, etc.
1720017199
:type scaling: (float)
17201-
:param disable_modal_windows: If True then all windows, including popups, will not be modal windows
17200+
:param disable_modal_windows: If True then all windows, including popups, will not be modal windows (unless they've been set to FORCED using another option)
1720217201
:type disable_modal_windows: (bool)
17202+
:param force_modal_windows: If True then all windows will be modal (the disable option will be ignored... all windows will be forced to be modal)
17203+
:type force_modal_windows: (bool)
1720317204
:param tooltip_offset: Offset to use for tooltips as a tuple. These values will be added to the mouse location when the widget was entered.
1720417205
:type tooltip_offset: ((None, None) | (int, int))
1720517206
:return: None
@@ -17258,6 +17259,7 @@ def set_options(icon=None, button_color=None, element_size=(None, None), button_
1725817259
global DEFAULT_KEEP_ON_TOP
1725917260
global DEFAULT_SCALING
1726017261
global DEFAULT_MODAL_WINDOWS_ENABLED
17262+
global DEFAULT_MODAL_WINDOWS_FORCED
1726117263
global DEFAULT_TOOLTIP_OFFSET
1726217264
global _pysimplegui_user_settings
1726317265
# global _my_windows
@@ -17437,6 +17439,11 @@ def set_options(icon=None, button_color=None, element_size=(None, None), button_
1743717439
if disable_modal_windows is not None:
1743817440
DEFAULT_MODAL_WINDOWS_ENABLED = not disable_modal_windows
1743917441

17442+
if force_modal_windows is not None:
17443+
DEFAULT_MODAL_WINDOWS_FORCED = force_modal_windows
17444+
17445+
17446+
1744017447
if tooltip_offset != (None, None):
1744117448
DEFAULT_TOOLTIP_OFFSET = tooltip_offset
1744217449

@@ -19908,7 +19915,7 @@ def make_days_layout():
1990819915
prev_choice = (week, day)
1990919916
break
1991019917

19911-
if modal:
19918+
if modal or DEFAULT_MODAL_WINDOWS_FORCED:
1991219919
window.make_modal()
1991319920

1991419921
while True: # Event Loop
@@ -22569,7 +22576,7 @@ def _github_issue_post_validate(values, checklist, issue_types):
2256922576
issue_type = itype
2257022577
break
2257122578
if issue_type is None:
22572-
popup_error('Must choose issue type')
22579+
popup_error('Must choose issue type', keep_on_top=True)
2257322580
return False
2257422581
if values['-OS WIN-']:
2257522582
os_ver = values['-OS WIN VER-']
@@ -22580,28 +22587,28 @@ def _github_issue_post_validate(values, checklist, issue_types):
2258022587
elif values['-OS OTHER-']:
2258122588
os_ver = values['-OS OTHER VER-']
2258222589
else:
22583-
popup_error('Must choose Operating System')
22590+
popup_error('Must choose Operating System', keep_on_top=True)
2258422591
return False
2258522592

2258622593
if os_ver == '':
22587-
popup_error('Must fill in an OS Version')
22594+
popup_error('Must fill in an OS Version', keep_on_top=True)
2258822595
return False
2258922596

2259022597
checkboxes = any([values[('-CB-', i)] for i in range(len(checklist))])
2259122598
if not checkboxes:
22592-
popup_error('None of the checkboxes were checked.... you need to have tried something...anything...')
22599+
popup_error('None of the checkboxes were checked.... you need to have tried something...anything...', keep_on_top=True)
2259322600
return False
2259422601

2259522602
title = values['-TITLE-'].strip()
2259622603
if len(title) == 0:
22597-
popup_error("Title can't be blank")
22604+
popup_error("Title can't be blank", keep_on_top=True)
2259822605
return False
2259922606
elif title[1:len(title) - 1] == issue_type:
22600-
popup_error("Title can't be blank (only the type of issue isn't enough)")
22607+
popup_error("Title can't be blank (only the type of issue isn't enough)", keep_on_top=True)
2260122608
return False
2260222609

2260322610
if len(values['-ML DETAILS-']) < 4:
22604-
popup_error("A little more details would be awesome")
22611+
popup_error("A little more details would be awesome", keep_on_top=True)
2260522612
return False
2260622613

2260722614
return True
@@ -22791,7 +22798,7 @@ def main_open_github_issue():
2279122798
'the markdown, copying it to a text file, and then using it later to manually paste into a new issue '
2279222799
'\n'
2279322800
'Are you sure you want to quit?',
22794-
image=EMOJI_BASE64_PONDER,
22801+
image=EMOJI_BASE64_PONDER, keep_on_top=True
2279522802
) == 'Yes':
2279622803
break
2279722804
if event == WIN_CLOSED:
@@ -22817,7 +22824,7 @@ def main_open_github_issue():
2281722824
issue_type = itype
2281822825
break
2281922826
if issue_type is None:
22820-
popup_error('Must choose issue type')
22827+
popup_error('Must choose issue type', keep_on_top=True)
2282122828
continue
2282222829
if values['-OS WIN-']:
2282322830
operating_system = 'Windows'
@@ -22832,7 +22839,7 @@ def main_open_github_issue():
2283222839
operating_system = 'Other'
2283322840
os_ver = values['-OS OTHER VER-']
2283422841
else:
22835-
popup_error('Must choose Operating System')
22842+
popup_error('Must choose Operating System', keep_on_top=True)
2283622843
continue
2283722844
checkboxes = ['X' if values[('-CB-', i)] else ' ' for i in range(len(checklist))]
2283822845

@@ -23233,7 +23240,7 @@ def main_global_pysimplegui_settings():
2323323240
[B('Ok', bind_return_key=True), B('Cancel'), B('Mac Patch Control')],
2323423241
]
2323523242

23236-
window = Window('Settings', layout, keep_on_top=True)
23243+
window = Window('Settings', layout, keep_on_top=True, modal=True)
2323723244
while True:
2323823245
event, values = window.read()
2323923246
if event in ('Cancel', WIN_CLOSED):
@@ -23624,7 +23631,7 @@ def VerLine(version, description, justification='r', size=(40, 1)):
2362423631
VerLine('{}/{}'.format(tkversion, tclversion), 'TK/TCL Versions'),
2362523632
VerLine(tclversion_detailed, 'detailed tkinter version'),
2362623633
VerLine(os.path.dirname(os.path.abspath(__file__)), 'PySimpleGUI Location', size=(40, 2)),
23627-
VerLine(sys.version, 'Python Version', size=(40,2)) +[Image(PYTHON_COLORED_HEARTS_BASE64, subsample=3)]], pad=0)
23634+
VerLine(sys.version, 'Python Version', size=(40,2)) +[Image(PYTHON_COLORED_HEARTS_BASE64, subsample=3, k='-PYTHON HEARTS-', enable_events=True)]], pad=0)
2362823635

2362923636
layout_bottom = [
2363023637
[B(SYMBOL_DOWN, pad=(0, 0), k='-HIDE TABS-'),
@@ -23658,7 +23665,7 @@ def VerLine(version, description, justification='r', size=(40, 1)):
2365823665
right_click_menu=['&Right', ['Right', '!&Click', '&Menu', 'E&xit', 'Properties']],
2365923666
# transparent_color= '#9FB8AD',
2366023667
resizable=True,
23661-
keep_on_top=True,
23668+
keep_on_top=False,
2366223669
element_justification='left', # justify contents to the left
2366323670
metadata='My window metadata',
2366423671
finalize=True,
@@ -23686,6 +23693,8 @@ def main():
2368623693
"""
2368723694
The PySimpleGUI "Test Harness". This is meant to be a super-quick test of the Elements.
2368823695
"""
23696+
forced_modal = DEFAULT_MODAL_WINDOWS_FORCED
23697+
set_options(force_modal_windows=True)
2368923698
window = _create_main_window()
2369023699
set_options(keep_on_top=True)
2369123700
graph_elem = window['+GRAPH+']
@@ -23727,15 +23736,15 @@ def main():
2372723736
elif event == '-INSTALL-':
2372823737
_upgrade_gui()
2372923738
elif event == 'Popup':
23730-
popup('This is your basic popup')
23739+
popup('This is your basic popup', keep_on_top=True)
2373123740
elif event == 'Get File':
23732-
popup_scrolled('Returned:', popup_get_file('Get File'))
23741+
popup_scrolled('Returned:', popup_get_file('Get File', keep_on_top=True))
2373323742
elif event == 'Get Folder':
23734-
popup_scrolled('Returned:', popup_get_folder('Get Folder'))
23743+
popup_scrolled('Returned:', popup_get_folder('Get Folder', keep_on_top=True))
2373523744
elif event == 'Get Date':
23736-
popup_scrolled('Returned:', popup_get_date())
23745+
popup_scrolled('Returned:', popup_get_date(keep_on_top=True))
2373723746
elif event == 'Get Text':
23738-
popup_scrolled('Returned:', popup_get_text('Enter some text'))
23747+
popup_scrolled('Returned:', popup_get_text('Enter some text', keep_on_top=True))
2373923748
elif event.startswith('-UDEMY-'):
2374023749
webbrowser.open_new_tab(r'https://udemy.com/PySimpleGUI')
2374123750
elif event.startswith('-SPONSOR-'):
@@ -23745,9 +23754,9 @@ def main():
2374523754
if webbrowser_available:
2374623755
# webbrowser.open_new_tab(r'https://udemy.com/PySimpleGUI')
2374723756
webbrowser.open_new_tab(r'https://www.buymeacoffee.com/PySimpleGUI')
23748-
elif event in ('-EMOJI-HEARTS-', '-HEART-'):
23757+
elif event in ('-EMOJI-HEARTS-', '-HEART-', '-PYTHON HEARTS-'):
2374923758
popup_scrolled("Oh look! It's a Udemy discount coupon!", 'BDC40CE5211BD258C767',
23750-
'A personal message from Mike -- thank you so very much for supporting PySimpleGUI!', title='Udemy Coupon', image=EMOJI_BASE64_MIKE)
23759+
'A personal message from Mike -- thank you so very much for supporting PySimpleGUI!', title='Udemy Coupon', image=EMOJI_BASE64_MIKE, keep_on_top=True)
2375123760

2375223761
elif event == 'Themes':
2375323762
search_string = popup_get_text('Enter a search term or leave blank for all themes', 'Show Available Themes', keep_on_top=True)
@@ -23778,8 +23787,10 @@ def main():
2377823787
elif event == 'P NoTitle':
2377923788
popup_no_titlebar('No titlebar', keep_on_top=True)
2378023789
elif event == 'P NoModal':
23790+
set_options(force_modal_windows=False)
2378123791
popup('Normal Popup - Not Modal', 'You can interact with main window menubar ',
2378223792
'but will have no effect immediately', 'button clicks will happen after you close this popup', modal=False, keep_on_top=True)
23793+
set_options(force_modal_windows=True)
2378323794
elif event == 'P NoBlock':
2378423795
popup_non_blocking('Non-blocking', 'The background window should still be running', keep_on_top=True)
2378523796
elif event == 'P AutoClose':
@@ -23794,7 +23805,7 @@ def main():
2379423805
# _refresh_debugger()
2379523806
print('event = ', event)
2379623807
window.close()
23797-
23808+
set_options(force_modal_windows=forced_modal)
2379823809

2379923810
# ------------------------ PEP8-ify The SDK ------------------------#
2380023811

docs/call reference.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19463,6 +19463,7 @@ set_options(icon = None,
1946319463
dpi_awareness = None,
1946419464
scaling = None,
1946519465
disable_modal_windows = None,
19466+
force_modal_windows = None,
1946619467
tooltip_offset = (None, None))
1946719468
```
1946819469

@@ -19523,7 +19524,8 @@ Parameter Descriptions:
1952319524
| bool | keep_on_top | If True then all windows will automatically be set to keep_on_top=True |
1952419525
| bool | dpi_awareness | If True then will turn on DPI awareness (Windows only at the moment) |
1952519526
| float | scaling | Sets the default scaling for all windows including popups, etc. |
19526-
| bool | disable_modal_windows | If True then all windows, including popups, will not be modal windows |
19527+
| bool | disable_modal_windows | If True then all windows, including popups, will not be modal windows (unless they've been set to FORCED using another option) |
19528+
| bool | force_modal_windows | If True then all windows will be modal (the disable option will be ignored... all windows will be forced to be modal) |
1952719529
| ((None, None) or (int, int)) | tooltip_offset | Offset to use for tooltips as a tuple. These values will be added to the mouse location when the widget was entered. |
1952819530
| None | **RETURN** | None
1952919531

@@ -19597,6 +19599,7 @@ SetOptions(icon = None,
1959719599
dpi_awareness = None,
1959819600
scaling = None,
1959919601
disable_modal_windows = None,
19602+
force_modal_windows = None,
1960019603
tooltip_offset = (None, None))
1960119604
```
1960219605

@@ -19657,7 +19660,8 @@ Parameter Descriptions:
1965719660
| bool | keep_on_top | If True then all windows will automatically be set to keep_on_top=True |
1965819661
| bool | dpi_awareness | If True then will turn on DPI awareness (Windows only at the moment) |
1965919662
| float | scaling | Sets the default scaling for all windows including popups, etc. |
19660-
| bool | disable_modal_windows | If True then all windows, including popups, will not be modal windows |
19663+
| bool | disable_modal_windows | If True then all windows, including popups, will not be modal windows (unless they've been set to FORCED using another option) |
19664+
| bool | force_modal_windows | If True then all windows will be modal (the disable option will be ignored... all windows will be forced to be modal) |
1966119665
| ((None, None) or (int, int)) | tooltip_offset | Offset to use for tooltips as a tuple. These values will be added to the mouse location when the widget was entered. |
1966219666
| None | **RETURN** | None
1966319667

docs/index.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9928,6 +9928,24 @@ Visibility losing settings fix
99289928
- `header_relief` - the type of header relief to use
99299929
- `Table` and `Tree` elements are now excluded from grab-anywhere so that headers can be resized without moving the window
99309930

9931+
## 4.59.0 PySimpleGUI 4-Apr-2022
9932+
9933+
An oh sh*t release due to yesterday's bug
9934+
New force modal Windows option
9935+
Test harness forces all windows to be modal and is no longer keep-on-top
9936+
9937+
- Removed ttk theme from the test harness. Forgot that I had changed it for testing.
9938+
- Fixed bug where disabled state was not correctly saved in update methods, causing events to not be generated (Thank you Jason, again!)
9939+
- Changed numerous elements, not just the `Input` element that demonstrated the problem
9940+
- New `force_modal_windows` parm added to `set_options`
9941+
- Forces all windows to be modal
9942+
- Overrides the `disable_modal_windows` option
9943+
- Used in the `main()` test harness to ensure all windows are modal so no window is accidentally lost
9944+
- Test Harness changes
9945+
- Set `keep_on_top=True` for all popups and windows created by test harness
9946+
- Set the main window `keep_on_top=False`. Ensures that all windows created by it should never be hidden. This is a somewhat experimental change. Let's hope for the best!
9947+
- Forced all windows except for 1 non-modal popup to be modal. This also should ensure no windows are "lost" behind the main window
9948+
99319949
## Code Condition
99329950

99339951
Make it run

readme_creator/markdown input files/4_Release_notes.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2472,6 +2472,25 @@ Visibility losing settings fix
24722472
- `header_relief` - the type of header relief to use
24732473
- `Table` and `Tree` elements are now excluded from grab-anywhere so that headers can be resized without moving the window
24742474

2475+
## 4.59.0 PySimpleGUI 4-Apr-2022
2476+
2477+
An oh sh*t release due to yesterday's bug
2478+
New force modal Windows option
2479+
Test harness forces all windows to be modal and is no longer keep-on-top
2480+
2481+
- Removed ttk theme from the test harness. Forgot that I had changed it for testing.
2482+
- Fixed bug where disabled state was not correctly saved in update methods, causing events to not be generated (Thank you Jason, again!)
2483+
- Changed numerous elements, not just the `Input` element that demonstrated the problem
2484+
- New `force_modal_windows` parm added to `set_options`
2485+
- Forces all windows to be modal
2486+
- Overrides the `disable_modal_windows` option
2487+
- Used in the `main()` test harness to ensure all windows are modal so no window is accidentally lost
2488+
- Test Harness changes
2489+
- Set `keep_on_top=True` for all popups and windows created by test harness
2490+
- Set the main window `keep_on_top=False`. Ensures that all windows created by it should never be hidden. This is a somewhat experimental change. Let's hope for the best!
2491+
- Forced all windows except for 1 non-modal popup to be modal. This also should ensure no windows are "lost" behind the main window
2492+
2493+
24752494
## Code Condition
24762495

24772496
Make it run

0 commit comments

Comments
 (0)