Commented out the merge_comments_from_file code... it's not done yet....

This commit is contained in:
PySimpleGUI 2021-10-17 16:29:58 -04:00
parent 890fb432eb
commit 47afad57e6
1 changed files with 29 additions and 27 deletions

View File

@ -59,6 +59,8 @@ _change_log = """
popup_scrolled - add an additional line per parm. Sometimes not enough height was computed popup_scrolled - add an additional line per parm. Sometimes not enough height was computed
4.49.0.17 4.49.0.17
Fixed problem in the delete_section code for UserSettings for INI files. Fixed problem in the delete_section code for UserSettings for INI files.
4.49.0.18
Removed the UserSettings merge_comments_from_file code (for now)
""" """
__version__ = version.split()[0] # For PEP 396 and PEP 345 __version__ = version.split()[0] # For PEP 396 and PEP 345
@ -19525,33 +19527,33 @@ class UserSettings:
self.read() self.read()
return self.full_filename return self.full_filename
#
def merge_comments_from_file(self, full_filename): # def merge_comments_from_file(self, full_filename):
print('--- merging comments -----') # print('--- merging comments -----')
merged_lines = [] # merged_lines = []
with open(full_filename, 'r') as f: # with open(full_filename, 'r') as f:
new_file_contents = f.readlines() # new_file_contents = f.readlines()
current_section = '' # current_section = ''
for line in new_file_contents: # for line in new_file_contents:
if len(line) == 0: # skip blank lines # if len(line) == 0: # skip blank lines
merged_lines.append(line) # merged_lines.append(line)
continue # continue
if line[0] == '[': # if a new section # if line[0] == '[': # if a new section
current_section = line[:line.index(']')] # current_section = line[:line.index(']')]
merged_lines.append(line) # merged_lines.append(line)
continue # continue
if len(line.lstrip()): # if len(line.lstrip()):
if line.lstrip()[0] == '#': # if a comment line, save it # if line.lstrip()[0] == '#': # if a comment line, save it
merged_lines.append(line) # merged_lines.append(line)
# Process a line with an = in it # # Process a line with an = in it
try: # try:
key = line[:line.index('=')] # key = line[:line.index('=')]
merged_lines.append(line) # merged_lines.append(line)
except: # except:
merged_lines.append(line) # merged_lines.append(line)
print('--- merging complete ----') # print('--- merging complete ----')
print(*merged_lines) # print(*merged_lines)
#
def save(self, filename=None, path=None): def save(self, filename=None, path=None):