diff --git a/PySimpleGUI.py b/PySimpleGUI.py index deb8f254..51b05ed9 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1,13 +1,15 @@ #!/usr/bin/python3 -version = __version__ = "4.60.1 Released 22-May-2022" +version = __version__ = "4.60.2 Released 26-Jul-2022" _change_log = """ - Changelog since 4.60.0 released to PyPI on 8-May-2022 + Changelog since 4.60.0 released to PyPI on 8-May-2022. These are "Dot" releases.... 4.60.1 A "dot-release" / patch for crash that occurs if the horizontal_scroll parm is set in Listbox element Was created when the ttk scrollbars were added + 4.60.2 + A "dot-release" for Mac 12.3+ "Invisible window" problem. Adds option in Mac control panel to set Alpha to 0.99 as default """ __version__ = version.split()[0] # For PEP 396 and PEP 345 @@ -422,6 +424,7 @@ DEFAULT_TOOLTIP_TIME = 400 DEFAULT_TOOLTIP_OFFSET = (0, -20) DEFAULT_KEEP_ON_TOP = None DEFAULT_SCALING = None +DEFAULT_ALPHA_CHANNEL = 1.0 TOOLTIP_BACKGROUND_COLOR = "#ffffe0" TOOLTIP_FONT = None #################### COLOR STUFF #################### @@ -615,6 +618,7 @@ ENABLE_TREEVIEW_869_PATCH = True ENABLE_MAC_NOTITLEBAR_PATCH = False ENABLE_MAC_MODAL_DISABLE_PATCH = False ENABLE_MAC_DISABLE_GRAB_ANYWHERE_WITH_TITLEBAR = True +ENABLE_MAC_ALPHA_99_PATCH= False OLD_TABLE_TREE_SELECTED_ROW_COLORS = ('#FFFFFF', '#4A6984') ALTERNATE_TABLE_AND_TREE_SELECTED_ROW_COLORS = ('SystemHighlightText', 'SystemHighlight') @@ -9328,7 +9332,7 @@ class Window: element_padding=None, margins=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=None, force_toplevel=False, - alpha_channel=1, return_keyboard_events=False, use_default_focus=True, text_justification=None, + alpha_channel=None, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=False, grab_anywhere_using_control=True, keep_on_top=None, resizable=False, disable_close=False, disable_minimize=False, right_click_menu=None, transparent_color=None, debugger_enabled=True, right_click_menu_background_color=None, right_click_menu_text_color=None, right_click_menu_disabled_text_color=None, @@ -9518,7 +9522,7 @@ class Window: self.KeepOnTop = keep_on_top self.ForceTopLevel = force_toplevel self.Resizable = resizable - self._AlphaChannel = alpha_channel + self._AlphaChannel = alpha_channel if alpha_channel is not None else DEFAULT_ALPHA_CHANNEL self.Timeout = None self.TimeoutKey = TIMEOUT_KEY self.TimerCancelled = False @@ -17740,7 +17744,7 @@ def set_options(icon=None, button_color=None, element_size=(None, None), button_ suppress_error_popups=None, suppress_raise_key_errors=None, suppress_key_guessing=None,warn_button_key_duplicates=False, enable_treeview_869_patch=None, enable_mac_notitlebar_patch=None, use_custom_titlebar=None, titlebar_background_color=None, titlebar_text_color=None, titlebar_font=None, 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), - sbar_trough_color=None, sbar_background_color=None, sbar_arrow_color=None, sbar_width=None, sbar_arrow_width=None, sbar_frame_color=None, sbar_relief=None): + sbar_trough_color=None, sbar_background_color=None, sbar_arrow_color=None, sbar_width=None, sbar_arrow_width=None, sbar_frame_color=None, sbar_relief=None, alpha_channel=None): """ :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 :type icon: bytes | str @@ -17867,6 +17871,8 @@ def set_options(icon=None, button_color=None, element_size=(None, None), button_ :param sbar_frame_color: Scrollbar Color of frame around scrollbar (available only on some ttk themes) :type sbar_frame_color: (str) :param sbar_relief: Scrollbar relief that will be used for the "thumb" of the scrollbar (the thing you grab that slides). Should be a constant that is defined at starting with "RELIEF_" - RELIEF_RAISED, RELIEF_SUNKEN, RELIEF_FLAT, RELIEF_RIDGE, RELIEF_GROOVE, RELIEF_SOLID + :param alpha_channel Default alpha channel to be used on all windows + :type alpha_channel (float) :type sbar_relief: (str) :return: None :rtype: None @@ -17926,6 +17932,8 @@ def set_options(icon=None, button_color=None, element_size=(None, None), button_ global DEFAULT_MODAL_WINDOWS_ENABLED global DEFAULT_MODAL_WINDOWS_FORCED global DEFAULT_TOOLTIP_OFFSET + global DEFAULT_ALPHA_CHANNEL + global _pysimplegui_user_settings global ttk_part_overrides_from_options # global _my_windows @@ -18111,6 +18119,8 @@ def set_options(icon=None, button_color=None, element_size=(None, None), button_ if tooltip_offset != (None, None): DEFAULT_TOOLTIP_OFFSET = tooltip_offset + if alpha_channel is not None: + DEFAULT_ALPHA_CHANNEL = alpha_channel # ---------------- ttk scrollbar section ---------------- if sbar_background_color is not None: @@ -22256,7 +22266,8 @@ available to make this process more atuomatic. # Dictionary of Mac Patches. Used to find the key in the global settings and the default value MAC_PATCH_DICT = {'Enable No Titlebar Patch' : ('-mac feature enable no titlebar patch-', False), 'Disable Modal Windows' : ('-mac feature disable modal windows-', True), - 'Disable Grab Anywhere with Titlebar' : ('-mac feature disable grab anywhere with titlebar-', True)} + 'Disable Grab Anywhere with Titlebar' : ('-mac feature disable grab anywhere with titlebar-', True), + 'Set Alpha Channel to 0.99 for MacOS >= 12.3' : ('-mac feature disable Alpha 0.99', True)} def _read_mac_global_settings(): """ @@ -22267,6 +22278,7 @@ def _read_mac_global_settings(): global ENABLE_MAC_MODAL_DISABLE_PATCH global ENABLE_MAC_NOTITLEBAR_PATCH global ENABLE_MAC_DISABLE_GRAB_ANYWHERE_WITH_TITLEBAR + global ENABLE_MAC_ALPHA_99_PATCH ENABLE_MAC_MODAL_DISABLE_PATCH = pysimplegui_user_settings.get(MAC_PATCH_DICT['Disable Modal Windows'][0], MAC_PATCH_DICT['Disable Modal Windows'][1]) @@ -22274,7 +22286,8 @@ def _read_mac_global_settings(): MAC_PATCH_DICT['Enable No Titlebar Patch'][1]) ENABLE_MAC_DISABLE_GRAB_ANYWHERE_WITH_TITLEBAR = pysimplegui_user_settings.get(MAC_PATCH_DICT['Disable Grab Anywhere with Titlebar'][0], MAC_PATCH_DICT['Disable Grab Anywhere with Titlebar'][1]) - + ENABLE_MAC_ALPHA_99_PATCH = pysimplegui_user_settings.get(MAC_PATCH_DICT['Set Alpha Channel to 0.99 for MacOS >= 12.3'][0], + MAC_PATCH_DICT['Set Alpha Channel to 0.99 for MacOS >= 12.3'][1]) def _mac_should_apply_notitlebar_patch(): """ @@ -22297,6 +22310,23 @@ def _mac_should_apply_notitlebar_patch(): return False +def _mac_should_set_alpha_to_99(): + + if not running_mac(): + return False + + if not ENABLE_MAC_ALPHA_99_PATCH: + return False + + try: + if (float(platform.mac_ver()[0]) >= 12.3): + return True + except Exception as e: + warnings.warn('_mac_should_seet_alpha_to_99 Exception while trying check mac_ver. Error = {}'.format(e), UserWarning) + return False + + return False + def main_mac_feature_control(): """ @@ -24815,6 +24845,10 @@ if running_windows(): _read_mac_global_settings() + +if _mac_should_set_alpha_to_99(): + print('Applyting Mac OS 12.3+ Alpha Channel fix. Your default Alpha Channel is now 0.99') + set_options(alpha_channel=0.99) # if running_mac(): # print('Your Mac patches are:') # print('Modal windows disabled:', ENABLE_MAC_MODAL_DISABLE_PATCH)