make version accessible without having to read a file

This works when krowlog is bundled into a single executable
This commit is contained in:
2022-08-28 08:44:45 +02:00
parent b6aa3083d2
commit 32028a54b9
3 changed files with 6 additions and 11 deletions

View File

@@ -4,11 +4,12 @@ import PySide6
import urllib3
from watchdog import version as watchdog_version
from PySide6.QtCore import Qt
from PySide6.QtGui import QFont, QPixmap
from PySide6.QtGui import QFont
from PySide6.QtWidgets import *
from pathlib import Path
import constants
import krowlog
from src.ui.icon import Icon
from src.ui.label import Label
from src.ui.vbox import VBox
@@ -30,7 +31,7 @@ class AboutDialog(QDialog):
heading_app_name.setFont(QFont("default", 25))
# heading_app_name.setTextInteractionFlags(Qt.TextInteractionFlag.TextSelectableByMouse)
version = Label(_("Version: {0}").format(self._version()))
version = Label(_("Version: {0}").format(krowlog.__version__))
version.setAlignment(Qt.AlignmentFlag.AlignLeft)
app_icon = QLabel()
@@ -85,6 +86,3 @@ class AboutDialog(QDialog):
result.layout = QVBoxLayout(result)
result.layout.addWidget(Label(label))
return result
def _version(self):
return Path(__file__).parent.parent.parent.parent.joinpath('VERSION.info').read_text("utf8").strip()