Skip to content

Commit

Permalink
chore: add a commit hash to the about dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
daxartio committed Dec 16, 2024
1 parent 7b8013f commit 27ec035
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 3 deletions.
15 changes: 15 additions & 0 deletions .github/scripts/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import subprocess
from pathlib import Path


def main() -> None:
res = subprocess.run(
["git", "rev-parse", "HEAD"],
capture_output=True,
text=True,
)
Path("version").write_text(res.stdout.strip(), encoding="utf-8")


if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Install python dependencies
run: pip install poetry && poetry install -E win
- name: Generate mo files
run: poetry run poe generate-mo
run: poetry run poe generate-mo generate-version
- name: Build
run: poetry run python builder.py build
- name: Generate installer
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,4 @@ cython_debug/

data
!tests/data
version
1 change: 1 addition & 0 deletions builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
config.base_dir("changelog_ru.md"),
config.base_dir("configs"),
config.STYLE_DIR,
config.COMMIT_VERSION_FILE,
]
includes = ["atexit", "codecs", "playsound", "pyImpinj"]
excludes = ["Tkinter", "unittest", "test", "pydoc"]
Expand Down
3 changes: 3 additions & 0 deletions languages/ru_RU/LC_MESSAGES/sportorg.po
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ msgstr ""
msgid "About"
msgstr "О нас"

msgid "Version"
msgstr "Версия"

msgid "Contributors"
msgstr "Разработчики"

Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ sequence = [
help = "Generate mo files"
cmd = "python -m sportorg.language"

[tool.poe.tasks.generate-version]
help = "Generate version file"
cmd = "python .github/scripts/version.py"

[tool.poe.tasks.run]
help = "Run"
sequence = [
Expand Down
2 changes: 1 addition & 1 deletion sportorg.iss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define MyAppName "SportOrg"
#define MyAppVersion "v1.7.1"
#define MyVersionInfoVersion "1.7.1.0"
#define MyAppPublisher "Danil Akhtarov, Alexei Zhulev, Semyon Yakimov, Konstantin Bats, Sergei Kobelev"
#define MyAppPublisher "SportOrg Team"
#define MyAppURL "https://sportorg.readthedocs.io"
#define MyAppExeName "SportOrg.exe"

Expand Down
12 changes: 12 additions & 0 deletions sportorg/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging.config
import os
import sys
from pathlib import Path
from typing import Optional

from pydantic import BaseSettings
Expand Down Expand Up @@ -92,6 +93,17 @@ def style_dir(*paths) -> str:
return os.path.join(STYLE_DIR, *paths)


COMMIT_VERSION_FILE = base_dir("version")


def commit_version() -> str:
path = Path(COMMIT_VERSION_FILE)
if not path.exists():
return ""

return path.read_text(encoding="utf-8")


ICON = icon_dir("sportorg.svg")

CONFIG_INI = data_dir("config.ini")
Expand Down
12 changes: 11 additions & 1 deletion sportorg/gui/dialogs/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def init_ui(self):
(
"\t- Danil Akhtarov,\n"
"\t- Sergei Kobelev,\n"
"\t- Alexander Karpov,\n"
"\t- Alexei Zhulev,\n"
"\t- Semyon Yakimov,\n"
"\t- Konstantin Bats."
),
Expand All @@ -53,9 +55,17 @@ def init_ui(self):
)
)
home_page_text.setOpenExternalLinks(True)

self.layout.addRow(home_page_text)

commit_version_text = QLabel()
commit_version_text.setTextInteractionFlags(
Qt.TextInteractionFlag.TextSelectableByMouse
)
commit_version_text.setText(
"{}: {}".format(translate("Version"), config.commit_version())
)
self.layout.addRow(commit_version_text)

licence_title = QLabel()
licence_title.setText("\nGPL v3 License")
licence_title.setAlignment(Qt.AlignCenter)
Expand Down

0 comments on commit 27ec035

Please sign in to comment.