diff --git a/utils/wl_utils.py b/utils/wl_utils.py index 2e12aa3c6..986b3cbc2 100644 --- a/utils/wl_utils.py +++ b/utils/wl_utils.py @@ -33,17 +33,11 @@ def check_os(): return is_windows, is_macos, is_linux def get_wl_ver(): - wl_ver = '1.0.0' + with open('../VERSION', 'r', encoding = 'utf_8') as f: + for line in f: + if line.strip() and not line.startswith('#'): + wl_ver = line.strip() - try: - # Version file is generated on Windows - with open('../VERSION', 'r', encoding = 'utf_8', newline = '\r\n') as f: - for line in f: - if line.strip() and not line.startswith('#'): - wl_ver = line.strip() - - break - except (FileNotFoundError, PermissionError): - pass + break return wl_ver diff --git a/wordless/wl_main.py b/wordless/wl_main.py index d7abbbc86..445878b60 100644 --- a/wordless/wl_main.py +++ b/wordless/wl_main.py @@ -1085,110 +1085,107 @@ def __init__(self, main): changelog = [] - try: - with open(wl_paths.get_path_file('CHANGELOG.md'), 'r', encoding = 'utf_8') as f: - for line in f: - # Changelog headers - if line.startswith('## '): - release_ver = re.search(r'(?<=\[)[^\]]+?(?=\])', line).group() - release_link = re.search(r'(?<=\()[^\)]+?(?=\))', line).group() - release_date = re.search(r'(?<=\- )[0-9?]{2}/[0-9?]{2}/[0-9?]{4}', line).group() - - changelog.append({ - 'release_ver': release_ver, - 'release_link': release_link, - 'release_date': release_date, - 'changelog_sections': [] - }) - - # Changelog section headers - elif line.startswith('### '): - changelog[-1]['changelog_sections'].append({ - 'section_header': line.replace('###', '').strip(), - 'section_list': [] - }) - # Changelog section lists - elif line.startswith('- '): - line = re.sub(r'^- ', r'', line).strip() - - changelog[-1]['changelog_sections'][-1]['section_list'].append(line) - - font_size_custom = main.settings_custom['general']['ui_settings']['font_size'] - - changelog_text = f''' -
- - - + with open(wl_paths.get_path_file('CHANGELOG.md'), 'r', encoding = 'utf_8') as f: + for line in f: + # Changelog headers + if line.startswith('## '): + release_ver = re.search(r'(?<=\[)[^\]]+?(?=\])', line).group() + release_link = re.search(r'(?<=\()[^\)]+?(?=\))', line).group() + release_date = re.search(r'(?<=\- )[0-9?]{2}/[0-9?]{2}/[0-9?]{4}', line).group() + + changelog.append({ + 'release_ver': release_ver, + 'release_link': release_link, + 'release_date': release_date, + 'changelog_sections': [] + }) + + # Changelog section headers + elif line.startswith('### '): + changelog[-1]['changelog_sections'].append({ + 'section_header': line.replace('###', '').strip(), + 'section_list': [] + }) + # Changelog section lists + elif line.startswith('- '): + line = re.sub(r'^- ', r'', line).strip() + + changelog[-1]['changelog_sections'][-1]['section_list'].append(line) + + font_size_custom = main.settings_custom['general']['ui_settings']['font_size'] + + changelog_text = f''' + + + + + ''' + + for release in changelog: + changelog_text += f''' +