Refresh the PySimpleGUI global settings in all Exec API calls in case someone has changed the global settings outside of the currently running program

This commit is contained in:
PySimpleGUI 2021-10-24 13:30:16 -04:00
parent 7d6870590c
commit 712f16e73e
1 changed files with 7 additions and 3 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/python3 #!/usr/bin/python3
version = __version__ = "4.51.7.10 Unreleased" version = __version__ = "4.51.7.11 Unreleased"
_change_log = """ _change_log = """
@ -41,6 +41,8 @@ _change_log = """
MAIN instea of MEIN (oy! When am I going to get this release out???) MAIN instea of MEIN (oy! When am I going to get this release out???)
4.51.7.10 4.51.7.10
Better description of the main restart as to not be alarming... Better description of the main restart as to not be alarming...
4.51.7.11
Refresh the PySimpleGUI settings in all exec calls in case settings changed in another program
""" """
__version__ = version.split()[0] # For PEP 396 and PEP 345 __version__ = version.split()[0] # For PEP 396 and PEP 345
@ -20305,6 +20307,7 @@ def execute_py_file(pyfile, parms=None, cwd=None, interpreter_command=None, wait
if interpreter_command is not None: if interpreter_command is not None:
python_program = interpreter_command python_program = interpreter_command
else: else:
pysimplegui_user_settings.load() # Refresh the settings just in case they've changed via another program
python_program = pysimplegui_user_settings.get('-python command-', '') python_program = pysimplegui_user_settings.get('-python command-', '')
if python_program == '': if python_program == '':
python_program = 'python' if running_windows() else 'python3' python_program = 'python' if running_windows() else 'python3'
@ -20327,6 +20330,7 @@ def execute_py_get_interpreter():
:return: Full path to python interpreter or '' if nothing entered :return: Full path to python interpreter or '' if nothing entered
:rtype: (str) :rtype: (str)
""" """
pysimplegui_user_settings.load() # Refresh the settings just in case they've changed via another program
interpreter = pysimplegui_user_settings.get('-python command-', '') interpreter = pysimplegui_user_settings.get('-python command-', '')
return interpreter return interpreter
@ -20348,7 +20352,7 @@ def execute_editor(file_to_edit, line_number=None):
""" """
if file_to_edit is not None and len(file_to_edit) != 0 and file_to_edit[0] not in ('\"', "\'") and ' ' in file_to_edit: if file_to_edit is not None and len(file_to_edit) != 0 and file_to_edit[0] not in ('\"', "\'") and ' ' in file_to_edit:
file_to_edit = '"' + file_to_edit + '"' file_to_edit = '"' + file_to_edit + '"'
pysimplegui_user_settings.load() # Refresh the settings just in case they've changed via another program
editor_program = pysimplegui_user_settings.get('-editor program-', None) editor_program = pysimplegui_user_settings.get('-editor program-', None)
if editor_program is not None: if editor_program is not None:
format_string = pysimplegui_user_settings.get('-editor format string-', None) format_string = pysimplegui_user_settings.get('-editor format string-', None)
@ -20416,7 +20420,7 @@ def execute_file_explorer(folder_to_open=''):
:return: Popen object :return: Popen object
:rtype: (subprocess.Popen) | None :rtype: (subprocess.Popen) | None
""" """
pysimplegui_user_settings.load() # Refresh the settings just in case they've changed via another program
explorer_program = pysimplegui_user_settings.get('-explorer program-', None) explorer_program = pysimplegui_user_settings.get('-explorer program-', None)
if explorer_program is not None: if explorer_program is not None:
sp = execute_command_subprocess(explorer_program, folder_to_open) sp = execute_command_subprocess(explorer_program, folder_to_open)