Skip to content
Snippets Groups Projects

Display changelog in about dialog

Merged Lan Dam requested to merge i276_show_changelog_in_about_dialog into develop
All threads resolved!
1 file
+ 23
1
Compare changes
  • Side-by-side
  • Inline
@@ -22,6 +22,17 @@ def add_separation_line(layout):
layout.addWidget(label)
def remove_empty_lines(text: str) -> str:
"""
Remove lines with no text from text
:param text: the text with empty lines that need to be removed
:return: text with no empty lines
"""
lines = text.split('\n')
no_empty_lines = [line for line in lines if line.strip()]
return '\n'.join(no_empty_lines)
class AboutDialog(QDialog):
"""
Dialog to show information of the software.
@@ -103,6 +114,10 @@ class AboutDialog(QDialog):
@staticmethod
def get_history_dict():
"""
Get dictionary of history by version from file HISTORY.rst
:return: dictionary of history by version
"""
current_file_path = os.path.abspath(__file__)
root = Path(current_file_path).parent.parent.parent
history_path = root.joinpath('HISTORY.rst')
@@ -121,8 +136,15 @@ class AboutDialog(QDialog):
history_dict[version] += line + '\n'
return history_dict
@QtCore.Slot()
def on_version_changed(self, version):
changelog = self.history_dict[version]
"""
When version is changed, place the corresponded changelog in changelog
edit.
:param version: the selected version
"""
changelog = remove_empty_lines(self.history_dict[version])
self.changelog_edit.setPlainText(changelog)
Loading