Better global theme support. Moved the line number to the front of the output
This commit is contained in:
parent
923723f7a7
commit
d27b337902
|
@ -297,8 +297,7 @@ def find_in_file(string, demo_files_dict, regex=False, verbose=False, window=Non
|
||||||
line_num_match = get_line_number(key, _match)
|
line_num_match = get_line_number(key, _match)
|
||||||
file_array_new.append(line_num_match)
|
file_array_new.append(line_num_match)
|
||||||
if (verbose):
|
if (verbose):
|
||||||
matched_str_line_num = f"{_match} | Line Number: {line_num_match}"
|
sg.cprint(f"Line: {line_num_match} | {_match.strip()}\n")
|
||||||
sg.cprint(f"{matched_str_line_num}\n")
|
|
||||||
file_array_old.append(file_array_new)
|
file_array_old.append(file_array_new)
|
||||||
file_lines_dict[tail] = file_array_old
|
file_lines_dict[tail] = file_array_old
|
||||||
except:
|
except:
|
||||||
|
@ -321,7 +320,6 @@ def settings_window():
|
||||||
:rtype: (bool)
|
:rtype: (bool)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
explorer_program = get_explorer()
|
|
||||||
try:
|
try:
|
||||||
global_editor = sg.pysimplegui_user_settings.get('-editor program-')
|
global_editor = sg.pysimplegui_user_settings.get('-editor program-')
|
||||||
except:
|
except:
|
||||||
|
@ -330,7 +328,10 @@ def settings_window():
|
||||||
global_explorer = sg.pysimplegui_user_settings.get('-explorer program-')
|
global_explorer = sg.pysimplegui_user_settings.get('-explorer program-')
|
||||||
except:
|
except:
|
||||||
global_explorer = ''
|
global_explorer = ''
|
||||||
|
try: # in case running with old version of PySimpleGUI that doesn't have a global PSG settings path
|
||||||
|
global_theme = sg.theme_global()
|
||||||
|
except:
|
||||||
|
global_theme = ''
|
||||||
|
|
||||||
layout = [[sg.T('Program Settings', font='DEFAULT 25')],
|
layout = [[sg.T('Program Settings', font='DEFAULT 25')],
|
||||||
[sg.T('Path to Tree', font='_ 16')],
|
[sg.T('Path to Tree', font='_ 16')],
|
||||||
|
@ -342,7 +343,8 @@ def settings_window():
|
||||||
[sg.T('File Explorer Program', font='_ 16')],
|
[sg.T('File Explorer Program', font='_ 16')],
|
||||||
[sg.T('Leave blank to use global default'), sg.T(global_explorer)],
|
[sg.T('Leave blank to use global default'), sg.T(global_explorer)],
|
||||||
[ sg.In(sg.user_settings_get_entry('-explorer program-'), k='-EXPLORER PROGRAM-'), sg.FileBrowse()],
|
[ sg.In(sg.user_settings_get_entry('-explorer program-'), k='-EXPLORER PROGRAM-'), sg.FileBrowse()],
|
||||||
[sg.T('Theme (leave blank to use global default)', font='_ 16')],
|
[sg.T('Theme', font='_ 16')],
|
||||||
|
[sg.T('Leave blank to use global default'), sg.T(global_theme)],
|
||||||
[sg.Combo(['']+sg.theme_list(),sg.user_settings_get_entry('-theme-', ''), readonly=True, k='-THEME-')],
|
[sg.Combo(['']+sg.theme_list(),sg.user_settings_get_entry('-theme-', ''), readonly=True, k='-THEME-')],
|
||||||
[sg.CB('Use Advanced Interface', default=advanced_mode() ,k='-ADVANCED MODE-')],
|
[sg.CB('Use Advanced Interface', default=advanced_mode() ,k='-ADVANCED MODE-')],
|
||||||
[sg.B('Ok', bind_return_key=True), sg.B('Cancel')],
|
[sg.B('Ok', bind_return_key=True), sg.B('Cancel')],
|
||||||
|
@ -454,9 +456,10 @@ def main():
|
||||||
file_list = get_file_list()
|
file_list = get_file_list()
|
||||||
window = make_window()
|
window = make_window()
|
||||||
window['-FILTER NUMBER-'].update(f'{len(file_list)} files')
|
window['-FILTER NUMBER-'].update(f'{len(file_list)} files')
|
||||||
|
counter = 0
|
||||||
while True:
|
while True:
|
||||||
event, values = window.read()
|
event, values = window.read()
|
||||||
|
counter += 1
|
||||||
if event in (sg.WINDOW_CLOSED, 'Exit'):
|
if event in (sg.WINDOW_CLOSED, 'Exit'):
|
||||||
break
|
break
|
||||||
if event == 'Edit':
|
if event == 'Edit':
|
||||||
|
|
Loading…
Reference in New Issue