MCPcopy
hub / github.com/PySimpleGUI/PySimpleGUI / upgrade_PySimpleGUI_gui

Function upgrade_PySimpleGUI_gui

PySimpleGUI/PySimpleGUI.py:24872–24943  ·  view source on GitHub ↗
(no_gui=False)

Source from the content-addressed store, hash-verified

24870 return new_ver
24871
24872def upgrade_PySimpleGUI_gui(no_gui=False):
24873 # print('Upgrading PySimpleGUI....')
24874 new_ver = upgrade_get_github_setuppy_version(silent_error=False)
24875 if not new_ver:
24876 return
24877 psg_source = net_download_file(URL_PSG_GITHUB_SOURCE)
24878 if psg_source is None:
24879 popup_error('Upgrade GUI - error downloading the PySimpleGUI.py file')
24880 return
24881 lines = psg_source.splitlines()
24882 start = end = None
24883 for i, line in enumerate(lines):
24884 if 'Changelog since' in line:
24885 start = i
24886 elif start:
24887 if '"""' in line:
24888 end = i
24889 break
24890 if not start or not end:
24891 popup_error('Upgrade GUI - error getting release notes')
24892 return
24893 else:
24894 release_notes = []
24895 for line in lines[start+1:end]:
24896 if line:
24897 release_notes.append(line)
24898 release_notes = '\n'.join(release_notes)
24899
24900 try:
24901 cur_ver = version[:version.index('\n')]
24902 except:
24903 cur_ver = version
24904
24905 pip_string= URL_PSG_PIP_INSTALL_FROM_GITHUB
24906 # if no_gui:
24907 # print(f'{cur_ver} is the version you are running now and will be overwritten')
24908 # print(f'{new_ver} is the version you are INSTALLING NOW....')
24909 # print(f'Wheel location = {pip_string}')
24910 # execute_pip_install_package(pip_string, force_reinstall=True, no_gui=True)
24911 # print('Install completed')
24912 # return
24913
24914 layout = [
24915 [Text('* WARNING *')],
24916 [Text('You are about to upgrade your PySimpleGUI package previously installed via pip')],
24917 [Text('to the latest Maintenance Release of PySimpleGUI.')],
24918 [Text(f'{cur_ver} is the version you are currently running',)],
24919 [Text(f'{new_ver} is the version you will install',)],
24920 [Text(f'{sys.executable } is location of python',)],
24921 [Text(f'Are you sure you want to overwrite your {cur_ver} release?')],
24922 [Push(), B('Yes', s=4), B('No', s=4), B('Show Release Notes', key='-REL NOTES-')],
24923 ]
24924
24925 window = Window('Upgrade To Maintenance Release', layout, keep_on_top=True)
24926
24927 while True:
24928 event, values = window.read()
24929 if event in ('No', WIN_CLOSED):

Callers 2

mainFunction · 0.85
main_command_lineFunction · 0.85

Calls 11

readMethod · 0.95
closeMethod · 0.95
net_download_fileFunction · 0.85
popup_errorFunction · 0.85
TextClass · 0.85
PushFunction · 0.85
WindowClass · 0.85
popup_quick_messageFunction · 0.85
popup_scrolledFunction · 0.85

Tested by

no test coverage detected