Skip to content

Commit 9ef86bc

Browse files
committed
Demo Browser set default demo program folder in settings window
1 parent d7200ba commit 9ef86bc

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

DemoPrograms/Browser_START_HERE_Demo_Programs_Browser.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import warnings
1111
import PySimpleGUI as sg
1212

13-
version = '6.0'
13+
version = '6.0.1'
1414
__version__ = version.split()[0]
1515

1616

@@ -52,6 +52,9 @@
5252
5.2.0 14-Aug-2024 Fixed erronous import error (when import line started with "from")
5353
Added a new "Path" input so that an arbitrary file can be executed easily (or edited)
5454
5.3.0 15-Aug-2024 One last change for the new path input... clear other fields if chars are entered
55+
6.0 8-Apr-2026 Major version bump to match the commercial to LGPL3 license change
56+
6.0.1 9-Apr-2026 Set the likely location of the demo programs as the initial path in the settings window
57+
5558
Copyright 2018-2026 PySinpleGUI. All rights reserved.
5659
"""
5760

@@ -230,7 +233,7 @@ def get_line_number(file_path, string, dupe_lines):
230233
if string.strip() == line.strip() and num not in dupe_lines:
231234
lmn = num
232235
return lmn
233-
236+
234237
def kill_ascii(s):
235238
return "".join([x if ord(x) < 128 else '?' for x in s])
236239

@@ -502,7 +505,7 @@ def find_in_file(string, demo_files_dict, regex=False, verbose=False, window=Non
502505
list_of_matches.append(_match.strip())
503506
file_array_old.append(file_array_new)
504507
file_array_old.append(file_match_list)
505-
508+
506509
if tail in file_lines_dict:
507510
for i in range(1, 100):
508511
new_tail = f'{tail}_{i}'
@@ -589,10 +592,13 @@ def settings_window():
589592
except:
590593
global_theme = ''
591594

595+
# normally the demo programs are located in a folder in the same folder as the demo browser
596+
default_demo_programs_path = os.path.join(os.path.dirname(__file__), 'demo_programs')
597+
592598
layout = [[sg.T('Program Settings', font='DEFAULT 25')],
593599
[sg.T('Path to Tree', font='_ 16')],
594-
[sg.Combo(sorted(sg.user_settings_get_entry('-folder names-', [])), default_value=sg.user_settings_get_entry('-demos folder-', get_demo_path()), size=(50, 1), key='-FOLDERNAME-'),
595-
sg.FolderBrowse('Folder Browse', target='-FOLDERNAME-'), sg.B('Clear History')],
600+
[sg.Combo(sorted(sg.user_settings_get_entry('-folder names-', [])), default_value=sg.user_settings_get_entry('-demos folder-', get_demo_path()), size=(50, 1), auto_size_text=False, key='-FOLDERNAME-'),
601+
sg.FolderBrowse('Folder Browse', target='-FOLDERNAME-', initial_folder=default_demo_programs_path), sg.B('Clear History')],
596602
[sg.T('Editor Program', font='_ 16')],
597603
[sg.T('Leave blank to use global default'), sg.T(global_editor)],
598604
[ sg.In(sg.user_settings_get_entry('-editor program-', ''),k='-EDITOR PROGRAM-'), sg.FileBrowse()],

0 commit comments

Comments
 (0)